SDL_SetGPUAl...ramesInFlight(3)
π SDL_SetGPUAllowedFramesInFlight π
okay bestie, so this is a page from the SDL3 FUNCTIONS manual β it's SDL_SetGPUAllowedFramesInFlight from the SDL3 FUNCTIONS corner of the docs, and it's literally all about telling your GPU how many frames it's allowed to juggle at once. no cap.
β¨ NAME β¨
SDL_SetGPUAllowedFramesInFlight β configures the maximum allowed number of frames in flight. like, the vibe ceiling for how many frames your GPU can have in the air at once π¦
β¨ SYNOPSIS β¨
#include <SDL3/SDL_gpu.h>
bool SDL_SetGPUAllowedFramesInFlight(
SDL_GPUDevice *device,
Uint32 allowed_frames_in_flight);
β¨ DESCRIPTION β¨
okay so here's the tea π« β when the device gets created, the default value is 2. and what that means is: after you've submitted 2 frames for presentation, if the GPU hasn't finished working on the first frame yet, then SDL_AcquireGPUSwapchainTexture() will fill the swapchain texture pointer with NULL, and SDL_WaitAndAcquireGPUSwapchainTexture() will justβ¦ block. sitting there. waiting. π
the tradeoff is real and it's giving classic:
- Higher values increase throughput β at the expense of visual latency.
- Lower values decrease visual latency β at the expense of throughput.
β οΈ not me forgetting to mention: calling this function will stall and flush the command queue to prevent synchronization issues. so yeah, it's a whole thing.
the minimum value of allowed frames in flight is 1, and the maximum is 3. periodt. π
β¨ FUNCTION PARAMETERS β¨
deviceβ a GPU context. your lil GPU situation πallowed_frames_in_flightβ the maximum number of frames that can be pending on the GPU. the ceiling, the limit, the boundary π
β¨ RETURN VALUE β¨
returns true if it worked, false on error β and if it's erroring, go call SDL_GetError() for more information, she'll tell you what's up π
β¨ AVAILABILITY β¨
this one is available since SDL 3.2.0. she's new-ish, she's fresh, she ate π₯
and that's the whole page bestie!! go forth and configure your frames in flight, you're the main character of your own render loop πβ¨
mwah π β with love from the Simple Directmedia Layer girlies, SDL 3.4.18 edition ππ¦
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms