SDL_HINT_VIDEO_DOUBLE_BUFFER(3)
π SDL_HINT_VIDEO_DOUBLE_BUFFER π
okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, and today's main character is a lil hint called SDL_HINT_VIDEO_DOUBLE_BUFFER. she's small, she's powerful, she controls your frames. let's get into it π
β¨ NAME β¨
SDL_HINT_VIDEO_DOUBLE_BUFFER β tell the video driver that we only want a double buffer. no more, no less, she said what she said π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_hints.h>
#define SDL_HINT_VIDEO_DOUBLE_BUFFER "SDL_VIDEO_DOUBLE_BUFFER"
πΈ DESCRIPTION πΈ
so here's the tea, fr fr. by default, most lowlevel 2D APIs will use a triple buffer scheme. what does that mean? it means they waste no CPU time on waiting for vsync after issuing a flip. iconic, efficient, no waiting around like a loser. BUT π β and this is the plot twist β it introduces a frame of latency.
on the other hand (and you knew there was another hand), using a double buffer scheme instead is recommended for cases where low latency is an important factor, because we save a whole frame of latency. yes bestie, a WHOLE frame. that's not a small deal, that's a big deal π
and how do we do this magical thing? we do so by waiting for vsync immediately after issuing a flip, usually just after eglSwapBuffers call in the backend's *_SwapWindow function. the way that we just... wait. on purpose. for the vibes. and for the latency π«Ά
this hint is currently supported on the following drivers:
- Raspberry Pi (
raspberrypi) - Wayland (
wayland)
β οΈ this hint should be set before SDL is initialized. do not pass go, do not collect $200, set it early or it's giving nothing π
β AVAILABILITY β
this hint is available since SDL 3.2.0. she's not ancient, she's not brand new, she's just right π
and that's the whole page, bestie!! go forth and double buffer responsibly π§π
this has been your girl from Simple Directmedia Layer, reporting live from SDL 3.4.18, signing off on SDL_HINT_VIDEO_DOUBLE_BUFFER(3) β mwah, periodt π
β¨
π¦ 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