-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Vulkan) Add adaptive vsync support #14788
(Vulkan) Add adaptive vsync support #14788
Conversation
Changed the MAILBOX case to be a special default fallthrough instead so that it rather gets set than FIFO when vsync is disabled and IMMEDIATE is not available. |
I think this might have been why we were using mailbox to being with..? |
Likely yes. |
Would that be something that could be set at runtime? Like via an option? I know we need more options like we need additional holes in our heads but this seems like a choice of least-bad results, which some may prefer one over the other. |
It appears the flashing happens because menu toggle is always setting vsync on and swap interval 1 while menu is alive. We have So I think we could and should simply harness that throttle option more and only force menu vsync when it is enabled. Also we still could use at least some kind of limiting when |
That should cover it. |
74d4320
to
695f116
Compare
Minor addition to also limit menu drawing when running without a core. Edit: Menu throttling stuff removed. |
695f116
to
be9fed2
Compare
8c59b49
to
e4f9fd4
Compare
This reverts commit 4543a52.
Description
Added the ability to use
VK_PRESENT_MODE_FIFO_RELAXED_KHR
presentation mode, which is basically adaptive vsync like in gl. So when available it sets the same existing flag (only for Windows & X) which shows the same option.Also made sure that vsync off rather uses
VK_PRESENT_MODE_IMMEDIATE_KHR
which causes similar tearing as other drivers, and notVK_PRESENT_MODE_MAILBOX_KHR
which causes stutter.Also enabled some useful logging to debug level without having
VULKAN_DEBUG
defined, such as which presentation modes are available and in use, and in readable text form rather than magic number.Unfortunately with
FIFO_RELAXED_KHR
the screen flashes when fast-forward is toggled, andIMMEDIATE_KHR
flashes when menu is toggled, but hopefully those can be sorted later.I was able to test it a little also under Linux VM, but the results weren't too good since
FIFO_RELAXED_KHR
was not available, and neither wasIMMEDIATE_KHR
, and the present modes were presented in reverse order compared to Windows, so we might have to insert some finer logic than the current one to decide which mode should be preferred.I at least added the requirement of Max Swapchains set to more than 2 (even if it does not come to fruition) for allowing
MAILBOX_KHR
when it comes beforeFIFO_KHR
. The above log snippet is from Windows, and the order is 2-3-1-0, and in Linux it was 1-2. So perhaps we should process them always in sorted order instead of offered order.No idea why 16 was/is the maximum count for presentation modes even if there won't be that many..
Please test with proper Linux and debug log level enabled!