SDL_GPUShaderFormat(3type)

๐Ÿ’… SDL_GPUShaderFormat ๐Ÿ’…

okay bestie, welcome to the SDL_GPUShaderFormat page โ€” it's a datatype from the SDL3 DATATYPES corner of the manual, and no cap, it's lowkey the whole personality test for your shader code. let's get into it ๐Ÿซถ


โœจ NAME โœจ

SDL_GPUShaderFormat โ€” literally just says what format your shader code is in. that's it. that's the whole job. ๐Ÿ‘‘


โœจ SYNOPSIS โœจ

#include <SDL3/SDL_gpu.h>

typedef Uint32 SDL_GPUShaderFormat;

#define SDL_GPU_SHADERFORMAT_INVALID  0
#define SDL_GPU_SHADERFORMAT_PRIVATE  (1u << 0) /**< Shaders for NDA'd platforms. */
#define SDL_GPU_SHADERFORMAT_SPIRV    (1u << 1) /**< SPIR-V shaders for Vulkan. */
#define SDL_GPU_SHADERFORMAT_DXBC     (1u << 2) /**< DXBC SM5_1 shaders for D3D12. */
#define SDL_GPU_SHADERFORMAT_DXIL     (1u << 3) /**< DXIL SM6_0 shaders for D3D12. */
#define SDL_GPU_SHADERFORMAT_MSL      (1u << 4) /**< MSL shaders for Metal. */
#define SDL_GPU_SHADERFORMAT_METALLIB (1u << 5) /**< Precompiled metallib shaders for Metal. */

so it's a Uint32 under the hood โ€” a lil bitfield situation, one bit per format, iykyk. ๐ŸŽ€ here's the roster:

  • SDL_GPU_SHADERFORMAT_INVALID = 0 โ€” the nothing-burger. no format, no vibes. ๐Ÿ’€
  • SDL_GPU_SHADERFORMAT_PRIVATE = (1u << 0) โ€” shaders for NDA'd platforms. ๐Ÿคซ secret business, we don't talk about it.
  • SDL_GPU_SHADERFORMAT_SPIRV = (1u << 1) โ€” SPIR-V shaders, and they're for Vulkan. ๐ŸŒ‹
  • SDL_GPU_SHADERFORMAT_DXBC = (1u << 2) โ€” DXBC SM5_1 shaders, for D3D12. ๐ŸŽฎ
  • SDL_GPU_SHADERFORMAT_DXIL = (1u << 3) โ€” DXIL SM6_0 shaders, also for D3D12. ๐ŸŽฎโœจ
  • SDL_GPU_SHADERFORMAT_MSL = (1u << 4) โ€” MSL shaders, for Metal. ๐ŸŽ
  • SDL_GPU_SHADERFORMAT_METALLIB = (1u << 5) โ€” precompiled metallib shaders, for Metal. already cooked, no compiling needed ๐Ÿ”ฅ

โœจ DESCRIPTION โœจ

each format is matched to one specific backend that actually accepts it. like, it's giving "you're MY format, you go with THIS backend." one format, one backend, iconic pairing behavior. ๐Ÿ’–


โœจ AVAILABILITY โœจ

this datatype has been around since SDL 3.2.0. she's not new new, she's established. ๐Ÿ‘‘


โœจ SEE ALSO โœจ


reminder fr fr: keep every one of those (1u << n) values exactly as they are. don't get cute and rename them, they're doing bitshift math and the math is not negotiable. ๐Ÿ™ˆ

mwah, that's the whole page ๐Ÿ’… this beauty ships with Simple Directmedia Layer, version SDL 3.4.18, dated with the SDL_GPUShaderFormat(3type) energy it deserves โ€” go forth and shader, my love ๐Ÿฆ‹๐Ÿ’œ

๐Ÿ“ฆ where this page comes from