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 to IMMEDIATE or MAILBOX, it's recommended that you query SDL_WindowSupportsGPUPresentMode after 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 πŸ”₯


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