SDL_GPUTextureUsageFlags(3type)
π SDL_GPUTextureUsageFlags π
okay bestie, welcome to the SDL_GPUTextureUsageFlags page β it's a datatype from the SDL3 manual (the 3type girlies know), and she's here to tell you exactly how a texture is intended to be used by the client. no cap. π
β¨ NAME β¨
SDL_GPUTextureUsageFlags β specifies how a texture is intended to be used by the client. that's the whole vibe. π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_gpu.h>
typedef Uint32 SDL_GPUTextureUsageFlags;
#define SDL_GPU_TEXTUREUSAGE_SAMPLER (1u << 0) /**< Texture supports sampling. */
#define SDL_GPU_TEXTUREUSAGE_COLOR_TARGET (1u << 1) /**< Texture is a color render target. */
#define SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET (1u << 2) /**< Texture is a depth stencil target. */
#define SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ (1u << 3) /**< Texture supports storage reads in graphics stages. */
#define SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ (1u << 4) /**< Texture supports storage reads in the compute stage. */
#define SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE (1u << 5) /**< Texture supports storage writes in the compute stage. */
#define SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE (1u << 6) /**< Texture supports reads and writes in the same compute shader. This is NOT equivalent to READ | WRITE. */
so it's literally just a typedef Uint32 and then a lil family of #defines. bit flags. iconic behavior honestly. π
SDL_GPU_TEXTUREUSAGE_SAMPLERβ(1u << 0)β texture supports sampling. π¦SDL_GPU_TEXTUREUSAGE_COLOR_TARGETβ(1u << 1)β texture is a color render target. π¨SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGETβ(1u << 2)β texture is a depth stencil target. πSDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READβ(1u << 3)β texture supports storage reads in graphics stages. πSDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READβ(1u << 4)β texture supports storage reads in the compute stage. πSDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITEβ(1u << 5)β texture supports storage writes in the compute stage. βοΈSDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITEβ(1u << 6)β texture supports reads and writes in the same compute shader. and listen β this is NOT equivalent toREAD | WRITE. do not come for me about it, they are different, periodt. π
π§ DESCRIPTION π§
first thing's first: a texture must have at least one usage flag. zero flags is not a lewk, it's not allowed, she needs at least one. π«Ά
also β combining SAMPLER with the STORAGE_READ flags is invalid. like, don't. it's giving error. π«
now the compute storage tea, because this is the part everyone gets confused about, and honestly valid:
READ | WRITEmeans you can have shader A that only writes into the texture and shader B that only reads from the texture, and you bind the same texture to either shader respectively. two different shaders, two different jobs, same texture, no overlap. π€SIMULTANEOUSmeans you can do reads and writes within the same shader or compute pass. it also implies that atomic ops can be used, since those are read-modify-write operations. π§ β¨
β οΈ if you use SIMULTANEOUS, you are responsible for avoiding data races, because there is no data synchronization within a compute pass. that's on you, bestie. no one's coming to save you. π
and one more lil caveat β SIMULTANEOUS usage is only supported by a limited number of texture formats. so vibe check your format first. πΈ
π AVAILABILITY π
this datatype has been available since SDL 3.2.0. she's a newer girl but she's thriving. β
π SEE ALSO π
and that's the whole page, bestie!! π go forth and flag your textures responsibly. mwah. π
Simple Directmedia Layer Β· SDL 3.4.18 Β· SDL_GPUTextureUsageFlags(3type) β sending u all my love, xoxo, see u in the next manpage π«Άπ
β¨
π¦ 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