SDL_GPUPresentMode(3type)
β¨ SDL_GPUPresentMode β¨
okay bestie, welcome to the datatype page for SDL_GPUPresentMode π
it's a lil enum from the SDL3 datatypes squad and it lives in SDL3/SDL_gpu.h, so let's get into it π«Ά
πΈ NAME πΈ
SDL_GPUPresentMode β the vibe-setter that says which timing gets used when you present swapchain textures to the OS. it's giving "when do we show the frame, bestie" π
π SYNOPSIS π
#include <SDL3/SDL_gpu.h>
typedef enum SDL_GPUPresentMode
{
SDL_GPU_PRESENTMODE_VSYNC,
SDL_GPU_PRESENTMODE_IMMEDIATE,
SDL_GPU_PRESENTMODE_MAILBOX
} SDL_GPUPresentMode;
π DESCRIPTION π
so here's the tea β β VSYNC mode is always supported, no cap. but IMMEDIATE and MAILBOX? they may not be supported on certain systems π so don't just assume, okay?
π«Ά real talk: if you wanna switch the present mode toIMMEDIATEorMAILBOX, it's recommended that you querySDL_WindowSupportsGPUPresentModeafter claiming the window. do the vibe check first, bestie, before you commit π
and now the three modes, one by one, no skips β¨
SDL_GPU_PRESENTMODE_VSYNCβ waits for vblank before presenting. no tearing is possible π if there's a pending image to present, the new image gets enqueued for presentation. it disallows tearing, but the cost is visual latency (yes that's the tradeoff, it's giving compromise π ).SDL_GPU_PRESENTMODE_IMMEDIATEβ presents immediately. lowest latency option, periodt β‘ but tearing may occur π¬ so like... choose wisely.SDL_GPU_PRESENTMODE_MAILBOXβ waits for vblank before presenting. no tearing is possible π¦ if there's a pending image to present, the pending image gets replaced by the new image π similar to VSYNC, but with reduced visual latency. lowkey the best of both worlds ngl.
π AVAILABILITY π
this enum has been available since SDL 3.2.0 β so it's been iconic for a minute.
π₯ SEE ALSO π₯
SDL_SetGPUSwapchainParameters(3)SDL_WindowSupportsGPUPresentMode(3)SDL_WaitAndAcquireGPUSwapchainTexture(3)
and that's the whole page, bestie!! this lil writeup came to you courtesy of Simple Directmedia Layer π«Ά, and it's from SDL 3.4.18, so if you're reading a different version... iykyk, go check that one π mwah, go present some frames β¨π π
π¦ 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