SDL_GPUTextureCreateInfo(3type)
π SDL_GPUTextureCreateInfo π
okay bestie, sit down, hydrate, because we're about to talk about the blueprint for every texture you'll ever make in SDL3's GPU API. this is a structure specifying the parameters of a texture β and yes it lives in the SDL3 DATATYPES section of the man pages, so you already know it's giving main character energy. β¨
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_gpu.h>
typedef struct SDL_GPUTextureCreateInfo
{
SDL_GPUTextureType type; /**< The base dimensionality of the texture. */
SDL_GPUTextureFormat format; /**< The pixel format of the texture. */
SDL_GPUTextureUsageFlags usage; /**< How the texture is intended to be used by the client. */
Uint32 width; /**< The width of the texture. */
Uint32 height; /**< The height of the texture. */
Uint32 layer_count_or_depth; /**< The layer count or depth of the texture. This value is treated as a layer count on 2D array textures, and as a depth value on 3D textures. */
Uint32 num_levels; /**< The number of mip levels in the texture. */
SDL_GPUSampleCount sample_count; /**< The number of samples per texel. Only applies if the texture is used as a render target. */
SDL_PropertiesID props; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */
} SDL_GPUTextureCreateInfo;
β¨ DESCRIPTION β¨
so basically this struct is the lil form you fill out before the GPU gods hand you a texture. every field is a vibe check, and the texture you get back is exactly as iconic as the form you submitted. π
one thing you need to know, no cap: usage flags can be bitwise OR'd together for combinations of usages. OR it up, bestie, mix and match, go feral. π
β οΈ BUT. and this is a big but. certain usage combinations are invalid β for exampleSAMPLERandGRAPHICS_STORAGE. the way that these two simply cannot coexistβ¦ it's giving enemies to lovers except they never get together. π pick a lane or the call will fail on you fr fr.
π§ the fields, one by one π§
typeβ aSDL_GPUTextureType. this is the base dimensionality of your texture. is it 2D? 3D? cube? that's a whole separate type, go read it. πformatβ aSDL_GPUTextureFormat. the pixel format of the texture. what's actually inside each pixel, the lore, the texture of the texture. πusageβ aSDL_GPUTextureUsageFlags. how the texture is intended to be used by the client. remember the OR-ing thing and the invalid-combo thing from above? this is that field. don't forget it. πwidthβ aUint32. the width of the texture. yes. that's it. she's straightforward. β¨heightβ aUint32. the height of the texture. equally straightforward. slay. πlayer_count_or_depthβ aUint32. the layer count or depth of the texture. okay this one has range: the value is treated as a layer count on 2D array textures, and as a depth value on 3D textures. one field, two jobs, she works hard. πnum_levelsβ aUint32. the number of mip levels in the texture. mipmaps, bestie. it's the tiny versions of your texture that make it look good from far away. iconic behavior honestly. π¦sample_countβ aSDL_GPUSampleCount. the number of samples per texel. and heads up: this only applies if the texture is used as a render target. if you're not render-targeting, she does nothing. read the room. πΈpropsβ aSDL_PropertiesID. a properties ID for extensions. should be0if no extensions are needed. default behavior is0, don't overthink it, just put0and move on. π
β AVAILABILITY β
this struct is available since SDL 3.2.0. so if you're on anything olderβ¦ girl. upgrade. π
π SEE ALSO π
go read these next, they're all connected, it's a whole cinematic universe:
SDL_CreateGPUTexture(3)SDL_GPUTextureType(3type)SDL_GPUTextureFormat(3type)SDL_GPUTextureUsageFlags(3type)SDL_GPUSampleCount(3type)
and that's the whole page bestie, you ate it up, no crumbs left. π«Ά
this lil masterpiece came to you courtesy of Simple Directmedia Layer, version SDL 3.4.18, dated right alongside SDL_GPUTextureCreateInfo(3type) β iykyk. go make something gorgeous with it. ππ₯π
π¦ 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