SDL 3.0
SDL_gpu.h File Reference
+ Include dependency graph for SDL_gpu.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SDL_GPUViewport
 
struct  SDL_GPUTextureTransferInfo
 
struct  SDL_GPUTransferBufferLocation
 
struct  SDL_GPUTextureLocation
 
struct  SDL_GPUTextureRegion
 
struct  SDL_GPUBlitRegion
 
struct  SDL_GPUBufferLocation
 
struct  SDL_GPUBufferRegion
 
struct  SDL_GPUIndirectDrawCommand
 
struct  SDL_GPUIndexedIndirectDrawCommand
 
struct  SDL_GPUIndirectDispatchCommand
 
struct  SDL_GPUSamplerCreateInfo
 
struct  SDL_GPUVertexBufferDescription
 
struct  SDL_GPUVertexAttribute
 
struct  SDL_GPUVertexInputState
 
struct  SDL_GPUStencilOpState
 
struct  SDL_GPUColorTargetBlendState
 
struct  SDL_GPUShaderCreateInfo
 
struct  SDL_GPUTextureCreateInfo
 
struct  SDL_GPUBufferCreateInfo
 
struct  SDL_GPUTransferBufferCreateInfo
 
struct  SDL_GPURasterizerState
 
struct  SDL_GPUMultisampleState
 
struct  SDL_GPUDepthStencilState
 
struct  SDL_GPUColorTargetDescription
 
struct  SDL_GPUGraphicsPipelineTargetInfo
 
struct  SDL_GPUGraphicsPipelineCreateInfo
 
struct  SDL_GPUComputePipelineCreateInfo
 
struct  SDL_GPUColorTargetInfo
 
struct  SDL_GPUDepthStencilTargetInfo
 
struct  SDL_GPUBlitInfo
 
struct  SDL_GPUBufferBinding
 
struct  SDL_GPUTextureSamplerBinding
 
struct  SDL_GPUStorageBufferReadWriteBinding
 
struct  SDL_GPUStorageTextureReadWriteBinding
 

Macros

#define SDL_GPU_TEXTUREUSAGE_SAMPLER   (1u << 0)
 
#define SDL_GPU_TEXTUREUSAGE_COLOR_TARGET   (1u << 1)
 
#define SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET   (1u << 2)
 
#define SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ   (1u << 3)
 
#define SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ   (1u << 4)
 
#define SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE   (1u << 5)
 
#define SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE   (1u << 6)
 
#define SDL_GPU_BUFFERUSAGE_VERTEX   (1u << 0)
 
#define SDL_GPU_BUFFERUSAGE_INDEX   (1u << 1)
 
#define SDL_GPU_BUFFERUSAGE_INDIRECT   (1u << 2)
 
#define SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ   (1u << 3)
 
#define SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ   (1u << 4)
 
#define SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE   (1u << 5)
 
#define SDL_GPU_SHADERFORMAT_INVALID   0
 
#define SDL_GPU_SHADERFORMAT_PRIVATE   (1u << 0)
 
#define SDL_GPU_SHADERFORMAT_SPIRV   (1u << 1)
 
#define SDL_GPU_SHADERFORMAT_DXBC   (1u << 2)
 
#define SDL_GPU_SHADERFORMAT_DXIL   (1u << 3)
 
#define SDL_GPU_SHADERFORMAT_MSL   (1u << 4)
 
#define SDL_GPU_SHADERFORMAT_METALLIB   (1u << 5)
 
#define SDL_GPU_COLORCOMPONENT_R   (1u << 0)
 
#define SDL_GPU_COLORCOMPONENT_G   (1u << 1)
 
#define SDL_GPU_COLORCOMPONENT_B   (1u << 2)
 
#define SDL_GPU_COLORCOMPONENT_A   (1u << 3)
 
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_R_FLOAT   "SDL.gpu.createtexture.d3d12.clear.r"
 
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_G_FLOAT   "SDL.gpu.createtexture.d3d12.clear.g"
 
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_B_FLOAT   "SDL.gpu.createtexture.d3d12.clear.b"
 
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_A_FLOAT   "SDL.gpu.createtexture.d3d12.clear.a"
 
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_DEPTH_FLOAT   "SDL.gpu.createtexture.d3d12.clear.depth"
 
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8   "SDL.gpu.createtexture.d3d12.clear.stencil"
 
#define SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN   "SDL.gpu.device.create.debugmode"
 
#define SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN   "SDL.gpu.device.create.preferlowpower"
 
#define SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING   "SDL.gpu.device.create.name"
 
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN   "SDL.gpu.device.create.shaders.private"
 
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN   "SDL.gpu.device.create.shaders.spirv"
 
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN   "SDL.gpu.device.create.shaders.dxbc"
 
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN   "SDL.gpu.device.create.shaders.dxil"
 
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN   "SDL.gpu.device.create.shaders.msl"
 
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN   "SDL.gpu.device.create.shaders.metallib"
 
#define SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING   "SDL.gpu.device.create.d3d12.semantic"
 

Typedefs

typedef struct SDL_GPUDevice SDL_GPUDevice
 
typedef struct SDL_GPUBuffer SDL_GPUBuffer
 
typedef struct SDL_GPUTransferBuffer SDL_GPUTransferBuffer
 
typedef struct SDL_GPUTexture SDL_GPUTexture
 
typedef struct SDL_GPUSampler SDL_GPUSampler
 
typedef struct SDL_GPUShader SDL_GPUShader
 
typedef struct SDL_GPUComputePipeline SDL_GPUComputePipeline
 
typedef struct SDL_GPUGraphicsPipeline SDL_GPUGraphicsPipeline
 
typedef struct SDL_GPUCommandBuffer SDL_GPUCommandBuffer
 
typedef struct SDL_GPURenderPass SDL_GPURenderPass
 
typedef struct SDL_GPUComputePass SDL_GPUComputePass
 
typedef struct SDL_GPUCopyPass SDL_GPUCopyPass
 
typedef struct SDL_GPUFence SDL_GPUFence
 
typedef Uint32 SDL_GPUTextureUsageFlags
 
typedef Uint32 SDL_GPUBufferUsageFlags
 
typedef Uint32 SDL_GPUShaderFormat
 
typedef Uint8 SDL_GPUColorComponentFlags
 

Enumerations

enum  SDL_GPUPrimitiveType {
  SDL_GPU_PRIMITIVETYPE_TRIANGLELIST ,
  SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP ,
  SDL_GPU_PRIMITIVETYPE_LINELIST ,
  SDL_GPU_PRIMITIVETYPE_LINESTRIP ,
  SDL_GPU_PRIMITIVETYPE_POINTLIST
}
 
enum  SDL_GPULoadOp {
  SDL_GPU_LOADOP_LOAD ,
  SDL_GPU_LOADOP_CLEAR ,
  SDL_GPU_LOADOP_DONT_CARE
}
 
enum  SDL_GPUStoreOp {
  SDL_GPU_STOREOP_STORE ,
  SDL_GPU_STOREOP_DONT_CARE ,
  SDL_GPU_STOREOP_RESOLVE ,
  SDL_GPU_STOREOP_RESOLVE_AND_STORE
}
 
enum  SDL_GPUIndexElementSize {
  SDL_GPU_INDEXELEMENTSIZE_16BIT ,
  SDL_GPU_INDEXELEMENTSIZE_32BIT
}
 
enum  SDL_GPUTextureFormat {
  SDL_GPU_TEXTUREFORMAT_INVALID ,
  SDL_GPU_TEXTUREFORMAT_A8_UNORM ,
  SDL_GPU_TEXTUREFORMAT_R8_UNORM ,
  SDL_GPU_TEXTUREFORMAT_R8G8_UNORM ,
  SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM ,
  SDL_GPU_TEXTUREFORMAT_R16_UNORM ,
  SDL_GPU_TEXTUREFORMAT_R16G16_UNORM ,
  SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM ,
  SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM ,
  SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM ,
  SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM ,
  SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM ,
  SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM ,
  SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM ,
  SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM ,
  SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM ,
  SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM ,
  SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM ,
  SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM ,
  SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT ,
  SDL_GPU_TEXTUREFORMAT_R8_SNORM ,
  SDL_GPU_TEXTUREFORMAT_R8G8_SNORM ,
  SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM ,
  SDL_GPU_TEXTUREFORMAT_R16_SNORM ,
  SDL_GPU_TEXTUREFORMAT_R16G16_SNORM ,
  SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM ,
  SDL_GPU_TEXTUREFORMAT_R16_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_R32_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT ,
  SDL_GPU_TEXTUREFORMAT_R8_UINT ,
  SDL_GPU_TEXTUREFORMAT_R8G8_UINT ,
  SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT ,
  SDL_GPU_TEXTUREFORMAT_R16_UINT ,
  SDL_GPU_TEXTUREFORMAT_R16G16_UINT ,
  SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT ,
  SDL_GPU_TEXTUREFORMAT_R32_UINT ,
  SDL_GPU_TEXTUREFORMAT_R32G32_UINT ,
  SDL_GPU_TEXTUREFORMAT_R32G32B32A32_UINT ,
  SDL_GPU_TEXTUREFORMAT_R8_INT ,
  SDL_GPU_TEXTUREFORMAT_R8G8_INT ,
  SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT ,
  SDL_GPU_TEXTUREFORMAT_R16_INT ,
  SDL_GPU_TEXTUREFORMAT_R16G16_INT ,
  SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT ,
  SDL_GPU_TEXTUREFORMAT_R32_INT ,
  SDL_GPU_TEXTUREFORMAT_R32G32_INT ,
  SDL_GPU_TEXTUREFORMAT_R32G32B32A32_INT ,
  SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_D16_UNORM ,
  SDL_GPU_TEXTUREFORMAT_D24_UNORM ,
  SDL_GPU_TEXTUREFORMAT_D32_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT ,
  SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT ,
  SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM ,
  SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM ,
  SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM ,
  SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM ,
  SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM ,
  SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM ,
  SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM ,
  SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM ,
  SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM ,
  SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM ,
  SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM ,
  SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM ,
  SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM ,
  SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM ,
  SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB ,
  SDL_GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT ,
  SDL_GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT
}
 
enum  SDL_GPUTextureType {
  SDL_GPU_TEXTURETYPE_2D ,
  SDL_GPU_TEXTURETYPE_2D_ARRAY ,
  SDL_GPU_TEXTURETYPE_3D ,
  SDL_GPU_TEXTURETYPE_CUBE ,
  SDL_GPU_TEXTURETYPE_CUBE_ARRAY
}
 
enum  SDL_GPUSampleCount {
  SDL_GPU_SAMPLECOUNT_1 ,
  SDL_GPU_SAMPLECOUNT_2 ,
  SDL_GPU_SAMPLECOUNT_4 ,
  SDL_GPU_SAMPLECOUNT_8
}
 
enum  SDL_GPUCubeMapFace {
  SDL_GPU_CUBEMAPFACE_POSITIVEX ,
  SDL_GPU_CUBEMAPFACE_NEGATIVEX ,
  SDL_GPU_CUBEMAPFACE_POSITIVEY ,
  SDL_GPU_CUBEMAPFACE_NEGATIVEY ,
  SDL_GPU_CUBEMAPFACE_POSITIVEZ ,
  SDL_GPU_CUBEMAPFACE_NEGATIVEZ
}
 
enum  SDL_GPUTransferBufferUsage {
  SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD ,
  SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD
}
 
enum  SDL_GPUShaderStage {
  SDL_GPU_SHADERSTAGE_VERTEX ,
  SDL_GPU_SHADERSTAGE_FRAGMENT
}
 
enum  SDL_GPUVertexElementFormat {
  SDL_GPU_VERTEXELEMENTFORMAT_INVALID ,
  SDL_GPU_VERTEXELEMENTFORMAT_INT ,
  SDL_GPU_VERTEXELEMENTFORMAT_INT2 ,
  SDL_GPU_VERTEXELEMENTFORMAT_INT3 ,
  SDL_GPU_VERTEXELEMENTFORMAT_INT4 ,
  SDL_GPU_VERTEXELEMENTFORMAT_UINT ,
  SDL_GPU_VERTEXELEMENTFORMAT_UINT2 ,
  SDL_GPU_VERTEXELEMENTFORMAT_UINT3 ,
  SDL_GPU_VERTEXELEMENTFORMAT_UINT4 ,
  SDL_GPU_VERTEXELEMENTFORMAT_FLOAT ,
  SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2 ,
  SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3 ,
  SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4 ,
  SDL_GPU_VERTEXELEMENTFORMAT_BYTE2 ,
  SDL_GPU_VERTEXELEMENTFORMAT_BYTE4 ,
  SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2 ,
  SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4 ,
  SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM ,
  SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM ,
  SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM ,
  SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM ,
  SDL_GPU_VERTEXELEMENTFORMAT_SHORT2 ,
  SDL_GPU_VERTEXELEMENTFORMAT_SHORT4 ,
  SDL_GPU_VERTEXELEMENTFORMAT_USHORT2 ,
  SDL_GPU_VERTEXELEMENTFORMAT_USHORT4 ,
  SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM ,
  SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM ,
  SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM ,
  SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM ,
  SDL_GPU_VERTEXELEMENTFORMAT_HALF2 ,
  SDL_GPU_VERTEXELEMENTFORMAT_HALF4
}
 
enum  SDL_GPUVertexInputRate {
  SDL_GPU_VERTEXINPUTRATE_VERTEX ,
  SDL_GPU_VERTEXINPUTRATE_INSTANCE
}
 
enum  SDL_GPUFillMode {
  SDL_GPU_FILLMODE_FILL ,
  SDL_GPU_FILLMODE_LINE
}
 
enum  SDL_GPUCullMode {
  SDL_GPU_CULLMODE_NONE ,
  SDL_GPU_CULLMODE_FRONT ,
  SDL_GPU_CULLMODE_BACK
}
 
enum  SDL_GPUFrontFace {
  SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE ,
  SDL_GPU_FRONTFACE_CLOCKWISE
}
 
enum  SDL_GPUCompareOp {
  SDL_GPU_COMPAREOP_INVALID ,
  SDL_GPU_COMPAREOP_NEVER ,
  SDL_GPU_COMPAREOP_LESS ,
  SDL_GPU_COMPAREOP_EQUAL ,
  SDL_GPU_COMPAREOP_LESS_OR_EQUAL ,
  SDL_GPU_COMPAREOP_GREATER ,
  SDL_GPU_COMPAREOP_NOT_EQUAL ,
  SDL_GPU_COMPAREOP_GREATER_OR_EQUAL ,
  SDL_GPU_COMPAREOP_ALWAYS
}
 
enum  SDL_GPUStencilOp {
  SDL_GPU_STENCILOP_INVALID ,
  SDL_GPU_STENCILOP_KEEP ,
  SDL_GPU_STENCILOP_ZERO ,
  SDL_GPU_STENCILOP_REPLACE ,
  SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP ,
  SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP ,
  SDL_GPU_STENCILOP_INVERT ,
  SDL_GPU_STENCILOP_INCREMENT_AND_WRAP ,
  SDL_GPU_STENCILOP_DECREMENT_AND_WRAP
}
 
enum  SDL_GPUBlendOp {
  SDL_GPU_BLENDOP_INVALID ,
  SDL_GPU_BLENDOP_ADD ,
  SDL_GPU_BLENDOP_SUBTRACT ,
  SDL_GPU_BLENDOP_REVERSE_SUBTRACT ,
  SDL_GPU_BLENDOP_MIN ,
  SDL_GPU_BLENDOP_MAX
}
 
enum  SDL_GPUBlendFactor {
  SDL_GPU_BLENDFACTOR_INVALID ,
  SDL_GPU_BLENDFACTOR_ZERO ,
  SDL_GPU_BLENDFACTOR_ONE ,
  SDL_GPU_BLENDFACTOR_SRC_COLOR ,
  SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR ,
  SDL_GPU_BLENDFACTOR_DST_COLOR ,
  SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR ,
  SDL_GPU_BLENDFACTOR_SRC_ALPHA ,
  SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA ,
  SDL_GPU_BLENDFACTOR_DST_ALPHA ,
  SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA ,
  SDL_GPU_BLENDFACTOR_CONSTANT_COLOR ,
  SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR ,
  SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE
}
 
enum  SDL_GPUFilter {
  SDL_GPU_FILTER_NEAREST ,
  SDL_GPU_FILTER_LINEAR
}
 
enum  SDL_GPUSamplerMipmapMode {
  SDL_GPU_SAMPLERMIPMAPMODE_NEAREST ,
  SDL_GPU_SAMPLERMIPMAPMODE_LINEAR
}
 
enum  SDL_GPUSamplerAddressMode {
  SDL_GPU_SAMPLERADDRESSMODE_REPEAT ,
  SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT ,
  SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE
}
 
enum  SDL_GPUPresentMode {
  SDL_GPU_PRESENTMODE_VSYNC ,
  SDL_GPU_PRESENTMODE_IMMEDIATE ,
  SDL_GPU_PRESENTMODE_MAILBOX
}
 
enum  SDL_GPUSwapchainComposition {
  SDL_GPU_SWAPCHAINCOMPOSITION_SDR ,
  SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR ,
  SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR ,
  SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2048
}
 

Functions

bool SDL_GPUSupportsShaderFormats (SDL_GPUShaderFormat format_flags, const char *name)
 
bool SDL_GPUSupportsProperties (SDL_PropertiesID props)
 
SDL_GPUDeviceSDL_CreateGPUDevice (SDL_GPUShaderFormat format_flags, bool debug_mode, const char *name)
 
SDL_GPUDeviceSDL_CreateGPUDeviceWithProperties (SDL_PropertiesID props)
 
void SDL_DestroyGPUDevice (SDL_GPUDevice *device)
 
int SDL_GetNumGPUDrivers (void)
 
const char * SDL_GetGPUDriver (int index)
 
const char * SDL_GetGPUDeviceDriver (SDL_GPUDevice *device)
 
SDL_GPUShaderFormat SDL_GetGPUShaderFormats (SDL_GPUDevice *device)
 
SDL_GPUComputePipelineSDL_CreateGPUComputePipeline (SDL_GPUDevice *device, const SDL_GPUComputePipelineCreateInfo *createinfo)
 
SDL_GPUGraphicsPipelineSDL_CreateGPUGraphicsPipeline (SDL_GPUDevice *device, const SDL_GPUGraphicsPipelineCreateInfo *createinfo)
 
SDL_GPUSamplerSDL_CreateGPUSampler (SDL_GPUDevice *device, const SDL_GPUSamplerCreateInfo *createinfo)
 
SDL_GPUShaderSDL_CreateGPUShader (SDL_GPUDevice *device, const SDL_GPUShaderCreateInfo *createinfo)
 
SDL_GPUTextureSDL_CreateGPUTexture (SDL_GPUDevice *device, const SDL_GPUTextureCreateInfo *createinfo)
 
SDL_GPUBufferSDL_CreateGPUBuffer (SDL_GPUDevice *device, const SDL_GPUBufferCreateInfo *createinfo)
 
SDL_GPUTransferBufferSDL_CreateGPUTransferBuffer (SDL_GPUDevice *device, const SDL_GPUTransferBufferCreateInfo *createinfo)
 
void SDL_SetGPUBufferName (SDL_GPUDevice *device, SDL_GPUBuffer *buffer, const char *text)
 
void SDL_SetGPUTextureName (SDL_GPUDevice *device, SDL_GPUTexture *texture, const char *text)
 
void SDL_InsertGPUDebugLabel (SDL_GPUCommandBuffer *command_buffer, const char *text)
 
void SDL_PushGPUDebugGroup (SDL_GPUCommandBuffer *command_buffer, const char *name)
 
void SDL_PopGPUDebugGroup (SDL_GPUCommandBuffer *command_buffer)
 
void SDL_ReleaseGPUTexture (SDL_GPUDevice *device, SDL_GPUTexture *texture)
 
void SDL_ReleaseGPUSampler (SDL_GPUDevice *device, SDL_GPUSampler *sampler)
 
void SDL_ReleaseGPUBuffer (SDL_GPUDevice *device, SDL_GPUBuffer *buffer)
 
void SDL_ReleaseGPUTransferBuffer (SDL_GPUDevice *device, SDL_GPUTransferBuffer *transfer_buffer)
 
void SDL_ReleaseGPUComputePipeline (SDL_GPUDevice *device, SDL_GPUComputePipeline *compute_pipeline)
 
void SDL_ReleaseGPUShader (SDL_GPUDevice *device, SDL_GPUShader *shader)
 
void SDL_ReleaseGPUGraphicsPipeline (SDL_GPUDevice *device, SDL_GPUGraphicsPipeline *graphics_pipeline)
 
SDL_GPUCommandBufferSDL_AcquireGPUCommandBuffer (SDL_GPUDevice *device)
 
void SDL_PushGPUVertexUniformData (SDL_GPUCommandBuffer *command_buffer, Uint32 slot_index, const void *data, Uint32 length)
 
void SDL_PushGPUFragmentUniformData (SDL_GPUCommandBuffer *command_buffer, Uint32 slot_index, const void *data, Uint32 length)
 
void SDL_PushGPUComputeUniformData (SDL_GPUCommandBuffer *command_buffer, Uint32 slot_index, const void *data, Uint32 length)
 
SDL_GPURenderPassSDL_BeginGPURenderPass (SDL_GPUCommandBuffer *command_buffer, const SDL_GPUColorTargetInfo *color_target_infos, Uint32 num_color_targets, const SDL_GPUDepthStencilTargetInfo *depth_stencil_target_info)
 
void SDL_BindGPUGraphicsPipeline (SDL_GPURenderPass *render_pass, SDL_GPUGraphicsPipeline *graphics_pipeline)
 
void SDL_SetGPUViewport (SDL_GPURenderPass *render_pass, const SDL_GPUViewport *viewport)
 
void SDL_SetGPUScissor (SDL_GPURenderPass *render_pass, const SDL_Rect *scissor)
 
void SDL_SetGPUBlendConstants (SDL_GPURenderPass *render_pass, SDL_FColor blend_constants)
 
void SDL_SetGPUStencilReference (SDL_GPURenderPass *render_pass, Uint8 reference)
 
void SDL_BindGPUVertexBuffers (SDL_GPURenderPass *render_pass, Uint32 first_slot, const SDL_GPUBufferBinding *bindings, Uint32 num_bindings)
 
void SDL_BindGPUIndexBuffer (SDL_GPURenderPass *render_pass, const SDL_GPUBufferBinding *binding, SDL_GPUIndexElementSize index_element_size)
 
void SDL_BindGPUVertexSamplers (SDL_GPURenderPass *render_pass, Uint32 first_slot, const SDL_GPUTextureSamplerBinding *texture_sampler_bindings, Uint32 num_bindings)
 
void SDL_BindGPUVertexStorageTextures (SDL_GPURenderPass *render_pass, Uint32 first_slot, SDL_GPUTexture *const *storage_textures, Uint32 num_bindings)
 
void SDL_BindGPUVertexStorageBuffers (SDL_GPURenderPass *render_pass, Uint32 first_slot, SDL_GPUBuffer *const *storage_buffers, Uint32 num_bindings)
 
void SDL_BindGPUFragmentSamplers (SDL_GPURenderPass *render_pass, Uint32 first_slot, const SDL_GPUTextureSamplerBinding *texture_sampler_bindings, Uint32 num_bindings)
 
void SDL_BindGPUFragmentStorageTextures (SDL_GPURenderPass *render_pass, Uint32 first_slot, SDL_GPUTexture *const *storage_textures, Uint32 num_bindings)
 
void SDL_BindGPUFragmentStorageBuffers (SDL_GPURenderPass *render_pass, Uint32 first_slot, SDL_GPUBuffer *const *storage_buffers, Uint32 num_bindings)
 
void SDL_DrawGPUIndexedPrimitives (SDL_GPURenderPass *render_pass, Uint32 num_indices, Uint32 num_instances, Uint32 first_index, Sint32 vertex_offset, Uint32 first_instance)
 
void SDL_DrawGPUPrimitives (SDL_GPURenderPass *render_pass, Uint32 num_vertices, Uint32 num_instances, Uint32 first_vertex, Uint32 first_instance)
 
void SDL_DrawGPUPrimitivesIndirect (SDL_GPURenderPass *render_pass, SDL_GPUBuffer *buffer, Uint32 offset, Uint32 draw_count)
 
void SDL_DrawGPUIndexedPrimitivesIndirect (SDL_GPURenderPass *render_pass, SDL_GPUBuffer *buffer, Uint32 offset, Uint32 draw_count)
 
void SDL_EndGPURenderPass (SDL_GPURenderPass *render_pass)
 
SDL_GPUComputePassSDL_BeginGPUComputePass (SDL_GPUCommandBuffer *command_buffer, const SDL_GPUStorageTextureReadWriteBinding *storage_texture_bindings, Uint32 num_storage_texture_bindings, const SDL_GPUStorageBufferReadWriteBinding *storage_buffer_bindings, Uint32 num_storage_buffer_bindings)
 
void SDL_BindGPUComputePipeline (SDL_GPUComputePass *compute_pass, SDL_GPUComputePipeline *compute_pipeline)
 
void SDL_BindGPUComputeSamplers (SDL_GPUComputePass *compute_pass, Uint32 first_slot, const SDL_GPUTextureSamplerBinding *texture_sampler_bindings, Uint32 num_bindings)
 
void SDL_BindGPUComputeStorageTextures (SDL_GPUComputePass *compute_pass, Uint32 first_slot, SDL_GPUTexture *const *storage_textures, Uint32 num_bindings)
 
void SDL_BindGPUComputeStorageBuffers (SDL_GPUComputePass *compute_pass, Uint32 first_slot, SDL_GPUBuffer *const *storage_buffers, Uint32 num_bindings)
 
void SDL_DispatchGPUCompute (SDL_GPUComputePass *compute_pass, Uint32 groupcount_x, Uint32 groupcount_y, Uint32 groupcount_z)
 
void SDL_DispatchGPUComputeIndirect (SDL_GPUComputePass *compute_pass, SDL_GPUBuffer *buffer, Uint32 offset)
 
void SDL_EndGPUComputePass (SDL_GPUComputePass *compute_pass)
 
void * SDL_MapGPUTransferBuffer (SDL_GPUDevice *device, SDL_GPUTransferBuffer *transfer_buffer, bool cycle)
 
void SDL_UnmapGPUTransferBuffer (SDL_GPUDevice *device, SDL_GPUTransferBuffer *transfer_buffer)
 
SDL_GPUCopyPassSDL_BeginGPUCopyPass (SDL_GPUCommandBuffer *command_buffer)
 
void SDL_UploadToGPUTexture (SDL_GPUCopyPass *copy_pass, const SDL_GPUTextureTransferInfo *source, const SDL_GPUTextureRegion *destination, bool cycle)
 
void SDL_UploadToGPUBuffer (SDL_GPUCopyPass *copy_pass, const SDL_GPUTransferBufferLocation *source, const SDL_GPUBufferRegion *destination, bool cycle)
 
void SDL_CopyGPUTextureToTexture (SDL_GPUCopyPass *copy_pass, const SDL_GPUTextureLocation *source, const SDL_GPUTextureLocation *destination, Uint32 w, Uint32 h, Uint32 d, bool cycle)
 
void SDL_CopyGPUBufferToBuffer (SDL_GPUCopyPass *copy_pass, const SDL_GPUBufferLocation *source, const SDL_GPUBufferLocation *destination, Uint32 size, bool cycle)
 
void SDL_DownloadFromGPUTexture (SDL_GPUCopyPass *copy_pass, const SDL_GPUTextureRegion *source, const SDL_GPUTextureTransferInfo *destination)
 
void SDL_DownloadFromGPUBuffer (SDL_GPUCopyPass *copy_pass, const SDL_GPUBufferRegion *source, const SDL_GPUTransferBufferLocation *destination)
 
void SDL_EndGPUCopyPass (SDL_GPUCopyPass *copy_pass)
 
void SDL_GenerateMipmapsForGPUTexture (SDL_GPUCommandBuffer *command_buffer, SDL_GPUTexture *texture)
 
void SDL_BlitGPUTexture (SDL_GPUCommandBuffer *command_buffer, const SDL_GPUBlitInfo *info)
 
bool SDL_WindowSupportsGPUSwapchainComposition (SDL_GPUDevice *device, SDL_Window *window, SDL_GPUSwapchainComposition swapchain_composition)
 
bool SDL_WindowSupportsGPUPresentMode (SDL_GPUDevice *device, SDL_Window *window, SDL_GPUPresentMode present_mode)
 
bool SDL_ClaimWindowForGPUDevice (SDL_GPUDevice *device, SDL_Window *window)
 
void SDL_ReleaseWindowFromGPUDevice (SDL_GPUDevice *device, SDL_Window *window)
 
bool SDL_SetGPUSwapchainParameters (SDL_GPUDevice *device, SDL_Window *window, SDL_GPUSwapchainComposition swapchain_composition, SDL_GPUPresentMode present_mode)
 
SDL_GPUTextureFormat SDL_GetGPUSwapchainTextureFormat (SDL_GPUDevice *device, SDL_Window *window)
 
bool SDL_AcquireGPUSwapchainTexture (SDL_GPUCommandBuffer *command_buffer, SDL_Window *window, SDL_GPUTexture **swapchain_texture, Uint32 *swapchain_texture_width, Uint32 *swapchain_texture_height)
 
bool SDL_SubmitGPUCommandBuffer (SDL_GPUCommandBuffer *command_buffer)
 
SDL_GPUFenceSDL_SubmitGPUCommandBufferAndAcquireFence (SDL_GPUCommandBuffer *command_buffer)
 
bool SDL_WaitForGPUIdle (SDL_GPUDevice *device)
 
bool SDL_WaitForGPUFences (SDL_GPUDevice *device, bool wait_all, SDL_GPUFence *const *fences, Uint32 num_fences)
 
bool SDL_QueryGPUFence (SDL_GPUDevice *device, SDL_GPUFence *fence)
 
void SDL_ReleaseGPUFence (SDL_GPUDevice *device, SDL_GPUFence *fence)
 
Uint32 SDL_GPUTextureFormatTexelBlockSize (SDL_GPUTextureFormat format)
 
bool SDL_GPUTextureSupportsFormat (SDL_GPUDevice *device, SDL_GPUTextureFormat format, SDL_GPUTextureType type, SDL_GPUTextureUsageFlags usage)
 
bool SDL_GPUTextureSupportsSampleCount (SDL_GPUDevice *device, SDL_GPUTextureFormat format, SDL_GPUSampleCount sample_count)
 
Uint32 SDL_CalculateGPUTextureFormatSize (SDL_GPUTextureFormat format, Uint32 width, Uint32 height, Uint32 depth_or_layer_count)
 

Macro Definition Documentation

◆ SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ

#define SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ   (1u << 4)

Buffer supports storage reads in the compute stage.

Definition at line 739 of file SDL_gpu.h.

◆ SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE

#define SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE   (1u << 5)

Buffer supports storage writes in the compute stage.

Definition at line 740 of file SDL_gpu.h.

◆ SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ

#define SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ   (1u << 3)

Buffer supports storage reads in graphics stages.

Definition at line 738 of file SDL_gpu.h.

◆ SDL_GPU_BUFFERUSAGE_INDEX

#define SDL_GPU_BUFFERUSAGE_INDEX   (1u << 1)

Buffer is an index buffer.

Definition at line 736 of file SDL_gpu.h.

◆ SDL_GPU_BUFFERUSAGE_INDIRECT

#define SDL_GPU_BUFFERUSAGE_INDIRECT   (1u << 2)

Buffer is an indirect buffer.

Definition at line 737 of file SDL_gpu.h.

◆ SDL_GPU_BUFFERUSAGE_VERTEX

#define SDL_GPU_BUFFERUSAGE_VERTEX   (1u << 0)

Buffer is a vertex buffer.

Definition at line 735 of file SDL_gpu.h.

◆ SDL_GPU_COLORCOMPONENT_A

#define SDL_GPU_COLORCOMPONENT_A   (1u << 3)

the alpha component

Definition at line 1013 of file SDL_gpu.h.

◆ SDL_GPU_COLORCOMPONENT_B

#define SDL_GPU_COLORCOMPONENT_B   (1u << 2)

the blue component

Definition at line 1012 of file SDL_gpu.h.

◆ SDL_GPU_COLORCOMPONENT_G

#define SDL_GPU_COLORCOMPONENT_G   (1u << 1)

the green component

Definition at line 1011 of file SDL_gpu.h.

◆ SDL_GPU_COLORCOMPONENT_R

#define SDL_GPU_COLORCOMPONENT_R   (1u << 0)

the red component

Definition at line 1010 of file SDL_gpu.h.

◆ SDL_GPU_SHADERFORMAT_DXBC

#define SDL_GPU_SHADERFORMAT_DXBC   (1u << 2)

DXBC SM5_0 shaders for D3D11.

Definition at line 785 of file SDL_gpu.h.

◆ SDL_GPU_SHADERFORMAT_DXIL

#define SDL_GPU_SHADERFORMAT_DXIL   (1u << 3)

DXIL shaders for D3D12.

Definition at line 786 of file SDL_gpu.h.

◆ SDL_GPU_SHADERFORMAT_INVALID

#define SDL_GPU_SHADERFORMAT_INVALID   0

Definition at line 782 of file SDL_gpu.h.

◆ SDL_GPU_SHADERFORMAT_METALLIB

#define SDL_GPU_SHADERFORMAT_METALLIB   (1u << 5)

Precompiled metallib shaders for Metal.

Definition at line 788 of file SDL_gpu.h.

◆ SDL_GPU_SHADERFORMAT_MSL

#define SDL_GPU_SHADERFORMAT_MSL   (1u << 4)

MSL shaders for Metal.

Definition at line 787 of file SDL_gpu.h.

◆ SDL_GPU_SHADERFORMAT_PRIVATE

#define SDL_GPU_SHADERFORMAT_PRIVATE   (1u << 0)

Shaders for NDA'd platforms.

Definition at line 783 of file SDL_gpu.h.

◆ SDL_GPU_SHADERFORMAT_SPIRV

#define SDL_GPU_SHADERFORMAT_SPIRV   (1u << 1)

SPIR-V shaders for Vulkan.

Definition at line 784 of file SDL_gpu.h.

◆ SDL_GPU_TEXTUREUSAGE_COLOR_TARGET

#define SDL_GPU_TEXTUREUSAGE_COLOR_TARGET   (1u << 1)

Texture is a color render target.

Definition at line 660 of file SDL_gpu.h.

◆ SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ

#define SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ   (1u << 4)

Texture supports storage reads in the compute stage.

Definition at line 663 of file SDL_gpu.h.

◆ SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE

#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.

Definition at line 665 of file SDL_gpu.h.

◆ SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE

#define SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE   (1u << 5)

Texture supports storage writes in the compute stage.

Definition at line 664 of file SDL_gpu.h.

◆ SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET

#define SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET   (1u << 2)

Texture is a depth stencil target.

Definition at line 661 of file SDL_gpu.h.

◆ SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ

#define SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ   (1u << 3)

Texture supports storage reads in graphics stages.

Definition at line 662 of file SDL_gpu.h.

◆ SDL_GPU_TEXTUREUSAGE_SAMPLER

#define SDL_GPU_TEXTUREUSAGE_SAMPLER   (1u << 0)

Texture supports sampling.

Definition at line 659 of file SDL_gpu.h.

◆ SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_A_FLOAT

#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_A_FLOAT   "SDL.gpu.createtexture.d3d12.clear.a"

Definition at line 1505 of file SDL_gpu.h.

◆ SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_B_FLOAT

#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_B_FLOAT   "SDL.gpu.createtexture.d3d12.clear.b"

Definition at line 1504 of file SDL_gpu.h.

◆ SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_DEPTH_FLOAT

#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_DEPTH_FLOAT   "SDL.gpu.createtexture.d3d12.clear.depth"

Definition at line 1506 of file SDL_gpu.h.

◆ SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_G_FLOAT

#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_G_FLOAT   "SDL.gpu.createtexture.d3d12.clear.g"

Definition at line 1503 of file SDL_gpu.h.

◆ SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_R_FLOAT

#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_R_FLOAT   "SDL.gpu.createtexture.d3d12.clear.r"

Definition at line 1502 of file SDL_gpu.h.

◆ SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8

#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8   "SDL.gpu.createtexture.d3d12.clear.stencil"

Definition at line 1507 of file SDL_gpu.h.

◆ SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING

#define SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING   "SDL.gpu.device.create.d3d12.semantic"

Definition at line 2000 of file SDL_gpu.h.

◆ SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN

#define SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN   "SDL.gpu.device.create.debugmode"

Definition at line 1991 of file SDL_gpu.h.

◆ SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING

#define SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING   "SDL.gpu.device.create.name"

Definition at line 1993 of file SDL_gpu.h.

◆ SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN

#define SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN   "SDL.gpu.device.create.preferlowpower"

Definition at line 1992 of file SDL_gpu.h.

◆ SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN

#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN   "SDL.gpu.device.create.shaders.dxbc"

Definition at line 1996 of file SDL_gpu.h.

◆ SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN

#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN   "SDL.gpu.device.create.shaders.dxil"

Definition at line 1997 of file SDL_gpu.h.

◆ SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN

#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN   "SDL.gpu.device.create.shaders.metallib"

Definition at line 1999 of file SDL_gpu.h.

◆ SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN

#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN   "SDL.gpu.device.create.shaders.msl"

Definition at line 1998 of file SDL_gpu.h.

◆ SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN

#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN   "SDL.gpu.device.create.shaders.private"

Definition at line 1994 of file SDL_gpu.h.

◆ SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN

#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN   "SDL.gpu.device.create.shaders.spirv"

Definition at line 1995 of file SDL_gpu.h.

Typedef Documentation

◆ SDL_GPUBuffer

◆ SDL_GPUBufferUsageFlags

Specifies how a buffer is intended to be used by the client.

A buffer must have at least one usage flag. Note that some usage flag combinations are invalid.

Unlike textures, READ | WRITE can be used for simultaneous read-write usage. The same data synchronization concerns as textures apply.

Since
This datatype is available since SDL 3.1.3
See also
SDL_CreateGPUBuffer

Definition at line 733 of file SDL_gpu.h.

◆ SDL_GPUColorComponentFlags

Specifies which color components are written in a graphics pipeline.

Since
This datatype is available since SDL 3.1.3
See also
SDL_CreateGPUGraphicsPipeline

Definition at line 1008 of file SDL_gpu.h.

◆ SDL_GPUCommandBuffer

An opaque handle representing a command buffer.

Most state is managed via command buffers. When setting state using a command buffer, that state is local to the command buffer.

Commands only begin execution on the GPU once SDL_SubmitGPUCommandBuffer is called. Once the command buffer is submitted, it is no longer valid to use it.

Command buffers are executed in submission order. If you submit command buffer A and then command buffer B all commands in A will begin executing before any command in B begins executing.

In multi-threading scenarios, you should only access a command buffer on the thread you acquired it from.

Since
This struct is available since SDL 3.1.3
See also
SDL_AcquireGPUCommandBuffer
SDL_SubmitGPUCommandBuffer
SDL_SubmitGPUCommandBufferAndAcquireFence

Definition at line 313 of file SDL_gpu.h.

◆ SDL_GPUComputePass

An opaque handle representing a compute pass.

This handle is transient and should not be held or referenced after SDL_EndGPUComputePass is called.

Since
This struct is available since SDL 3.1.3
See also
SDL_BeginGPUComputePass
SDL_EndGPUComputePass

Definition at line 339 of file SDL_gpu.h.

◆ SDL_GPUComputePipeline

An opaque handle representing a compute pipeline.

Used during compute passes.

Since
This struct is available since SDL 3.1.3
See also
SDL_CreateGPUComputePipeline
SDL_BindGPUComputePipeline
SDL_ReleaseGPUComputePipeline

Definition at line 275 of file SDL_gpu.h.

◆ SDL_GPUCopyPass

An opaque handle representing a copy pass.

This handle is transient and should not be held or referenced after SDL_EndGPUCopyPass is called.

Since
This struct is available since SDL 3.1.3
See also
SDL_BeginGPUCopyPass
SDL_EndGPUCopyPass

Definition at line 352 of file SDL_gpu.h.

◆ SDL_GPUDevice

typedef struct SDL_GPUDevice SDL_GPUDevice

CategoryGPU

The GPU API offers a cross-platform way for apps to talk to modern graphics hardware. It offers both 3D graphics and "compute" support, in the style of Metal, Vulkan, and Direct3D 12.

A basic workflow might be something like this:

The app creates a GPU device with SDL_CreateGPUDevice(), and assigns it to a window with SDL_ClaimWindowForGPUDevice()–although strictly speaking you can render offscreen entirely, perhaps for image processing, and not use a window at all.

Next the app prepares static data (things that are created once and used over and over). For example:

To render, the app creates one or more command buffers, with SDL_AcquireGPUCommandBuffer(). Command buffers collect rendering instructions that will be submitted to the GPU in batch. Complex scenes can use multiple command buffers, maybe configured across multiple threads in parallel, as long as they are submitted in the correct order, but many apps will just need one command buffer per frame.

Rendering can happen to a texture (what other APIs call a "render target") or it can happen to the swapchain texture (which is just a special texture that represents a window's contents). The app can use SDL_AcquireGPUSwapchainTexture() to render to the window.

Rendering actually happens in a Render Pass, which is encoded into a command buffer. One can encode multiple render passes (or alternate between render and compute passes) in a single command buffer, but many apps might simply need a single render pass in a single command buffer. Render Passes can render to up to four color textures and one depth texture simultaneously. If the set of textures being rendered to needs to change, the Render Pass must be ended and a new one must be begun.

The app calls SDL_BeginGPURenderPass(). Then it sets states it needs for each draw:

Then, make the actual draw commands with these states:

After all the drawing commands for a pass are complete, the app should call SDL_EndGPURenderPass(). Once a render pass ends all render-related state is reset.

The app can begin new Render Passes and make new draws in the same command buffer until the entire scene is rendered.

Once all of the render commands for the scene are complete, the app calls SDL_SubmitGPUCommandBuffer() to send it to the GPU for processing.

If the app needs to read back data from texture or buffers, the API has an efficient way of doing this, provided that the app is willing to tolerate some latency. When the app uses SDL_DownloadFromGPUTexture() or SDL_DownloadFromGPUBuffer(), submitting the command buffer with SubmitGPUCommandBufferAndAcquireFence() will return a fence handle that the app can poll or wait on in a thread. Once the fence indicates that the command buffer is done processing, it is safe to read the downloaded data. Make sure to call SDL_ReleaseGPUFence() when done with the fence.

The API also has "compute" support. The app calls SDL_BeginGPUComputePass() with compute-writeable textures and/or buffers, which can be written to in a compute shader. Then it sets states it needs for the compute dispatches:

Then, dispatch compute work:

For advanced users, this opens up powerful GPU-driven workflows.

Graphics and compute pipelines require the use of shaders, which as mentioned above are small programs executed on the GPU. Each backend (Vulkan, Metal, D3D12) requires a different shader format. When the app creates the GPU device, the app lets the device know which shader formats the app can provide. It will then select the appropriate backend depending on the available shader formats and the backends available on the platform. When creating shaders, the app must provide the correct shader format for the selected backend. If you would like to learn more about why the API works this way, there is a detailed blog post explaining this situation.

It is optimal for apps to pre-compile the shader formats they might use, but for ease of use SDL provides a separate project, SDL_gpu_shadercross , for performing runtime shader cross-compilation.

This is an extremely quick overview that leaves out several important details. Already, though, one can see that GPU programming can be quite complex! If you just need simple 2D graphics, the Render API is much easier to use but still hardware-accelerated. That said, even for 2D applications the performance benefits and expressiveness of the GPU API are significant.

The GPU API targets a feature set with a wide range of hardware support and ease of portability. It is designed so that the app won't have to branch itself by querying feature support. If you need cutting-edge features with limited hardware support, this API is probably not for you.

Examples demonstrating proper usage of this API can be found hereAn opaque handle representing the SDL_GPU context.

Since
This struct is available since SDL 3.1.3

Definition at line 175 of file SDL_gpu.h.

◆ SDL_GPUFence

typedef struct SDL_GPUFence SDL_GPUFence

An opaque handle representing a fence.

Since
This struct is available since SDL 3.1.3
See also
SDL_SubmitGPUCommandBufferAndAcquireFence
SDL_QueryGPUFence
SDL_WaitForGPUFences
SDL_ReleaseGPUFence

Definition at line 364 of file SDL_gpu.h.

◆ SDL_GPUGraphicsPipeline

An opaque handle representing a graphics pipeline.

Used during render passes.

Since
This struct is available since SDL 3.1.3
See also
SDL_CreateGPUGraphicsPipeline
SDL_BindGPUGraphicsPipeline
SDL_ReleaseGPUGraphicsPipeline

Definition at line 288 of file SDL_gpu.h.

◆ SDL_GPURenderPass

An opaque handle representing a render pass.

This handle is transient and should not be held or referenced after SDL_EndGPURenderPass is called.

Since
This struct is available since SDL 3.1.3
See also
SDL_BeginGPURenderPass
SDL_EndGPURenderPass

Definition at line 326 of file SDL_gpu.h.

◆ SDL_GPUSampler

An opaque handle representing a sampler.

Since
This struct is available since SDL 3.1.3
See also
SDL_CreateGPUSampler
SDL_BindGPUVertexSamplers
SDL_BindGPUFragmentSamplers
SDL_ReleaseGPUSampler

Definition at line 251 of file SDL_gpu.h.

◆ SDL_GPUShader

typedef struct SDL_GPUShader SDL_GPUShader

An opaque handle representing a compiled shader object.

Since
This struct is available since SDL 3.1.3
See also
SDL_CreateGPUShader
SDL_CreateGPUGraphicsPipeline
SDL_ReleaseGPUShader

Definition at line 262 of file SDL_gpu.h.

◆ SDL_GPUShaderFormat

Specifies the format of shader code.

Each format corresponds to a specific backend that accepts it.

Since
This datatype is available since SDL 3.1.3
See also
SDL_CreateGPUShader

Definition at line 780 of file SDL_gpu.h.

◆ SDL_GPUTexture

◆ SDL_GPUTextureUsageFlags

Specifies how a texture is intended to be used by the client.

A texture must have at least one usage flag. Note that some usage flag combinations are invalid.

With regards to compute storage usage, READ | WRITE means that you can have shader A that only writes into the texture and shader B that only reads from the texture and bind the same texture to either shader respectively. SIMULTANEOUS means that 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, as there is no data synchronization within a compute pass. Note that SIMULTANEOUS usage is only supported by a limited number of texture formats.

Since
This datatype is available since SDL 3.1.3
See also
SDL_CreateGPUTexture

Definition at line 657 of file SDL_gpu.h.

◆ SDL_GPUTransferBuffer

An opaque handle representing a transfer buffer.

Used for transferring data to and from the device.

Since
This struct is available since SDL 3.1.3
See also
SDL_CreateGPUTransferBuffer
SDL_MapGPUTransferBuffer
SDL_UnmapGPUTransferBuffer
SDL_UploadToGPUBuffer
SDL_UploadToGPUTexture
SDL_DownloadFromGPUBuffer
SDL_DownloadFromGPUTexture
SDL_ReleaseGPUTransferBuffer

Definition at line 218 of file SDL_gpu.h.

Enumeration Type Documentation

◆ SDL_GPUBlendFactor

Specifies a blending factor to be used when pixels in a render target are blended with existing pixels in the texture.

The source color is the value written by the fragment shader. The destination color is the value currently existing in the texture.

Since
This enum is available since SDL 3.1.3
See also
SDL_CreateGPUGraphicsPipeline
Enumerator
SDL_GPU_BLENDFACTOR_INVALID 
SDL_GPU_BLENDFACTOR_ZERO 

0

SDL_GPU_BLENDFACTOR_ONE 

1

SDL_GPU_BLENDFACTOR_SRC_COLOR 

source color

SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR 

1 - source color

SDL_GPU_BLENDFACTOR_DST_COLOR 

destination color

SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR 

1 - destination color

SDL_GPU_BLENDFACTOR_SRC_ALPHA 

source alpha

SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA 

1 - source alpha

SDL_GPU_BLENDFACTOR_DST_ALPHA 

destination alpha

SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA 

1 - destination alpha

SDL_GPU_BLENDFACTOR_CONSTANT_COLOR 

blend constant

SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR 

1 - blend constant

SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE 

min(source alpha, 1 - destination alpha)

Definition at line 983 of file SDL_gpu.h.

984{
986 SDL_GPU_BLENDFACTOR_ZERO, /**< 0 */
987 SDL_GPU_BLENDFACTOR_ONE, /**< 1 */
988 SDL_GPU_BLENDFACTOR_SRC_COLOR, /**< source color */
989 SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR, /**< 1 - source color */
990 SDL_GPU_BLENDFACTOR_DST_COLOR, /**< destination color */
991 SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR, /**< 1 - destination color */
992 SDL_GPU_BLENDFACTOR_SRC_ALPHA, /**< source alpha */
993 SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, /**< 1 - source alpha */
994 SDL_GPU_BLENDFACTOR_DST_ALPHA, /**< destination alpha */
995 SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA, /**< 1 - destination alpha */
996 SDL_GPU_BLENDFACTOR_CONSTANT_COLOR, /**< blend constant */
997 SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR, /**< 1 - blend constant */
998 SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE /**< min(source alpha, 1 - destination alpha) */
SDL_GPUBlendFactor
Definition SDL_gpu.h:984
@ SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA
Definition SDL_gpu.h:993
@ SDL_GPU_BLENDFACTOR_CONSTANT_COLOR
Definition SDL_gpu.h:996
@ SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR
Definition SDL_gpu.h:991
@ SDL_GPU_BLENDFACTOR_INVALID
Definition SDL_gpu.h:985
@ SDL_GPU_BLENDFACTOR_DST_ALPHA
Definition SDL_gpu.h:994
@ SDL_GPU_BLENDFACTOR_ZERO
Definition SDL_gpu.h:986
@ SDL_GPU_BLENDFACTOR_DST_COLOR
Definition SDL_gpu.h:990
@ SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA
Definition SDL_gpu.h:995
@ SDL_GPU_BLENDFACTOR_SRC_ALPHA
Definition SDL_gpu.h:992
@ SDL_GPU_BLENDFACTOR_SRC_COLOR
Definition SDL_gpu.h:988
@ SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR
Definition SDL_gpu.h:989
@ SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE
Definition SDL_gpu.h:998
@ SDL_GPU_BLENDFACTOR_ONE
Definition SDL_gpu.h:987
@ SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR
Definition SDL_gpu.h:997

◆ SDL_GPUBlendOp

Specifies the operator to be used when pixels in a render target are blended with existing pixels in the texture.

The source color is the value written by the fragment shader. The destination color is the value currently existing in the texture.

Since
This enum is available since SDL 3.1.3
See also
SDL_CreateGPUGraphicsPipeline
Enumerator
SDL_GPU_BLENDOP_INVALID 
SDL_GPU_BLENDOP_ADD 

(source * source_factor) + (destination * destination_factor)

SDL_GPU_BLENDOP_SUBTRACT 

(source * source_factor) - (destination * destination_factor)

SDL_GPU_BLENDOP_REVERSE_SUBTRACT 

(destination * destination_factor) - (source * source_factor)

SDL_GPU_BLENDOP_MIN 

min(source, destination)

SDL_GPU_BLENDOP_MAX 

max(source, destination)

Definition at line 962 of file SDL_gpu.h.

963{
965 SDL_GPU_BLENDOP_ADD, /**< (source * source_factor) + (destination * destination_factor) */
966 SDL_GPU_BLENDOP_SUBTRACT, /**< (source * source_factor) - (destination * destination_factor) */
967 SDL_GPU_BLENDOP_REVERSE_SUBTRACT, /**< (destination * destination_factor) - (source * source_factor) */
968 SDL_GPU_BLENDOP_MIN, /**< min(source, destination) */
969 SDL_GPU_BLENDOP_MAX /**< max(source, destination) */
SDL_GPUBlendOp
Definition SDL_gpu.h:963
@ SDL_GPU_BLENDOP_MIN
Definition SDL_gpu.h:968
@ SDL_GPU_BLENDOP_INVALID
Definition SDL_gpu.h:964
@ SDL_GPU_BLENDOP_MAX
Definition SDL_gpu.h:969
@ SDL_GPU_BLENDOP_REVERSE_SUBTRACT
Definition SDL_gpu.h:967
@ SDL_GPU_BLENDOP_SUBTRACT
Definition SDL_gpu.h:966
@ SDL_GPU_BLENDOP_ADD
Definition SDL_gpu.h:965

◆ SDL_GPUCompareOp

Specifies a comparison operator for depth, stencil and sampler operations.

Since
This enum is available since SDL 3.1.3
See also
SDL_CreateGPUGraphicsPipeline
Enumerator
SDL_GPU_COMPAREOP_INVALID 
SDL_GPU_COMPAREOP_NEVER 

The comparison always evaluates false.

SDL_GPU_COMPAREOP_LESS 

The comparison evaluates reference < test.

SDL_GPU_COMPAREOP_EQUAL 

The comparison evaluates reference == test.

SDL_GPU_COMPAREOP_LESS_OR_EQUAL 

The comparison evaluates reference <= test.

SDL_GPU_COMPAREOP_GREATER 

The comparison evaluates reference > test.

SDL_GPU_COMPAREOP_NOT_EQUAL 

The comparison evaluates reference != test.

SDL_GPU_COMPAREOP_GREATER_OR_EQUAL 

The comparison evalutes reference >= test.

SDL_GPU_COMPAREOP_ALWAYS 

The comparison always evaluates true.

Definition at line 917 of file SDL_gpu.h.

918{
920 SDL_GPU_COMPAREOP_NEVER, /**< The comparison always evaluates false. */
921 SDL_GPU_COMPAREOP_LESS, /**< The comparison evaluates reference < test. */
922 SDL_GPU_COMPAREOP_EQUAL, /**< The comparison evaluates reference == test. */
923 SDL_GPU_COMPAREOP_LESS_OR_EQUAL, /**< The comparison evaluates reference <= test. */
924 SDL_GPU_COMPAREOP_GREATER, /**< The comparison evaluates reference > test. */
925 SDL_GPU_COMPAREOP_NOT_EQUAL, /**< The comparison evaluates reference != test. */
926 SDL_GPU_COMPAREOP_GREATER_OR_EQUAL, /**< The comparison evalutes reference >= test. */
927 SDL_GPU_COMPAREOP_ALWAYS /**< The comparison always evaluates true. */
SDL_GPUCompareOp
Definition SDL_gpu.h:918
@ SDL_GPU_COMPAREOP_NEVER
Definition SDL_gpu.h:920
@ SDL_GPU_COMPAREOP_INVALID
Definition SDL_gpu.h:919
@ SDL_GPU_COMPAREOP_GREATER
Definition SDL_gpu.h:924
@ SDL_GPU_COMPAREOP_LESS
Definition SDL_gpu.h:921
@ SDL_GPU_COMPAREOP_GREATER_OR_EQUAL
Definition SDL_gpu.h:926
@ SDL_GPU_COMPAREOP_ALWAYS
Definition SDL_gpu.h:927
@ SDL_GPU_COMPAREOP_LESS_OR_EQUAL
Definition SDL_gpu.h:923
@ SDL_GPU_COMPAREOP_NOT_EQUAL
Definition SDL_gpu.h:925
@ SDL_GPU_COMPAREOP_EQUAL
Definition SDL_gpu.h:922

◆ SDL_GPUCubeMapFace

Specifies the face of a cube map.

Can be passed in as the layer field in texture-related structs.

Since
This enum is available since SDL 3.1.3
Enumerator
SDL_GPU_CUBEMAPFACE_POSITIVEX 
SDL_GPU_CUBEMAPFACE_NEGATIVEX 
SDL_GPU_CUBEMAPFACE_POSITIVEY 
SDL_GPU_CUBEMAPFACE_NEGATIVEY 
SDL_GPU_CUBEMAPFACE_POSITIVEZ 
SDL_GPU_CUBEMAPFACE_NEGATIVEZ 

Definition at line 710 of file SDL_gpu.h.

711{
SDL_GPUCubeMapFace
Definition SDL_gpu.h:711
@ SDL_GPU_CUBEMAPFACE_NEGATIVEY
Definition SDL_gpu.h:715
@ SDL_GPU_CUBEMAPFACE_POSITIVEY
Definition SDL_gpu.h:714
@ SDL_GPU_CUBEMAPFACE_NEGATIVEX
Definition SDL_gpu.h:713
@ SDL_GPU_CUBEMAPFACE_NEGATIVEZ
Definition SDL_gpu.h:717
@ SDL_GPU_CUBEMAPFACE_POSITIVEX
Definition SDL_gpu.h:712
@ SDL_GPU_CUBEMAPFACE_POSITIVEZ
Definition SDL_gpu.h:716

◆ SDL_GPUCullMode

Specifies the facing direction in which triangle faces will be culled.

Since
This enum is available since SDL 3.1.3
See also
SDL_CreateGPUGraphicsPipeline
Enumerator
SDL_GPU_CULLMODE_NONE 

No triangles are culled.

SDL_GPU_CULLMODE_FRONT 

Front-facing triangles are culled.

SDL_GPU_CULLMODE_BACK 

Back-facing triangles are culled.

Definition at line 889 of file SDL_gpu.h.

890{
891 SDL_GPU_CULLMODE_NONE, /**< No triangles are culled. */
892 SDL_GPU_CULLMODE_FRONT, /**< Front-facing triangles are culled. */
893 SDL_GPU_CULLMODE_BACK /**< Back-facing triangles are culled. */
SDL_GPUCullMode
Definition SDL_gpu.h:890
@ SDL_GPU_CULLMODE_FRONT
Definition SDL_gpu.h:892
@ SDL_GPU_CULLMODE_NONE
Definition SDL_gpu.h:891
@ SDL_GPU_CULLMODE_BACK
Definition SDL_gpu.h:893

◆ SDL_GPUFillMode

Specifies the fill mode of the graphics pipeline.

Since
This enum is available since SDL 3.1.3
See also
SDL_CreateGPUGraphicsPipeline
Enumerator
SDL_GPU_FILLMODE_FILL 

Polygons will be rendered via rasterization.

SDL_GPU_FILLMODE_LINE 

Polygon edges will be drawn as line segments.

Definition at line 876 of file SDL_gpu.h.

877{
878 SDL_GPU_FILLMODE_FILL, /**< Polygons will be rendered via rasterization. */
879 SDL_GPU_FILLMODE_LINE /**< Polygon edges will be drawn as line segments. */
SDL_GPUFillMode
Definition SDL_gpu.h:877
@ SDL_GPU_FILLMODE_FILL
Definition SDL_gpu.h:878
@ SDL_GPU_FILLMODE_LINE
Definition SDL_gpu.h:879

◆ SDL_GPUFilter

Specifies a filter operation used by a sampler.

Since
This enum is available since SDL 3.1.3
See also
SDL_CreateGPUSampler
Enumerator
SDL_GPU_FILTER_NEAREST 

Point filtering.

SDL_GPU_FILTER_LINEAR 

Linear filtering.

Definition at line 1022 of file SDL_gpu.h.

1023{
1024 SDL_GPU_FILTER_NEAREST, /**< Point filtering. */
1025 SDL_GPU_FILTER_LINEAR /**< Linear filtering. */
SDL_GPUFilter
Definition SDL_gpu.h:1023
@ SDL_GPU_FILTER_NEAREST
Definition SDL_gpu.h:1024
@ SDL_GPU_FILTER_LINEAR
Definition SDL_gpu.h:1025

◆ SDL_GPUFrontFace

Specifies the vertex winding that will cause a triangle to be determined to be front-facing.

Since
This enum is available since SDL 3.1.3
See also
SDL_CreateGPUGraphicsPipeline
Enumerator
SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE 

A triangle with counter-clockwise vertex winding will be considered front-facing.

SDL_GPU_FRONTFACE_CLOCKWISE 

A triangle with clockwise vertex winding will be considered front-facing.

Definition at line 904 of file SDL_gpu.h.

905{
906 SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE, /**< A triangle with counter-clockwise vertex winding will be considered front-facing. */
907 SDL_GPU_FRONTFACE_CLOCKWISE /**< A triangle with clockwise vertex winding will be considered front-facing. */
SDL_GPUFrontFace
Definition SDL_gpu.h:905
@ SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE
Definition SDL_gpu.h:906
@ SDL_GPU_FRONTFACE_CLOCKWISE
Definition SDL_gpu.h:907

◆ SDL_GPUIndexElementSize

Specifies the size of elements in an index buffer.

Since
This enum is available since SDL 3.1.3
See also
SDL_CreateGPUGraphicsPipeline
Enumerator
SDL_GPU_INDEXELEMENTSIZE_16BIT 

The index elements are 16-bit.

SDL_GPU_INDEXELEMENTSIZE_32BIT 

The index elements are 32-bit.

Definition at line 420 of file SDL_gpu.h.

421{
422 SDL_GPU_INDEXELEMENTSIZE_16BIT, /**< The index elements are 16-bit. */
423 SDL_GPU_INDEXELEMENTSIZE_32BIT /**< The index elements are 32-bit. */
SDL_GPUIndexElementSize
Definition SDL_gpu.h:421
@ SDL_GPU_INDEXELEMENTSIZE_16BIT
Definition SDL_gpu.h:422
@ SDL_GPU_INDEXELEMENTSIZE_32BIT
Definition SDL_gpu.h:423

◆ SDL_GPULoadOp

Specifies how the contents of a texture attached to a render pass are treated at the beginning of the render pass.

Since
This enum is available since SDL 3.1.3
See also
SDL_BeginGPURenderPass
Enumerator
SDL_GPU_LOADOP_LOAD 

The previous contents of the texture will be preserved.

SDL_GPU_LOADOP_CLEAR 

The contents of the texture will be cleared to a color.

SDL_GPU_LOADOP_DONT_CARE 

The previous contents of the texture need not be preserved. The contents will be undefined.

Definition at line 390 of file SDL_gpu.h.

391{
392 SDL_GPU_LOADOP_LOAD, /**< The previous contents of the texture will be preserved. */
393 SDL_GPU_LOADOP_CLEAR, /**< The contents of the texture will be cleared to a color. */
394 SDL_GPU_LOADOP_DONT_CARE /**< The previous contents of the texture need not be preserved. The contents will be undefined. */
SDL_GPULoadOp
Definition SDL_gpu.h:391
@ SDL_GPU_LOADOP_DONT_CARE
Definition SDL_gpu.h:394
@ SDL_GPU_LOADOP_CLEAR
Definition SDL_gpu.h:393
@ SDL_GPU_LOADOP_LOAD
Definition SDL_gpu.h:392

◆ SDL_GPUPresentMode

Specifies the timing that will be used to present swapchain textures to the OS.

Note that this value affects the behavior of SDL_AcquireGPUSwapchainTexture. VSYNC mode will always be supported. IMMEDIATE and MAILBOX modes may not be supported on certain systems.

It is recommended to query SDL_WindowSupportsGPUPresentMode after claiming the window if you wish to change the present mode to IMMEDIATE or MAILBOX.

  • VSYNC: Waits for vblank before presenting. No tearing is possible. If there is a pending image to present, the new image is enqueued for presentation. Disallows tearing at the cost of visual latency. When using this present mode, AcquireGPUSwapchainTexture will block if too many frames are in flight.
  • IMMEDIATE: Immediately presents. Lowest latency option, but tearing may occur. When using this mode, AcquireGPUSwapchainTexture will fill the swapchain texture pointer with NULL if too many frames are in flight.
  • MAILBOX: Waits for vblank before presenting. No tearing is possible. If there is a pending image to present, the pending image is replaced by the new image. Similar to VSYNC, but with reduced visual latency. When using this mode, AcquireGPUSwapchainTexture will fill the swapchain texture pointer with NULL if too many frames are in flight.
Since
This enum is available since SDL 3.1.3
See also
SDL_SetGPUSwapchainParameters
SDL_WindowSupportsGPUPresentMode
SDL_AcquireGPUSwapchainTexture
Enumerator
SDL_GPU_PRESENTMODE_VSYNC 
SDL_GPU_PRESENTMODE_IMMEDIATE 
SDL_GPU_PRESENTMODE_MAILBOX 

Definition at line 1087 of file SDL_gpu.h.

1088{
SDL_GPUPresentMode
Definition SDL_gpu.h:1088
@ SDL_GPU_PRESENTMODE_VSYNC
Definition SDL_gpu.h:1089
@ SDL_GPU_PRESENTMODE_IMMEDIATE
Definition SDL_gpu.h:1090
@ SDL_GPU_PRESENTMODE_MAILBOX
Definition SDL_gpu.h:1091

◆ SDL_GPUPrimitiveType

Specifies the primitive topology of a graphics pipeline.

Since
This enum is available since SDL 3.1.3
See also
SDL_CreateGPUGraphicsPipeline
Enumerator
SDL_GPU_PRIMITIVETYPE_TRIANGLELIST 

A series of separate triangles.

SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP 

A series of connected triangles.

SDL_GPU_PRIMITIVETYPE_LINELIST 

A series of separate lines.

SDL_GPU_PRIMITIVETYPE_LINESTRIP 

A series of connected lines.

SDL_GPU_PRIMITIVETYPE_POINTLIST 

A series of separate points.

Definition at line 373 of file SDL_gpu.h.

374{
375 SDL_GPU_PRIMITIVETYPE_TRIANGLELIST, /**< A series of separate triangles. */
376 SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP, /**< A series of connected triangles. */
377 SDL_GPU_PRIMITIVETYPE_LINELIST, /**< A series of separate lines. */
378 SDL_GPU_PRIMITIVETYPE_LINESTRIP, /**< A series of connected lines. */
379 SDL_GPU_PRIMITIVETYPE_POINTLIST /**< A series of separate points. */
SDL_GPUPrimitiveType
Definition SDL_gpu.h:374
@ SDL_GPU_PRIMITIVETYPE_TRIANGLELIST
Definition SDL_gpu.h:375
@ SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP
Definition SDL_gpu.h:376
@ SDL_GPU_PRIMITIVETYPE_POINTLIST
Definition SDL_gpu.h:379
@ SDL_GPU_PRIMITIVETYPE_LINESTRIP
Definition SDL_gpu.h:378
@ SDL_GPU_PRIMITIVETYPE_LINELIST
Definition SDL_gpu.h:377

◆ SDL_GPUSampleCount

Specifies the sample count of a texture.

Used in multisampling. Note that this value only applies when the texture is used as a render target.

Since
This enum is available since SDL 3.1.3
See also
SDL_CreateGPUTexture
SDL_GPUTextureSupportsSampleCount
Enumerator
SDL_GPU_SAMPLECOUNT_1 

No multisampling.

SDL_GPU_SAMPLECOUNT_2 

MSAA 2x

SDL_GPU_SAMPLECOUNT_4 

MSAA 4x

SDL_GPU_SAMPLECOUNT_8 

MSAA 8x

Definition at line 694 of file SDL_gpu.h.

695{
696 SDL_GPU_SAMPLECOUNT_1, /**< No multisampling. */
697 SDL_GPU_SAMPLECOUNT_2, /**< MSAA 2x */
698 SDL_GPU_SAMPLECOUNT_4, /**< MSAA 4x */
699 SDL_GPU_SAMPLECOUNT_8 /**< MSAA 8x */
SDL_GPUSampleCount
Definition SDL_gpu.h:695
@ SDL_GPU_SAMPLECOUNT_2
Definition SDL_gpu.h:697
@ SDL_GPU_SAMPLECOUNT_8
Definition SDL_gpu.h:699
@ SDL_GPU_SAMPLECOUNT_1
Definition SDL_gpu.h:696
@ SDL_GPU_SAMPLECOUNT_4
Definition SDL_gpu.h:698

◆ SDL_GPUSamplerAddressMode

Specifies behavior of texture sampling when the coordinates exceed the 0-1 range.

Since
This enum is available since SDL 3.1.3
See also
SDL_CreateGPUSampler
Enumerator
SDL_GPU_SAMPLERADDRESSMODE_REPEAT 

Specifies that the coordinates will wrap around.

SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT 

Specifies that the coordinates will wrap around mirrored.

SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE 

Specifies that the coordinates will clamp to the 0-1 range.

Definition at line 1049 of file SDL_gpu.h.

1050{
1051 SDL_GPU_SAMPLERADDRESSMODE_REPEAT, /**< Specifies that the coordinates will wrap around. */
1052 SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT, /**< Specifies that the coordinates will wrap around mirrored. */
1053 SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE /**< Specifies that the coordinates will clamp to the 0-1 range. */
SDL_GPUSamplerAddressMode
Definition SDL_gpu.h:1050
@ SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT
Definition SDL_gpu.h:1052
@ SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE
Definition SDL_gpu.h:1053
@ SDL_GPU_SAMPLERADDRESSMODE_REPEAT
Definition SDL_gpu.h:1051

◆ SDL_GPUSamplerMipmapMode

Specifies a mipmap mode used by a sampler.

Since
This enum is available since SDL 3.1.3
See also
SDL_CreateGPUSampler
Enumerator
SDL_GPU_SAMPLERMIPMAPMODE_NEAREST 

Point filtering.

SDL_GPU_SAMPLERMIPMAPMODE_LINEAR 

Linear filtering.

Definition at line 1035 of file SDL_gpu.h.

1036{
1037 SDL_GPU_SAMPLERMIPMAPMODE_NEAREST, /**< Point filtering. */
1038 SDL_GPU_SAMPLERMIPMAPMODE_LINEAR /**< Linear filtering. */
SDL_GPUSamplerMipmapMode
Definition SDL_gpu.h:1036
@ SDL_GPU_SAMPLERMIPMAPMODE_NEAREST
Definition SDL_gpu.h:1037
@ SDL_GPU_SAMPLERMIPMAPMODE_LINEAR
Definition SDL_gpu.h:1038

◆ SDL_GPUShaderStage

Specifies which stage a shader program corresponds to.

Since
This enum is available since SDL 3.1.3
See also
SDL_CreateGPUShader
Enumerator
SDL_GPU_SHADERSTAGE_VERTEX 
SDL_GPU_SHADERSTAGE_FRAGMENT 

Definition at line 765 of file SDL_gpu.h.

766{
SDL_GPUShaderStage
Definition SDL_gpu.h:766
@ SDL_GPU_SHADERSTAGE_FRAGMENT
Definition SDL_gpu.h:768
@ SDL_GPU_SHADERSTAGE_VERTEX
Definition SDL_gpu.h:767

◆ SDL_GPUStencilOp

Specifies what happens to a stored stencil value if stencil tests fail or pass.

Since
This enum is available since SDL 3.1.3
See also
SDL_CreateGPUGraphicsPipeline
Enumerator
SDL_GPU_STENCILOP_INVALID 
SDL_GPU_STENCILOP_KEEP 

Keeps the current value.

SDL_GPU_STENCILOP_ZERO 

Sets the value to 0.

SDL_GPU_STENCILOP_REPLACE 

Sets the value to reference.

SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP 

Increments the current value and clamps to the maximum value.

SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP 

Decrements the current value and clamps to 0.

SDL_GPU_STENCILOP_INVERT 

Bitwise-inverts the current value.

SDL_GPU_STENCILOP_INCREMENT_AND_WRAP 

Increments the current value and wraps back to 0.

SDL_GPU_STENCILOP_DECREMENT_AND_WRAP 

Decrements the current value and wraps to the maximum value.

Definition at line 938 of file SDL_gpu.h.

939{
941 SDL_GPU_STENCILOP_KEEP, /**< Keeps the current value. */
942 SDL_GPU_STENCILOP_ZERO, /**< Sets the value to 0. */
943 SDL_GPU_STENCILOP_REPLACE, /**< Sets the value to reference. */
944 SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP, /**< Increments the current value and clamps to the maximum value. */
945 SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP, /**< Decrements the current value and clamps to 0. */
946 SDL_GPU_STENCILOP_INVERT, /**< Bitwise-inverts the current value. */
947 SDL_GPU_STENCILOP_INCREMENT_AND_WRAP, /**< Increments the current value and wraps back to 0. */
948 SDL_GPU_STENCILOP_DECREMENT_AND_WRAP /**< Decrements the current value and wraps to the maximum value. */
SDL_GPUStencilOp
Definition SDL_gpu.h:939
@ SDL_GPU_STENCILOP_DECREMENT_AND_WRAP
Definition SDL_gpu.h:948
@ SDL_GPU_STENCILOP_ZERO
Definition SDL_gpu.h:942
@ SDL_GPU_STENCILOP_KEEP
Definition SDL_gpu.h:941
@ SDL_GPU_STENCILOP_INVERT
Definition SDL_gpu.h:946
@ SDL_GPU_STENCILOP_REPLACE
Definition SDL_gpu.h:943
@ SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP
Definition SDL_gpu.h:945
@ SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP
Definition SDL_gpu.h:944
@ SDL_GPU_STENCILOP_INCREMENT_AND_WRAP
Definition SDL_gpu.h:947
@ SDL_GPU_STENCILOP_INVALID
Definition SDL_gpu.h:940

◆ SDL_GPUStoreOp

Specifies how the contents of a texture attached to a render pass are treated at the end of the render pass.

Since
This enum is available since SDL 3.1.3
See also
SDL_BeginGPURenderPass
Enumerator
SDL_GPU_STOREOP_STORE 

The contents generated during the render pass will be written to memory.

SDL_GPU_STOREOP_DONT_CARE 

The contents generated during the render pass are not needed and may be discarded. The contents will be undefined.

SDL_GPU_STOREOP_RESOLVE 

The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture may then be discarded and will be undefined.

SDL_GPU_STOREOP_RESOLVE_AND_STORE 

The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture will be written to memory.

Definition at line 405 of file SDL_gpu.h.

406{
407 SDL_GPU_STOREOP_STORE, /**< The contents generated during the render pass will be written to memory. */
408 SDL_GPU_STOREOP_DONT_CARE, /**< The contents generated during the render pass are not needed and may be discarded. The contents will be undefined. */
409 SDL_GPU_STOREOP_RESOLVE, /**< The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture may then be discarded and will be undefined. */
410 SDL_GPU_STOREOP_RESOLVE_AND_STORE /**< The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture will be written to memory. */
SDL_GPUStoreOp
Definition SDL_gpu.h:406
@ SDL_GPU_STOREOP_RESOLVE_AND_STORE
Definition SDL_gpu.h:410
@ SDL_GPU_STOREOP_STORE
Definition SDL_gpu.h:407
@ SDL_GPU_STOREOP_DONT_CARE
Definition SDL_gpu.h:408
@ SDL_GPU_STOREOP_RESOLVE
Definition SDL_gpu.h:409

◆ SDL_GPUSwapchainComposition

Specifies the texture format and colorspace of the swapchain textures.

SDR will always be supported. Other compositions may not be supported on certain systems.

It is recommended to query SDL_WindowSupportsGPUSwapchainComposition after claiming the window if you wish to change the swapchain composition from SDR.

  • SDR: B8G8R8A8 or R8G8B8A8 swapchain. Pixel values are in nonlinear sRGB encoding.
  • SDR_LINEAR: B8G8R8A8_SRGB or R8G8B8A8_SRGB swapchain. Pixel values are in nonlinear sRGB encoding.
  • HDR_EXTENDED_LINEAR: R16G16B16A16_SFLOAT swapchain. Pixel values are in extended linear encoding.
  • HDR10_ST2048: A2R10G10B10 or A2B10G10R10 swapchain. Pixel values are in PQ ST2048 encoding.
Since
This enum is available since SDL 3.1.3
See also
SDL_SetGPUSwapchainParameters
SDL_WindowSupportsGPUSwapchainComposition
SDL_AcquireGPUSwapchainTexture
Enumerator
SDL_GPU_SWAPCHAINCOMPOSITION_SDR 
SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR 
SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR 
SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2048 

Definition at line 1119 of file SDL_gpu.h.

1120{
SDL_GPUSwapchainComposition
Definition SDL_gpu.h:1120
@ SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2048
Definition SDL_gpu.h:1124
@ SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR
Definition SDL_gpu.h:1122
@ SDL_GPU_SWAPCHAINCOMPOSITION_SDR
Definition SDL_gpu.h:1121
@ SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR
Definition SDL_gpu.h:1123

◆ SDL_GPUTextureFormat

Specifies the pixel format of a texture.

Texture format support varies depending on driver, hardware, and usage flags. In general, you should use SDL_GPUTextureSupportsFormat to query if a format is supported before using it. However, there are a few guaranteed formats.

FIXME: Check universal support for 32-bit component formats FIXME: Check universal support for SIMULTANEOUS_READ_WRITE

For SAMPLER usage, the following formats are universally supported:

  • R8G8B8A8_UNORM
  • B8G8R8A8_UNORM
  • R8_UNORM
  • R8_SNORM
  • R8G8_UNORM
  • R8G8_SNORM
  • R8G8B8A8_SNORM
  • R16_FLOAT
  • R16G16_FLOAT
  • R16G16B16A16_FLOAT
  • R32_FLOAT
  • R32G32_FLOAT
  • R32G32B32A32_FLOAT
  • R11G11B10_UFLOAT
  • R8G8B8A8_UNORM_SRGB
  • B8G8R8A8_UNORM_SRGB
  • D16_UNORM

For COLOR_TARGET usage, the following formats are universally supported:

  • R8G8B8A8_UNORM
  • B8G8R8A8_UNORM
  • R8_UNORM
  • R16_FLOAT
  • R16G16_FLOAT
  • R16G16B16A16_FLOAT
  • R32_FLOAT
  • R32G32_FLOAT
  • R32G32B32A32_FLOAT
  • R8_UINT
  • R8G8_UINT
  • R8G8B8A8_UINT
  • R16_UINT
  • R16G16_UINT
  • R16G16B16A16_UINT
  • R8_INT
  • R8G8_INT
  • R8G8B8A8_INT
  • R16_INT
  • R16G16_INT
  • R16G16B16A16_INT
  • R8G8B8A8_UNORM_SRGB
  • B8G8R8A8_UNORM_SRGB

For STORAGE usages, the following formats are universally supported:

  • R8G8B8A8_UNORM
  • R8G8B8A8_SNORM
  • R16G16B16A16_FLOAT
  • R32_FLOAT
  • R32G32_FLOAT
  • R32G32B32A32_FLOAT
  • R8G8B8A8_UINT
  • R16G16B16A16_UINT
  • R8G8B8A8_INT
  • R16G16B16A16_INT

For DEPTH_STENCIL_TARGET usage, the following formats are universally supported:

  • D16_UNORM
  • Either (but not necessarily both!) D24_UNORM or D32_SFLOAT
  • Either (but not necessarily both!) D24_UNORM_S8_UINT or D32_SFLOAT_S8_UINT

Unless D16_UNORM is sufficient for your purposes, always check which of D24/D32 is supported before creating a depth-stencil texture!

Since
This enum is available since SDL 3.1.3
See also
SDL_CreateGPUTexture
SDL_GPUTextureSupportsFormat
Enumerator
SDL_GPU_TEXTUREFORMAT_INVALID 
SDL_GPU_TEXTUREFORMAT_A8_UNORM 
SDL_GPU_TEXTUREFORMAT_R8_UNORM 
SDL_GPU_TEXTUREFORMAT_R8G8_UNORM 
SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM 
SDL_GPU_TEXTUREFORMAT_R16_UNORM 
SDL_GPU_TEXTUREFORMAT_R16G16_UNORM 
SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM 
SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM 
SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM 
SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM 
SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM 
SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM 
SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM 
SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM 
SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM 
SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM 
SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM 
SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM 
SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT 
SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT 
SDL_GPU_TEXTUREFORMAT_R8_SNORM 
SDL_GPU_TEXTUREFORMAT_R8G8_SNORM 
SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM 
SDL_GPU_TEXTUREFORMAT_R16_SNORM 
SDL_GPU_TEXTUREFORMAT_R16G16_SNORM 
SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM 
SDL_GPU_TEXTUREFORMAT_R16_FLOAT 
SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT 
SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT 
SDL_GPU_TEXTUREFORMAT_R32_FLOAT 
SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT 
SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT 
SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT 
SDL_GPU_TEXTUREFORMAT_R8_UINT 
SDL_GPU_TEXTUREFORMAT_R8G8_UINT 
SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT 
SDL_GPU_TEXTUREFORMAT_R16_UINT 
SDL_GPU_TEXTUREFORMAT_R16G16_UINT 
SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT 
SDL_GPU_TEXTUREFORMAT_R32_UINT 
SDL_GPU_TEXTUREFORMAT_R32G32_UINT 
SDL_GPU_TEXTUREFORMAT_R32G32B32A32_UINT 
SDL_GPU_TEXTUREFORMAT_R8_INT 
SDL_GPU_TEXTUREFORMAT_R8G8_INT 
SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT 
SDL_GPU_TEXTUREFORMAT_R16_INT 
SDL_GPU_TEXTUREFORMAT_R16G16_INT 
SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT 
SDL_GPU_TEXTUREFORMAT_R32_INT 
SDL_GPU_TEXTUREFORMAT_R32G32_INT 
SDL_GPU_TEXTUREFORMAT_R32G32B32A32_INT 
SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_D16_UNORM 
SDL_GPU_TEXTUREFORMAT_D24_UNORM 
SDL_GPU_TEXTUREFORMAT_D32_FLOAT 
SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT 
SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT 
SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM 
SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM 
SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM 
SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM 
SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM 
SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM 
SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM 
SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM 
SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM 
SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM 
SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM 
SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM 
SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM 
SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM 
SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB 
SDL_GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT 
SDL_GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT 
SDL_GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT 
SDL_GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT 
SDL_GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT 
SDL_GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT 
SDL_GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT 
SDL_GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT 
SDL_GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT 
SDL_GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT 
SDL_GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT 
SDL_GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT 
SDL_GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT 
SDL_GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT 

Definition at line 512 of file SDL_gpu.h.

513{
515
516 /* Unsigned Normalized Float Color Formats */
529 /* Compressed Unsigned Normalized Float Color Formats */
536 /* Compressed Signed Float Color Formats */
538 /* Compressed Unsigned Float Color Formats */
540 /* Signed Normalized Float Color Formats */
547 /* Signed Float Color Formats */
554 /* Unsigned Float Color Formats */
556 /* Unsigned Integer Color Formats */
566 /* Signed Integer Color Formats */
576 /* SRGB Unsigned Normalized Color Formats */
579 /* Compressed SRGB Unsigned Normalized Color Formats */
584 /* Depth Formats */
590 /* Compressed ASTC Normalized Float Color Formats*/
605 /* Compressed SRGB ASTC Normalized Float Color Formats*/
620 /* Compressed ASTC Signed Float Color Formats*/
SDL_GPUTextureFormat
Definition SDL_gpu.h:513
@ SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM
Definition SDL_gpu.h:528
@ SDL_GPU_TEXTUREFORMAT_D16_UNORM
Definition SDL_gpu.h:585
@ SDL_GPU_TEXTUREFORMAT_R16G16_INT
Definition SDL_gpu.h:571
@ SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT
Definition SDL_gpu.h:562
@ SDL_GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT
Definition SDL_gpu.h:630
@ SDL_GPU_TEXTUREFORMAT_R8_UINT
Definition SDL_gpu.h:557
@ SDL_GPU_TEXTUREFORMAT_R8G8_SNORM
Definition SDL_gpu.h:542
@ SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM
Definition SDL_gpu.h:523
@ SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM
Definition SDL_gpu.h:593
@ SDL_GPU_TEXTUREFORMAT_A8_UNORM
Definition SDL_gpu.h:517
@ SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT
Definition SDL_gpu.h:537
@ SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB
Definition SDL_gpu.h:610
@ SDL_GPU_TEXTUREFORMAT_R16_UINT
Definition SDL_gpu.h:560
@ SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM
Definition SDL_gpu.h:591
@ SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM
Definition SDL_gpu.h:546
@ SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM
Definition SDL_gpu.h:599
@ SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM
Definition SDL_gpu.h:534
@ SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM
Definition SDL_gpu.h:594
@ SDL_GPU_TEXTUREFORMAT_R32_INT
Definition SDL_gpu.h:573
@ SDL_GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT
Definition SDL_gpu.h:627
@ SDL_GPU_TEXTUREFORMAT_R16_INT
Definition SDL_gpu.h:570
@ SDL_GPU_TEXTUREFORMAT_R32G32B32A32_UINT
Definition SDL_gpu.h:565
@ SDL_GPU_TEXTUREFORMAT_R32G32_INT
Definition SDL_gpu.h:574
@ SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM
Definition SDL_gpu.h:533
@ SDL_GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT
Definition SDL_gpu.h:633
@ SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB
Definition SDL_gpu.h:614
@ SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT
Definition SDL_gpu.h:552
@ SDL_GPU_TEXTUREFORMAT_R32_UINT
Definition SDL_gpu.h:563
@ SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB
Definition SDL_gpu.h:609
@ SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB
Definition SDL_gpu.h:577
@ SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM
Definition SDL_gpu.h:543
@ SDL_GPU_TEXTUREFORMAT_R16_UNORM
Definition SDL_gpu.h:521
@ SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT
Definition SDL_gpu.h:589
@ SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT
Definition SDL_gpu.h:539
@ SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM
Definition SDL_gpu.h:535
@ SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM
Definition SDL_gpu.h:600
@ SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM
Definition SDL_gpu.h:531
@ SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT
Definition SDL_gpu.h:553
@ SDL_GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT
Definition SDL_gpu.h:625
@ SDL_GPU_TEXTUREFORMAT_R8_SNORM
Definition SDL_gpu.h:541
@ SDL_GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT
Definition SDL_gpu.h:628
@ SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB
Definition SDL_gpu.h:617
@ SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB
Definition SDL_gpu.h:580
@ SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB
Definition SDL_gpu.h:613
@ SDL_GPU_TEXTUREFORMAT_R8_UNORM
Definition SDL_gpu.h:518
@ SDL_GPU_TEXTUREFORMAT_D24_UNORM
Definition SDL_gpu.h:586
@ SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB
Definition SDL_gpu.h:581
@ SDL_GPU_TEXTUREFORMAT_INVALID
Definition SDL_gpu.h:514
@ SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB
Definition SDL_gpu.h:606
@ SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB
Definition SDL_gpu.h:608
@ SDL_GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT
Definition SDL_gpu.h:634
@ SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB
Definition SDL_gpu.h:607
@ SDL_GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT
Definition SDL_gpu.h:631
@ SDL_GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT
Definition SDL_gpu.h:622
@ SDL_GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT
Definition SDL_gpu.h:626
@ SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB
Definition SDL_gpu.h:612
@ SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM
Definition SDL_gpu.h:532
@ SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM
Definition SDL_gpu.h:602
@ SDL_GPU_TEXTUREFORMAT_R16G16_SNORM
Definition SDL_gpu.h:545
@ SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM
Definition SDL_gpu.h:597
@ SDL_GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT
Definition SDL_gpu.h:632
@ SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM
Definition SDL_gpu.h:527
@ SDL_GPU_TEXTUREFORMAT_R8G8_INT
Definition SDL_gpu.h:568
@ SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM
Definition SDL_gpu.h:592
@ SDL_GPU_TEXTUREFORMAT_D32_FLOAT
Definition SDL_gpu.h:587
@ SDL_GPU_TEXTUREFORMAT_R32G32B32A32_INT
Definition SDL_gpu.h:575
@ SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM
Definition SDL_gpu.h:603
@ SDL_GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT
Definition SDL_gpu.h:621
@ SDL_GPU_TEXTUREFORMAT_R8_INT
Definition SDL_gpu.h:567
@ SDL_GPU_TEXTUREFORMAT_R8G8_UINT
Definition SDL_gpu.h:558
@ SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT
Definition SDL_gpu.h:549
@ SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM
Definition SDL_gpu.h:601
@ SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM
Definition SDL_gpu.h:604
@ SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB
Definition SDL_gpu.h:618
@ SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB
Definition SDL_gpu.h:611
@ SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM
Definition SDL_gpu.h:526
@ SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB
Definition SDL_gpu.h:582
@ SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM
Definition SDL_gpu.h:530
@ SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB
Definition SDL_gpu.h:583
@ SDL_GPU_TEXTUREFORMAT_R32_FLOAT
Definition SDL_gpu.h:551
@ SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT
Definition SDL_gpu.h:588
@ SDL_GPU_TEXTUREFORMAT_R32G32_UINT
Definition SDL_gpu.h:564
@ SDL_GPU_TEXTUREFORMAT_R8G8_UNORM
Definition SDL_gpu.h:519
@ SDL_GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT
Definition SDL_gpu.h:623
@ SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB
Definition SDL_gpu.h:578
@ SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB
Definition SDL_gpu.h:616
@ SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM
Definition SDL_gpu.h:525
@ SDL_GPU_TEXTUREFORMAT_R16G16_UNORM
Definition SDL_gpu.h:522
@ SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM
Definition SDL_gpu.h:520
@ SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT
Definition SDL_gpu.h:555
@ SDL_GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT
Definition SDL_gpu.h:629
@ SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT
Definition SDL_gpu.h:572
@ SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM
Definition SDL_gpu.h:595
@ SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT
Definition SDL_gpu.h:559
@ SDL_GPU_TEXTUREFORMAT_R16G16_UINT
Definition SDL_gpu.h:561
@ SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT
Definition SDL_gpu.h:550
@ SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM
Definition SDL_gpu.h:598
@ SDL_GPU_TEXTUREFORMAT_R16_SNORM
Definition SDL_gpu.h:544
@ SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT
Definition SDL_gpu.h:569
@ SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM
Definition SDL_gpu.h:524
@ SDL_GPU_TEXTUREFORMAT_R16_FLOAT
Definition SDL_gpu.h:548
@ SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB
Definition SDL_gpu.h:615
@ SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB
Definition SDL_gpu.h:619
@ SDL_GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT
Definition SDL_gpu.h:624
@ SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM
Definition SDL_gpu.h:596

◆ SDL_GPUTextureType

Specifies the type of a texture.

Since
This enum is available since SDL 3.1.3
See also
SDL_CreateGPUTexture
Enumerator
SDL_GPU_TEXTURETYPE_2D 

The texture is a 2-dimensional image.

SDL_GPU_TEXTURETYPE_2D_ARRAY 

The texture is a 2-dimensional array image.

SDL_GPU_TEXTURETYPE_3D 

The texture is a 3-dimensional image.

SDL_GPU_TEXTURETYPE_CUBE 

The texture is a cube image.

SDL_GPU_TEXTURETYPE_CUBE_ARRAY 

The texture is a cube array image.

Definition at line 674 of file SDL_gpu.h.

675{
676 SDL_GPU_TEXTURETYPE_2D, /**< The texture is a 2-dimensional image. */
677 SDL_GPU_TEXTURETYPE_2D_ARRAY, /**< The texture is a 2-dimensional array image. */
678 SDL_GPU_TEXTURETYPE_3D, /**< The texture is a 3-dimensional image. */
679 SDL_GPU_TEXTURETYPE_CUBE, /**< The texture is a cube image. */
680 SDL_GPU_TEXTURETYPE_CUBE_ARRAY /**< The texture is a cube array image. */
SDL_GPUTextureType
Definition SDL_gpu.h:675
@ SDL_GPU_TEXTURETYPE_CUBE_ARRAY
Definition SDL_gpu.h:680
@ SDL_GPU_TEXTURETYPE_3D
Definition SDL_gpu.h:678
@ SDL_GPU_TEXTURETYPE_CUBE
Definition SDL_gpu.h:679
@ SDL_GPU_TEXTURETYPE_2D
Definition SDL_gpu.h:676
@ SDL_GPU_TEXTURETYPE_2D_ARRAY
Definition SDL_gpu.h:677

◆ SDL_GPUTransferBufferUsage

Specifies how a transfer buffer is intended to be used by the client.

Note that mapping and copying FROM an upload transfer buffer or TO a download transfer buffer is undefined behavior.

Since
This enum is available since SDL 3.1.3
See also
SDL_CreateGPUTransferBuffer
Enumerator
SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD 
SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD 

Definition at line 752 of file SDL_gpu.h.

753{
SDL_GPUTransferBufferUsage
Definition SDL_gpu.h:753
@ SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD
Definition SDL_gpu.h:755
@ SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD
Definition SDL_gpu.h:754

◆ SDL_GPUVertexElementFormat

Specifies the format of a vertex attribute.

Since
This enum is available since SDL 3.1.3
See also
SDL_CreateGPUGraphicsPipeline
Enumerator
SDL_GPU_VERTEXELEMENTFORMAT_INVALID 
SDL_GPU_VERTEXELEMENTFORMAT_INT 
SDL_GPU_VERTEXELEMENTFORMAT_INT2 
SDL_GPU_VERTEXELEMENTFORMAT_INT3 
SDL_GPU_VERTEXELEMENTFORMAT_INT4 
SDL_GPU_VERTEXELEMENTFORMAT_UINT 
SDL_GPU_VERTEXELEMENTFORMAT_UINT2 
SDL_GPU_VERTEXELEMENTFORMAT_UINT3 
SDL_GPU_VERTEXELEMENTFORMAT_UINT4 
SDL_GPU_VERTEXELEMENTFORMAT_FLOAT 
SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2 
SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3 
SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4 
SDL_GPU_VERTEXELEMENTFORMAT_BYTE2 
SDL_GPU_VERTEXELEMENTFORMAT_BYTE4 
SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2 
SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4 
SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM 
SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM 
SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM 
SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM 
SDL_GPU_VERTEXELEMENTFORMAT_SHORT2 
SDL_GPU_VERTEXELEMENTFORMAT_SHORT4 
SDL_GPU_VERTEXELEMENTFORMAT_USHORT2 
SDL_GPU_VERTEXELEMENTFORMAT_USHORT4 
SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM 
SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM 
SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM 
SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM 
SDL_GPU_VERTEXELEMENTFORMAT_HALF2 
SDL_GPU_VERTEXELEMENTFORMAT_HALF4 

Definition at line 797 of file SDL_gpu.h.

798{
800
801 /* 32-bit Signed Integers */
806
807 /* 32-bit Unsigned Integers */
812
813 /* 32-bit Floats */
818
819 /* 8-bit Signed Integers */
822
823 /* 8-bit Unsigned Integers */
826
827 /* 8-bit Signed Normalized */
830
831 /* 8-bit Unsigned Normalized */
834
835 /* 16-bit Signed Integers */
838
839 /* 16-bit Unsigned Integers */
842
843 /* 16-bit Signed Normalized */
846
847 /* 16-bit Unsigned Normalized */
850
851 /* 16-bit Floats */
SDL_GPUVertexElementFormat
Definition SDL_gpu.h:798
@ SDL_GPU_VERTEXELEMENTFORMAT_INT4
Definition SDL_gpu.h:805
@ SDL_GPU_VERTEXELEMENTFORMAT_INT
Definition SDL_gpu.h:802
@ SDL_GPU_VERTEXELEMENTFORMAT_INVALID
Definition SDL_gpu.h:799
@ SDL_GPU_VERTEXELEMENTFORMAT_HALF2
Definition SDL_gpu.h:852
@ SDL_GPU_VERTEXELEMENTFORMAT_BYTE2
Definition SDL_gpu.h:820
@ SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4
Definition SDL_gpu.h:825
@ SDL_GPU_VERTEXELEMENTFORMAT_USHORT4
Definition SDL_gpu.h:841
@ SDL_GPU_VERTEXELEMENTFORMAT_INT2
Definition SDL_gpu.h:803
@ SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM
Definition SDL_gpu.h:828
@ SDL_GPU_VERTEXELEMENTFORMAT_UINT2
Definition SDL_gpu.h:809
@ SDL_GPU_VERTEXELEMENTFORMAT_BYTE4
Definition SDL_gpu.h:821
@ SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM
Definition SDL_gpu.h:844
@ SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4
Definition SDL_gpu.h:817
@ SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM
Definition SDL_gpu.h:832
@ SDL_GPU_VERTEXELEMENTFORMAT_UINT3
Definition SDL_gpu.h:810
@ SDL_GPU_VERTEXELEMENTFORMAT_UINT
Definition SDL_gpu.h:808
@ SDL_GPU_VERTEXELEMENTFORMAT_UINT4
Definition SDL_gpu.h:811
@ SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM
Definition SDL_gpu.h:848
@ SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3
Definition SDL_gpu.h:816
@ SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2
Definition SDL_gpu.h:824
@ SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2
Definition SDL_gpu.h:815
@ SDL_GPU_VERTEXELEMENTFORMAT_SHORT4
Definition SDL_gpu.h:837
@ SDL_GPU_VERTEXELEMENTFORMAT_FLOAT
Definition SDL_gpu.h:814
@ SDL_GPU_VERTEXELEMENTFORMAT_SHORT2
Definition SDL_gpu.h:836
@ SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM
Definition SDL_gpu.h:829
@ SDL_GPU_VERTEXELEMENTFORMAT_HALF4
Definition SDL_gpu.h:853
@ SDL_GPU_VERTEXELEMENTFORMAT_USHORT2
Definition SDL_gpu.h:840
@ SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM
Definition SDL_gpu.h:833
@ SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM
Definition SDL_gpu.h:845
@ SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM
Definition SDL_gpu.h:849
@ SDL_GPU_VERTEXELEMENTFORMAT_INT3
Definition SDL_gpu.h:804

◆ SDL_GPUVertexInputRate

Specifies the rate at which vertex attributes are pulled from buffers.

Since
This enum is available since SDL 3.1.3
See also
SDL_CreateGPUGraphicsPipeline
Enumerator
SDL_GPU_VERTEXINPUTRATE_VERTEX 

Attribute addressing is a function of the vertex index.

SDL_GPU_VERTEXINPUTRATE_INSTANCE 

Attribute addressing is a function of the instance index.

Definition at line 863 of file SDL_gpu.h.

864{
865 SDL_GPU_VERTEXINPUTRATE_VERTEX, /**< Attribute addressing is a function of the vertex index. */
866 SDL_GPU_VERTEXINPUTRATE_INSTANCE /**< Attribute addressing is a function of the instance index. */
SDL_GPUVertexInputRate
Definition SDL_gpu.h:864
@ SDL_GPU_VERTEXINPUTRATE_INSTANCE
Definition SDL_gpu.h:866
@ SDL_GPU_VERTEXINPUTRATE_VERTEX
Definition SDL_gpu.h:865

Function Documentation

◆ SDL_AcquireGPUCommandBuffer()

SDL_GPUCommandBuffer * SDL_AcquireGPUCommandBuffer ( SDL_GPUDevice device)
extern

Acquire a command buffer.

This command buffer is managed by the implementation and should not be freed by the user. The command buffer may only be used on the thread it was acquired on. The command buffer should be submitted on the thread it was acquired on.

Parameters
devicea GPU context.
Returns
a command buffer, or NULL on failure; call SDL_GetError() for more information.
Since
This function is available since SDL 3.1.3.
See also
SDL_SubmitGPUCommandBuffer
SDL_SubmitGPUCommandBufferAndAcquireFence

◆ SDL_AcquireGPUSwapchainTexture()

bool SDL_AcquireGPUSwapchainTexture ( SDL_GPUCommandBuffer command_buffer,
SDL_Window window,
SDL_GPUTexture **  swapchain_texture,
Uint32 swapchain_texture_width,
Uint32 swapchain_texture_height 
)
extern

Acquire a texture to use in presentation.

When a swapchain texture is acquired on a command buffer, it will automatically be submitted for presentation when the command buffer is submitted. The swapchain texture should only be referenced by the command buffer used to acquire it. The swapchain texture handle can be filled in with NULL under certain conditions. This is not necessarily an error. If this function returns false then there is an error.

The swapchain texture is managed by the implementation and must not be freed by the user. You MUST NOT call this function from any thread other than the one that created the window.

Parameters
command_buffera command buffer.
windowa window that has been claimed.
swapchain_texturea pointer filled in with a swapchain texture handle.
swapchain_texture_widtha pointer filled in with the swapchain texture width, may be NULL.
swapchain_texture_heighta pointer filled in with the swapchain texture height, may be NULL.
Returns
true on success, false on error; call SDL_GetError() for more information.
Since
This function is available since SDL 3.1.3.
See also
SDL_ClaimWindowForGPUDevice
SDL_SubmitGPUCommandBuffer
SDL_SubmitGPUCommandBufferAndAcquireFence
SDL_GetWindowSizeInPixels

◆ SDL_BeginGPUComputePass()

SDL_GPUComputePass * SDL_BeginGPUComputePass ( SDL_GPUCommandBuffer command_buffer,
const SDL_GPUStorageTextureReadWriteBinding storage_texture_bindings,
Uint32  num_storage_texture_bindings,
const SDL_GPUStorageBufferReadWriteBinding storage_buffer_bindings,
Uint32  num_storage_buffer_bindings 
)
extern

Begins a compute pass on a command buffer.

A compute pass is defined by a set of texture subresources and buffers that may be written to by compute pipelines. These textures and buffers must have been created with the COMPUTE_STORAGE_WRITE bit or the COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE bit. If you do not create a texture with COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE, you must not read from the texture in the compute pass. All operations related to compute pipelines must take place inside of a compute pass. You must not begin another compute pass, or a render pass or copy pass before ending the compute pass.

A VERY IMPORTANT NOTE - Reads and writes in compute passes are NOT implicitly synchronized. This means you may cause data races by both reading and writing a resource region in a compute pass, or by writing multiple times to a resource region. If your compute work depends on reading the completed output from a previous dispatch, you MUST end the current compute pass and begin a new one before you can safely access the data. Otherwise you will receive unexpected results. Reading and writing a texture in the same compute pass is only supported by specific texture formats. Make sure you check the format support!

Parameters
command_buffera command buffer.
storage_texture_bindingsan array of writeable storage texture binding structs.
num_storage_texture_bindingsthe number of storage textures to bind from the array.
storage_buffer_bindingsan array of writeable storage buffer binding structs.
num_storage_buffer_bindingsthe number of storage buffers to bind from the array.
Returns
a compute pass handle.
Since
This function is available since SDL 3.1.3.
See also
SDL_EndGPUComputePass

◆ SDL_BeginGPUCopyPass()

SDL_GPUCopyPass * SDL_BeginGPUCopyPass ( SDL_GPUCommandBuffer command_buffer)
extern

Begins a copy pass on a command buffer.

All operations related to copying to or from buffers or textures take place inside a copy pass. You must not begin another copy pass, or a render pass or compute pass before ending the copy pass.

Parameters
command_buffera command buffer.
Returns
a copy pass handle.
Since
This function is available since SDL 3.1.3.

◆ SDL_BeginGPURenderPass()

SDL_GPURenderPass * SDL_BeginGPURenderPass ( SDL_GPUCommandBuffer command_buffer,
const SDL_GPUColorTargetInfo color_target_infos,
Uint32  num_color_targets,
const SDL_GPUDepthStencilTargetInfo depth_stencil_target_info 
)
extern

Begins a render pass on a command buffer.

A render pass consists of a set of texture subresources (or depth slices in the 3D texture case) which will be rendered to during the render pass, along with corresponding clear values and load/store operations. All operations related to graphics pipelines must take place inside of a render pass. A default viewport and scissor state are automatically set when this is called. You cannot begin another render pass, or begin a compute pass or copy pass until you have ended the render pass.

Parameters
command_buffera command buffer.
color_target_infosan array of texture subresources with corresponding clear values and load/store ops.
num_color_targetsthe number of color targets in the color_target_infos array.
depth_stencil_target_infoa texture subresource with corresponding clear value and load/store ops, may be NULL.
Returns
a render pass handle.
Since
This function is available since SDL 3.1.3.
See also
SDL_EndGPURenderPass

◆ SDL_BindGPUComputePipeline()

void SDL_BindGPUComputePipeline ( SDL_GPUComputePass compute_pass,
SDL_GPUComputePipeline compute_pipeline 
)
extern

Binds a compute pipeline on a command buffer for use in compute dispatch.

Parameters
compute_passa compute pass handle.
compute_pipelinea compute pipeline to bind.
Since
This function is available since SDL 3.1.3.

◆ SDL_BindGPUComputeSamplers()

void SDL_BindGPUComputeSamplers ( SDL_GPUComputePass compute_pass,
Uint32  first_slot,
const SDL_GPUTextureSamplerBinding texture_sampler_bindings,
Uint32  num_bindings 
)
extern

Binds texture-sampler pairs for use on the compute shader.

The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER.

Parameters
compute_passa compute pass handle.
first_slotthe compute sampler slot to begin binding from.
texture_sampler_bindingsan array of texture-sampler binding structs.
num_bindingsthe number of texture-sampler bindings to bind from the array.
Since
This function is available since SDL 3.1.3.

◆ SDL_BindGPUComputeStorageBuffers()

void SDL_BindGPUComputeStorageBuffers ( SDL_GPUComputePass compute_pass,
Uint32  first_slot,
SDL_GPUBuffer *const *  storage_buffers,
Uint32  num_bindings 
)
extern

Binds storage buffers as readonly for use on the compute pipeline.

These buffers must have been created with SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ.

Parameters
compute_passa compute pass handle.
first_slotthe compute storage buffer slot to begin binding from.
storage_buffersan array of storage buffer binding structs.
num_bindingsthe number of storage buffers to bind from the array.
Since
This function is available since SDL 3.1.3.

◆ SDL_BindGPUComputeStorageTextures()

void SDL_BindGPUComputeStorageTextures ( SDL_GPUComputePass compute_pass,
Uint32  first_slot,
SDL_GPUTexture *const *  storage_textures,
Uint32  num_bindings 
)
extern

Binds storage textures as readonly for use on the compute pipeline.

These textures must have been created with SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ.

Parameters
compute_passa compute pass handle.
first_slotthe compute storage texture slot to begin binding from.
storage_texturesan array of storage textures.
num_bindingsthe number of storage textures to bind from the array.
Since
This function is available since SDL 3.1.3.

◆ SDL_BindGPUFragmentSamplers()

void SDL_BindGPUFragmentSamplers ( SDL_GPURenderPass render_pass,
Uint32  first_slot,
const SDL_GPUTextureSamplerBinding texture_sampler_bindings,
Uint32  num_bindings 
)
extern

Binds texture-sampler pairs for use on the fragment shader.

The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER.

Parameters
render_passa render pass handle.
first_slotthe fragment sampler slot to begin binding from.
texture_sampler_bindingsan array of texture-sampler binding structs.
num_bindingsthe number of texture-sampler pairs to bind from the array.
Since
This function is available since SDL 3.1.3.

◆ SDL_BindGPUFragmentStorageBuffers()

void SDL_BindGPUFragmentStorageBuffers ( SDL_GPURenderPass render_pass,
Uint32  first_slot,
SDL_GPUBuffer *const *  storage_buffers,
Uint32  num_bindings 
)
extern

Binds storage buffers for use on the fragment shader.

These buffers must have been created with SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ.

Parameters
render_passa render pass handle.
first_slotthe fragment storage buffer slot to begin binding from.
storage_buffersan array of storage buffers.
num_bindingsthe number of storage buffers to bind from the array.
Since
This function is available since SDL 3.1.3.

◆ SDL_BindGPUFragmentStorageTextures()

void SDL_BindGPUFragmentStorageTextures ( SDL_GPURenderPass render_pass,
Uint32  first_slot,
SDL_GPUTexture *const *  storage_textures,
Uint32  num_bindings 
)
extern

Binds storage textures for use on the fragment shader.

These textures must have been created with SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ.

Parameters
render_passa render pass handle.
first_slotthe fragment storage texture slot to begin binding from.
storage_texturesan array of storage textures.
num_bindingsthe number of storage textures to bind from the array.
Since
This function is available since SDL 3.1.3.

◆ SDL_BindGPUGraphicsPipeline()

void SDL_BindGPUGraphicsPipeline ( SDL_GPURenderPass render_pass,
SDL_GPUGraphicsPipeline graphics_pipeline 
)
extern

Binds a graphics pipeline on a render pass to be used in rendering.

A graphics pipeline must be bound before making any draw calls.

Parameters
render_passa render pass handle.
graphics_pipelinethe graphics pipeline to bind.
Since
This function is available since SDL 3.1.3.

◆ SDL_BindGPUIndexBuffer()

void SDL_BindGPUIndexBuffer ( SDL_GPURenderPass render_pass,
const SDL_GPUBufferBinding binding,
SDL_GPUIndexElementSize  index_element_size 
)
extern

Binds an index buffer on a command buffer for use with subsequent draw calls.

Parameters
render_passa render pass handle.
bindinga pointer to a struct containing an index buffer and offset.
index_element_sizewhether the index values in the buffer are 16- or 32-bit.
Since
This function is available since SDL 3.1.3.

◆ SDL_BindGPUVertexBuffers()

void SDL_BindGPUVertexBuffers ( SDL_GPURenderPass render_pass,
Uint32  first_slot,
const SDL_GPUBufferBinding bindings,
Uint32  num_bindings 
)
extern

Binds vertex buffers on a command buffer for use with subsequent draw calls.

Parameters
render_passa render pass handle.
first_slotthe vertex buffer slot to begin binding from.
bindingsan array of SDL_GPUBufferBinding structs containing vertex buffers and offset values.
num_bindingsthe number of bindings in the bindings array.
Since
This function is available since SDL 3.1.3.

◆ SDL_BindGPUVertexSamplers()

void SDL_BindGPUVertexSamplers ( SDL_GPURenderPass render_pass,
Uint32  first_slot,
const SDL_GPUTextureSamplerBinding texture_sampler_bindings,
Uint32  num_bindings 
)
extern

Binds texture-sampler pairs for use on the vertex shader.

The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER.

Parameters
render_passa render pass handle.
first_slotthe vertex sampler slot to begin binding from.
texture_sampler_bindingsan array of texture-sampler binding structs.
num_bindingsthe number of texture-sampler pairs to bind from the array.
Since
This function is available since SDL 3.1.3.

◆ SDL_BindGPUVertexStorageBuffers()

void SDL_BindGPUVertexStorageBuffers ( SDL_GPURenderPass render_pass,
Uint32  first_slot,
SDL_GPUBuffer *const *  storage_buffers,
Uint32  num_bindings 
)
extern

Binds storage buffers for use on the vertex shader.

These buffers must have been created with SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ.

Parameters
render_passa render pass handle.
first_slotthe vertex storage buffer slot to begin binding from.
storage_buffersan array of buffers.
num_bindingsthe number of buffers to bind from the array.
Since
This function is available since SDL 3.1.3.

◆ SDL_BindGPUVertexStorageTextures()

void SDL_BindGPUVertexStorageTextures ( SDL_GPURenderPass render_pass,
Uint32  first_slot,
SDL_GPUTexture *const *  storage_textures,
Uint32  num_bindings 
)
extern

Binds storage textures for use on the vertex shader.

These textures must have been created with SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ.

Parameters
render_passa render pass handle.
first_slotthe vertex storage texture slot to begin binding from.
storage_texturesan array of storage textures.
num_bindingsthe number of storage texture to bind from the array.
Since
This function is available since SDL 3.1.3.

◆ SDL_BlitGPUTexture()

void SDL_BlitGPUTexture ( SDL_GPUCommandBuffer command_buffer,
const SDL_GPUBlitInfo info 
)
extern

Blits from a source texture region to a destination texture region.

This function must not be called inside of any pass.

Parameters
command_buffera command buffer.
infothe blit info struct containing the blit parameters.
Since
This function is available since SDL 3.1.3.

◆ SDL_CalculateGPUTextureFormatSize()

Uint32 SDL_CalculateGPUTextureFormatSize ( SDL_GPUTextureFormat  format,
Uint32  width,
Uint32  height,
Uint32  depth_or_layer_count 
)
extern

Calculate the size in bytes of a texture format with dimensions.

Parameters
formata texture format.
widthwidth in pixels.
heightheight in pixels.
depth_or_layer_countdepth for 3D textures or layer count otherwise.
Returns
the size of a texture with this format and dimensions.
Since
This function is available since SDL 3.2.0.

◆ SDL_ClaimWindowForGPUDevice()

bool SDL_ClaimWindowForGPUDevice ( SDL_GPUDevice device,
SDL_Window window 
)
extern

Claims a window, creating a swapchain structure for it.

This must be called before SDL_AcquireGPUSwapchainTexture is called using the window. You should only call this function from the thread that created the window.

The swapchain will be created with SDL_GPU_SWAPCHAINCOMPOSITION_SDR and SDL_GPU_PRESENTMODE_VSYNC. If you want to have different swapchain parameters, you must call SDL_SetGPUSwapchainParameters after claiming the window.

Parameters
devicea GPU context.
windowan SDL_Window.
Returns
true on success, or false on failure; call SDL_GetError() for more information.
Since
This function is available since SDL 3.1.3.
See also
SDL_AcquireGPUSwapchainTexture
SDL_ReleaseWindowFromGPUDevice
SDL_WindowSupportsGPUPresentMode
SDL_WindowSupportsGPUSwapchainComposition

◆ SDL_CopyGPUBufferToBuffer()

void SDL_CopyGPUBufferToBuffer ( SDL_GPUCopyPass copy_pass,
const SDL_GPUBufferLocation source,
const SDL_GPUBufferLocation destination,
Uint32  size,
bool  cycle 
)
extern

Performs a buffer-to-buffer copy.

This copy occurs on the GPU timeline. You may assume the copy has finished in subsequent commands.

Parameters
copy_passa copy pass handle.
sourcethe buffer and offset to copy from.
destinationthe buffer and offset to copy to.
sizethe length of the buffer to copy.
cycleif true, cycles the destination buffer if it is already bound, otherwise overwrites the data.
Since
This function is available since SDL 3.1.3.

◆ SDL_CopyGPUTextureToTexture()

void SDL_CopyGPUTextureToTexture ( SDL_GPUCopyPass copy_pass,
const SDL_GPUTextureLocation source,
const SDL_GPUTextureLocation destination,
Uint32  w,
Uint32  h,
Uint32  d,
bool  cycle 
)
extern

Performs a texture-to-texture copy.

This copy occurs on the GPU timeline. You may assume the copy has finished in subsequent commands.

Parameters
copy_passa copy pass handle.
sourcea source texture region.
destinationa destination texture region.
wthe width of the region to copy.
hthe height of the region to copy.
dthe depth of the region to copy.
cycleif true, cycles the destination texture if the destination texture is bound, otherwise overwrites the data.
Since
This function is available since SDL 3.1.3.

◆ SDL_CreateGPUBuffer()

SDL_GPUBuffer * SDL_CreateGPUBuffer ( SDL_GPUDevice device,
const SDL_GPUBufferCreateInfo createinfo 
)
extern

Creates a buffer object to be used in graphics or compute workflows.

The contents of this buffer are undefined until data is written to the buffer.

Note that certain combinations of usage flags are invalid. For example, a buffer cannot have both the VERTEX and INDEX flags.

Parameters
devicea GPU Context.
createinfoa struct describing the state of the buffer to create.
Returns
a buffer object on success, or NULL on failure; call SDL_GetError() for more information.
Since
This function is available since SDL 3.1.3.
See also
SDL_SetGPUBufferName
SDL_UploadToGPUBuffer
SDL_DownloadFromGPUBuffer
SDL_CopyGPUBufferToBuffer
SDL_BindGPUVertexBuffers
SDL_BindGPUIndexBuffer
SDL_BindGPUVertexStorageBuffers
SDL_BindGPUFragmentStorageBuffers
SDL_DrawGPUPrimitivesIndirect
SDL_DrawGPUIndexedPrimitivesIndirect
SDL_BindGPUComputeStorageBuffers
SDL_DispatchGPUComputeIndirect
SDL_ReleaseGPUBuffer

◆ SDL_CreateGPUComputePipeline()

SDL_GPUComputePipeline * SDL_CreateGPUComputePipeline ( SDL_GPUDevice device,
const SDL_GPUComputePipelineCreateInfo createinfo 
)
extern

Creates a pipeline object to be used in a compute workflow.

Shader resource bindings must be authored to follow a particular order depending on the shader format.

For SPIR-V shaders, use the following resource sets:

  • 0: Sampled textures, followed by read-only storage textures, followed by read-only storage buffers
  • 1: Write-only storage textures, followed by write-only storage buffers
  • 2: Uniform buffers

For DXBC Shader Model 5_0 shaders, use the following register order:

  • t registers: Sampled textures, followed by read-only storage textures, followed by read-only storage buffers
  • u registers: Write-only storage textures, followed by write-only storage buffers
  • b registers: Uniform buffers

For DXIL shaders, use the following register order:

  • (t[n], space0): Sampled textures, followed by read-only storage textures, followed by read-only storage buffers
  • (u[n], space1): Write-only storage textures, followed by write-only storage buffers
  • (b[n], space2): Uniform buffers

For MSL/metallib, use the following order:

  • [[buffer]]: Uniform buffers, followed by write-only storage buffers, followed by write-only storage buffers
  • [[texture]]: Sampled textures, followed by read-only storage textures, followed by write-only storage textures
Parameters
devicea GPU Context.
createinfoa struct describing the state of the compute pipeline to create.
Returns
a compute pipeline object on success, or NULL on failure; call SDL_GetError() for more information.
Since
This function is available since SDL 3.1.3.
See also
SDL_BindGPUComputePipeline
SDL_ReleaseGPUComputePipeline

◆ SDL_CreateGPUDevice()

SDL_GPUDevice * SDL_CreateGPUDevice ( SDL_GPUShaderFormat  format_flags,
bool  debug_mode,
const char *  name 
)
extern

Creates a GPU context.

Parameters
format_flagsa bitflag indicating which shader formats the app is able to provide.
debug_modeenable debug mode properties and validations.
namethe preferred GPU driver, or NULL to let SDL pick the optimal driver.
Returns
a GPU context on success or NULL on failure; call SDL_GetError() for more information.
Since
This function is available since SDL 3.1.3.
See also
SDL_GetGPUShaderFormats
SDL_GetGPUDeviceDriver
SDL_DestroyGPUDevice
SDL_GPUSupportsShaderFormats

◆ SDL_CreateGPUDeviceWithProperties()

SDL_GPUDevice * SDL_CreateGPUDeviceWithProperties ( SDL_PropertiesID  props)
extern

Creates a GPU context.

These are the supported properties:

  • SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN: enable debug mode properties and validations, defaults to true.
  • SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN: enable to prefer energy efficiency over maximum GPU performance, defaults to false.
  • SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING: the name of the GPU driver to use, if a specific one is desired.

These are the current shader format properties:

  • SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN: The app is able to provide shaders for an NDA platform.
  • SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN: The app is able to provide SPIR-V shaders if applicable.
  • SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN: The app is able to provide DXBC shaders if applicable SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN: The app is able to provide DXIL shaders if applicable.
  • SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN: The app is able to provide MSL shaders if applicable.
  • SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN: The app is able to provide Metal shader libraries if applicable.

With the D3D12 renderer:

  • SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING: the prefix to use for all vertex semantics, default is "TEXCOORD".
Parameters
propsthe properties to use.
Returns
a GPU context on success or NULL on failure; call SDL_GetError() for more information.
Since
This function is available since SDL 3.1.3.
See also
SDL_GetGPUShaderFormats
SDL_GetGPUDeviceDriver
SDL_DestroyGPUDevice
SDL_GPUSupportsProperties

◆ SDL_CreateGPUGraphicsPipeline()

SDL_GPUGraphicsPipeline * SDL_CreateGPUGraphicsPipeline ( SDL_GPUDevice device,
const SDL_GPUGraphicsPipelineCreateInfo createinfo 
)
extern

Creates a pipeline object to be used in a graphics workflow.

Parameters
devicea GPU Context.
createinfoa struct describing the state of the graphics pipeline to create.
Returns
a graphics pipeline object on success, or NULL on failure; call SDL_GetError() for more information.
Since
This function is available since SDL 3.1.3.
See also
SDL_CreateGPUShader
SDL_BindGPUGraphicsPipeline
SDL_ReleaseGPUGraphicsPipeline

◆ SDL_CreateGPUSampler()

SDL_GPUSampler * SDL_CreateGPUSampler ( SDL_GPUDevice device,
const SDL_GPUSamplerCreateInfo createinfo 
)
extern

Creates a sampler object to be used when binding textures in a graphics workflow.

Parameters
devicea GPU Context.
createinfoa struct describing the state of the sampler to create.
Returns
a sampler object on success, or NULL on failure; call SDL_GetError() for more information.
Since
This function is available since SDL 3.1.3.
See also
SDL_BindGPUVertexSamplers
SDL_BindGPUFragmentSamplers
SDL_ReleaseSampler

◆ SDL_CreateGPUShader()

SDL_GPUShader * SDL_CreateGPUShader ( SDL_GPUDevice device,
const SDL_GPUShaderCreateInfo createinfo 
)
extern

Creates a shader to be used when creating a graphics pipeline.

Shader resource bindings must be authored to follow a particular order depending on the shader format.

For SPIR-V shaders, use the following resource sets:

For vertex shaders:

  • 0: Sampled textures, followed by storage textures, followed by storage buffers
  • 1: Uniform buffers

For fragment shaders:

  • 2: Sampled textures, followed by storage textures, followed by storage buffers
  • 3: Uniform buffers

For DXBC Shader Model 5_0 shaders, use the following register order:

  • t registers: Sampled textures, followed by storage textures, followed by storage buffers
  • s registers: Samplers with indices corresponding to the sampled textures
  • b registers: Uniform buffers

For DXIL shaders, use the following register order:

For vertex shaders:

  • (t[n], space0): Sampled textures, followed by storage textures, followed by storage buffers
  • (s[n], space0): Samplers with indices corresponding to the sampled textures
  • (b[n], space1): Uniform buffers

For pixel shaders:

  • (t[n], space2): Sampled textures, followed by storage textures, followed by storage buffers
  • (s[n], space2): Samplers with indices corresponding to the sampled textures
  • (b[n], space3): Uniform buffers

For MSL/metallib, use the following order:

  • [[texture]]: Sampled textures, followed by storage textures
  • [[sampler]]: Samplers with indices corresponding to the sampled textures
  • [[buffer]]: Uniform buffers, followed by storage buffers. Vertex buffer 0 is bound at [[buffer(14)]], vertex buffer 1 at [[buffer(15)]], and so on. Rather than manually authoring vertex buffer indices, use the [[stage_in]] attribute which will automatically use the vertex input information from the SDL_GPUPipeline.
Parameters
devicea GPU Context.
createinfoa struct describing the state of the shader to create.
Returns
a shader object on success, or NULL on failure; call SDL_GetError() for more information.
Since
This function is available since SDL 3.1.3.
See also
SDL_CreateGPUGraphicsPipeline
SDL_ReleaseGPUShader

◆ SDL_CreateGPUTexture()

SDL_GPUTexture * SDL_CreateGPUTexture ( SDL_GPUDevice device,
const SDL_GPUTextureCreateInfo createinfo 
)
extern

Creates a texture object to be used in graphics or compute workflows.

The contents of this texture are undefined until data is written to the texture.

Note that certain combinations of usage flags are invalid. For example, a texture cannot have both the SAMPLER and GRAPHICS_STORAGE_READ flags.

If you request a sample count higher than the hardware supports, the implementation will automatically fall back to the highest available sample count.

Parameters
devicea GPU Context.
createinfoa struct describing the state of the texture to create.
Returns
a texture object on success, or NULL on failure; call SDL_GetError() for more information.
Since
This function is available since SDL 3.1.3.
See also
SDL_UploadToGPUTexture
SDL_DownloadFromGPUTexture
SDL_BindGPUVertexSamplers
SDL_BindGPUVertexStorageTextures
SDL_BindGPUFragmentSamplers
SDL_BindGPUFragmentStorageTextures
SDL_BindGPUComputeStorageTextures
SDL_BlitGPUTexture
SDL_ReleaseGPUTexture
SDL_GPUTextureSupportsFormat

◆ SDL_CreateGPUTransferBuffer()

SDL_GPUTransferBuffer * SDL_CreateGPUTransferBuffer ( SDL_GPUDevice device,
const SDL_GPUTransferBufferCreateInfo createinfo 
)
extern

Creates a transfer buffer to be used when uploading to or downloading from graphics resources.

Download buffers can be particularly expensive to create, so it is good practice to reuse them if data will be downloaded regularly.

Parameters
devicea GPU Context.
createinfoa struct describing the state of the transfer buffer to create.
Returns
a transfer buffer on success, or NULL on failure; call SDL_GetError() for more information.
Since
This function is available since SDL 3.1.3.
See also
SDL_UploadToGPUBuffer
SDL_DownloadFromGPUBuffer
SDL_UploadToGPUTexture
SDL_DownloadFromGPUTexture
SDL_ReleaseGPUTransferBuffer

◆ SDL_DestroyGPUDevice()

void SDL_DestroyGPUDevice ( SDL_GPUDevice device)
extern

Destroys a GPU context previously returned by SDL_CreateGPUDevice.

Parameters
devicea GPU Context to destroy.
Since
This function is available since SDL 3.1.3.
See also
SDL_CreateGPUDevice

◆ SDL_DispatchGPUCompute()

void SDL_DispatchGPUCompute ( SDL_GPUComputePass compute_pass,
Uint32  groupcount_x,
Uint32  groupcount_y,
Uint32  groupcount_z 
)
extern

Dispatches compute work.

You must not call this function before binding a compute pipeline.

A VERY IMPORTANT NOTE If you dispatch multiple times in a compute pass, and the dispatches write to the same resource region as each other, there is no guarantee of which order the writes will occur. If the write order matters, you MUST end the compute pass and begin another one.

Parameters
compute_passa compute pass handle.
groupcount_xnumber of local workgroups to dispatch in the X dimension.
groupcount_ynumber of local workgroups to dispatch in the Y dimension.
groupcount_znumber of local workgroups to dispatch in the Z dimension.
Since
This function is available since SDL 3.1.3.

◆ SDL_DispatchGPUComputeIndirect()

void SDL_DispatchGPUComputeIndirect ( SDL_GPUComputePass compute_pass,
SDL_GPUBuffer buffer,
Uint32  offset 
)
extern

Dispatches compute work with parameters set from a buffer.

The buffer layout should match the layout of SDL_GPUIndirectDispatchCommand. You must not call this function before binding a compute pipeline.

A VERY IMPORTANT NOTE If you dispatch multiple times in a compute pass, and the dispatches write to the same resource region as each other, there is no guarantee of which order the writes will occur. If the write order matters, you MUST end the compute pass and begin another one.

Parameters
compute_passa compute pass handle.
buffera buffer containing dispatch parameters.
offsetthe offset to start reading from the dispatch buffer.
Since
This function is available since SDL 3.1.3.

◆ SDL_DownloadFromGPUBuffer()

void SDL_DownloadFromGPUBuffer ( SDL_GPUCopyPass copy_pass,
const SDL_GPUBufferRegion source,
const SDL_GPUTransferBufferLocation destination 
)
extern

Copies data from a buffer to a transfer buffer on the GPU timeline.

This data is not guaranteed to be copied until the command buffer fence is signaled.

Parameters
copy_passa copy pass handle.
sourcethe source buffer with offset and size.
destinationthe destination transfer buffer with offset.
Since
This function is available since SDL 3.1.3.

◆ SDL_DownloadFromGPUTexture()

void SDL_DownloadFromGPUTexture ( SDL_GPUCopyPass copy_pass,
const SDL_GPUTextureRegion source,
const SDL_GPUTextureTransferInfo destination 
)
extern

Copies data from a texture to a transfer buffer on the GPU timeline.

This data is not guaranteed to be copied until the command buffer fence is signaled.

Parameters
copy_passa copy pass handle.
sourcethe source texture region.
destinationthe destination transfer buffer with image layout information.
Since
This function is available since SDL 3.1.3.

◆ SDL_DrawGPUIndexedPrimitives()

void SDL_DrawGPUIndexedPrimitives ( SDL_GPURenderPass render_pass,
Uint32  num_indices,
Uint32  num_instances,
Uint32  first_index,
Sint32  vertex_offset,
Uint32  first_instance 
)
extern

Draws data using bound graphics state with an index buffer and instancing enabled.

You must not call this function before binding a graphics pipeline.

Note that the first_vertex and first_instance parameters are NOT compatible with built-in vertex/instance ID variables in shaders (for example, SV_VertexID). If your shader depends on these variables, the correlating draw call parameter MUST be 0.

Parameters
render_passa render pass handle.
num_indicesthe number of indices to draw per instance.
num_instancesthe number of instances to draw.
first_indexthe starting index within the index buffer.
vertex_offsetvalue added to vertex index before indexing into the vertex buffer.
first_instancethe ID of the first instance to draw.
Since
This function is available since SDL 3.1.3.

◆ SDL_DrawGPUIndexedPrimitivesIndirect()

void SDL_DrawGPUIndexedPrimitivesIndirect ( SDL_GPURenderPass render_pass,
SDL_GPUBuffer buffer,
Uint32  offset,
Uint32  draw_count 
)
extern

Draws data using bound graphics state with an index buffer enabled and with draw parameters set from a buffer.

The buffer must consist of tightly-packed draw parameter sets that each match the layout of SDL_GPUIndexedIndirectDrawCommand. You must not call this function before binding a graphics pipeline.

Parameters
render_passa render pass handle.
buffera buffer containing draw parameters.
offsetthe offset to start reading from the draw buffer.
draw_countthe number of draw parameter sets that should be read from the draw buffer.
Since
This function is available since SDL 3.1.3.

◆ SDL_DrawGPUPrimitives()

void SDL_DrawGPUPrimitives ( SDL_GPURenderPass render_pass,
Uint32  num_vertices,
Uint32  num_instances,
Uint32  first_vertex,
Uint32  first_instance 
)
extern

Draws data using bound graphics state.

You must not call this function before binding a graphics pipeline.

Note that the first_vertex and first_instance parameters are NOT compatible with built-in vertex/instance ID variables in shaders (for example, SV_VertexID). If your shader depends on these variables, the correlating draw call parameter MUST be 0.

Parameters
render_passa render pass handle.
num_verticesthe number of vertices to draw.
num_instancesthe number of instances that will be drawn.
first_vertexthe index of the first vertex to draw.
first_instancethe ID of the first instance to draw.
Since
This function is available since SDL 3.1.3.

◆ SDL_DrawGPUPrimitivesIndirect()

void SDL_DrawGPUPrimitivesIndirect ( SDL_GPURenderPass render_pass,
SDL_GPUBuffer buffer,
Uint32  offset,
Uint32  draw_count 
)
extern

Draws data using bound graphics state and with draw parameters set from a buffer.

The buffer must consist of tightly-packed draw parameter sets that each match the layout of SDL_GPUIndirectDrawCommand. You must not call this function before binding a graphics pipeline.

Parameters
render_passa render pass handle.
buffera buffer containing draw parameters.
offsetthe offset to start reading from the draw buffer.
draw_countthe number of draw parameter sets that should be read from the draw buffer.
Since
This function is available since SDL 3.1.3.

◆ SDL_EndGPUComputePass()

void SDL_EndGPUComputePass ( SDL_GPUComputePass compute_pass)
extern

Ends the current compute pass.

All bound compute state on the command buffer is unset. The compute pass handle is now invalid.

Parameters
compute_passa compute pass handle.
Since
This function is available since SDL 3.1.3.

◆ SDL_EndGPUCopyPass()

void SDL_EndGPUCopyPass ( SDL_GPUCopyPass copy_pass)
extern

Ends the current copy pass.

Parameters
copy_passa copy pass handle.
Since
This function is available since SDL 3.1.3.

◆ SDL_EndGPURenderPass()

void SDL_EndGPURenderPass ( SDL_GPURenderPass render_pass)
extern

Ends the given render pass.

All bound graphics state on the render pass command buffer is unset. The render pass handle is now invalid.

Parameters
render_passa render pass handle.
Since
This function is available since SDL 3.1.3.

◆ SDL_GenerateMipmapsForGPUTexture()

void SDL_GenerateMipmapsForGPUTexture ( SDL_GPUCommandBuffer command_buffer,
SDL_GPUTexture texture 
)
extern

Generates mipmaps for the given texture.

This function must not be called inside of any pass.

Parameters
command_buffera command_buffer.
texturea texture with more than 1 mip level.
Since
This function is available since SDL 3.1.3.

◆ SDL_GetGPUDeviceDriver()

const char * SDL_GetGPUDeviceDriver ( SDL_GPUDevice device)
extern

Returns the name of the backend used to create this GPU context.

Parameters
devicea GPU context to query.
Returns
the name of the device's driver, or NULL on error.
Since
This function is available since SDL 3.1.3.

◆ SDL_GetGPUDriver()

const char * SDL_GetGPUDriver ( int  index)
extern

Get the name of a built in GPU driver.

The GPU drivers are presented in the order in which they are normally checked during initialization.

The names of drivers are all simple, low-ASCII identifiers, like "vulkan", "metal" or "direct3d12". These never have Unicode characters, and are not meant to be proper names.

Parameters
indexthe index of a GPU driver.
Returns
the name of the GPU driver with the given index.
Since
This function is available since SDL 3.1.3.
See also
SDL_GetNumGPUDrivers

◆ SDL_GetGPUShaderFormats()

SDL_GPUShaderFormat SDL_GetGPUShaderFormats ( SDL_GPUDevice device)
extern

Returns the supported shader formats for this GPU context.

Parameters
devicea GPU context to query.
Returns
a bitflag indicating which shader formats the driver is able to consume.
Since
This function is available since SDL 3.1.3.

◆ SDL_GetGPUSwapchainTextureFormat()

SDL_GPUTextureFormat SDL_GetGPUSwapchainTextureFormat ( SDL_GPUDevice device,
SDL_Window window 
)
extern

Obtains the texture format of the swapchain for the given window.

Note that this format can change if the swapchain parameters change.

Parameters
devicea GPU context.
windowan SDL_Window that has been claimed.
Returns
the texture format of the swapchain.
Since
This function is available since SDL 3.1.3.

◆ SDL_GetNumGPUDrivers()

int SDL_GetNumGPUDrivers ( void  )
extern

Get the number of GPU drivers compiled into SDL.

Returns
the number of built in GPU drivers.
Since
This function is available since SDL 3.1.3.
See also
SDL_GetGPUDriver

◆ SDL_GPUSupportsProperties()

bool SDL_GPUSupportsProperties ( SDL_PropertiesID  props)
extern

Checks for GPU runtime support.

Parameters
propsthe properties to use.
Returns
true if supported, false otherwise.
Since
This function is available since SDL 3.1.3.
See also
SDL_CreateGPUDeviceWithProperties

◆ SDL_GPUSupportsShaderFormats()

bool SDL_GPUSupportsShaderFormats ( SDL_GPUShaderFormat  format_flags,
const char *  name 
)
extern

Checks for GPU runtime support.

Parameters
format_flagsa bitflag indicating which shader formats the app is able to provide.
namethe preferred GPU driver, or NULL to let SDL pick the optimal driver.
Returns
true if supported, false otherwise.
Since
This function is available since SDL 3.1.3.
See also
SDL_CreateGPUDevice

◆ SDL_GPUTextureFormatTexelBlockSize()

Uint32 SDL_GPUTextureFormatTexelBlockSize ( SDL_GPUTextureFormat  format)
extern

Obtains the texel block size for a texture format.

Parameters
formatthe texture format you want to know the texel size of.
Returns
the texel block size of the texture format.
Since
This function is available since SDL 3.1.3.
See also
SDL_UploadToGPUTexture

◆ SDL_GPUTextureSupportsFormat()

bool SDL_GPUTextureSupportsFormat ( SDL_GPUDevice device,
SDL_GPUTextureFormat  format,
SDL_GPUTextureType  type,
SDL_GPUTextureUsageFlags  usage 
)
extern

Determines whether a texture format is supported for a given type and usage.

Parameters
devicea GPU context.
formatthe texture format to check.
typethe type of texture (2D, 3D, Cube).
usagea bitmask of all usage scenarios to check.
Returns
whether the texture format is supported for this type and usage.
Since
This function is available since SDL 3.1.3.

◆ SDL_GPUTextureSupportsSampleCount()

bool SDL_GPUTextureSupportsSampleCount ( SDL_GPUDevice device,
SDL_GPUTextureFormat  format,
SDL_GPUSampleCount  sample_count 
)
extern

Determines if a sample count for a texture format is supported.

Parameters
devicea GPU context.
formatthe texture format to check.
sample_countthe sample count to check.
Returns
a hardware-specific version of min(preferred, possible).
Since
This function is available since SDL 3.1.3.

◆ SDL_InsertGPUDebugLabel()

void SDL_InsertGPUDebugLabel ( SDL_GPUCommandBuffer command_buffer,
const char *  text 
)
extern

Inserts an arbitrary string label into the command buffer callstream.

Useful for debugging.

Parameters
command_buffera command buffer.
texta UTF-8 string constant to insert as the label.
Since
This function is available since SDL 3.1.3.

◆ SDL_MapGPUTransferBuffer()

void * SDL_MapGPUTransferBuffer ( SDL_GPUDevice device,
SDL_GPUTransferBuffer transfer_buffer,
bool  cycle 
)
extern

Maps a transfer buffer into application address space.

You must unmap the transfer buffer before encoding upload commands.

Parameters
devicea GPU context.
transfer_buffera transfer buffer.
cycleif true, cycles the transfer buffer if it is already bound.
Returns
the address of the mapped transfer buffer memory, or NULL on failure; call SDL_GetError() for more information.
Since
This function is available since SDL 3.1.3.

◆ SDL_PopGPUDebugGroup()

void SDL_PopGPUDebugGroup ( SDL_GPUCommandBuffer command_buffer)
extern

Ends the most-recently pushed debug group.

Parameters
command_buffera command buffer.
Since
This function is available since SDL 3.1.3.
See also
SDL_PushGPUDebugGroup

◆ SDL_PushGPUComputeUniformData()

void SDL_PushGPUComputeUniformData ( SDL_GPUCommandBuffer command_buffer,
Uint32  slot_index,
const void *  data,
Uint32  length 
)
extern

Pushes data to a uniform slot on the command buffer.

Subsequent draw calls will use this uniform data.

Parameters
command_buffera command buffer.
slot_indexthe uniform slot to push data to.
dataclient data to write.
lengththe length of the data to write.
Since
This function is available since SDL 3.1.3.

◆ SDL_PushGPUDebugGroup()

void SDL_PushGPUDebugGroup ( SDL_GPUCommandBuffer command_buffer,
const char *  name 
)
extern

Begins a debug group with an arbitary name.

Used for denoting groups of calls when viewing the command buffer callstream in a graphics debugging tool.

Each call to SDL_PushGPUDebugGroup must have a corresponding call to SDL_PopGPUDebugGroup.

On some backends (e.g. Metal), pushing a debug group during a render/blit/compute pass will create a group that is scoped to the native pass rather than the command buffer. For best results, if you push a debug group during a pass, always pop it in the same pass.

Parameters
command_buffera command buffer.
namea UTF-8 string constant that names the group.
Since
This function is available since SDL 3.1.3.
See also
SDL_PopGPUDebugGroup

◆ SDL_PushGPUFragmentUniformData()

void SDL_PushGPUFragmentUniformData ( SDL_GPUCommandBuffer command_buffer,
Uint32  slot_index,
const void *  data,
Uint32  length 
)
extern

Pushes data to a fragment uniform slot on the command buffer.

Subsequent draw calls will use this uniform data.

Parameters
command_buffera command buffer.
slot_indexthe fragment uniform slot to push data to.
dataclient data to write.
lengththe length of the data to write.
Since
This function is available since SDL 3.1.3.

◆ SDL_PushGPUVertexUniformData()

void SDL_PushGPUVertexUniformData ( SDL_GPUCommandBuffer command_buffer,
Uint32  slot_index,
const void *  data,
Uint32  length 
)
extern

Pushes data to a vertex uniform slot on the command buffer.

Subsequent draw calls will use this uniform data.

Parameters
command_buffera command buffer.
slot_indexthe vertex uniform slot to push data to.
dataclient data to write.
lengththe length of the data to write.
Since
This function is available since SDL 3.1.3.

◆ SDL_QueryGPUFence()

bool SDL_QueryGPUFence ( SDL_GPUDevice device,
SDL_GPUFence fence 
)
extern

Checks the status of a fence.

Parameters
devicea GPU context.
fencea fence.
Returns
true if the fence is signaled, false if it is not.
Since
This function is available since SDL 3.1.3.
See also
SDL_SubmitGPUCommandBufferAndAcquireFence

◆ SDL_ReleaseGPUBuffer()

void SDL_ReleaseGPUBuffer ( SDL_GPUDevice device,
SDL_GPUBuffer buffer 
)
extern

Frees the given buffer as soon as it is safe to do so.

You must not reference the buffer after calling this function.

Parameters
devicea GPU context.
buffera buffer to be destroyed.
Since
This function is available since SDL 3.1.3.

◆ SDL_ReleaseGPUComputePipeline()

void SDL_ReleaseGPUComputePipeline ( SDL_GPUDevice device,
SDL_GPUComputePipeline compute_pipeline 
)
extern

Frees the given compute pipeline as soon as it is safe to do so.

You must not reference the compute pipeline after calling this function.

Parameters
devicea GPU context.
compute_pipelinea compute pipeline to be destroyed.
Since
This function is available since SDL 3.1.3.

◆ SDL_ReleaseGPUFence()

void SDL_ReleaseGPUFence ( SDL_GPUDevice device,
SDL_GPUFence fence 
)
extern

Releases a fence obtained from SDL_SubmitGPUCommandBufferAndAcquireFence.

Parameters
devicea GPU context.
fencea fence.
Since
This function is available since SDL 3.1.3.
See also
SDL_SubmitGPUCommandBufferAndAcquireFence

◆ SDL_ReleaseGPUGraphicsPipeline()

void SDL_ReleaseGPUGraphicsPipeline ( SDL_GPUDevice device,
SDL_GPUGraphicsPipeline graphics_pipeline 
)
extern

Frees the given graphics pipeline as soon as it is safe to do so.

You must not reference the graphics pipeline after calling this function.

Parameters
devicea GPU context.
graphics_pipelinea graphics pipeline to be destroyed.
Since
This function is available since SDL 3.1.3.

◆ SDL_ReleaseGPUSampler()

void SDL_ReleaseGPUSampler ( SDL_GPUDevice device,
SDL_GPUSampler sampler 
)
extern

Frees the given sampler as soon as it is safe to do so.

You must not reference the sampler after calling this function.

Parameters
devicea GPU context.
samplera sampler to be destroyed.
Since
This function is available since SDL 3.1.3.

◆ SDL_ReleaseGPUShader()

void SDL_ReleaseGPUShader ( SDL_GPUDevice device,
SDL_GPUShader shader 
)
extern

Frees the given shader as soon as it is safe to do so.

You must not reference the shader after calling this function.

Parameters
devicea GPU context.
shadera shader to be destroyed.
Since
This function is available since SDL 3.1.3.

◆ SDL_ReleaseGPUTexture()

void SDL_ReleaseGPUTexture ( SDL_GPUDevice device,
SDL_GPUTexture texture 
)
extern

Frees the given texture as soon as it is safe to do so.

You must not reference the texture after calling this function.

Parameters
devicea GPU context.
texturea texture to be destroyed.
Since
This function is available since SDL 3.1.3.

◆ SDL_ReleaseGPUTransferBuffer()

void SDL_ReleaseGPUTransferBuffer ( SDL_GPUDevice device,
SDL_GPUTransferBuffer transfer_buffer 
)
extern

Frees the given transfer buffer as soon as it is safe to do so.

You must not reference the transfer buffer after calling this function.

Parameters
devicea GPU context.
transfer_buffera transfer buffer to be destroyed.
Since
This function is available since SDL 3.1.3.

◆ SDL_ReleaseWindowFromGPUDevice()

void SDL_ReleaseWindowFromGPUDevice ( SDL_GPUDevice device,
SDL_Window window 
)
extern

Unclaims a window, destroying its swapchain structure.

Parameters
devicea GPU context.
windowan SDL_Window that has been claimed.
Since
This function is available since SDL 3.1.3.
See also
SDL_ClaimWindowForGPUDevice

◆ SDL_SetGPUBlendConstants()

void SDL_SetGPUBlendConstants ( SDL_GPURenderPass render_pass,
SDL_FColor  blend_constants 
)
extern

Sets the current blend constants on a command buffer.

Parameters
render_passa render pass handle.
blend_constantsthe blend constant color.
Since
This function is available since SDL 3.1.3.
See also
SDL_GPU_BLENDFACTOR_CONSTANT_COLOR
SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR

◆ SDL_SetGPUBufferName()

void SDL_SetGPUBufferName ( SDL_GPUDevice device,
SDL_GPUBuffer buffer,
const char *  text 
)
extern

Sets an arbitrary string constant to label a buffer.

Useful for debugging.

Parameters
devicea GPU Context.
buffera buffer to attach the name to.
texta UTF-8 string constant to mark as the name of the buffer.
Since
This function is available since SDL 3.1.3.

◆ SDL_SetGPUScissor()

void SDL_SetGPUScissor ( SDL_GPURenderPass render_pass,
const SDL_Rect scissor 
)
extern

Sets the current scissor state on a command buffer.

Parameters
render_passa render pass handle.
scissorthe scissor area to set.
Since
This function is available since SDL 3.1.3.

◆ SDL_SetGPUStencilReference()

void SDL_SetGPUStencilReference ( SDL_GPURenderPass render_pass,
Uint8  reference 
)
extern

Sets the current stencil reference value on a command buffer.

Parameters
render_passa render pass handle.
referencethe stencil reference value to set.
Since
This function is available since SDL 3.1.3.

◆ SDL_SetGPUSwapchainParameters()

bool SDL_SetGPUSwapchainParameters ( SDL_GPUDevice device,
SDL_Window window,
SDL_GPUSwapchainComposition  swapchain_composition,
SDL_GPUPresentMode  present_mode 
)
extern

Changes the swapchain parameters for the given claimed window.

This function will fail if the requested present mode or swapchain composition are unsupported by the device. Check if the parameters are supported via SDL_WindowSupportsGPUPresentMode / SDL_WindowSupportsGPUSwapchainComposition prior to calling this function.

SDL_GPU_PRESENTMODE_VSYNC and SDL_GPU_SWAPCHAINCOMPOSITION_SDR are always supported.

Parameters
devicea GPU context.
windowan SDL_Window that has been claimed.
swapchain_compositionthe desired composition of the swapchain.
present_modethe desired present mode for the swapchain.
Returns
true if successful, false on error; call SDL_GetError() for more information.
Since
This function is available since SDL 3.1.3.
See also
SDL_WindowSupportsGPUPresentMode
SDL_WindowSupportsGPUSwapchainComposition

◆ SDL_SetGPUTextureName()

void SDL_SetGPUTextureName ( SDL_GPUDevice device,
SDL_GPUTexture texture,
const char *  text 
)
extern

Sets an arbitrary string constant to label a texture.

Useful for debugging.

Parameters
devicea GPU Context.
texturea texture to attach the name to.
texta UTF-8 string constant to mark as the name of the texture.
Since
This function is available since SDL 3.1.3.

◆ SDL_SetGPUViewport()

void SDL_SetGPUViewport ( SDL_GPURenderPass render_pass,
const SDL_GPUViewport viewport 
)
extern

Sets the current viewport state on a command buffer.

Parameters
render_passa render pass handle.
viewportthe viewport to set.
Since
This function is available since SDL 3.1.3.

◆ SDL_SubmitGPUCommandBuffer()

bool SDL_SubmitGPUCommandBuffer ( SDL_GPUCommandBuffer command_buffer)
extern

Submits a command buffer so its commands can be processed on the GPU.

It is invalid to use the command buffer after this is called.

This must be called from the thread the command buffer was acquired on.

All commands in the submission are guaranteed to begin executing before any command in a subsequent submission begins executing.

Parameters
command_buffera command buffer.
Returns
true on success, false on failure; call SDL_GetError() for more information.
Since
This function is available since SDL 3.1.3.
See also
SDL_AcquireGPUCommandBuffer
SDL_AcquireGPUSwapchainTexture
SDL_SubmitGPUCommandBufferAndAcquireFence

◆ SDL_SubmitGPUCommandBufferAndAcquireFence()

SDL_GPUFence * SDL_SubmitGPUCommandBufferAndAcquireFence ( SDL_GPUCommandBuffer command_buffer)
extern

Submits a command buffer so its commands can be processed on the GPU, and acquires a fence associated with the command buffer.

You must release this fence when it is no longer needed or it will cause a leak. It is invalid to use the command buffer after this is called.

This must be called from the thread the command buffer was acquired on.

All commands in the submission are guaranteed to begin executing before any command in a subsequent submission begins executing.

Parameters
command_buffera command buffer.
Returns
a fence associated with the command buffer, or NULL on failure; call SDL_GetError() for more information.
Since
This function is available since SDL 3.1.3.
See also
SDL_AcquireGPUCommandBuffer
SDL_AcquireGPUSwapchainTexture
SDL_SubmitGPUCommandBuffer
SDL_ReleaseGPUFence

◆ SDL_UnmapGPUTransferBuffer()

void SDL_UnmapGPUTransferBuffer ( SDL_GPUDevice device,
SDL_GPUTransferBuffer transfer_buffer 
)
extern

Unmaps a previously mapped transfer buffer.

Parameters
devicea GPU context.
transfer_buffera previously mapped transfer buffer.
Since
This function is available since SDL 3.1.3.

◆ SDL_UploadToGPUBuffer()

void SDL_UploadToGPUBuffer ( SDL_GPUCopyPass copy_pass,
const SDL_GPUTransferBufferLocation source,
const SDL_GPUBufferRegion destination,
bool  cycle 
)
extern

Uploads data from a transfer buffer to a buffer.

The upload occurs on the GPU timeline. You may assume that the upload has finished in subsequent commands.

Parameters
copy_passa copy pass handle.
sourcethe source transfer buffer with offset.
destinationthe destination buffer with offset and size.
cycleif true, cycles the buffer if it is already bound, otherwise overwrites the data.
Since
This function is available since SDL 3.1.3.

◆ SDL_UploadToGPUTexture()

void SDL_UploadToGPUTexture ( SDL_GPUCopyPass copy_pass,
const SDL_GPUTextureTransferInfo source,
const SDL_GPUTextureRegion destination,
bool  cycle 
)
extern

Uploads data from a transfer buffer to a texture.

The upload occurs on the GPU timeline. You may assume that the upload has finished in subsequent commands.

You must align the data in the transfer buffer to a multiple of the texel size of the texture format.

Parameters
copy_passa copy pass handle.
sourcethe source transfer buffer with image layout information.
destinationthe destination texture region.
cycleif true, cycles the texture if the texture is bound, otherwise overwrites the data.
Since
This function is available since SDL 3.1.3.

◆ SDL_WaitForGPUFences()

bool SDL_WaitForGPUFences ( SDL_GPUDevice device,
bool  wait_all,
SDL_GPUFence *const *  fences,
Uint32  num_fences 
)
extern

Blocks the thread until the given fences are signaled.

Parameters
devicea GPU context.
wait_allif 0, wait for any fence to be signaled, if 1, wait for all fences to be signaled.
fencesan array of fences to wait on.
num_fencesthe number of fences in the fences array.
Returns
true on success, false on failure; call SDL_GetError() for more information.
Since
This function is available since SDL 3.1.3.
See also
SDL_SubmitGPUCommandBufferAndAcquireFence
SDL_WaitForGPUIdle

◆ SDL_WaitForGPUIdle()

bool SDL_WaitForGPUIdle ( SDL_GPUDevice device)
extern

Blocks the thread until the GPU is completely idle.

Parameters
devicea GPU context.
Returns
true on success, false on failure; call SDL_GetError() for more information.
Since
This function is available since SDL 3.1.3.
See also
SDL_WaitForGPUFences

◆ SDL_WindowSupportsGPUPresentMode()

bool SDL_WindowSupportsGPUPresentMode ( SDL_GPUDevice device,
SDL_Window window,
SDL_GPUPresentMode  present_mode 
)
extern

Determines whether a presentation mode is supported by the window.

The window must be claimed before calling this function.

Parameters
devicea GPU context.
windowan SDL_Window.
present_modethe presentation mode to check.
Returns
true if supported, false if unsupported.
Since
This function is available since SDL 3.1.3.
See also
SDL_ClaimWindowForGPUDevice

◆ SDL_WindowSupportsGPUSwapchainComposition()

bool SDL_WindowSupportsGPUSwapchainComposition ( SDL_GPUDevice device,
SDL_Window window,
SDL_GPUSwapchainComposition  swapchain_composition 
)
extern

Determines whether a swapchain composition is supported by the window.

The window must be claimed before calling this function.

Parameters
devicea GPU context.
windowan SDL_Window.
swapchain_compositionthe swapchain composition to check.
Returns
true if supported, false if unsupported.
Since
This function is available since SDL 3.1.3.
See also
SDL_ClaimWindowForGPUDevice