SDL_CreateGPUDevice(3)
π SDL_CreateGPUDevice π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where today we're building a whole entire GPU context. yes, really. sit down, hydrate, let's go β¨
πΈ NAME πΈ
SDL_CreateGPUDevice β Creates a GPU context.
like, it makes the GPU context. that's the whole job. main character energy fr π
π SYNOPSIS π
#include <SDL3/SDL_gpu.h>
SDL_GPUDevice * SDL_CreateGPUDevice(
SDL_GPUShaderFormat format_flags,
bool debug_mode,
const char *name);
π¦ DESCRIPTION π¦
so the GPU driver name you pass in can be one of these, no cap:
- "vulkan": [Vulkan](CategoryGPU#vulkan) π₯
- "direct3d12": [D3D12](CategoryGPU#d3d12) π
- "metal": [Metal](CategoryGPU#metal) π
NULL: just let SDL pick the optimal driver, bestie. she knows what she's doing π«Ά
β¨ FUNCTION PARAMETERS β¨
format_flagsβ a bitflag indicating which shader formats the app is able to provide. it's giving "here's what I brought to the party" πdebug_modeβ enable debug mode properties and validations. turn this on when you want the extra checks, lowkey essential while you're still figuring things out πnameβ the preferred GPU driver, orNULLto let SDL pick the optimal driver. queen behavior, delegating π
π RETURN VALUE π
Returns a GPU context on success or NULL on failure β and if it fails, call SDL_GetError() for more information, because she will tell you exactly what went wrong π
β AVAILABILITY β
This function is available since SDL 3.2.0. iconic since day one, periodt π
π SEE ALSO π
SDL_CreateGPUDeviceWithProperties(3)SDL_GetGPUShaderFormats(3)SDL_GetGPUDeviceDriver(3)SDL_DestroyGPUDevice(3)SDL_GPUSupportsShaderFormats(3)
ok so quick vibe check: if you made a device, you gotta SDL_DestroyGPUDevice it later. don't leave her hanging. π«Ά
that's the whole page bestie, mwah π this one's from Simple Directmedia Layer, SDL 3.4.18 era β go forth and create your GPU device, you absolute legend πΈβ¨π
π¦ 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