Skip to content

Add support for VK_PRESENT_MODE_FIFO_LATEST_READY_KHR#1985

Open
silvanshade wants to merge 4 commits intoflightlessmango:masterfrom
silvanshade:feature/fifo-latest-ready
Open

Add support for VK_PRESENT_MODE_FIFO_LATEST_READY_KHR#1985
silvanshade wants to merge 4 commits intoflightlessmango:masterfrom
silvanshade:feature/fifo-latest-ready

Conversation

@silvanshade
Copy link

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_KHR is because it provides low-latency similar to Mailbox mode but with semantics that allow for improved frame pacing, especially in coordination with VK_EXT_present_timing.

See the commit comments for additional detail.

Tested on an NVIDIA RTX 5090 with driver version 595.45.04:

mailbox fifo-latest-ready

Note that I had to update the Vulkan Headers version to version 1.4.345 to 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.

This commit uses a local wrap for vulkan-headers 1.4.345 corresponding
to an upstream PR for wrapdb which is not yet merged.
struct device_data *device_data = FIND(struct device_data, device);
const auto& params = device_data->instance->params;

if (params.vsync < 4) {
Copy link
Contributor

@soerengrunewald soerengrunewald Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()) {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@silvanshade silvanshade force-pushed the feature/fifo-latest-ready branch from 1b8b10a to bd5bee4 Compare March 11, 2026 16:49
@silvanshade silvanshade force-pushed the feature/fifo-latest-ready branch from bd5bee4 to 5362d1e Compare March 11, 2026 16:54
@silvanshade silvanshade force-pushed the feature/fifo-latest-ready branch from 5362d1e to fbc690c Compare March 11, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants