Add support for VK_PRESENT_MODE_FIFO_LATEST_READY_KHR#1985
Open
silvanshade wants to merge 4 commits intoflightlessmango:masterfrom
Open
Add support for VK_PRESENT_MODE_FIFO_LATEST_READY_KHR#1985silvanshade wants to merge 4 commits intoflightlessmango:masterfrom
silvanshade wants to merge 4 commits intoflightlessmango:masterfrom
Conversation
This commit uses a local wrap for vulkan-headers 1.4.345 corresponding to an upstream PR for wrapdb which is not yet merged.
soerengrunewald
suggested changes
Mar 11, 2026
| struct device_data *device_data = FIND(struct device_data, device); | ||
| const auto& params = device_data->instance->params; | ||
|
|
||
| if (params.vsync < 4) { |
Contributor
There was a problem hiding this comment.
The check is there for a reason, if the user decides to put in a value greater then presentModes.size() you'll have an out-of-bound error.
How about this instead?
- if (params.vsync < 4) {
+ if (params.vsync < presentModes.size()) {
Author
There was a problem hiding this comment.
Gotcha. I've made the suggested change and also added an out-of-range warning for clarity.
This commit adds support for setting the Vulkan present mode to VK_PRESENT_MODE_FIFO_LATEST_READY_KHR by specifying vsync=6. VK_PRESENT_MODE_FIFO_LATEST_READY_KHR is similar to VK_PRESENT_MODE_MAILBOX_KHR but is intended to enable both low-latency, like Mailbox, but also improved frame pacing, unlike Mailbox, by retaining enough information to coordinate with VK_EXT_present_timing. This is possible because VK_PRESENT_MODE_FIFO_LATEST_READY_KHR retains multiple presents in queue until VBLANK, at which point the most recently completed present (modulo target timing) is shown and the rest are discarded. Mailbox in contrast discards superseded presents immediately, retaining only the latest, making such coordination impossible. Details: https://docs.vulkan.org/features/latest/features/proposals/VK_EXT_present_mode_fifo_latest_ready.html
1b8b10a to
bd5bee4
Compare
bd5bee4 to
5362d1e
Compare
5362d1e to
fbc690c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for present mode
VK_PRESENT_MODE_FIFO_LATEST_READY_KHR:https://docs.vulkan.org/features/latest/features/proposals/VK_EXT_present_mode_fifo_latest_ready.html
The motivation for supporting
VK_PRESENT_MODE_FIFO_LATEST_READY_KHRis because it provides low-latency similar to Mailbox mode but with semantics that allow for improved frame pacing, especially in coordination withVK_EXT_present_timing.See the commit comments for additional detail.
Tested on an NVIDIA RTX 5090 with driver version 595.45.04:
Note that I had to update the Vulkan Headers version to version
1.4.345to be able to refer to the new present mode. I've submitted an updated wrap definition for the Vulkan Headers upstream: mesonbuild/wrapdb#2690. This local version could be removed once that is merged.