Vulkan Present Mode selection
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 (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 (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.
Could this be a parameter on SwapChain? (Like yet another flag).
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.
Usually we add a SwapChain::isFooSupported() for each new flag we add. This ends up calling into the platform on the backend side.