filament icon indicating copy to clipboard operation
filament copied to clipboard

Vulkan Present Mode selection

Open jwinarske opened this issue 3 months ago • 5 comments

Is your feature request related to a problem? Please describe. FIFO present mode is not sufficient for high refresh monitor use cases.

We need to control run on frame cases; skip subsequent frames.

For Linux Wayland FIFO mode and using the Wayland (default) frame callback mechanism is not granular enough for high frame rates (e.g. 160Hz). Also some vendors (NVidia) behave badly here; 1/3 of the frame rate. To get better granularity one can use the Wayland precision timing protocol.

Mailbox mode enables precision timing callbacks with Vulkan Wayland WSI.

We need a way to set the present mode; FIFO as default, mailbox as optional.

Describe the solution you'd like Either as an API parameter or associate an environmental variable.

Describe alternatives you've considered Downstream patch on Filament.

OS and backend Possibly Wayland specific. Have not tested other WSI in this scenario. Mailbox mode would be used for certain scenarios (e.g. high frame rate games) on all platforms.

jwinarske avatar Sep 23 '25 13:09 jwinarske

@jwinarske (hi!) is this something that you would be able to contribute? Wayland is not at all a platform that we have expertise in or that is a priority for us.

pixelflinger avatar Sep 25 '25 05:09 pixelflinger

@pixelflinger (hi) absolutely, happy to contribute.

The next question is API change or environmental variable approach. We prefer to switch between fifo and mailbox at runtime. An environmental variable would work if we tore the engine down. It would be better to tear down/setup the swap chain if present mode “changed”.

We need to do some further cross platform WSI validation (windows, Linux kms-drm, android, Mac+moltenvk) and see how it works there to determine if a Filament API change is justified.

jwinarske avatar Sep 25 '25 12:09 jwinarske

Could this be a parameter on SwapChain? (Like yet another flag).

pixelflinger avatar Sep 25 '25 15:09 pixelflinger

Sure. It could be a parameter with the default of FIFO. I would say do not check if mode is supported in swapchain create; let app do this once earlier on. So if invalid present mode was set, it would end in a runtime error.

jwinarske avatar Sep 25 '25 15:09 jwinarske

Usually we add a SwapChain::isFooSupported() for each new flag we add. This ends up calling into the platform on the backend side.

pixelflinger avatar Sep 25 '25 23:09 pixelflinger