SDL_SETGPUSWAPCHAINPARAMETERS(3)
π SDL_SetGPUSwapchainParameters(3) π
okay bestie so this is a page from the SDL3 FUNCTIONS collection, and it's about SDL_SetGPUSwapchainParameters β yes it's a mouthful, yes it's iconic, let's get into it π«Ά
β¨ NAME β¨
SDL_SetGPUSwapchainParameters β changes the swapchain parameters for the given claimed window. that's it, that's the whole job, no cap π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_gpu.h>
bool SDL_SetGPUSwapchainParameters(
SDL_GPUDevice *device,
SDL_Window *window,
SDL_GPUSwapchainComposition swapchain_composition,
SDL_GPUPresentMode present_mode);
look at that signature, so clean, so put-together πΈ
β¨ DESCRIPTION β¨
so like. this function will fail if the present mode or the swapchain composition you're asking for aren't supported by the device π like it's not gonna be nice about it, it's just gonna say no.
the way you avoid that heartbreak is: check if your parameters are even supported first, using SDL_WindowSupportsGPUPresentMode / SDL_WindowSupportsGPUSwapchainComposition, before you call this function. vibe check first, ask questions later, fr fr π
and here's the one guaranteed slay: SDL_GPU_PRESENTMODE_VSYNC with SDL_GPU_SWAPCHAINCOMPOSITION_SDR is always supported. always. periodt π
β¨ FUNCTION PARAMETERS β¨
deviceβ a GPU context. your whole GPU situation.windowβ anSDL_Windowthat has been claimed. claimed!! key word, don't skip it πswapchain_compositionβ the desired composition of the swapchain. what you want it to be.present_modeβ the desired present mode for the swapchain. again, desired, we're manifesting here π¦
β¨ RETURN VALUE β¨
returns true if successful, false on error π₯ and if you get a false, go call SDL_GetError() for more information β she will tell you what went wrong, so listen to her.
β¨ AVAILABILITY β¨
this function is available since SDL 3.2.0 β so if you're on something older, that's a you problem, upgrade bestie.
β¨ SEE ALSO β¨
go read those two first, they're the pre-flight check and they will save you so much grief π
and that's the page!! brought to you by Simple Directmedia Layer, SDL 3.4.18, and this very SDL_SetGPUSwapchainParameters(3) moment π mwah, go claim ur window and set those params, you got this π§β¨
π¦ 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