quick question, not a real problem, just for my understanding: I use SDL3/SDL_GPU on Linux/KDE Wayland and noticed that my test apps FPS aren’t uncapped, but instead default to the refresh rate of my monitor (so vsync, I guess).
That’s totally fine, but is that typical for SDL_GPU?
Secondly, is that tied to the SDL_GPUPresentMode I can query with this function: SDL3/SDL_WindowSupportsGPUPresentMode - SDL Wiki ? (This tells me that SDL_GPU_PRESENTMODE_IMMEDIATE is not supported on my system, so I guess it’s not supported for Vulkan on Linux?)
The present mode is what determines how/when the rendering results are shown on screen.
The 3 present modes supported by SDL3 GPU (but not necessarily by all operating systems/GPUs/drivers)
SDL_GPU_PRESENTMODE_VSYNC: This is the default and the only present mode guaranteed to work everywhere. When a frame is finished rendering it’s added to the back of the queue for presentation, and new frames are only shown when the monitor refreshes, in FIFO order. No visual tearing, but the most latency between when a frame’s command buffer is sent off for rendering and when it’s actually shown on screen, especially if you have multiple frames in flight.
SDL_GPU_PRESENTMODE_IMMEDIATE: when a frame is finished rendering it is shown immediately, without waiting for the monitor to refresh. This can result in visual tearing, where half of the old frame is shown at the top of the screen while the new frame that just finished is shown at the bottom, but has the least latency.
SDL_GPU_PRESENTMODE_MAILBOX: meant to be a happy medium between VSYNC and IMMEDIATE. When a frame is finished rendering, it jumps to the front of the queue instead of being pushed to the back, and any other frames that were waiting are discarded. Waits for the monitor’s vertical refresh before showing new frames. No visual tearing, and less latency than VSYNC if you have multiple frames in flight. Note: if you call SDL_SetGPUAllowedFramesInFlight() and set it to 1 then this is the same as VSYNC and you should just set your present mode to that instead.
edit: regarding Vulkan on Linux, Vulkan actually supports more present modes than SDL3 GPU does, so it’s probably just that your GPU’s actual driver doesn’t support IMMEDIATE (or have something to do with the window compositor if you aren’t running in fullscreen mode)