SDL_SetGPUTextureName(3)
π SDL_SetGPUTextureName(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we're talking about SDL_SetGPUTextureName β the little function that slaps an arbitrary string constant onto a texture so it has a name. cute, right? π
β¨ NAME β¨
SDL_SetGPUTextureName β sets an arbitrary string constant to label a texture. that's it. that's the whole vibe. π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_gpu.h>
void SDL_SetGPUTextureName(
SDL_GPUDevice *device,
SDL_GPUTexture *texture,
const char *text);
look at that signature. three params, no return value, absolutely zero drama. π¦
π«Ά DESCRIPTION π«Ά
okay so here's the tea, and it's important tea: you should use SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING with SDL_CreateGPUTexture instead of this function to avoid thread safety issues. π
like. this function works. but the property at creation time is the good path. this one is the "oops I forgot to name it and now I'm here" path. choose wisely, queen. π
π FUNCTION PARAMETERS π
deviceβ a GPU Context. your whole GPU situation. the main character. β¨textureβ a texture to attach the name to. this is the lil guy getting a nametag π·οΈtextβ a UTF-8 string constant to mark as the name of the texture. UTF-8, bestie, don't come in here with your weird encodings. also note it's a string constant β a pointer to a literal-ish thing. π
π THREAD SAFETY π
this function is not thread safe. you must make sure the texture is not simultaneously used by any other thread.
not me warning you twice but like. fr fr. do not let another thread touch that texture while this is running. no cap. that's a real crash-shaped consequence. π
π AVAILABILITY π
this function is available since SDL 3.2.0. so if you're on something older, no texture-naming for you, sorry babe. π
π₯ SEE ALSO π₯
SDL_CreateGPUTexture(3)β the function you should probably be using instead. go say hi. π«Ά
and that's the whole page, bestie!! go forth and label your textures responsibly!! πβ¨ππ¦πΈπ π«Άππ₯ππβππππ§π
this has been your girl delivering the Simple Directmedia Layer tea, straight from the SDL 3.4.18 era of the docs β mwah, stay iconic, and remember: name your textures at creation time. 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