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_GPUStorageBufferWriteOnlyBinding
 
struct  SDL_GPUStorageTextureWriteOnlyBinding
 

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_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_BOOL   "SDL.gpu.device.create.debugmode"
 
#define SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOL   "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_BOOL   "SDL.gpu.device.create.shaders.private"
 
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOL   "SDL.gpu.device.create.shaders.spirv"
 
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOL   "SDL.gpu.device.create.shaders.dxbc"
 
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOL   "SDL.gpu.device.create.shaders.dxil"
 
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOL   "SDL.gpu.device.create.shaders.msl"
 
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOL   "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_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_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
}
 
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

SDL_bool SDL_GPUSupportsShaderFormats (SDL_GPUShaderFormat format_flags, const char *name)
 
SDL_bool SDL_GPUSupportsProperties (SDL_PropertiesID props)
 
SDL_GPUDeviceSDL_CreateGPUDevice (SDL_GPUShaderFormat format_flags, SDL_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_GPUStorageTextureWriteOnlyBinding *storage_texture_bindings, Uint32 num_storage_texture_bindings, const SDL_GPUStorageBufferWriteOnlyBinding *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, SDL_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, SDL_bool cycle)
 
void SDL_UploadToGPUBuffer (SDL_GPUCopyPass *copy_pass, const SDL_GPUTransferBufferLocation *source, const SDL_GPUBufferRegion *destination, SDL_bool cycle)
 
void SDL_CopyGPUTextureToTexture (SDL_GPUCopyPass *copy_pass, const SDL_GPUTextureLocation *source, const SDL_GPUTextureLocation *destination, Uint32 w, Uint32 h, Uint32 d, SDL_bool cycle)
 
void SDL_CopyGPUBufferToBuffer (SDL_GPUCopyPass *copy_pass, const SDL_GPUBufferLocation *source, const SDL_GPUBufferLocation *destination, Uint32 size, SDL_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)
 
SDL_bool SDL_WindowSupportsGPUSwapchainComposition (SDL_GPUDevice *device, SDL_Window *window, SDL_GPUSwapchainComposition swapchain_composition)
 
SDL_bool SDL_WindowSupportsGPUPresentMode (SDL_GPUDevice *device, SDL_Window *window, SDL_GPUPresentMode present_mode)
 
SDL_bool SDL_ClaimWindowForGPUDevice (SDL_GPUDevice *device, SDL_Window *window)
 
void SDL_ReleaseWindowFromGPUDevice (SDL_GPUDevice *device, SDL_Window *window)
 
SDL_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)
 
SDL_GPUTextureSDL_AcquireGPUSwapchainTexture (SDL_GPUCommandBuffer *command_buffer, SDL_Window *window, Uint32 *w, Uint32 *h)
 
void SDL_SubmitGPUCommandBuffer (SDL_GPUCommandBuffer *command_buffer)
 
SDL_GPUFenceSDL_SubmitGPUCommandBufferAndAcquireFence (SDL_GPUCommandBuffer *command_buffer)
 
void SDL_WaitForGPUIdle (SDL_GPUDevice *device)
 
void SDL_WaitForGPUFences (SDL_GPUDevice *device, SDL_bool wait_all, SDL_GPUFence *const *fences, Uint32 num_fences)
 
SDL_bool SDL_QueryGPUFence (SDL_GPUDevice *device, SDL_GPUFence *fence)
 
void SDL_ReleaseGPUFence (SDL_GPUDevice *device, SDL_GPUFence *fence)
 
Uint32 SDL_GPUTextureFormatTexelBlockSize (SDL_GPUTextureFormat format)
 
SDL_bool SDL_GPUTextureSupportsFormat (SDL_GPUDevice *device, SDL_GPUTextureFormat format, SDL_GPUTextureType type, SDL_GPUTextureUsageFlags usage)
 
SDL_bool SDL_GPUTextureSupportsSampleCount (SDL_GPUDevice *device, SDL_GPUTextureFormat format, SDL_GPUSampleCount sample_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 549 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 550 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 548 of file SDL_gpu.h.

◆ SDL_GPU_BUFFERUSAGE_INDEX

#define SDL_GPU_BUFFERUSAGE_INDEX   (1u << 1)

Buffer is an index buffer.

Definition at line 546 of file SDL_gpu.h.

◆ SDL_GPU_BUFFERUSAGE_INDIRECT

#define SDL_GPU_BUFFERUSAGE_INDIRECT   (1u << 2)

Buffer is an indirect buffer.

Definition at line 547 of file SDL_gpu.h.

◆ SDL_GPU_BUFFERUSAGE_VERTEX

#define SDL_GPU_BUFFERUSAGE_VERTEX   (1u << 0)

Buffer is a vertex buffer.

Definition at line 545 of file SDL_gpu.h.

◆ SDL_GPU_COLORCOMPONENT_A

#define SDL_GPU_COLORCOMPONENT_A   (1u << 3)

the alpha component

Definition at line 823 of file SDL_gpu.h.

◆ SDL_GPU_COLORCOMPONENT_B

#define SDL_GPU_COLORCOMPONENT_B   (1u << 2)

the blue component

Definition at line 822 of file SDL_gpu.h.

◆ SDL_GPU_COLORCOMPONENT_G

#define SDL_GPU_COLORCOMPONENT_G   (1u << 1)

the green component

Definition at line 821 of file SDL_gpu.h.

◆ SDL_GPU_COLORCOMPONENT_R

#define SDL_GPU_COLORCOMPONENT_R   (1u << 0)

the red component

Definition at line 820 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 595 of file SDL_gpu.h.

◆ SDL_GPU_SHADERFORMAT_DXIL

#define SDL_GPU_SHADERFORMAT_DXIL   (1u << 3)

DXIL shaders for D3D12.

Definition at line 596 of file SDL_gpu.h.

◆ SDL_GPU_SHADERFORMAT_INVALID

#define SDL_GPU_SHADERFORMAT_INVALID   0

Definition at line 592 of file SDL_gpu.h.

◆ SDL_GPU_SHADERFORMAT_METALLIB

#define SDL_GPU_SHADERFORMAT_METALLIB   (1u << 5)

Precompiled metallib shaders for Metal.

Definition at line 598 of file SDL_gpu.h.

◆ SDL_GPU_SHADERFORMAT_MSL

#define SDL_GPU_SHADERFORMAT_MSL   (1u << 4)

MSL shaders for Metal.

Definition at line 597 of file SDL_gpu.h.

◆ SDL_GPU_SHADERFORMAT_PRIVATE

#define SDL_GPU_SHADERFORMAT_PRIVATE   (1u << 0)

Shaders for NDA'd platforms.

Definition at line 593 of file SDL_gpu.h.

◆ SDL_GPU_SHADERFORMAT_SPIRV

#define SDL_GPU_SHADERFORMAT_SPIRV   (1u << 1)

SPIR-V shaders for Vulkan.

Definition at line 594 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 474 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 477 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 478 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 475 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 476 of file SDL_gpu.h.

◆ SDL_GPU_TEXTUREUSAGE_SAMPLER

#define SDL_GPU_TEXTUREUSAGE_SAMPLER   (1u << 0)

Texture supports sampling.

Definition at line 473 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 1315 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 1314 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 1316 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 1313 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 1312 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 1317 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 1802 of file SDL_gpu.h.

◆ SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOL

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

Definition at line 1793 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 1795 of file SDL_gpu.h.

◆ SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOL

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

Definition at line 1794 of file SDL_gpu.h.

◆ SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOL

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

Definition at line 1798 of file SDL_gpu.h.

◆ SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOL

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

Definition at line 1799 of file SDL_gpu.h.

◆ SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOL

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

Definition at line 1801 of file SDL_gpu.h.

◆ SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOL

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

Definition at line 1800 of file SDL_gpu.h.

◆ SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOL

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

Definition at line 1796 of file SDL_gpu.h.

◆ SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOL

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

Definition at line 1797 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.

Since
This enum is available since SDL 3.0.0
See also
SDL_CreateGPUBuffer

Definition at line 543 of file SDL_gpu.h.

◆ SDL_GPUColorComponentFlags

Specifies which color components are written in a graphics pipeline.

Since
This enum is available since SDL 3.0.0
See also
SDL_CreateGPUGraphicsPipeline

Definition at line 818 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 acquire and submit a command buffer on the same thread. As long as you satisfy this requirement, all functionality related to command buffers is thread-safe.

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

Definition at line 191 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.0.0
See also
SDL_BeginGPUComputePass
SDL_EndGPUComputePass

Definition at line 217 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.0.0
See also
SDL_CreateGPUComputePipeline
SDL_BindGPUComputePipeline
SDL_ReleaseGPUComputePipeline

Definition at line 152 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.0.0
See also
SDL_BeginGPUCopyPass
SDL_EndGPUCopyPass

Definition at line 230 of file SDL_gpu.h.

◆ SDL_GPUDevice

typedef struct SDL_GPUDevice SDL_GPUDevice

CategoryGPU

Include file for SDL GPU API functions An opaque handle representing the SDL_GPU context.

Since
This struct is available since SDL 3.0.0

Definition at line 52 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.0.0
See also
SDL_SubmitGPUCommandBufferAndAcquireFence
SDL_QueryGPUFence
SDL_WaitForGPUFences
SDL_ReleaseGPUFence

Definition at line 242 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.0.0
See also
SDL_CreateGPUGraphicsPipeline
SDL_BindGPUGraphicsPipeline
SDL_ReleaseGPUGraphicsPipeline

Definition at line 165 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.0.0
See also
SDL_BeginGPURenderPass
SDL_EndGPURenderPass

Definition at line 204 of file SDL_gpu.h.

◆ SDL_GPUSampler

An opaque handle representing a sampler.

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

Definition at line 128 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.0.0
See also
SDL_CreateGPUShader
SDL_CreateGPUGraphicsPipeline
SDL_ReleaseGPUShader

Definition at line 139 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.0.0
See also
SDL_CreateGPUShader

Definition at line 590 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.

Since
This enum is available since SDL 3.0.0
See also
SDL_CreateGPUTexture

Definition at line 471 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.0.0
See also
SDL_CreateGPUTransferBuffer
SDL_MapGPUTransferBuffer
SDL_UnmapGPUTransferBuffer
SDL_UploadToGPUBuffer
SDL_UploadToGPUTexture
SDL_DownloadFromGPUBuffer
SDL_DownloadFromGPUTexture
SDL_ReleaseGPUTransferBuffer

Definition at line 95 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.0.0
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 793 of file SDL_gpu.h.

794{
796 SDL_GPU_BLENDFACTOR_ZERO, /**< 0 */
797 SDL_GPU_BLENDFACTOR_ONE, /**< 1 */
798 SDL_GPU_BLENDFACTOR_SRC_COLOR, /**< source color */
799 SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR, /**< 1 - source color */
800 SDL_GPU_BLENDFACTOR_DST_COLOR, /**< destination color */
801 SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR, /**< 1 - destination color */
802 SDL_GPU_BLENDFACTOR_SRC_ALPHA, /**< source alpha */
803 SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, /**< 1 - source alpha */
804 SDL_GPU_BLENDFACTOR_DST_ALPHA, /**< destination alpha */
805 SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA, /**< 1 - destination alpha */
806 SDL_GPU_BLENDFACTOR_CONSTANT_COLOR, /**< blend constant */
807 SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR, /**< 1 - blend constant */
808 SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE /**< min(source alpha, 1 - destination alpha) */
SDL_GPUBlendFactor
Definition SDL_gpu.h:794
@ SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA
Definition SDL_gpu.h:803
@ SDL_GPU_BLENDFACTOR_CONSTANT_COLOR
Definition SDL_gpu.h:806
@ SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR
Definition SDL_gpu.h:801
@ SDL_GPU_BLENDFACTOR_INVALID
Definition SDL_gpu.h:795
@ SDL_GPU_BLENDFACTOR_DST_ALPHA
Definition SDL_gpu.h:804
@ SDL_GPU_BLENDFACTOR_ZERO
Definition SDL_gpu.h:796
@ SDL_GPU_BLENDFACTOR_DST_COLOR
Definition SDL_gpu.h:800
@ SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA
Definition SDL_gpu.h:805
@ SDL_GPU_BLENDFACTOR_SRC_ALPHA
Definition SDL_gpu.h:802
@ SDL_GPU_BLENDFACTOR_SRC_COLOR
Definition SDL_gpu.h:798
@ SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR
Definition SDL_gpu.h:799
@ SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE
Definition SDL_gpu.h:808
@ SDL_GPU_BLENDFACTOR_ONE
Definition SDL_gpu.h:797
@ SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR
Definition SDL_gpu.h:807

◆ 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.0.0
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 772 of file SDL_gpu.h.

773{
775 SDL_GPU_BLENDOP_ADD, /**< (source * source_factor) + (destination * destination_factor) */
776 SDL_GPU_BLENDOP_SUBTRACT, /**< (source * source_factor) - (destination * destination_factor) */
777 SDL_GPU_BLENDOP_REVERSE_SUBTRACT, /**< (destination * destination_factor) - (source * source_factor) */
778 SDL_GPU_BLENDOP_MIN, /**< min(source, destination) */
779 SDL_GPU_BLENDOP_MAX /**< max(source, destination) */
SDL_GPUBlendOp
Definition SDL_gpu.h:773
@ SDL_GPU_BLENDOP_MIN
Definition SDL_gpu.h:778
@ SDL_GPU_BLENDOP_INVALID
Definition SDL_gpu.h:774
@ SDL_GPU_BLENDOP_MAX
Definition SDL_gpu.h:779
@ SDL_GPU_BLENDOP_REVERSE_SUBTRACT
Definition SDL_gpu.h:777
@ SDL_GPU_BLENDOP_SUBTRACT
Definition SDL_gpu.h:776
@ SDL_GPU_BLENDOP_ADD
Definition SDL_gpu.h:775

◆ SDL_GPUCompareOp

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

Since
This enum is available since SDL 3.0.0
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 727 of file SDL_gpu.h.

728{
730 SDL_GPU_COMPAREOP_NEVER, /**< The comparison always evaluates false. */
731 SDL_GPU_COMPAREOP_LESS, /**< The comparison evaluates reference < test. */
732 SDL_GPU_COMPAREOP_EQUAL, /**< The comparison evaluates reference == test. */
733 SDL_GPU_COMPAREOP_LESS_OR_EQUAL, /**< The comparison evaluates reference <= test. */
734 SDL_GPU_COMPAREOP_GREATER, /**< The comparison evaluates reference > test. */
735 SDL_GPU_COMPAREOP_NOT_EQUAL, /**< The comparison evaluates reference != test. */
736 SDL_GPU_COMPAREOP_GREATER_OR_EQUAL, /**< The comparison evalutes reference >= test. */
737 SDL_GPU_COMPAREOP_ALWAYS /**< The comparison always evaluates true. */
SDL_GPUCompareOp
Definition SDL_gpu.h:728
@ SDL_GPU_COMPAREOP_NEVER
Definition SDL_gpu.h:730
@ SDL_GPU_COMPAREOP_INVALID
Definition SDL_gpu.h:729
@ SDL_GPU_COMPAREOP_GREATER
Definition SDL_gpu.h:734
@ SDL_GPU_COMPAREOP_LESS
Definition SDL_gpu.h:731
@ SDL_GPU_COMPAREOP_GREATER_OR_EQUAL
Definition SDL_gpu.h:736
@ SDL_GPU_COMPAREOP_ALWAYS
Definition SDL_gpu.h:737
@ SDL_GPU_COMPAREOP_LESS_OR_EQUAL
Definition SDL_gpu.h:733
@ SDL_GPU_COMPAREOP_NOT_EQUAL
Definition SDL_gpu.h:735
@ SDL_GPU_COMPAREOP_EQUAL
Definition SDL_gpu.h:732

◆ 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.0.0
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 523 of file SDL_gpu.h.

524{
SDL_GPUCubeMapFace
Definition SDL_gpu.h:524
@ SDL_GPU_CUBEMAPFACE_NEGATIVEY
Definition SDL_gpu.h:528
@ SDL_GPU_CUBEMAPFACE_POSITIVEY
Definition SDL_gpu.h:527
@ SDL_GPU_CUBEMAPFACE_NEGATIVEX
Definition SDL_gpu.h:526
@ SDL_GPU_CUBEMAPFACE_NEGATIVEZ
Definition SDL_gpu.h:530
@ SDL_GPU_CUBEMAPFACE_POSITIVEX
Definition SDL_gpu.h:525
@ SDL_GPU_CUBEMAPFACE_POSITIVEZ
Definition SDL_gpu.h:529

◆ SDL_GPUCullMode

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

Since
This enum is available since SDL 3.0.0
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 699 of file SDL_gpu.h.

700{
701 SDL_GPU_CULLMODE_NONE, /**< No triangles are culled. */
702 SDL_GPU_CULLMODE_FRONT, /**< Front-facing triangles are culled. */
703 SDL_GPU_CULLMODE_BACK /**< Back-facing triangles are culled. */
SDL_GPUCullMode
Definition SDL_gpu.h:700
@ SDL_GPU_CULLMODE_FRONT
Definition SDL_gpu.h:702
@ SDL_GPU_CULLMODE_NONE
Definition SDL_gpu.h:701
@ SDL_GPU_CULLMODE_BACK
Definition SDL_gpu.h:703

◆ SDL_GPUFillMode

Specifies the fill mode of the graphics pipeline.

Since
This enum is available since SDL 3.0.0
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 686 of file SDL_gpu.h.

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

◆ SDL_GPUFilter

Specifies a filter operation used by a sampler.

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

Point filtering.

SDL_GPU_FILTER_LINEAR 

Linear filtering.

Definition at line 832 of file SDL_gpu.h.

833{
834 SDL_GPU_FILTER_NEAREST, /**< Point filtering. */
835 SDL_GPU_FILTER_LINEAR /**< Linear filtering. */
SDL_GPUFilter
Definition SDL_gpu.h:833
@ SDL_GPU_FILTER_NEAREST
Definition SDL_gpu.h:834
@ SDL_GPU_FILTER_LINEAR
Definition SDL_gpu.h:835

◆ 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.0.0
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 714 of file SDL_gpu.h.

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

◆ SDL_GPUIndexElementSize

Specifies the size of elements in an index buffer.

Since
This enum is available since SDL 3.0.0
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 298 of file SDL_gpu.h.

299{
300 SDL_GPU_INDEXELEMENTSIZE_16BIT, /**< The index elements are 16-bit. */
301 SDL_GPU_INDEXELEMENTSIZE_32BIT /**< The index elements are 32-bit. */
SDL_GPUIndexElementSize
Definition SDL_gpu.h:299
@ SDL_GPU_INDEXELEMENTSIZE_16BIT
Definition SDL_gpu.h:300
@ SDL_GPU_INDEXELEMENTSIZE_32BIT
Definition SDL_gpu.h:301

◆ 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.0.0
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 268 of file SDL_gpu.h.

269{
270 SDL_GPU_LOADOP_LOAD, /**< The previous contents of the texture will be preserved. */
271 SDL_GPU_LOADOP_CLEAR, /**< The contents of the texture will be cleared to a color. */
272 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:269
@ SDL_GPU_LOADOP_DONT_CARE
Definition SDL_gpu.h:272
@ SDL_GPU_LOADOP_CLEAR
Definition SDL_gpu.h:271
@ SDL_GPU_LOADOP_LOAD
Definition SDL_gpu.h:270

◆ 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, AcquireSwapchainTexture will block if too many frames are in flight.
  • IMMEDIATE: Immediately presents. Lowest latency option, but tearing may occur. When using this mode, AcquireSwapchainTexture will return 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, AcquireSwapchainTexture will return NULL if too many frames are in flight.
Since
This enum is available since SDL 3.0.0
See also
SDL_SetGPUSwapchainParameters
SDL_WindowSupportsGPUPresentMode
SDL_AcquireGPUSwapchainTexture
Enumerator
SDL_GPU_PRESENTMODE_VSYNC 
SDL_GPU_PRESENTMODE_IMMEDIATE 
SDL_GPU_PRESENTMODE_MAILBOX 

Definition at line 897 of file SDL_gpu.h.

898{
SDL_GPUPresentMode
Definition SDL_gpu.h:898
@ SDL_GPU_PRESENTMODE_VSYNC
Definition SDL_gpu.h:899
@ SDL_GPU_PRESENTMODE_IMMEDIATE
Definition SDL_gpu.h:900
@ SDL_GPU_PRESENTMODE_MAILBOX
Definition SDL_gpu.h:901

◆ SDL_GPUPrimitiveType

Specifies the primitive topology of a graphics pipeline.

Since
This enum is available since SDL 3.0.0
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 251 of file SDL_gpu.h.

252{
253 SDL_GPU_PRIMITIVETYPE_TRIANGLELIST, /**< A series of separate triangles. */
254 SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP, /**< A series of connected triangles. */
255 SDL_GPU_PRIMITIVETYPE_LINELIST, /**< A series of separate lines. */
256 SDL_GPU_PRIMITIVETYPE_LINESTRIP, /**< A series of connected lines. */
257 SDL_GPU_PRIMITIVETYPE_POINTLIST /**< A series of separate points. */
SDL_GPUPrimitiveType
Definition SDL_gpu.h:252
@ SDL_GPU_PRIMITIVETYPE_TRIANGLELIST
Definition SDL_gpu.h:253
@ SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP
Definition SDL_gpu.h:254
@ SDL_GPU_PRIMITIVETYPE_POINTLIST
Definition SDL_gpu.h:257
@ SDL_GPU_PRIMITIVETYPE_LINESTRIP
Definition SDL_gpu.h:256
@ SDL_GPU_PRIMITIVETYPE_LINELIST
Definition SDL_gpu.h:255

◆ 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.0.0
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 507 of file SDL_gpu.h.

508{
509 SDL_GPU_SAMPLECOUNT_1, /**< No multisampling. */
510 SDL_GPU_SAMPLECOUNT_2, /**< MSAA 2x */
511 SDL_GPU_SAMPLECOUNT_4, /**< MSAA 4x */
512 SDL_GPU_SAMPLECOUNT_8 /**< MSAA 8x */
SDL_GPUSampleCount
Definition SDL_gpu.h:508
@ SDL_GPU_SAMPLECOUNT_2
Definition SDL_gpu.h:510
@ SDL_GPU_SAMPLECOUNT_8
Definition SDL_gpu.h:512
@ SDL_GPU_SAMPLECOUNT_1
Definition SDL_gpu.h:509
@ SDL_GPU_SAMPLECOUNT_4
Definition SDL_gpu.h:511

◆ SDL_GPUSamplerAddressMode

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

Since
This enum is available since SDL 3.0.0
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 859 of file SDL_gpu.h.

860{
861 SDL_GPU_SAMPLERADDRESSMODE_REPEAT, /**< Specifies that the coordinates will wrap around. */
862 SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT, /**< Specifies that the coordinates will wrap around mirrored. */
863 SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE /**< Specifies that the coordinates will clamp to the 0-1 range. */
SDL_GPUSamplerAddressMode
Definition SDL_gpu.h:860
@ SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT
Definition SDL_gpu.h:862
@ SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE
Definition SDL_gpu.h:863
@ SDL_GPU_SAMPLERADDRESSMODE_REPEAT
Definition SDL_gpu.h:861

◆ SDL_GPUSamplerMipmapMode

Specifies a mipmap mode used by a sampler.

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

Point filtering.

SDL_GPU_SAMPLERMIPMAPMODE_LINEAR 

Linear filtering.

Definition at line 845 of file SDL_gpu.h.

846{
847 SDL_GPU_SAMPLERMIPMAPMODE_NEAREST, /**< Point filtering. */
848 SDL_GPU_SAMPLERMIPMAPMODE_LINEAR /**< Linear filtering. */
SDL_GPUSamplerMipmapMode
Definition SDL_gpu.h:846
@ SDL_GPU_SAMPLERMIPMAPMODE_NEAREST
Definition SDL_gpu.h:847
@ SDL_GPU_SAMPLERMIPMAPMODE_LINEAR
Definition SDL_gpu.h:848

◆ SDL_GPUShaderStage

Specifies which stage a shader program corresponds to.

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

Definition at line 575 of file SDL_gpu.h.

576{
SDL_GPUShaderStage
Definition SDL_gpu.h:576
@ SDL_GPU_SHADERSTAGE_FRAGMENT
Definition SDL_gpu.h:578
@ SDL_GPU_SHADERSTAGE_VERTEX
Definition SDL_gpu.h:577

◆ SDL_GPUStencilOp

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

Since
This enum is available since SDL 3.0.0
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 748 of file SDL_gpu.h.

749{
751 SDL_GPU_STENCILOP_KEEP, /**< Keeps the current value. */
752 SDL_GPU_STENCILOP_ZERO, /**< Sets the value to 0. */
753 SDL_GPU_STENCILOP_REPLACE, /**< Sets the value to reference. */
754 SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP, /**< Increments the current value and clamps to the maximum value. */
755 SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP, /**< Decrements the current value and clamps to 0. */
756 SDL_GPU_STENCILOP_INVERT, /**< Bitwise-inverts the current value. */
757 SDL_GPU_STENCILOP_INCREMENT_AND_WRAP, /**< Increments the current value and wraps back to 0. */
758 SDL_GPU_STENCILOP_DECREMENT_AND_WRAP /**< Decrements the current value and wraps to the maximum value. */
SDL_GPUStencilOp
Definition SDL_gpu.h:749
@ SDL_GPU_STENCILOP_DECREMENT_AND_WRAP
Definition SDL_gpu.h:758
@ SDL_GPU_STENCILOP_ZERO
Definition SDL_gpu.h:752
@ SDL_GPU_STENCILOP_KEEP
Definition SDL_gpu.h:751
@ SDL_GPU_STENCILOP_INVERT
Definition SDL_gpu.h:756
@ SDL_GPU_STENCILOP_REPLACE
Definition SDL_gpu.h:753
@ SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP
Definition SDL_gpu.h:755
@ SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP
Definition SDL_gpu.h:754
@ SDL_GPU_STENCILOP_INCREMENT_AND_WRAP
Definition SDL_gpu.h:757
@ SDL_GPU_STENCILOP_INVALID
Definition SDL_gpu.h:750

◆ 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.0.0
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 283 of file SDL_gpu.h.

284{
285 SDL_GPU_STOREOP_STORE, /**< The contents generated during the render pass will be written to memory. */
286 SDL_GPU_STOREOP_DONT_CARE, /**< The contents generated during the render pass are not needed and may be discarded. The contents will be undefined. */
287 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. */
288 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:284
@ SDL_GPU_STOREOP_RESOLVE_AND_STORE
Definition SDL_gpu.h:288
@ SDL_GPU_STOREOP_STORE
Definition SDL_gpu.h:285
@ SDL_GPU_STOREOP_DONT_CARE
Definition SDL_gpu.h:286
@ SDL_GPU_STOREOP_RESOLVE
Definition SDL_gpu.h:287

◆ 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.0.0
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 929 of file SDL_gpu.h.

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

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.0.0
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_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_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 

Definition at line 387 of file SDL_gpu.h.

388{
390
391 /* Unsigned Normalized Float Color Formats */
404 /* Compressed Unsigned Normalized Float Color Formats */
411 /* Compressed Signed Float Color Formats */
413 /* Compressed Unsigned Float Color Formats */
415 /* Signed Normalized Float Color Formats */
422 /* Signed Float Color Formats */
429 /* Unsigned Float Color Formats */
431 /* Unsigned Integer Color Formats */
438 /* Signed Integer Color Formats */
445 /* SRGB Unsigned Normalized Color Formats */
448 /* Compressed SRGB Unsigned Normalized Color Formats */
453 /* Depth Formats */
SDL_GPUTextureFormat
Definition SDL_gpu.h:388
@ SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM
Definition SDL_gpu.h:403
@ SDL_GPU_TEXTUREFORMAT_D16_UNORM
Definition SDL_gpu.h:454
@ SDL_GPU_TEXTUREFORMAT_R16G16_INT
Definition SDL_gpu.h:443
@ SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT
Definition SDL_gpu.h:437
@ SDL_GPU_TEXTUREFORMAT_R8_UINT
Definition SDL_gpu.h:432
@ SDL_GPU_TEXTUREFORMAT_R8G8_SNORM
Definition SDL_gpu.h:417
@ SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM
Definition SDL_gpu.h:398
@ SDL_GPU_TEXTUREFORMAT_A8_UNORM
Definition SDL_gpu.h:392
@ SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT
Definition SDL_gpu.h:412
@ SDL_GPU_TEXTUREFORMAT_R16_UINT
Definition SDL_gpu.h:435
@ SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM
Definition SDL_gpu.h:421
@ SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM
Definition SDL_gpu.h:409
@ SDL_GPU_TEXTUREFORMAT_R16_INT
Definition SDL_gpu.h:442
@ SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM
Definition SDL_gpu.h:408
@ SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT
Definition SDL_gpu.h:427
@ SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB
Definition SDL_gpu.h:446
@ SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM
Definition SDL_gpu.h:418
@ SDL_GPU_TEXTUREFORMAT_R16_UNORM
Definition SDL_gpu.h:396
@ SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT
Definition SDL_gpu.h:458
@ SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT
Definition SDL_gpu.h:414
@ SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM
Definition SDL_gpu.h:410
@ SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM
Definition SDL_gpu.h:406
@ SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT
Definition SDL_gpu.h:428
@ SDL_GPU_TEXTUREFORMAT_R8_SNORM
Definition SDL_gpu.h:416
@ SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB
Definition SDL_gpu.h:449
@ SDL_GPU_TEXTUREFORMAT_R8_UNORM
Definition SDL_gpu.h:393
@ SDL_GPU_TEXTUREFORMAT_D24_UNORM
Definition SDL_gpu.h:455
@ SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB
Definition SDL_gpu.h:450
@ SDL_GPU_TEXTUREFORMAT_INVALID
Definition SDL_gpu.h:389
@ SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM
Definition SDL_gpu.h:407
@ SDL_GPU_TEXTUREFORMAT_R16G16_SNORM
Definition SDL_gpu.h:420
@ SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM
Definition SDL_gpu.h:402
@ SDL_GPU_TEXTUREFORMAT_R8G8_INT
Definition SDL_gpu.h:440
@ SDL_GPU_TEXTUREFORMAT_D32_FLOAT
Definition SDL_gpu.h:456
@ SDL_GPU_TEXTUREFORMAT_R8_INT
Definition SDL_gpu.h:439
@ SDL_GPU_TEXTUREFORMAT_R8G8_UINT
Definition SDL_gpu.h:433
@ SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT
Definition SDL_gpu.h:424
@ SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM
Definition SDL_gpu.h:401
@ SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB
Definition SDL_gpu.h:451
@ SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM
Definition SDL_gpu.h:405
@ SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB
Definition SDL_gpu.h:452
@ SDL_GPU_TEXTUREFORMAT_R32_FLOAT
Definition SDL_gpu.h:426
@ SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT
Definition SDL_gpu.h:457
@ SDL_GPU_TEXTUREFORMAT_R8G8_UNORM
Definition SDL_gpu.h:394
@ SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB
Definition SDL_gpu.h:447
@ SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM
Definition SDL_gpu.h:400
@ SDL_GPU_TEXTUREFORMAT_R16G16_UNORM
Definition SDL_gpu.h:397
@ SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM
Definition SDL_gpu.h:395
@ SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT
Definition SDL_gpu.h:430
@ SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT
Definition SDL_gpu.h:444
@ SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT
Definition SDL_gpu.h:434
@ SDL_GPU_TEXTUREFORMAT_R16G16_UINT
Definition SDL_gpu.h:436
@ SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT
Definition SDL_gpu.h:425
@ SDL_GPU_TEXTUREFORMAT_R16_SNORM
Definition SDL_gpu.h:419
@ SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT
Definition SDL_gpu.h:441
@ SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM
Definition SDL_gpu.h:399
@ SDL_GPU_TEXTUREFORMAT_R16_FLOAT
Definition SDL_gpu.h:423

◆ SDL_GPUTextureType

Specifies the type of a texture.

Since
This enum is available since SDL 3.0.0
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 487 of file SDL_gpu.h.

488{
489 SDL_GPU_TEXTURETYPE_2D, /**< The texture is a 2-dimensional image. */
490 SDL_GPU_TEXTURETYPE_2D_ARRAY, /**< The texture is a 2-dimensional array image. */
491 SDL_GPU_TEXTURETYPE_3D, /**< The texture is a 3-dimensional image. */
492 SDL_GPU_TEXTURETYPE_CUBE, /**< The texture is a cube image. */
493 SDL_GPU_TEXTURETYPE_CUBE_ARRAY /**< The texture is a cube array image. */
SDL_GPUTextureType
Definition SDL_gpu.h:488
@ SDL_GPU_TEXTURETYPE_CUBE_ARRAY
Definition SDL_gpu.h:493
@ SDL_GPU_TEXTURETYPE_3D
Definition SDL_gpu.h:491
@ SDL_GPU_TEXTURETYPE_CUBE
Definition SDL_gpu.h:492
@ SDL_GPU_TEXTURETYPE_2D
Definition SDL_gpu.h:489
@ SDL_GPU_TEXTURETYPE_2D_ARRAY
Definition SDL_gpu.h:490

◆ 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.0.0
See also
SDL_CreateGPUTransferBuffer
Enumerator
SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD 
SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD 

Definition at line 562 of file SDL_gpu.h.

563{
SDL_GPUTransferBufferUsage
Definition SDL_gpu.h:563
@ SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD
Definition SDL_gpu.h:565
@ SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD
Definition SDL_gpu.h:564

◆ SDL_GPUVertexElementFormat

Specifies the format of a vertex attribute.

Since
This enum is available since SDL 3.0.0
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 607 of file SDL_gpu.h.

608{
610
611 /* 32-bit Signed Integers */
616
617 /* 32-bit Unsigned Integers */
622
623 /* 32-bit Floats */
628
629 /* 8-bit Signed Integers */
632
633 /* 8-bit Unsigned Integers */
636
637 /* 8-bit Signed Normalized */
640
641 /* 8-bit Unsigned Normalized */
644
645 /* 16-bit Signed Integers */
648
649 /* 16-bit Unsigned Integers */
652
653 /* 16-bit Signed Normalized */
656
657 /* 16-bit Unsigned Normalized */
660
661 /* 16-bit Floats */
SDL_GPUVertexElementFormat
Definition SDL_gpu.h:608
@ SDL_GPU_VERTEXELEMENTFORMAT_INT4
Definition SDL_gpu.h:615
@ SDL_GPU_VERTEXELEMENTFORMAT_INT
Definition SDL_gpu.h:612
@ SDL_GPU_VERTEXELEMENTFORMAT_INVALID
Definition SDL_gpu.h:609
@ SDL_GPU_VERTEXELEMENTFORMAT_HALF2
Definition SDL_gpu.h:662
@ SDL_GPU_VERTEXELEMENTFORMAT_BYTE2
Definition SDL_gpu.h:630
@ SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4
Definition SDL_gpu.h:635
@ SDL_GPU_VERTEXELEMENTFORMAT_USHORT4
Definition SDL_gpu.h:651
@ SDL_GPU_VERTEXELEMENTFORMAT_INT2
Definition SDL_gpu.h:613
@ SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM
Definition SDL_gpu.h:638
@ SDL_GPU_VERTEXELEMENTFORMAT_UINT2
Definition SDL_gpu.h:619
@ SDL_GPU_VERTEXELEMENTFORMAT_BYTE4
Definition SDL_gpu.h:631
@ SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM
Definition SDL_gpu.h:654
@ SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4
Definition SDL_gpu.h:627
@ SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM
Definition SDL_gpu.h:642
@ SDL_GPU_VERTEXELEMENTFORMAT_UINT3
Definition SDL_gpu.h:620
@ SDL_GPU_VERTEXELEMENTFORMAT_UINT
Definition SDL_gpu.h:618
@ SDL_GPU_VERTEXELEMENTFORMAT_UINT4
Definition SDL_gpu.h:621
@ SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM
Definition SDL_gpu.h:658
@ SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3
Definition SDL_gpu.h:626
@ SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2
Definition SDL_gpu.h:634
@ SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2
Definition SDL_gpu.h:625
@ SDL_GPU_VERTEXELEMENTFORMAT_SHORT4
Definition SDL_gpu.h:647
@ SDL_GPU_VERTEXELEMENTFORMAT_FLOAT
Definition SDL_gpu.h:624
@ SDL_GPU_VERTEXELEMENTFORMAT_SHORT2
Definition SDL_gpu.h:646
@ SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM
Definition SDL_gpu.h:639
@ SDL_GPU_VERTEXELEMENTFORMAT_HALF4
Definition SDL_gpu.h:663
@ SDL_GPU_VERTEXELEMENTFORMAT_USHORT2
Definition SDL_gpu.h:650
@ SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM
Definition SDL_gpu.h:643
@ SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM
Definition SDL_gpu.h:655
@ SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM
Definition SDL_gpu.h:659
@ SDL_GPU_VERTEXELEMENTFORMAT_INT3
Definition SDL_gpu.h:614

◆ SDL_GPUVertexInputRate

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

Since
This enum is available since SDL 3.0.0
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 673 of file SDL_gpu.h.

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

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.
Since
This function is available since SDL 3.0.0.
See also
SDL_SubmitGPUCommandBuffer
SDL_SubmitGPUCommandBufferAndAcquireFence

◆ SDL_AcquireGPUSwapchainTexture()

SDL_GPUTexture * SDL_AcquireGPUSwapchainTexture ( SDL_GPUCommandBuffer command_buffer,
SDL_Window window,
Uint32 w,
Uint32 h 
)
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. May return NULL under certain conditions. This is not necessarily an error. This 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.
wa pointer filled in with the swapchain width.
ha pointer filled in with the swapchain height.
Returns
a swapchain texture.
Since
This function is available since SDL 3.0.0.
See also
SDL_ClaimWindowForGPUDevice
SDL_SubmitGPUCommandBuffer
SDL_SubmitGPUCommandBufferAndAcquireFence

◆ SDL_BeginGPUComputePass()

SDL_GPUComputePass * SDL_BeginGPUComputePass ( SDL_GPUCommandBuffer command_buffer,
const SDL_GPUStorageTextureWriteOnlyBinding storage_texture_bindings,
Uint32  num_storage_texture_bindings,
const SDL_GPUStorageBufferWriteOnlyBinding 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 will be written to by compute pipelines. These textures and buffers must have been created with the COMPUTE_STORAGE_WRITE bit. 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 Textures and buffers bound as write-only MUST NOT be read from during the compute pass. Doing so will result in undefined behavior. If your compute work requires reading the output from a previous dispatch, you MUST end the current compute pass and begin a new one before you can safely access the data.

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

◆ 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.0.0.
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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ SDL_ClaimWindowForGPUDevice()

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

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
SDL_TRUE on success, otherwise SDL_FALSE.
Since
This function is available since SDL 3.0.0.
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,
SDL_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 SDL_TRUE, cycles the destination buffer if it is already bound, otherwise overwrites the data.
Since
This function is available since SDL 3.0.0.

◆ SDL_CopyGPUTextureToTexture()

void SDL_CopyGPUTextureToTexture ( SDL_GPUCopyPass copy_pass,
const SDL_GPUTextureLocation source,
const SDL_GPUTextureLocation destination,
Uint32  w,
Uint32  h,
Uint32  d,
SDL_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 SDL_TRUE, cycles the destination texture if the destination texture is bound, otherwise overwrites the data.
Since
This function is available since SDL 3.0.0.

◆ 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.
Since
This function is available since SDL 3.0.0.
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.
Since
This function is available since SDL 3.0.0.
See also
SDL_BindGPUComputePipeline
SDL_ReleaseGPUComputePipeline

◆ SDL_CreateGPUDevice()

SDL_GPUDevice * SDL_CreateGPUDevice ( SDL_GPUShaderFormat  format_flags,
SDL_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.
Since
This function is available since SDL 3.0.0.
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_BOOL: enable debug mode properties and validations, defaults to SDL_TRUE.
  • SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOL: enable to prefer energy efficiency over maximum GPU performance, defaults to SDL_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_BOOL: The app is able to provide shaders for an NDA platform.
  • SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOL: The app is able to provide SPIR-V shaders if applicable.
  • SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOL: The app is able to provide DXBC shaders if applicable SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOL: The app is able to provide DXIL shaders if applicable. -SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOL: The app is able to provide MSL shaders if applicable. -SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOL`: 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.
Since
This function is available since SDL 3.0.0.
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.
Since
This function is available since SDL 3.0.0.
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.
Since
This function is available since SDL 3.0.0.
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.
Since
This function is available since SDL 3.0.0.
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.
Since
This function is available since SDL 3.0.0.
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.

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.
Since
This function is available since SDL 3.0.0.
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.0.0.
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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.
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.0.0.

◆ SDL_GetGPUSwapchainTextureFormat()

SDL_GPUTextureFormat SDL_GetGPUSwapchainTextureFormat ( SDL_GPUDevice device,
SDL_Window window 
)
extern

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

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

◆ 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.0.0.
See also
SDL_GetGPUDriver

◆ SDL_GPUSupportsProperties()

SDL_bool SDL_GPUSupportsProperties ( SDL_PropertiesID  props)
extern

Checks for GPU runtime support.

Parameters
propsthe properties to use.
Returns
SDL_TRUE if supported, SDL_FALSE otherwise.
Since
This function is available since SDL 3.0.0.
See also
SDL_CreateGPUDeviceWithProperties

◆ SDL_GPUSupportsShaderFormats()

SDL_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
SDL_TRUE if supported, SDL_FALSE otherwise.
Since
This function is available since SDL 3.0.0.
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.0.0.
See also
SDL_UploadToGPUTexture

◆ SDL_GPUTextureSupportsFormat()

SDL_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.0.0.

◆ SDL_GPUTextureSupportsSampleCount()

SDL_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.0.0.

◆ 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.0.0.

◆ SDL_MapGPUTransferBuffer()

void * SDL_MapGPUTransferBuffer ( SDL_GPUDevice device,
SDL_GPUTransferBuffer transfer_buffer,
SDL_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 SDL_TRUE, cycles the transfer buffer if it is already bound.
Returns
the address of the mapped transfer buffer memory.
Since
This function is available since SDL 3.0.0.

◆ 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.0.0.
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.0.0.

◆ 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.0.0.
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.0.0.

◆ 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.0.0.

◆ SDL_QueryGPUFence()

SDL_bool SDL_QueryGPUFence ( SDL_GPUDevice device,
SDL_GPUFence fence 
)
extern

Checks the status of a fence.

Parameters
devicea GPU context.
fencea fence.
Returns
SDL_TRUE if the fence is signaled, SDL_FALSE if it is not.
Since
This function is available since SDL 3.0.0.
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.0.0.

◆ 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.0.0.

◆ 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.0.0.
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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ 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.0.0.
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.0.0.
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.0.0.

◆ 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.0.0.

◆ 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.0.0.

◆ SDL_SetGPUSwapchainParameters()

SDL_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
SDL_TRUE if successful, SDL_FALSE on error.
Since
This function is available since SDL 3.0.0.
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.0.0.

◆ 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.0.0.

◆ SDL_SubmitGPUCommandBuffer()

void 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.
Since
This function is available since SDL 3.0.0.
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.
Since
This function is available since SDL 3.0.0.
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.0.0.

◆ SDL_UploadToGPUBuffer()

void SDL_UploadToGPUBuffer ( SDL_GPUCopyPass copy_pass,
const SDL_GPUTransferBufferLocation source,
const SDL_GPUBufferRegion destination,
SDL_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 SDL_TRUE, cycles the buffer if it is already bound, otherwise overwrites the data.
Since
This function is available since SDL 3.0.0.

◆ SDL_UploadToGPUTexture()

void SDL_UploadToGPUTexture ( SDL_GPUCopyPass copy_pass,
const SDL_GPUTextureTransferInfo source,
const SDL_GPUTextureRegion destination,
SDL_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 SDL_TRUE, cycles the texture if the texture is bound, otherwise overwrites the data.
Since
This function is available since SDL 3.0.0.

◆ SDL_WaitForGPUFences()

void SDL_WaitForGPUFences ( SDL_GPUDevice device,
SDL_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.
Since
This function is available since SDL 3.0.0.
See also
SDL_SubmitGPUCommandBufferAndAcquireFence
SDL_WaitForGPUIdle

◆ SDL_WaitForGPUIdle()

void SDL_WaitForGPUIdle ( SDL_GPUDevice device)
extern

Blocks the thread until the GPU is completely idle.

Parameters
devicea GPU context.
Since
This function is available since SDL 3.0.0.
See also
SDL_WaitForGPUFences

◆ SDL_WindowSupportsGPUPresentMode()

SDL_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
SDL_TRUE if supported, SDL_FALSE if unsupported (or on error).
Since
This function is available since SDL 3.0.0.
See also
SDL_ClaimWindowForGPUDevice

◆ SDL_WindowSupportsGPUSwapchainComposition()

SDL_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
SDL_TRUE if supported, SDL_FALSE if unsupported (or on error).
Since
This function is available since SDL 3.0.0.
See also
SDL_ClaimWindowForGPUDevice