|
SDL3pp
A slim C++ wrapper for SDL3
|
The GPU API offers a cross-platform way for apps to talk to modern graphics hardware. More...

Classes | |
| struct | SDL::GPUDeviceParam |
| Safely wrap GPUDevice for non owning parameters. More... | |
| class | SDL::GPUBuffer |
| An opaque handle representing a buffer. More... | |
| class | SDL::GPUTransferBuffer |
| An opaque handle representing a transfer buffer. More... | |
| class | SDL::GPUTexture |
| An opaque handle representing a texture. More... | |
| class | SDL::GPUSampler |
| An opaque handle representing a sampler. More... | |
| class | SDL::GPUShader |
| An opaque handle representing a compiled shader object. More... | |
| class | SDL::GPUComputePipeline |
| An opaque handle representing a compute pipeline. More... | |
| class | SDL::GPUGraphicsPipeline |
| An opaque handle representing a graphics pipeline. More... | |
| class | SDL::GPURenderPass |
| An opaque handle representing a render pass. More... | |
| class | SDL::GPUComputePass |
| An opaque handle representing a compute pass. More... | |
| class | SDL::GPUCopyPass |
| An opaque handle representing a copy pass. More... | |
| class | SDL::GPUCommandBuffer |
| An opaque handle representing a command buffer. More... | |
| class | SDL::GPUDevice |
| An opaque handle representing the SDL_GPU context. More... | |
| struct | SDL::GPUDeviceRef |
| Semi-safe reference for GPUDevice. More... | |
Typedefs | |
| using | SDL::GPUDeviceRaw = SDL_GPUDevice * |
| Alias to raw representation for GPUDevice. | |
| using | SDL::GPUBufferRaw = SDL_GPUBuffer * |
| Alias to raw representation for GPUBuffer. | |
| using | SDL::GPUTransferBufferRaw = SDL_GPUTransferBuffer * |
| Alias to raw representation for GPUTransferBuffer. | |
| using | SDL::GPUTextureRaw = SDL_GPUTexture * |
| Alias to raw representation for GPUTexture. | |
| using | SDL::GPUSamplerRaw = SDL_GPUSampler * |
| Alias to raw representation for GPUSampler. | |
| using | SDL::GPUShaderRaw = SDL_GPUShader * |
| Alias to raw representation for GPUShader. | |
| using | SDL::GPUComputePipelineRaw = SDL_GPUComputePipeline * |
| Alias to raw representation for GPUComputePipeline. | |
| using | SDL::GPUGraphicsPipelineRaw = SDL_GPUGraphicsPipeline * |
| Alias to raw representation for GPUGraphicsPipeline. | |
| using | SDL::GPUCommandBufferRaw = SDL_GPUCommandBuffer * |
| Alias to raw representation for GPUCommandBuffer. | |
| using | SDL::GPURenderPassRaw = SDL_GPURenderPass * |
| Alias to raw representation for GPURenderPass. | |
| using | SDL::GPUComputePassRaw = SDL_GPUComputePass * |
| Alias to raw representation for GPUComputePass. | |
| using | SDL::GPUCopyPassRaw = SDL_GPUCopyPass * |
| Alias to raw representation for GPUCopyPass. | |
| using | SDL::GPUBufferCreateInfo = SDL_GPUBufferCreateInfo |
| A structure specifying the parameters of a buffer. More... | |
| using | SDL::GPUTransferBufferCreateInfo = SDL_GPUTransferBufferCreateInfo |
| A structure specifying the parameters of a transfer buffer. More... | |
| using | SDL::GPUTextureCreateInfo = SDL_GPUTextureCreateInfo |
| A structure specifying the parameters of a texture. More... | |
| using | SDL::GPUSamplerCreateInfo = SDL_GPUSamplerCreateInfo |
| A structure specifying the parameters of a sampler. More... | |
| using | SDL::GPUShaderCreateInfo = SDL_GPUShaderCreateInfo |
| A structure specifying code and metadata for creating a shader object. More... | |
| using | SDL::GPUComputePipelineCreateInfo = SDL_GPUComputePipelineCreateInfo |
| A structure specifying the parameters of a compute pipeline state. More... | |
| using | SDL::GPUGraphicsPipelineCreateInfo = SDL_GPUGraphicsPipelineCreateInfo |
| A structure specifying the parameters of a graphics pipeline state. More... | |
| using | SDL::GPUViewport = SDL_GPUViewport |
| A structure specifying a viewport. More... | |
| using | SDL::GPUBufferBinding = SDL_GPUBufferBinding |
| A structure specifying parameters in a buffer binding call. More... | |
| using | SDL::GPUIndexElementSize = SDL_GPUIndexElementSize |
| Specifies the size of elements in an index buffer. More... | |
| using | SDL::GPUTextureSamplerBinding = SDL_GPUTextureSamplerBinding |
| A structure specifying parameters in a sampler binding call. More... | |
| using | SDL::GPUBufferRegion = SDL_GPUBufferRegion |
| A structure specifying a region of a buffer. More... | |
| using | SDL::GPUTextureLocation = SDL_GPUTextureLocation |
| A structure specifying a location in a texture. More... | |
| using | SDL::GPUBufferLocation = SDL_GPUBufferLocation |
| A structure specifying a location in a buffer. More... | |
| using | SDL::GPUTextureRegion = SDL_GPUTextureRegion |
| A structure specifying a region of a texture. More... | |
| using | SDL::GPUTextureTransferInfo = SDL_GPUTextureTransferInfo |
| A structure specifying parameters related to transferring data to or from a texture. More... | |
| using | SDL::GPUTransferBufferLocation = SDL_GPUTransferBufferLocation |
| A structure specifying a location in a transfer buffer. More... | |
| using | SDL::GPUColorTargetInfo = SDL_GPUColorTargetInfo |
| A structure specifying the parameters of a color target used by a render pass. More... | |
| using | SDL::GPUDepthStencilTargetInfo = SDL_GPUDepthStencilTargetInfo |
| A structure specifying the parameters of a depth-stencil target used by a render pass. More... | |
| using | SDL::GPUStorageTextureReadWriteBinding = SDL_GPUStorageTextureReadWriteBinding |
| A structure specifying parameters related to binding textures in a compute pass. More... | |
| using | SDL::GPUStorageBufferReadWriteBinding = SDL_GPUStorageBufferReadWriteBinding |
| A structure specifying parameters related to binding buffers in a compute pass. More... | |
| using | SDL::GPUBlitInfo = SDL_GPUBlitInfo |
| A structure containing parameters for a blit command. More... | |
| using | SDL::GPUFence = SDL_GPUFence |
| An opaque handle representing a fence. More... | |
| using | SDL::GPUShaderFormat = Uint32 |
| Specifies the format of shader code. More... | |
| using | SDL::GPUSwapchainComposition = SDL_GPUSwapchainComposition |
| Specifies the texture format and colorspace of the swapchain textures. More... | |
| using | SDL::GPUPresentMode = SDL_GPUPresentMode |
| Specifies the timing that will be used to present swapchain textures to the OS. More... | |
| using | SDL::GPUTextureFormat = SDL_GPUTextureFormat |
| Specifies the pixel format of a texture. More... | |
| using | SDL::GPUTextureType = SDL_GPUTextureType |
| Specifies the type of a texture. More... | |
| using | SDL::GPUTextureUsageFlags = Uint32 |
| Specifies how a texture is intended to be used by the client. More... | |
| using | SDL::GPUSampleCount = SDL_GPUSampleCount |
| Specifies the sample count of a texture. More... | |
| using | SDL::GPUPrimitiveType = SDL_GPUPrimitiveType |
| Specifies the primitive topology of a graphics pipeline. More... | |
| using | SDL::GPULoadOp = SDL_GPULoadOp |
| Specifies how the contents of a texture attached to a render pass are treated at the beginning of the render pass. More... | |
| using | SDL::GPUStoreOp = SDL_GPUStoreOp |
| Specifies how the contents of a texture attached to a render pass are treated at the end of the render pass. More... | |
| using | SDL::GPUCubeMapFace = SDL_GPUCubeMapFace |
| Specifies the face of a cube map. More... | |
| using | SDL::GPUBufferUsageFlags = Uint32 |
| Specifies how a buffer is intended to be used by the client. More... | |
| using | SDL::GPUTransferBufferUsage = SDL_GPUTransferBufferUsage |
| Specifies how a transfer buffer is intended to be used by the client. More... | |
| using | SDL::GPUShaderStage = SDL_GPUShaderStage |
| Specifies which stage a shader program corresponds to. More... | |
| using | SDL::GPUVertexElementFormat = SDL_GPUVertexElementFormat |
| Specifies the format of a vertex attribute. More... | |
| using | SDL::GPUVertexInputRate = SDL_GPUVertexInputRate |
| Specifies the rate at which vertex attributes are pulled from buffers. More... | |
| using | SDL::GPUFillMode = SDL_GPUFillMode |
| Specifies the fill mode of the graphics pipeline. More... | |
| using | SDL::GPUCullMode = SDL_GPUCullMode |
| Specifies the facing direction in which triangle faces will be culled. More... | |
| using | SDL::GPUFrontFace = SDL_GPUFrontFace |
| Specifies the vertex winding that will cause a triangle to be determined to be front-facing. More... | |
| using | SDL::GPUCompareOp = SDL_GPUCompareOp |
| Specifies a comparison operator for depth, stencil and sampler operations. More... | |
| using | SDL::GPUStencilOp = SDL_GPUStencilOp |
| Specifies what happens to a stored stencil value if stencil tests fail or pass. More... | |
| using | SDL::GPUBlendOp = SDL_GPUBlendOp |
| Specifies the operator to be used when pixels in a render target are blended with existing pixels in the texture. More... | |
| using | SDL::GPUBlendFactor = SDL_GPUBlendFactor |
| Specifies a blending factor to be used when pixels in a render target are blended with existing pixels in the texture. More... | |
| using | SDL::GPUColorComponentFlags = Uint8 |
| Specifies which color components are written in a graphics pipeline. More... | |
| using | SDL::GPUFilter = SDL_GPUFilter |
| Specifies a filter operation used by a sampler. More... | |
| using | SDL::GPUSamplerMipmapMode = SDL_GPUSamplerMipmapMode |
| Specifies a mipmap mode used by a sampler. More... | |
| using | SDL::GPUSamplerAddressMode = SDL_GPUSamplerAddressMode |
| Specifies behavior of texture sampling when the coordinates exceed the 0-1 range. More... | |
| using | SDL::GPUBlitRegion = SDL_GPUBlitRegion |
| A structure specifying a region of a texture used in the blit operation. More... | |
| using | SDL::GPUIndirectDrawCommand = SDL_GPUIndirectDrawCommand |
| A structure specifying the parameters of an indirect draw command. More... | |
| using | SDL::GPUIndexedIndirectDrawCommand = SDL_GPUIndexedIndirectDrawCommand |
| A structure specifying the parameters of an indexed indirect draw command. More... | |
| using | SDL::GPUIndirectDispatchCommand = SDL_GPUIndirectDispatchCommand |
| A structure specifying the parameters of an indexed dispatch command. More... | |
| using | SDL::GPUVertexBufferDescription = SDL_GPUVertexBufferDescription |
| A structure specifying the parameters of vertex buffers used in a graphics pipeline. More... | |
| using | SDL::GPUVertexAttribute = SDL_GPUVertexAttribute |
| A structure specifying a vertex attribute. More... | |
| using | SDL::GPUVertexInputState = SDL_GPUVertexInputState |
| A structure specifying the parameters of a graphics pipeline vertex input state. More... | |
| using | SDL::GPUStencilOpState = SDL_GPUStencilOpState |
| A structure specifying the stencil operation state of a graphics pipeline. More... | |
| using | SDL::GPUColorTargetBlendState = SDL_GPUColorTargetBlendState |
| A structure specifying the blend state of a color target. More... | |
| using | SDL::GPURasterizerState = SDL_GPURasterizerState |
| A structure specifying the parameters of the graphics pipeline rasterizer state. More... | |
| using | SDL::GPUMultisampleState = SDL_GPUMultisampleState |
| A structure specifying the parameters of the graphics pipeline multisample state. More... | |
| using | SDL::GPUDepthStencilState = SDL_GPUDepthStencilState |
| A structure specifying the parameters of the graphics pipeline depth stencil state. More... | |
| using | SDL::GPUColorTargetDescription = SDL_GPUColorTargetDescription |
| A structure specifying the parameters of color targets used in a graphics pipeline. More... | |
| using | SDL::GPUGraphicsPipelineTargetInfo = SDL_GPUGraphicsPipelineTargetInfo |
| A structure specifying the descriptions of render targets used in a graphics pipeline. More... | |
| using | SDL::GPUVulkanOptions = SDL_GPUVulkanOptions |
| A structure specifying additional options when using Vulkan. More... | |
Functions | |
| bool | SDL::GPUSupportsShaderFormats (GPUShaderFormat format_flags, StringParam name) |
| Checks for GPU runtime support. More... | |
| bool | SDL::GPUSupportsProperties (PropertiesParam props) |
| Checks for GPU runtime support. More... | |
| GPUDevice | SDL::CreateGPUDevice (GPUShaderFormat format_flags, bool debug_mode, StringParam name) |
| Creates a GPU context. More... | |
| GPUDevice | SDL::CreateGPUDeviceWithProperties (PropertiesParam props) |
| Creates a GPU context. More... | |
| void | SDL::DestroyGPUDevice (GPUDeviceRaw device) |
| Destroys a GPU context previously returned by GPUDevice.GPUDevice. More... | |
| int | SDL::GetNumGPUDrivers () |
| Get the number of GPU drivers compiled into SDL. More... | |
| const char * | SDL::GetGPUDriver (int index) |
| Get the name of a built in GPU driver. More... | |
| const char * | SDL::GetGPUDeviceDriver (GPUDeviceParam device) |
| Returns the name of the backend used to create this GPU context. More... | |
| GPUShaderFormat | SDL::GetGPUShaderFormats (GPUDeviceParam device) |
| Returns the supported shader formats for this GPU context. More... | |
| PropertiesRef | SDL::GetGPUDeviceProperties (GPUDeviceParam device) |
| Get the properties associated with a GPU device. More... | |
| GPUComputePipeline | SDL::CreateGPUComputePipeline (GPUDeviceParam device, const GPUComputePipelineCreateInfo &createinfo) |
| Creates a pipeline object to be used in a compute workflow. More... | |
| GPUGraphicsPipeline | SDL::CreateGPUGraphicsPipeline (GPUDeviceParam device, const GPUGraphicsPipelineCreateInfo &createinfo) |
| Creates a pipeline object to be used in a graphics workflow. More... | |
| GPUSampler | SDL::CreateGPUSampler (GPUDeviceParam device, const GPUSamplerCreateInfo &createinfo) |
| Creates a sampler object to be used when binding textures in a graphics workflow. More... | |
| GPUShader | SDL::CreateGPUShader (GPUDeviceParam device, const GPUShaderCreateInfo &createinfo) |
| Creates a shader to be used when creating a graphics pipeline. More... | |
| GPUTexture | SDL::CreateGPUTexture (GPUDeviceParam device, const GPUTextureCreateInfo &createinfo) |
| Creates a texture object to be used in graphics or compute workflows. More... | |
| GPUBuffer | SDL::CreateGPUBuffer (GPUDeviceParam device, const GPUBufferCreateInfo &createinfo) |
| Creates a buffer object to be used in graphics or compute workflows. More... | |
| GPUTransferBuffer | SDL::CreateGPUTransferBuffer (GPUDeviceParam device, const GPUTransferBufferCreateInfo &createinfo) |
| Creates a transfer buffer to be used when uploading to or downloading from graphics resources. More... | |
| void | SDL::SetGPUBufferName (GPUDeviceParam device, GPUBuffer buffer, StringParam text) |
| Sets an arbitrary string constant to label a buffer. More... | |
| void | SDL::SetGPUTextureName (GPUDeviceParam device, GPUTexture texture, StringParam text) |
| Sets an arbitrary string constant to label a texture. More... | |
| void | SDL::InsertGPUDebugLabel (GPUCommandBuffer command_buffer, StringParam text) |
| Inserts an arbitrary string label into the command buffer callstream. More... | |
| void | SDL::PushGPUDebugGroup (GPUCommandBuffer command_buffer, StringParam name) |
| Begins a debug group with an arbitrary name. More... | |
| void | SDL::PopGPUDebugGroup (GPUCommandBuffer command_buffer) |
| Ends the most-recently pushed debug group. More... | |
| void | SDL::ReleaseGPUTexture (GPUDeviceParam device, GPUTexture texture) |
| Frees the given texture as soon as it is safe to do so. More... | |
| void | SDL::ReleaseGPUSampler (GPUDeviceParam device, GPUSampler sampler) |
| Frees the given sampler as soon as it is safe to do so. More... | |
| void | SDL::ReleaseGPUBuffer (GPUDeviceParam device, GPUBuffer buffer) |
| Frees the given buffer as soon as it is safe to do so. More... | |
| void | SDL::ReleaseGPUTransferBuffer (GPUDeviceParam device, GPUTransferBuffer transfer_buffer) |
| Frees the given transfer buffer as soon as it is safe to do so. More... | |
| void | SDL::ReleaseGPUComputePipeline (GPUDeviceParam device, GPUComputePipeline compute_pipeline) |
| Frees the given compute pipeline as soon as it is safe to do so. More... | |
| void | SDL::ReleaseGPUShader (GPUDeviceParam device, GPUShader shader) |
| Frees the given shader as soon as it is safe to do so. More... | |
| void | SDL::ReleaseGPUGraphicsPipeline (GPUDeviceParam device, GPUGraphicsPipeline graphics_pipeline) |
| Frees the given graphics pipeline as soon as it is safe to do so. More... | |
| GPUCommandBuffer | SDL::AcquireGPUCommandBuffer (GPUDeviceParam device) |
| Acquire a command buffer. More... | |
| void | SDL::PushGPUVertexUniformData (GPUCommandBuffer command_buffer, Uint32 slot_index, SourceBytes data) |
| Pushes data to a vertex uniform slot on the command buffer. More... | |
| void | SDL::PushGPUFragmentUniformData (GPUCommandBuffer command_buffer, Uint32 slot_index, SourceBytes data) |
| Pushes data to a fragment uniform slot on the command buffer. More... | |
| void | SDL::PushGPUComputeUniformData (GPUCommandBuffer command_buffer, Uint32 slot_index, SourceBytes data) |
| Pushes data to a uniform slot on the command buffer. More... | |
| GPURenderPass | SDL::BeginGPURenderPass (GPUCommandBuffer command_buffer, std::span< const GPUColorTargetInfo > color_target_infos, OptionalRef< const GPUDepthStencilTargetInfo > depth_stencil_target_info) |
| Begins a render pass on a command buffer. More... | |
| void | SDL::BindGPUGraphicsPipeline (GPURenderPass render_pass, GPUGraphicsPipeline graphics_pipeline) |
| Binds a graphics pipeline on a render pass to be used in rendering. More... | |
| void | SDL::SetGPUViewport (GPURenderPass render_pass, const GPUViewport &viewport) |
| Sets the current viewport state on a command buffer. More... | |
| void | SDL::SetGPUScissor (GPURenderPass render_pass, const RectRaw &scissor) |
| Sets the current scissor state on a command buffer. More... | |
| void | SDL::SetGPUBlendConstants (GPURenderPass render_pass, FColorRaw blend_constants) |
| Sets the current blend constants on a command buffer. More... | |
| void | SDL::SetGPUStencilReference (GPURenderPass render_pass, Uint8 reference) |
| Sets the current stencil reference value on a command buffer. More... | |
| void | SDL::BindGPUVertexBuffers (GPURenderPass render_pass, Uint32 first_slot, std::span< const GPUBufferBinding > bindings) |
| Binds vertex buffers on a command buffer for use with subsequent draw calls. More... | |
| void | SDL::BindGPUIndexBuffer (GPURenderPass render_pass, const GPUBufferBinding &binding, GPUIndexElementSize index_element_size) |
| Binds an index buffer on a command buffer for use with subsequent draw calls. More... | |
| void | SDL::BindGPUVertexSamplers (GPURenderPass render_pass, Uint32 first_slot, std::span< const GPUTextureSamplerBinding > texture_sampler_bindings) |
| Binds texture-sampler pairs for use on the vertex shader. More... | |
| void | SDL::BindGPUVertexStorageTextures (GPURenderPass render_pass, Uint32 first_slot, SpanRef< const GPUTextureRaw > storage_textures) |
| Binds storage textures for use on the vertex shader. More... | |
| void | SDL::BindGPUVertexStorageBuffers (GPURenderPass render_pass, Uint32 first_slot, SpanRef< const GPUBufferRaw > storage_buffers) |
| Binds storage buffers for use on the vertex shader. More... | |
| void | SDL::BindGPUFragmentSamplers (GPURenderPass render_pass, Uint32 first_slot, std::span< const GPUTextureSamplerBinding > texture_sampler_bindings) |
| Binds texture-sampler pairs for use on the fragment shader. More... | |
| void | SDL::BindGPUFragmentStorageTextures (GPURenderPass render_pass, Uint32 first_slot, SpanRef< const GPUTextureRaw > storage_textures) |
| Binds storage textures for use on the fragment shader. More... | |
| void | SDL::BindGPUFragmentStorageBuffers (GPURenderPass render_pass, Uint32 first_slot, SpanRef< const GPUBufferRaw > storage_buffers) |
| Binds storage buffers for use on the fragment shader. More... | |
| void | SDL::DrawGPUIndexedPrimitives (GPURenderPass render_pass, Uint32 num_indices, Uint32 num_instances, Uint32 first_index, Sint32 vertex_offset, Uint32 first_instance) |
| Draws data using bound graphics state with an index buffer and instancing enabled. More... | |
| void | SDL::DrawGPUPrimitives (GPURenderPass render_pass, Uint32 num_vertices, Uint32 num_instances, Uint32 first_vertex, Uint32 first_instance) |
| Draws data using bound graphics state. More... | |
| void | SDL::DrawGPUPrimitivesIndirect (GPURenderPass render_pass, GPUBuffer buffer, Uint32 offset, Uint32 draw_count) |
| Draws data using bound graphics state and with draw parameters set from a buffer. More... | |
| void | SDL::DrawGPUIndexedPrimitivesIndirect (GPURenderPass render_pass, GPUBuffer buffer, Uint32 offset, Uint32 draw_count) |
| Draws data using bound graphics state with an index buffer enabled and with draw parameters set from a buffer. More... | |
| void | SDL::EndGPURenderPass (GPURenderPass render_pass) |
| Ends the given render pass. More... | |
| GPUComputePass | SDL::BeginGPUComputePass (GPUCommandBuffer command_buffer, std::span< const GPUStorageTextureReadWriteBinding > storage_texture_bindings, std::span< const GPUStorageBufferReadWriteBinding > storage_buffer_bindings) |
| Begins a compute pass on a command buffer. More... | |
| void | SDL::BindGPUComputePipeline (GPUComputePass compute_pass, GPUComputePipeline compute_pipeline) |
| Binds a compute pipeline on a command buffer for use in compute dispatch. More... | |
| void | SDL::BindGPUComputeSamplers (GPUComputePass compute_pass, Uint32 first_slot, std::span< const GPUTextureSamplerBinding > texture_sampler_bindings) |
| Binds texture-sampler pairs for use on the compute shader. More... | |
| void | SDL::BindGPUComputeStorageTextures (GPUComputePass compute_pass, Uint32 first_slot, SpanRef< const GPUTextureRaw > storage_textures) |
| Binds storage textures as readonly for use on the compute pipeline. More... | |
| void | SDL::BindGPUComputeStorageBuffers (GPUComputePass compute_pass, Uint32 first_slot, SpanRef< const GPUBufferRaw > storage_buffers) |
| Binds storage buffers as readonly for use on the compute pipeline. More... | |
| void | SDL::DispatchGPUCompute (GPUComputePass compute_pass, Uint32 groupcount_x, Uint32 groupcount_y, Uint32 groupcount_z) |
| Dispatches compute work. More... | |
| void | SDL::DispatchGPUComputeIndirect (GPUComputePass compute_pass, GPUBuffer buffer, Uint32 offset) |
| Dispatches compute work with parameters set from a buffer. More... | |
| void | SDL::EndGPUComputePass (GPUComputePass compute_pass) |
| Ends the current compute pass. More... | |
| void * | SDL::MapGPUTransferBuffer (GPUDeviceParam device, GPUTransferBuffer transfer_buffer, bool cycle) |
| Maps a transfer buffer into application address space. More... | |
| void | SDL::UnmapGPUTransferBuffer (GPUDeviceParam device, GPUTransferBuffer transfer_buffer) |
| Unmaps a previously mapped transfer buffer. More... | |
| GPUCopyPass | SDL::BeginGPUCopyPass (GPUCommandBuffer command_buffer) |
| Begins a copy pass on a command buffer. More... | |
| void | SDL::UploadToGPUTexture (GPUCopyPass copy_pass, const GPUTextureTransferInfo &source, const GPUTextureRegion &destination, bool cycle) |
| Uploads data from a transfer buffer to a texture. More... | |
| void | SDL::UploadToGPUBuffer (GPUCopyPass copy_pass, const GPUTransferBufferLocation &source, const GPUBufferRegion &destination, bool cycle) |
| Uploads data from a transfer buffer to a buffer. More... | |
| void | SDL::CopyGPUTextureToTexture (GPUCopyPass copy_pass, const GPUTextureLocation &source, const GPUTextureLocation &destination, Uint32 w, Uint32 h, Uint32 d, bool cycle) |
| Performs a texture-to-texture copy. More... | |
| void | SDL::CopyGPUBufferToBuffer (GPUCopyPass copy_pass, const GPUBufferLocation &source, const GPUBufferLocation &destination, Uint32 size, bool cycle) |
| Performs a buffer-to-buffer copy. More... | |
| void | SDL::DownloadFromGPUTexture (GPUCopyPass copy_pass, const GPUTextureRegion &source, const GPUTextureTransferInfo &destination) |
| Copies data from a texture to a transfer buffer on the GPU timeline. More... | |
| void | SDL::DownloadFromGPUBuffer (GPUCopyPass copy_pass, const GPUBufferRegion &source, const GPUTransferBufferLocation &destination) |
| Copies data from a buffer to a transfer buffer on the GPU timeline. More... | |
| void | SDL::EndGPUCopyPass (GPUCopyPass copy_pass) |
| Ends the current copy pass. More... | |
| void | SDL::GenerateMipmapsForGPUTexture (GPUCommandBuffer command_buffer, GPUTexture texture) |
| Generates mipmaps for the given texture. More... | |
| void | SDL::BlitGPUTexture (GPUCommandBuffer command_buffer, const GPUBlitInfo &info) |
| Blits from a source texture region to a destination texture region. More... | |
| bool | SDL::WindowSupportsGPUSwapchainComposition (GPUDeviceParam device, WindowParam window, GPUSwapchainComposition swapchain_composition) |
| Determines whether a swapchain composition is supported by the window. More... | |
| bool | SDL::WindowSupportsGPUPresentMode (GPUDeviceParam device, WindowParam window, GPUPresentMode present_mode) |
| Determines whether a presentation mode is supported by the window. More... | |
| void | SDL::ClaimWindowForGPUDevice (GPUDeviceParam device, WindowParam window) |
| Claims a window, creating a swapchain structure for it. More... | |
| void | SDL::ReleaseWindowFromGPUDevice (GPUDeviceParam device, WindowParam window) |
| Unclaims a window, destroying its swapchain structure. More... | |
| bool | SDL::SetGPUSwapchainParameters (GPUDeviceParam device, WindowParam window, GPUSwapchainComposition swapchain_composition, GPUPresentMode present_mode) |
| Changes the swapchain parameters for the given claimed window. More... | |
| bool | SDL::SetGPUAllowedFramesInFlight (GPUDeviceParam device, Uint32 allowed_frames_in_flight) |
| Configures the maximum allowed number of frames in flight. More... | |
| GPUTextureFormat | SDL::GetGPUSwapchainTextureFormat (GPUDeviceParam device, WindowParam window) |
| Obtains the texture format of the swapchain for the given window. More... | |
| GPUTexture | SDL::AcquireGPUSwapchainTexture (GPUCommandBuffer command_buffer, WindowParam window, Uint32 *swapchain_texture_width=nullptr, Uint32 *swapchain_texture_height=nullptr) |
| Acquire a texture to use in presentation. More... | |
| void | SDL::WaitForGPUSwapchain (GPUDeviceParam device, WindowParam window) |
| Blocks the thread until a swapchain texture is available to be acquired. More... | |
| GPUTexture | SDL::WaitAndAcquireGPUSwapchainTexture (GPUCommandBuffer command_buffer, WindowParam window, Uint32 *swapchain_texture_width=nullptr, Uint32 *swapchain_texture_height=nullptr) |
| Blocks the thread until a swapchain texture is available to be acquired, and then acquires it. More... | |
| void | SDL::SubmitGPUCommandBuffer (GPUCommandBuffer command_buffer) |
| Submits a command buffer so its commands can be processed on the GPU. More... | |
| GPUFence * | SDL::SubmitGPUCommandBufferAndAcquireFence (GPUCommandBuffer command_buffer) |
| Submits a command buffer so its commands can be processed on the GPU, and acquires a fence associated with the command buffer. More... | |
| void | SDL::CancelGPUCommandBuffer (GPUCommandBuffer command_buffer) |
| Cancels a command buffer. More... | |
| void | SDL::WaitForGPUIdle (GPUDeviceParam device) |
| Blocks the thread until the GPU is completely idle. More... | |
| void | SDL::WaitForGPUFences (GPUDeviceParam device, bool wait_all, std::span< GPUFence *const > fences) |
| Blocks the thread until the given fences are signaled. More... | |
| bool | SDL::QueryGPUFence (GPUDeviceParam device, GPUFence *fence) |
| Checks the status of a fence. More... | |
| void | SDL::ReleaseGPUFence (GPUDeviceParam device, GPUFence *fence) |
| Releases a fence obtained from GPUCommandBuffer.SubmitAndAcquireFence. More... | |
| Uint32 | SDL::GPUTextureFormatTexelBlockSize (GPUTextureFormat format) |
| Obtains the texel block size for a texture format. More... | |
| bool | SDL::GPUTextureSupportsFormat (GPUDeviceParam device, GPUTextureFormat format, GPUTextureType type, GPUTextureUsageFlags usage) |
| Determines whether a texture format is supported for a given type and usage. More... | |
| bool | SDL::GPUTextureSupportsSampleCount (GPUDeviceParam device, GPUTextureFormat format, GPUSampleCount sample_count) |
| Determines if a sample count for a texture format is supported. More... | |
| Uint32 | SDL::CalculateGPUTextureFormatSize (GPUTextureFormat format, Uint32 width, Uint32 height, Uint32 depth_or_layer_count) |
| Calculate the size in bytes of a texture format with dimensions. More... | |
| PixelFormat | SDL::GetPixelFormatFromGPUTextureFormat (GPUTextureFormat format) |
| Get the SDL pixel format corresponding to a GPU texture format. More... | |
| GPUTextureFormat | SDL::GetGPUTextureFormatFromPixelFormat (PixelFormat format) |
| Get the GPU texture format corresponding to an SDL pixel format. More... | |
| void | SDL::GDKSuspendGPU (GPUDeviceParam device) |
| Call this to suspend GPU operation on Xbox when you receive the EVENT_DID_ENTER_BACKGROUND event. More... | |
| void | SDL::GDKResumeGPU (GPUDeviceParam device) |
| Call this to resume GPU operation on Xbox when you receive the EVENT_WILL_ENTER_FOREGROUND event. More... | |
| void | SDL::GPUDevice::Destroy () |
| Destroys a GPU context previously returned by GPUDevice.GPUDevice. More... | |
| const char * | SDL::GPUDevice::GetDriver () |
| Returns the name of the backend used to create this GPU context. More... | |
| GPUShaderFormat | SDL::GPUDevice::GetShaderFormats () |
| Returns the supported shader formats for this GPU context. More... | |
| PropertiesRef | SDL::GPUDevice::GetProperties () |
| Get the properties associated with a GPU device. More... | |
| GPUComputePipeline | SDL::GPUDevice::CreateComputePipeline (const GPUComputePipelineCreateInfo &createinfo) |
| Creates a pipeline object to be used in a compute workflow. More... | |
| GPUGraphicsPipeline | SDL::GPUDevice::CreateGraphicsPipeline (const GPUGraphicsPipelineCreateInfo &createinfo) |
| Creates a pipeline object to be used in a graphics workflow. More... | |
| GPUSampler | SDL::GPUDevice::CreateSampler (const GPUSamplerCreateInfo &createinfo) |
| Creates a sampler object to be used when binding textures in a graphics workflow. More... | |
| GPUShader | SDL::GPUDevice::CreateShader (const GPUShaderCreateInfo &createinfo) |
| Creates a shader to be used when creating a graphics pipeline. More... | |
| GPUTexture | SDL::GPUDevice::CreateTexture (const GPUTextureCreateInfo &createinfo) |
| Creates a texture object to be used in graphics or compute workflows. More... | |
| GPUBuffer | SDL::GPUDevice::CreateBuffer (const GPUBufferCreateInfo &createinfo) |
| Creates a buffer object to be used in graphics or compute workflows. More... | |
| GPUTransferBuffer | SDL::GPUDevice::CreateTransferBuffer (const GPUTransferBufferCreateInfo &createinfo) |
| Creates a transfer buffer to be used when uploading to or downloading from graphics resources. More... | |
| void | SDL::GPUDevice::SetBufferName (GPUBuffer buffer, StringParam text) |
| Sets an arbitrary string constant to label a buffer. More... | |
| void | SDL::GPUDevice::SetTextureName (GPUTexture texture, StringParam text) |
| Sets an arbitrary string constant to label a texture. More... | |
| void | SDL::GPUCommandBuffer::InsertDebugLabel (StringParam text) |
| Inserts an arbitrary string label into the command buffer callstream. More... | |
| void | SDL::GPUCommandBuffer::PushDebugGroup (StringParam name) |
| Begins a debug group with an arbitrary name. More... | |
| void | SDL::GPUCommandBuffer::PopDebugGroup () |
| Ends the most-recently pushed debug group. More... | |
| void | SDL::GPUDevice::ReleaseTexture (GPUTexture texture) |
| Frees the given texture as soon as it is safe to do so. More... | |
| void | SDL::GPUDevice::ReleaseSampler (GPUSampler sampler) |
| Frees the given sampler as soon as it is safe to do so. More... | |
| void | SDL::GPUDevice::ReleaseBuffer (GPUBuffer buffer) |
| Frees the given buffer as soon as it is safe to do so. More... | |
| void | SDL::GPUDevice::ReleaseTransferBuffer (GPUTransferBuffer transfer_buffer) |
| Frees the given transfer buffer as soon as it is safe to do so. More... | |
| void | SDL::GPUDevice::ReleaseComputePipeline (GPUComputePipeline compute_pipeline) |
| Frees the given compute pipeline as soon as it is safe to do so. More... | |
| void | SDL::GPUDevice::ReleaseShader (GPUShader shader) |
| Frees the given shader as soon as it is safe to do so. More... | |
| void | SDL::GPUDevice::ReleaseGraphicsPipeline (GPUGraphicsPipeline graphics_pipeline) |
| Frees the given graphics pipeline as soon as it is safe to do so. More... | |
| GPUCommandBuffer | SDL::GPUDevice::AcquireCommandBuffer () |
| Acquire a command buffer. More... | |
| void | SDL::GPUCommandBuffer::PushVertexUniformData (Uint32 slot_index, SourceBytes data) |
| Pushes data to a vertex uniform slot on the command buffer. More... | |
| void | SDL::GPUCommandBuffer::PushFragmentUniformData (Uint32 slot_index, SourceBytes data) |
| Pushes data to a fragment uniform slot on the command buffer. More... | |
| void | SDL::GPUCommandBuffer::PushComputeUniformData (Uint32 slot_index, SourceBytes data) |
| Pushes data to a uniform slot on the command buffer. More... | |
| GPURenderPass | SDL::GPUCommandBuffer::BeginRenderPass (std::span< const GPUColorTargetInfo > color_target_infos, OptionalRef< const GPUDepthStencilTargetInfo > depth_stencil_target_info) |
| Begins a render pass on a command buffer. More... | |
| void | SDL::GPURenderPass::BindPipeline (GPUGraphicsPipeline graphics_pipeline) |
| Binds a graphics pipeline on a render pass to be used in rendering. More... | |
| void | SDL::GPURenderPass::SetViewport (const GPUViewport &viewport) |
| Sets the current viewport state on a command buffer. More... | |
| void | SDL::GPURenderPass::SetScissor (const RectRaw &scissor) |
| Sets the current scissor state on a command buffer. More... | |
| void | SDL::GPURenderPass::SetBlendConstants (FColorRaw blend_constants) |
| Sets the current blend constants on a command buffer. More... | |
| void | SDL::GPURenderPass::SetStencilReference (Uint8 reference) |
| Sets the current stencil reference value on a command buffer. More... | |
| void | SDL::GPURenderPass::BindVertexBuffers (Uint32 first_slot, std::span< const GPUBufferBinding > bindings) |
| Binds vertex buffers on a command buffer for use with subsequent draw calls. More... | |
| void | SDL::GPURenderPass::BindIndexBuffer (const GPUBufferBinding &binding, GPUIndexElementSize index_element_size) |
| Binds an index buffer on a command buffer for use with subsequent draw calls. More... | |
| void | SDL::GPURenderPass::BindVertexSamplers (Uint32 first_slot, std::span< const GPUTextureSamplerBinding > texture_sampler_bindings) |
| Binds texture-sampler pairs for use on the vertex shader. More... | |
| void | SDL::GPURenderPass::BindVertexStorageTextures (Uint32 first_slot, SpanRef< const GPUTextureRaw > storage_textures) |
| Binds storage textures for use on the vertex shader. More... | |
| void | SDL::GPURenderPass::BindVertexStorageBuffers (Uint32 first_slot, SpanRef< const GPUBufferRaw > storage_buffers) |
| Binds storage buffers for use on the vertex shader. More... | |
| void | SDL::GPURenderPass::BindFragmentSamplers (Uint32 first_slot, std::span< const GPUTextureSamplerBinding > texture_sampler_bindings) |
| Binds texture-sampler pairs for use on the fragment shader. More... | |
| void | SDL::GPURenderPass::BindFragmentStorageTextures (Uint32 first_slot, SpanRef< const GPUTextureRaw > storage_textures) |
| Binds storage textures for use on the fragment shader. More... | |
| void | SDL::GPURenderPass::BindFragmentStorageBuffers (Uint32 first_slot, SpanRef< const GPUBufferRaw > storage_buffers) |
| Binds storage buffers for use on the fragment shader. More... | |
| void | SDL::GPURenderPass::DrawIndexedPrimitives (Uint32 num_indices, Uint32 num_instances, Uint32 first_index, Sint32 vertex_offset, Uint32 first_instance) |
| Draws data using bound graphics state with an index buffer and instancing enabled. More... | |
| void | SDL::GPURenderPass::DrawPrimitives (Uint32 num_vertices, Uint32 num_instances, Uint32 first_vertex, Uint32 first_instance) |
| Draws data using bound graphics state. More... | |
| void | SDL::GPURenderPass::DrawPrimitivesIndirect (GPUBuffer buffer, Uint32 offset, Uint32 draw_count) |
| Draws data using bound graphics state and with draw parameters set from a buffer. More... | |
| void | SDL::GPURenderPass::DrawIndexedPrimitivesIndirect (GPUBuffer buffer, Uint32 offset, Uint32 draw_count) |
| Draws data using bound graphics state with an index buffer enabled and with draw parameters set from a buffer. More... | |
| void | SDL::GPURenderPass::End () |
| Ends the given render pass. More... | |
| GPUComputePass | SDL::GPUCommandBuffer::BeginComputePass (std::span< const GPUStorageTextureReadWriteBinding > storage_texture_bindings, std::span< const GPUStorageBufferReadWriteBinding > storage_buffer_bindings) |
| Begins a compute pass on a command buffer. More... | |
| void | SDL::GPUComputePass::BindPipeline (GPUComputePipeline compute_pipeline) |
| Binds a compute pipeline on a command buffer for use in compute dispatch. More... | |
| void | SDL::GPUComputePass::BindSamplers (Uint32 first_slot, std::span< const GPUTextureSamplerBinding > texture_sampler_bindings) |
| Binds texture-sampler pairs for use on the compute shader. More... | |
| void | SDL::GPUComputePass::BindStorageTextures (Uint32 first_slot, SpanRef< const GPUTextureRaw > storage_textures) |
| Binds storage textures as readonly for use on the compute pipeline. More... | |
| void | SDL::GPUComputePass::BindStorageBuffers (Uint32 first_slot, SpanRef< const GPUBufferRaw > storage_buffers) |
| Binds storage buffers as readonly for use on the compute pipeline. More... | |
| void | SDL::GPUComputePass::Dispatch (Uint32 groupcount_x, Uint32 groupcount_y, Uint32 groupcount_z) |
| Dispatches compute work. More... | |
| void | SDL::GPUComputePass::DispatchIndirect (GPUBuffer buffer, Uint32 offset) |
| Dispatches compute work with parameters set from a buffer. More... | |
| void | SDL::GPUComputePass::End () |
| Ends the current compute pass. More... | |
| void * | SDL::GPUDevice::MapTransferBuffer (GPUTransferBuffer transfer_buffer, bool cycle) |
| Maps a transfer buffer into application address space. More... | |
| void | SDL::GPUDevice::UnmapTransferBuffer (GPUTransferBuffer transfer_buffer) |
| Unmaps a previously mapped transfer buffer. More... | |
| GPUCopyPass | SDL::GPUCommandBuffer::BeginCopyPass () |
| Begins a copy pass on a command buffer. More... | |
| void | SDL::GPUCopyPass::UploadToTexture (const GPUTextureTransferInfo &source, const GPUTextureRegion &destination, bool cycle) |
| Uploads data from a transfer buffer to a texture. More... | |
| void | SDL::GPUCopyPass::UploadToBuffer (const GPUTransferBufferLocation &source, const GPUBufferRegion &destination, bool cycle) |
| Uploads data from a transfer buffer to a buffer. More... | |
| void | SDL::GPUCopyPass::CopyTextureToTexture (const GPUTextureLocation &source, const GPUTextureLocation &destination, Uint32 w, Uint32 h, Uint32 d, bool cycle) |
| Performs a texture-to-texture copy. More... | |
| void | SDL::GPUCopyPass::CopyBufferToBuffer (const GPUBufferLocation &source, const GPUBufferLocation &destination, Uint32 size, bool cycle) |
| Performs a buffer-to-buffer copy. More... | |
| void | SDL::GPUCopyPass::DownloadFromTexture (const GPUTextureRegion &source, const GPUTextureTransferInfo &destination) |
| Copies data from a texture to a transfer buffer on the GPU timeline. More... | |
| void | SDL::GPUCopyPass::DownloadFromBuffer (const GPUBufferRegion &source, const GPUTransferBufferLocation &destination) |
| Copies data from a buffer to a transfer buffer on the GPU timeline. More... | |
| void | SDL::GPUCopyPass::End () |
| Ends the current copy pass. More... | |
| void | SDL::GPUCommandBuffer::GenerateMipmapsForTexture (GPUTexture texture) |
| Generates mipmaps for the given texture. More... | |
| void | SDL::GPUCommandBuffer::BlitTexture (const GPUBlitInfo &info) |
| Blits from a source texture region to a destination texture region. More... | |
| bool | SDL::GPUDevice::WindowSupportsSwapchainComposition (WindowParam window, GPUSwapchainComposition swapchain_composition) |
| Determines whether a swapchain composition is supported by the window. More... | |
| bool | SDL::GPUDevice::WindowSupportsPresentMode (WindowParam window, GPUPresentMode present_mode) |
| Determines whether a presentation mode is supported by the window. More... | |
| void | SDL::GPUDevice::ClaimWindow (WindowParam window) |
| Claims a window, creating a swapchain structure for it. More... | |
| void | SDL::GPUDevice::ReleaseWindow (WindowParam window) |
| Unclaims a window, destroying its swapchain structure. More... | |
| bool | SDL::GPUDevice::SetSwapchainParameters (WindowParam window, GPUSwapchainComposition swapchain_composition, GPUPresentMode present_mode) |
| Changes the swapchain parameters for the given claimed window. More... | |
| bool | SDL::GPUDevice::SetAllowedFramesInFlight (Uint32 allowed_frames_in_flight) |
| Configures the maximum allowed number of frames in flight. More... | |
| GPUTextureFormat | SDL::GPUDevice::GetSwapchainTextureFormat (WindowParam window) |
| Obtains the texture format of the swapchain for the given window. More... | |
| GPUTexture | SDL::GPUCommandBuffer::AcquireSwapchainTexture (WindowParam window, Uint32 *swapchain_texture_width=nullptr, Uint32 *swapchain_texture_height=nullptr) |
| Acquire a texture to use in presentation. More... | |
| void | SDL::GPUDevice::WaitForSwapchain (WindowParam window) |
| Blocks the thread until a swapchain texture is available to be acquired. More... | |
| GPUTexture | SDL::GPUCommandBuffer::WaitAndAcquireSwapchainTexture (WindowParam window, Uint32 *swapchain_texture_width=nullptr, Uint32 *swapchain_texture_height=nullptr) |
| Blocks the thread until a swapchain texture is available to be acquired, and then acquires it. More... | |
| void | SDL::GPUCommandBuffer::Submit () |
| Submits a command buffer so its commands can be processed on the GPU. More... | |
| GPUFence * | SDL::GPUCommandBuffer::SubmitAndAcquireFence () |
| Submits a command buffer so its commands can be processed on the GPU, and acquires a fence associated with the command buffer. More... | |
| void | SDL::GPUCommandBuffer::Cancel () |
| Cancels a command buffer. More... | |
| void | SDL::GPUDevice::WaitForIdle () |
| Blocks the thread until the GPU is completely idle. More... | |
| void | SDL::GPUDevice::WaitForFences (bool wait_all, std::span< GPUFence *const > fences) |
| Blocks the thread until the given fences are signaled. More... | |
| bool | SDL::GPUDevice::QueryFence (GPUFence *fence) |
| Checks the status of a fence. More... | |
| void | SDL::GPUDevice::ReleaseFence (GPUFence *fence) |
| Releases a fence obtained from GPUCommandBuffer.SubmitAndAcquireFence. More... | |
| bool | SDL::GPUDevice::TextureSupportsFormat (GPUTextureFormat format, GPUTextureType type, GPUTextureUsageFlags usage) |
| Determines whether a texture format is supported for a given type and usage. More... | |
| bool | SDL::GPUDevice::TextureSupportsSampleCount (GPUTextureFormat format, GPUSampleCount sample_count) |
| Determines if a sample count for a texture format is supported. More... | |
| void | SDL::GPUDevice::GDKSuspendGPU () |
| Call this to suspend GPU operation on Xbox when you receive the EVENT_DID_ENTER_BACKGROUND event. More... | |
| void | SDL::GPUDevice::GDKResumeGPU () |
| Call this to resume GPU operation on Xbox when you receive the EVENT_WILL_ENTER_FOREGROUND event. More... | |
It offers both 3D graphics and compute support, in the style of Metal, Vulkan, and Direct3D 12.
A basic workflow might be something like this:
The app creates a GPU device with GPUDevice.GPUDevice(), and assigns it to a window with GPUDevice.ClaimWindow()–although strictly speaking you can render offscreen entirely, perhaps for image processing, and not use a window at all.
Next, the app prepares static data (things that are created once and used over and over). For example:
To render, the app creates one or more command buffers, with GPUDevice.AcquireCommandBuffer(). Command buffers collect rendering instructions that will be submitted to the GPU in batch. Complex scenes can use multiple command buffers, maybe configured across multiple threads in parallel, as long as they are submitted in the correct order, but many apps will just need one command buffer per frame.
Rendering can happen to a texture (what other APIs call a "render target") or it can happen to the swapchain texture (which is just a special texture that represents a window's contents). The app can use GPUCommandBuffer.WaitAndAcquireSwapchainTexture() to render to the window.
Rendering actually happens in a Render Pass, which is encoded into a command buffer. One can encode multiple render passes (or alternate between render and compute passes) in a single command buffer, but many apps might simply need a single render pass in a single command buffer. Render Passes can render to up to four color textures and one depth texture simultaneously. If the set of textures being rendered to needs to change, the Render Pass must be ended and a new one must be begun.
The app calls GPUCommandBuffer.BeginRenderPass(). Then it sets states it needs for each draw:
Then, make the actual draw commands with these states:
After all the drawing commands for a pass are complete, the app should call GPURenderPass.End(). Once a render pass ends all render-related state is reset.
The app can begin new Render Passes and make new draws in the same command buffer until the entire scene is rendered.
Once all of the render commands for the scene are complete, the app calls GPUCommandBuffer.Submit() to send it to the GPU for processing.
If the app needs to read back data from texture or buffers, the API has an efficient way of doing this, provided that the app is willing to tolerate some latency. When the app uses GPUCopyPass.DownloadFromTexture() or GPUCopyPass.DownloadFromBuffer(), submitting the command buffer with GPUCommandBuffer.SubmitAndAcquireFence() will return a fence handle that the app can poll or wait on in a thread. Once the fence indicates that the command buffer is done processing, it is safe to read the downloaded data. Make sure to call GPUDevice.ReleaseFence() when done with the fence.
The API also has "compute" support. The app calls GPUCommandBuffer.BeginComputePass() with compute-writeable textures and/or buffers, which can be written to in a compute shader. Then it sets states it needs for the compute dispatches:
Then, dispatch compute work:
For advanced users, this opens up powerful GPU-driven workflows.
Graphics and compute pipelines require the use of shaders, which as mentioned above are small programs executed on the GPU. Each backend (Vulkan, Metal, D3D12) requires a different shader format. When the app creates the GPU device, the app lets the device know which shader formats the app can provide. It will then select the appropriate backend depending on the available shader formats and the backends available on the platform. When creating shaders, the app must provide the correct shader format for the selected backend. If you would like to learn more about why the API works this way, there is a detailed blog post explaining this situation.
It is optimal for apps to pre-compile the shader formats they might use, but for ease of use SDL provides a separate project, SDL_shadercross , for performing runtime shader cross-compilation. It also has a CLI interface for offline precompilation as well.
This is an extremely quick overview that leaves out several important details. Already, though, one can see that GPU programming can be quite complex! If you just need simple 2D graphics, the Render API is much easier to use but still hardware-accelerated. That said, even for 2D applications the performance benefits and expressiveness of the GPU API are significant.
The GPU API targets a feature set with a wide range of hardware support and ease of portability. It is designed so that the app won't have to branch itself by querying feature support. If you need cutting-edge features with limited hardware support, this API is probably not for you.
Examples demonstrating proper usage of this API can be found here.
Here are some basic tips for maximizing your rendering performance.
In general try to remember the golden rule of performance: doing things is more expensive than not doing things. Don't Touch The Driver!
Question: When are you adding more advanced features, like ray tracing or mesh shaders?
Answer: We don't have immediate plans to add more bleeding-edge features, but we certainly might in the future, when these features prove worthwhile, and reasonable to implement across several platforms and underlying APIs. So while these things are not in the "never" category, they are definitely not "near future" items either.
Question: Why is my shader not working?
Answer: A common oversight when using shaders is not properly laying out the shader resources/registers correctly. The GPU API is very strict with how it wants resources to be laid out and it's difficult for the API to automatically validate shaders to see if they have a compatible layout. See the documentation for GPUShader.GPUShader() and GPUComputePipeline.GPUComputePipeline() for information on the expected layout.
Another common issue is not setting the correct number of samplers, textures, and buffers in GPUShaderCreateInfo. If possible use shader reflection to extract the required information from the shader automatically instead of manually filling in the struct's values.
Question: My application isn't performing very well. Is this the GPU API's fault?
Answer: No. Long answer: The GPU API is a relatively thin layer over the underlying graphics API. While it's possible that we have done something inefficiently, it's very unlikely especially if you are relatively inexperienced with GPU rendering. Please see the performance tips above and make sure you are following them. Additionally, tools like RenderDoc can be very helpful for diagnosing incorrect behavior and performance issues.
SDL driver name: "vulkan" (for use in GPUDevice.GPUDevice() and prop::GpuDevice.CREATE_NAME_STRING)
Supported on Windows, Linux, Nintendo Switch, and certain Android devices. Requires Vulkan 1.0 with the following extensions and device features:
VK_KHR_swapchainVK_KHR_maintenance1independentBlendimageCubeArraydepthClampshaderClipDistancedrawIndirectFirstInstancesampleRateShadingYou can remove some of these requirements to increase compatibility with Android devices by using these properties when creating the GPU device with GPUDevice.GPUDevice():
SDL driver name: "direct3d12"
Supported on Windows 10 or newer, Xbox One (GDK), and Xbox Series X|S (GDK). Requires a GPU that supports DirectX 12 Feature Level 11_0 and Resource Binding Tier 2 or above.
You can remove the Tier 2 resource binding requirement to support Intel Haswell and Broadwell GPUs by using this property when creating the GPU device with GPUDevice.GPUDevice():
SDL driver name: "metal"
Supported on macOS 10.14+ and iOS/tvOS 13.0+. Hardware requirements vary by operating system:
The GPU API uses a left-handed coordinate system, following the convention of D3D12 and Metal. Specifically:
(-1.0, -1.0). The upper-right corner is (1.0, 1.0). Z values range from [0.0, 1.0] where 0 is the near plane.(0, 0) and extends to the bottom-right corner at (viewportWidth, viewportHeight). +Y is down.(0, 0) and extends to the bottom-right corner at (1.0, 1.0). +Y is down.If the backend driver differs from this convention (e.g. Vulkan, which has an NDC that assumes +Y is down), SDL will automatically convert the coordinate system behind the scenes, so you don't need to perform any coordinate flipping logic in your shaders.
Uniforms are for passing data to shaders. The uniform data will be constant across all executions of the shader.
There are 4 available uniform slots per shader stage (where the stages are vertex, fragment, and compute). Uniform data pushed to a slot on a stage keeps its value throughout the command buffer until you call the relevant Push function on that slot again.
For example, you could write your vertex shaders to read a camera matrix from uniform binding slot 0, push the camera matrix at the start of the command buffer, and that data will be used for every subsequent draw call.
It is valid to push uniform data during a render or compute pass.
Uniforms are best for pushing small amounts of data. If you are pushing more than a matrix or two per call you should consider using a storage buffer instead.
When using a command buffer, operations do not occur immediately - they occur some time after the command buffer is submitted.
When a resource is used in a pending or active command buffer, it is considered to be "bound". When a resource is no longer used in any pending or active command buffers, it is considered to be "unbound".
If data resources are bound, it is unspecified when that data will be unbound unless you acquire a fence when submitting the command buffer and wait on it. However, this doesn't mean you need to track resource usage manually.
All of the functions and structs that involve writing to a resource have a "cycle" bool. GPUTransferBuffer, GPUBuffer, and GPUTexture all effectively function as ring buffers on internal resources. When cycle is true, if the resource is bound, the cycle rotates to the next unbound internal resource, or if none are available, a new one is created. This means you don't have to worry about complex state tracking and synchronization as long as cycling is correctly employed.
For example: you can call GPUDevice.MapTransferBuffer(), write texture data, GPUDevice.UnmapTransferBuffer(), and then GPUCopyPass.UploadToTexture(). The next time you write texture data to the transfer buffer, if you set the cycle param to true, you don't have to worry about overwriting any data that is not yet uploaded.
Another example: If you are using a texture in a render pass every frame, this can cause a data dependency between frames. If you set cycle to true in the GPUColorTargetInfo struct, you can prevent this data dependency.
Cycling will never undefine already bound data. When cycling, all data in the resource is considered to be undefined for subsequent commands until that data is written again. You must take care not to read undefined data.
Note that when cycling a texture, the entire texture will be cycled, even if only part of the texture is used in the call, so you must consider the entire texture to contain undefined data after cycling.
You must also take care not to overwrite a section of data that has been referenced in a command without cycling first. It is OK to overwrite unreferenced data in a bound resource without cycling, but overwriting a section of data that has already been referenced will produce unexpected results.
At some point of your GPU journey, you will probably encounter issues that are not traceable with regular debugger - for example, your code compiles but you get an empty screen, or your shader fails in runtime.
For debugging such cases, there are tools that allow visually inspecting the whole GPU frame, every drawcall, every bound resource, memory buffers, etc. They are the following, per platform:
Aside from that, you may want to enable additional debug layers to receive more detailed error messages, based on your GPU backend:
vulkan-validation-layers system package that should be installed. * For Metal, it should be enough just to run the application from XCode to receive detailed errors or warnings in the output.Don't hesitate to use tools as RenderDoc when encountering runtime issues or unexpected output on screen, quick GPU frame inspection can usually help you fix the majority of such problems.
| using SDL::GPUBlendFactor = typedef SDL_GPUBlendFactor |
The source color is the value written by the fragment shader. The destination color is the value currently existing in the texture.
| using SDL::GPUBlendOp = typedef SDL_GPUBlendOp |
The source color is the value written by the fragment shader. The destination color is the value currently existing in the texture.
| using SDL::GPUBlitInfo = typedef SDL_GPUBlitInfo |
| using SDL::GPUBlitRegion = typedef SDL_GPUBlitRegion |
| using SDL::GPUBufferBinding = typedef SDL_GPUBufferBinding |
| using SDL::GPUBufferCreateInfo = typedef SDL_GPUBufferCreateInfo |
Usage flags can be bitwise OR'd together for combinations of usages. Note that certain combinations are invalid, for example VERTEX and INDEX.
| using SDL::GPUBufferLocation = typedef SDL_GPUBufferLocation |
Used when copying data between buffers.
| using SDL::GPUBufferRegion = typedef SDL_GPUBufferRegion |
Used when transferring data to or from buffers.
| using SDL::GPUBufferUsageFlags = typedef Uint32 |
A buffer must have at least one usage flag. Note that some usage flag combinations are invalid.
Unlike textures, READ | WRITE can be used for simultaneous read-write usage. The same data synchronization concerns as textures apply.
If you use a STORAGE flag, the data in the buffer must respect std140 layout conventions. In practical terms this means you must ensure that vec3 and vec4 fields are 16-byte aligned.
| using SDL::GPUColorComponentFlags = typedef Uint8 |
| using SDL::GPUColorTargetBlendState = typedef SDL_GPUColorTargetBlendState |
| using SDL::GPUColorTargetDescription = typedef SDL_GPUColorTargetDescription |
| using SDL::GPUColorTargetInfo = typedef SDL_GPUColorTargetInfo |
The load_op field determines what is done with the texture at the beginning of the render pass.
The store_op field determines what is done with the color results of the render pass.
| using SDL::GPUCompareOp = typedef SDL_GPUCompareOp |
| using SDL::GPUComputePipelineCreateInfo = typedef SDL_GPUComputePipelineCreateInfo |
| using SDL::GPUCubeMapFace = typedef SDL_GPUCubeMapFace |
Can be passed in as the layer field in texture-related structs.
| using SDL::GPUCullMode = typedef SDL_GPUCullMode |
| using SDL::GPUDepthStencilState = typedef SDL_GPUDepthStencilState |
| using SDL::GPUDepthStencilTargetInfo = typedef SDL_GPUDepthStencilTargetInfo |
The load_op field determines what is done with the depth contents of the texture at the beginning of the render pass.
The store_op field determines what is done with the depth results of the render pass.
The stencil_load_op field determines what is done with the stencil contents of the texture at the beginning of the render pass.
The stencil_store_op field determines what is done with the stencil results of the render pass.
Note that depth/stencil targets do not support multisample resolves.
Due to ABI limitations, depth textures with more than 255 layers are not supported.
| using SDL::GPUFence = typedef SDL_GPUFence |
| using SDL::GPUFillMode = typedef SDL_GPUFillMode |
| using SDL::GPUFilter = typedef SDL_GPUFilter |
| using SDL::GPUFrontFace = typedef SDL_GPUFrontFace |
| using SDL::GPUGraphicsPipelineCreateInfo = typedef SDL_GPUGraphicsPipelineCreateInfo |
| using SDL::GPUGraphicsPipelineTargetInfo = typedef SDL_GPUGraphicsPipelineTargetInfo |
| using SDL::GPUIndexedIndirectDrawCommand = typedef SDL_GPUIndexedIndirectDrawCommand |
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); GPU APIs and shader languages do not define these built-in variables consistently, so if your shader depends on them, the only way to keep behavior consistent and portable is to always pass 0 for the correlating parameter in the draw calls.
| using SDL::GPUIndexElementSize = typedef SDL_GPUIndexElementSize |
| using SDL::GPUIndirectDispatchCommand = typedef SDL_GPUIndirectDispatchCommand |
| using SDL::GPUIndirectDrawCommand = typedef SDL_GPUIndirectDrawCommand |
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); GPU APIs and shader languages do not define these built-in variables consistently, so if your shader depends on them, the only way to keep behavior consistent and portable is to always pass 0 for the correlating parameter in the draw calls.
| using SDL::GPULoadOp = typedef SDL_GPULoadOp |
| using SDL::GPUMultisampleState = typedef SDL_GPUMultisampleState |
| using SDL::GPUPresentMode = typedef SDL_GPUPresentMode |
VSYNC mode will always be supported. IMMEDIATE and MAILBOX modes may not be supported on certain systems.
It is recommended to query GPUDevice.WindowSupportsPresentMode after claiming the window if you wish to change the present mode to IMMEDIATE or MAILBOX.
| using SDL::GPUPrimitiveType = typedef SDL_GPUPrimitiveType |
If you are using POINTLIST you must include a point size output in the vertex shader.
Note that sized point topology is totally unsupported on D3D12. Any size other than 1 will be ignored. In general, you should avoid using point topology for both compatibility and performance reasons. You WILL regret using it.
| using SDL::GPURasterizerState = typedef SDL_GPURasterizerState |
Note that GPU_FILLMODE_LINE is not supported on many Android devices. For those devices, the fill mode will automatically fall back to FILL.
Also note that the D3D12 driver will enable depth clamping even if enable_depth_clip is true. If you need this clamp+clip behavior, consider enabling depth clip and then manually clamping depth in your fragment shaders on Metal and Vulkan.
| using SDL::GPUSampleCount = typedef SDL_GPUSampleCount |
Used in multisampling. Note that this value only applies when the texture is used as a render target.
| using SDL::GPUSamplerAddressMode = typedef SDL_GPUSamplerAddressMode |
| using SDL::GPUSamplerCreateInfo = typedef SDL_GPUSamplerCreateInfo |
Note that mip_lod_bias is a no-op for the Metal driver. For Metal, LOD bias must be applied via shader instead.
| using SDL::GPUSamplerMipmapMode = typedef SDL_GPUSamplerMipmapMode |
| using SDL::GPUShaderCreateInfo = typedef SDL_GPUShaderCreateInfo |
| using SDL::GPUShaderFormat = typedef Uint32 |
Each format corresponds to a specific backend that accepts it.
| using SDL::GPUShaderStage = typedef SDL_GPUShaderStage |
| using SDL::GPUStencilOp = typedef SDL_GPUStencilOp |
| using SDL::GPUStencilOpState = typedef SDL_GPUStencilOpState |
| using SDL::GPUStorageBufferReadWriteBinding = typedef SDL_GPUStorageBufferReadWriteBinding |
| using SDL::GPUStorageTextureReadWriteBinding = typedef SDL_GPUStorageTextureReadWriteBinding |
| using SDL::GPUStoreOp = typedef SDL_GPUStoreOp |
| using SDL::GPUSwapchainComposition = typedef SDL_GPUSwapchainComposition |
SDR will always be supported. Other compositions may not be supported on certain systems.
It is recommended to query GPUDevice.WindowSupportsSwapchainComposition after claiming the window if you wish to change the swapchain composition from SDR.
| using SDL::GPUTextureCreateInfo = typedef SDL_GPUTextureCreateInfo |
Usage flags can be bitwise OR'd together for combinations of usages. Note that certain usage combinations are invalid, for example SAMPLER and GRAPHICS_STORAGE.
| using SDL::GPUTextureFormat = typedef SDL_GPUTextureFormat |
Texture format support varies depending on driver, hardware, and usage flags. In general, you should use GPUDevice.TextureSupportsFormat to query if a format is supported before using it. However, there are a few guaranteed formats.
FIXME: Check universal support for 32-bit component formats FIXME: Check universal support for SIMULTANEOUS_READ_WRITE
For SAMPLER usage, the following formats are universally supported:
For COLOR_TARGET usage, the following formats are universally supported:
For STORAGE usages, the following formats are universally supported:
For DEPTH_STENCIL_TARGET usage, the following formats are universally supported:
Unless D16_UNORM is sufficient for your purposes, always check which of D24/D32 is supported before creating a depth-stencil texture!
| using SDL::GPUTextureLocation = typedef SDL_GPUTextureLocation |
Used when copying data from one texture to another.
| using SDL::GPUTextureRegion = typedef SDL_GPUTextureRegion |
Used when transferring data to or from a texture.
| using SDL::GPUTextureSamplerBinding = typedef SDL_GPUTextureSamplerBinding |
| using SDL::GPUTextureTransferInfo = typedef SDL_GPUTextureTransferInfo |
If either of pixels_per_row or rows_per_layer is zero, then width and height of passed GPUTextureRegion to GPUCopyPass.UploadToTexture or GPUCopyPass.DownloadFromTexture are used as default values respectively and data is considered to be tightly packed.
WARNING: Direct3D 12 requires texture data row pitch to be 256 byte aligned, and offsets to be aligned to 512 bytes. If they are not, SDL will make a temporary copy of the data that is properly aligned, but this adds overhead to the transfer process. Apps can avoid this by aligning their data appropriately, or using a different GPU backend than Direct3D 12.
| using SDL::GPUTextureType = typedef SDL_GPUTextureType |
| using SDL::GPUTextureUsageFlags = typedef Uint32 |
A texture must have at least one usage flag. Note that some usage flag combinations are invalid.
With regards to compute storage usage, READ | WRITE means that you can have shader A that only writes into the texture and shader B that only reads from the texture and bind the same texture to either shader respectively. SIMULTANEOUS means that you can do reads and writes within the same shader or compute pass. It also implies that atomic ops can be used, since those are read-modify-write operations. If you use SIMULTANEOUS, you are responsible for avoiding data races, as there is no data synchronization within a compute pass. Note that SIMULTANEOUS usage is only supported by a limited number of texture formats.
| using SDL::GPUTransferBufferCreateInfo = typedef SDL_GPUTransferBufferCreateInfo |
| using SDL::GPUTransferBufferLocation = typedef SDL_GPUTransferBufferLocation |
Used when transferring buffer data to or from a transfer buffer.
| using SDL::GPUTransferBufferUsage = typedef SDL_GPUTransferBufferUsage |
Note that mapping and copying FROM an upload transfer buffer or TO a download transfer buffer is undefined behavior.
| using SDL::GPUVertexAttribute = typedef SDL_GPUVertexAttribute |
All vertex attribute locations provided to an GPUVertexInputState must be unique.
| using SDL::GPUVertexBufferDescription = typedef SDL_GPUVertexBufferDescription |
When you call GPURenderPass.BindVertexBuffers, you specify the binding slots of the vertex buffers. For example if you called GPURenderPass.BindVertexBuffers with a first_slot of 2 and num_bindings of 3, the binding slots 2, 3, 4 would be used by the vertex buffers you pass in.
Vertex attributes are linked to buffers via the buffer_slot field of GPUVertexAttribute. For example, if an attribute has a buffer_slot of 0, then that attribute belongs to the vertex buffer bound at slot 0.
| using SDL::GPUVertexElementFormat = typedef SDL_GPUVertexElementFormat |
| using SDL::GPUVertexInputRate = typedef SDL_GPUVertexInputRate |
| using SDL::GPUVertexInputState = typedef SDL_GPUVertexInputState |
| using SDL::GPUViewport = typedef SDL_GPUViewport |
| using SDL::GPUVulkanOptions = typedef SDL_GPUVulkanOptions |
When no such structure is provided, SDL will use Vulkan API version 1.0 and a minimal set of features. The requested API version influences how the feature_list is processed by SDL. When requesting API version 1.0, the feature_list is ignored. Only the vulkan_10_physical_device_features and the extension lists are used. When requesting API version 1.1, the feature_list is scanned for feature structures introduced in Vulkan 1.1. When requesting Vulkan 1.2 or higher, the feature_list is additionally scanned for compound feature structs such as VkPhysicalDeviceVulkan11Features. The device and instance extension lists, as well as vulkan_10_physical_device_features, are always processed.
|
inline |
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.
It is valid to acquire multiple command buffers on the same thread at once. In fact a common design pattern is to acquire two command buffers per frame where one is dedicated to render and compute passes and the other is dedicated to copy passes and other preparatory work such as generating mipmaps. Interleaving commands between the two command buffers reduces the total amount of passes overall which improves rendering performance.
|
inline |
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.
It is valid to acquire multiple command buffers on the same thread at once. In fact a common design pattern is to acquire two command buffers per frame where one is dedicated to render and compute passes and the other is dedicated to copy passes and other preparatory work such as generating mipmaps. Interleaving commands between the two command buffers reduces the total amount of passes overall which improves rendering performance.
| device | a GPU context. |
|
inline |
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.
This function will fill the swapchain texture handle with nullptr if too many frames are in flight. This is not an error. This nullptr pointer should not be passed back into SDL. Instead, it should be considered as an indication to wait until the swapchain is available.
If you use this function, it is possible to create a situation where many command buffers are allocated while the rendering context waits for the GPU to catch up, which will cause memory usage to grow. You should use GPUCommandBuffer.WaitAndAcquireSwapchainTexture() unless you know what you are doing with timing.
The swapchain texture is managed by the implementation and must not be freed by the user. You MUST NOT call this function from any thread other than the one that created the window.
| command_buffer | a command buffer. |
| window | a window that has been claimed. |
| swapchain_texture_width | a pointer filled in with the swapchain texture width, may be nullptr. |
| swapchain_texture_height | a pointer filled in with the swapchain texture height, may be nullptr. |
| Error | on failure. |
|
inline |
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.
This function will fill the swapchain texture handle with nullptr if too many frames are in flight. This is not an error. This nullptr pointer should not be passed back into SDL. Instead, it should be considered as an indication to wait until the swapchain is available.
If you use this function, it is possible to create a situation where many command buffers are allocated while the rendering context waits for the GPU to catch up, which will cause memory usage to grow. You should use GPUCommandBuffer.WaitAndAcquireSwapchainTexture() unless you know what you are doing with timing.
The swapchain texture is managed by the implementation and must not be freed by the user. You MUST NOT call this function from any thread other than the one that created the window.
| window | a window that has been claimed. |
| swapchain_texture_width | a pointer filled in with the swapchain texture width, may be nullptr. |
| swapchain_texture_height | a pointer filled in with the swapchain texture height, may be nullptr. |
| Error | on failure. |
|
inline |
A compute pass is defined by a set of texture subresources and buffers that may be written to by compute pipelines. These textures and buffers must have been created with the COMPUTE_STORAGE_WRITE bit or the COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE bit. If you do not create a texture with COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE, you must not read from the texture in the compute pass. All operations related to compute pipelines must take place inside of a compute pass. You must not begin another compute pass, or a render pass or copy pass before ending the compute pass.
A VERY IMPORTANT NOTE - Reads and writes in compute passes are NOT implicitly synchronized. This means you may cause data races by both reading and writing a resource region in a compute pass, or by writing multiple times to a resource region. If your compute work depends on reading the completed output from a previous dispatch, you MUST end the current compute pass and begin a new one before you can safely access the data. Otherwise you will receive unexpected results. Reading and writing a texture in the same compute pass is only supported by specific texture formats. Make sure you check the format support!
| storage_texture_bindings | an array of writeable storage texture binding structs. |
| storage_buffer_bindings | an array of writeable storage buffer binding structs. |
|
inline |
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.
|
inline |
A compute pass is defined by a set of texture subresources and buffers that may be written to by compute pipelines. These textures and buffers must have been created with the COMPUTE_STORAGE_WRITE bit or the COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE bit. If you do not create a texture with COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE, you must not read from the texture in the compute pass. All operations related to compute pipelines must take place inside of a compute pass. You must not begin another compute pass, or a render pass or copy pass before ending the compute pass.
A VERY IMPORTANT NOTE - Reads and writes in compute passes are NOT implicitly synchronized. This means you may cause data races by both reading and writing a resource region in a compute pass, or by writing multiple times to a resource region. If your compute work depends on reading the completed output from a previous dispatch, you MUST end the current compute pass and begin a new one before you can safely access the data. Otherwise you will receive unexpected results. Reading and writing a texture in the same compute pass is only supported by specific texture formats. Make sure you check the format support!
| command_buffer | a command buffer. |
| storage_texture_bindings | an array of writeable storage texture binding structs. |
| storage_buffer_bindings | an array of writeable storage buffer binding structs. |
|
inline |
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.
| command_buffer | a command buffer. |
|
inline |
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.
Using GPU_LOADOP_LOAD before any contents have been written to the texture subresource will result in undefined behavior. GPU_LOADOP_CLEAR will set the contents of the texture subresource to a single value before any rendering is performed. It's fine to do an empty render pass using GPU_STOREOP_STORE to clear a texture, but in general it's better to think of clearing not as an independent operation but as something that's done as the beginning of a render pass.
| command_buffer | a command buffer. |
| color_target_infos | an array of texture subresources with corresponding clear values and load/store ops. |
| depth_stencil_target_info | a texture subresource with corresponding clear value and load/store ops, may be nullptr. |
|
inline |
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.
Using GPU_LOADOP_LOAD before any contents have been written to the texture subresource will result in undefined behavior. GPU_LOADOP_CLEAR will set the contents of the texture subresource to a single value before any rendering is performed. It's fine to do an empty render pass using GPU_STOREOP_STORE to clear a texture, but in general it's better to think of clearing not as an independent operation but as something that's done as the beginning of a render pass.
| color_target_infos | an array of texture subresources with corresponding clear values and load/store ops. |
| depth_stencil_target_info | a texture subresource with corresponding clear value and load/store ops, may be nullptr. |
|
inline |
The textures must have been created with GPU_TEXTUREUSAGE_SAMPLER.
Be sure your shader is set up according to the requirements documented in GPUShader.GPUShader().
| first_slot | the fragment sampler slot to begin binding from. |
| texture_sampler_bindings | an array of texture-sampler binding structs. |
|
inline |
These buffers must have been created with GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ.
Be sure your shader is set up according to the requirements documented in GPUShader.GPUShader().
| first_slot | the fragment storage buffer slot to begin binding from. |
| storage_buffers | an array of storage buffers. |
|
inline |
These textures must have been created with GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ.
Be sure your shader is set up according to the requirements documented in GPUShader.GPUShader().
| first_slot | the fragment storage texture slot to begin binding from. |
| storage_textures | an array of storage textures. |
|
inline |
| compute_pass | a compute pass handle. |
| compute_pipeline | a compute pipeline to bind. |
|
inline |
The textures must have been created with GPU_TEXTUREUSAGE_SAMPLER.
Be sure your shader is set up according to the requirements documented in GPUComputePipeline.GPUComputePipeline().
| compute_pass | a compute pass handle. |
| first_slot | the compute sampler slot to begin binding from. |
| texture_sampler_bindings | an array of texture-sampler binding structs. |
|
inline |
These buffers must have been created with GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ.
Be sure your shader is set up according to the requirements documented in GPUComputePipeline.GPUComputePipeline().
| compute_pass | a compute pass handle. |
| first_slot | the compute storage buffer slot to begin binding from. |
| storage_buffers | an array of storage buffer binding structs. |
|
inline |
These textures must have been created with GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ.
Be sure your shader is set up according to the requirements documented in GPUComputePipeline.GPUComputePipeline().
| compute_pass | a compute pass handle. |
| first_slot | the compute storage texture slot to begin binding from. |
| storage_textures | an array of storage textures. |
|
inline |
The textures must have been created with GPU_TEXTUREUSAGE_SAMPLER.
Be sure your shader is set up according to the requirements documented in GPUShader.GPUShader().
| render_pass | a render pass handle. |
| first_slot | the fragment sampler slot to begin binding from. |
| texture_sampler_bindings | an array of texture-sampler binding structs. |
|
inline |
These buffers must have been created with GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ.
Be sure your shader is set up according to the requirements documented in GPUShader.GPUShader().
| render_pass | a render pass handle. |
| first_slot | the fragment storage buffer slot to begin binding from. |
| storage_buffers | an array of storage buffers. |
|
inline |
These textures must have been created with GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ.
Be sure your shader is set up according to the requirements documented in GPUShader.GPUShader().
| render_pass | a render pass handle. |
| first_slot | the fragment storage texture slot to begin binding from. |
| storage_textures | an array of storage textures. |
|
inline |
A graphics pipeline must be bound before making any draw calls.
| render_pass | a render pass handle. |
| graphics_pipeline | the graphics pipeline to bind. |
|
inline |
| render_pass | a render pass handle. |
| binding | a pointer to a struct containing an index buffer and offset. |
| index_element_size | whether the index values in the buffer are 16- or 32-bit. |
|
inline |
| render_pass | a render pass handle. |
| first_slot | the vertex buffer slot to begin binding from. |
| bindings | an array of GPUBufferBinding structs containing vertex buffers and offset values. |
|
inline |
The textures must have been created with GPU_TEXTUREUSAGE_SAMPLER.
Be sure your shader is set up according to the requirements documented in GPUShader.GPUShader().
| render_pass | a render pass handle. |
| first_slot | the vertex sampler slot to begin binding from. |
| texture_sampler_bindings | an array of texture-sampler binding structs. |
|
inline |
These buffers must have been created with GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ.
Be sure your shader is set up according to the requirements documented in GPUShader.GPUShader().
| render_pass | a render pass handle. |
| first_slot | the vertex storage buffer slot to begin binding from. |
| storage_buffers | an array of buffers. |
|
inline |
These textures must have been created with GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ.
Be sure your shader is set up according to the requirements documented in GPUShader.GPUShader().
| render_pass | a render pass handle. |
| first_slot | the vertex storage texture slot to begin binding from. |
| storage_textures | an array of storage textures. |
|
inline |
| binding | a pointer to a struct containing an index buffer and offset. |
| index_element_size | whether the index values in the buffer are 16- or 32-bit. |
|
inline |
| compute_pipeline | a compute pipeline to bind. |
|
inline |
A graphics pipeline must be bound before making any draw calls.
| graphics_pipeline | the graphics pipeline to bind. |
|
inline |
The textures must have been created with GPU_TEXTUREUSAGE_SAMPLER.
Be sure your shader is set up according to the requirements documented in GPUComputePipeline.GPUComputePipeline().
| first_slot | the compute sampler slot to begin binding from. |
| texture_sampler_bindings | an array of texture-sampler binding structs. |
|
inline |
These buffers must have been created with GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ.
Be sure your shader is set up according to the requirements documented in GPUComputePipeline.GPUComputePipeline().
| first_slot | the compute storage buffer slot to begin binding from. |
| storage_buffers | an array of storage buffer binding structs. |
|
inline |
These textures must have been created with GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ.
Be sure your shader is set up according to the requirements documented in GPUComputePipeline.GPUComputePipeline().
| first_slot | the compute storage texture slot to begin binding from. |
| storage_textures | an array of storage textures. |
|
inline |
| first_slot | the vertex buffer slot to begin binding from. |
| bindings | an array of GPUBufferBinding structs containing vertex buffers and offset values. |
|
inline |
The textures must have been created with GPU_TEXTUREUSAGE_SAMPLER.
Be sure your shader is set up according to the requirements documented in GPUShader.GPUShader().
| first_slot | the vertex sampler slot to begin binding from. |
| texture_sampler_bindings | an array of texture-sampler binding structs. |
|
inline |
These buffers must have been created with GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ.
Be sure your shader is set up according to the requirements documented in GPUShader.GPUShader().
| first_slot | the vertex storage buffer slot to begin binding from. |
| storage_buffers | an array of buffers. |
|
inline |
These textures must have been created with GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ.
Be sure your shader is set up according to the requirements documented in GPUShader.GPUShader().
| first_slot | the vertex storage texture slot to begin binding from. |
| storage_textures | an array of storage textures. |
|
inline |
This function must not be called inside of any pass.
| command_buffer | a command buffer. |
| info | the blit info struct containing the blit parameters. |
|
inline |
This function must not be called inside of any pass.
| info | the blit info struct containing the blit parameters. |
|
inline |
| format | a texture format. |
| width | width in pixels. |
| height | height in pixels. |
| depth_or_layer_count | depth for 3D textures or layer count otherwise. |
|
inline |
None of the enqueued commands are executed.
It is an error to call this function after a swapchain texture has been acquired.
This must be called from the thread the command buffer was acquired on.
You must not reference the command buffer after calling this function.
| Error | on failure. |
|
inline |
None of the enqueued commands are executed.
It is an error to call this function after a swapchain texture has been acquired.
This must be called from the thread the command buffer was acquired on.
You must not reference the command buffer after calling this function.
| command_buffer | a command buffer. |
| Error | on failure. |
|
inline |
This must be called before GPUCommandBuffer.AcquireSwapchainTexture is called using the window. You should only call this function from the thread that created the window.
The swapchain will be created with GPU_SWAPCHAINCOMPOSITION_SDR and GPU_PRESENTMODE_VSYNC. If you want to have different swapchain parameters, you must call GPUDevice.SetSwapchainParameters after claiming the window.
| window | an Window. |
| Error | on failure. |
|
inline |
This must be called before GPUCommandBuffer.AcquireSwapchainTexture is called using the window. You should only call this function from the thread that created the window.
The swapchain will be created with GPU_SWAPCHAINCOMPOSITION_SDR and GPU_PRESENTMODE_VSYNC. If you want to have different swapchain parameters, you must call GPUDevice.SetSwapchainParameters after claiming the window.
| device | a GPU context. |
| window | an Window. |
| Error | on failure. |
|
inline |
This copy occurs on the GPU timeline. You may assume the copy has finished in subsequent commands.
| source | the buffer and offset to copy from. |
| destination | the buffer and offset to copy to. |
| size | the length of the buffer to copy. |
| cycle | if true, cycles the destination buffer if it is already bound, otherwise overwrites the data. |
|
inline |
This copy occurs on the GPU timeline. You may assume the copy has finished in subsequent commands.
| copy_pass | a copy pass handle. |
| source | the buffer and offset to copy from. |
| destination | the buffer and offset to copy to. |
| size | the length of the buffer to copy. |
| cycle | if true, cycles the destination buffer if it is already bound, otherwise overwrites the data. |
|
inline |
This copy occurs on the GPU timeline. You may assume the copy has finished in subsequent commands.
This function does not support copying between depth and color textures. For those, copy the texture to a buffer and then to the destination texture.
| copy_pass | a copy pass handle. |
| source | a source texture region. |
| destination | a destination texture region. |
| w | the width of the region to copy. |
| h | the height of the region to copy. |
| d | the depth of the region to copy. |
| cycle | if true, cycles the destination texture if the destination texture is bound, otherwise overwrites the data. |
|
inline |
This copy occurs on the GPU timeline. You may assume the copy has finished in subsequent commands.
This function does not support copying between depth and color textures. For those, copy the texture to a buffer and then to the destination texture.
| source | a source texture region. |
| destination | a destination texture region. |
| w | the width of the region to copy. |
| h | the height of the region to copy. |
| d | the depth of the region to copy. |
| cycle | if true, cycles the destination texture if the destination texture is bound, otherwise overwrites the data. |
|
inline |
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.
If you use a STORAGE flag, the data in the buffer must respect std140 layout conventions. In practical terms this means you must ensure that vec3 and vec4 fields are 16-byte aligned.
For better understanding of underlying concepts and memory management with SDL GPU API, you may refer this blog post .
There are optional properties that can be provided through props. These are the supported properties:
prop::GPUBuffer.CREATE_NAME_STRING: a name that can be displayed in debugging tools.| createinfo | a struct describing the state of the buffer to create. |
| Error | on failure. |
|
inline |
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 DXBC and DXIL shaders, use the following register order:
For MSL/metallib, use the following order:
There are optional properties that can be provided through props. These are the supported properties:
prop::GPUComputePipeline.CREATE_NAME_STRING: a name that can be displayed in debugging tools.| createinfo | a struct describing the state of the compute pipeline to create. |
| Error | on failure. |
|
inline |
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.
If you use a STORAGE flag, the data in the buffer must respect std140 layout conventions. In practical terms this means you must ensure that vec3 and vec4 fields are 16-byte aligned.
For better understanding of underlying concepts and memory management with SDL GPU API, you may refer this blog post .
There are optional properties that can be provided through props. These are the supported properties:
prop::GPUBuffer.CREATE_NAME_STRING: a name that can be displayed in debugging tools.| device | a GPU Context. |
| createinfo | a struct describing the state of the buffer to create. |
| Error | on failure. |
|
inline |
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 DXBC and DXIL shaders, use the following register order:
For MSL/metallib, use the following order:
There are optional properties that can be provided through props. These are the supported properties:
prop::GPUComputePipeline.CREATE_NAME_STRING: a name that can be displayed in debugging tools.| device | a GPU Context. |
| createinfo | a struct describing the state of the compute pipeline to create. |
| Error | on failure. |
|
inline |
The GPU driver name can be one of the following:
| format_flags | a bitflag indicating which shader formats the app is able to provide. |
| debug_mode | enable debug mode properties and validations. |
| name | the preferred GPU driver, or nullptr to let SDL pick the optimal driver. |
| Error | on failure. |
|
inline |
These are the supported properties:
prop::GpuDevice.CREATE_DEBUGMODE_BOOLEAN: enable debug mode properties and validations, defaults to true.prop::GpuDevice.CREATE_PREFERLOWPOWER_BOOLEAN: enable to prefer energy efficiency over maximum GPU performance, defaults to false.prop::GpuDevice.CREATE_VERBOSE_BOOLEAN: enable to automatically log useful debug information on device creation, defaults to true.prop::GpuDevice.CREATE_NAME_STRING: the name of the GPU driver to use, if a specific one is desired.prop::GpuDevice.CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN: Enable Vulkan device feature shaderClipDistance. If disabled, clip distances are not supported in shader code: gl_ClipDistance[] built-ins of GLSL, SV_ClipDistance0/1 semantics of HLSL and [[clip_distance]] attribute of Metal. Disabling optional features allows the application to run on some older Android devices. Defaults to true.prop::GpuDevice.CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN: Enable Vulkan device feature depthClamp. If disabled, there is no depth clamp support and enable_depth_clip in GPURasterizerState must always be set to true. Disabling optional features allows the application to run on some older Android devices. Defaults to true.prop::GpuDevice.CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN: Enable Vulkan device feature drawIndirectFirstInstance. If disabled, the argument first_instance of GPUIndirectDrawCommand must be set to zero. Disabling optional features allows the application to run on some older Android devices. Defaults to true.prop::GpuDevice.CREATE_FEATURE_ANISOTROPY_BOOLEAN: Enable Vulkan device feature samplerAnisotropy. If disabled, enable_anisotropy of GPUSamplerCreateInfo must be set to false. Disabling optional features allows the application to run on some older Android devices. Defaults to true.These are the current shader format properties:
prop::GpuDevice.CREATE_SHADERS_PRIVATE_BOOLEAN: The app is able to provide shaders for an NDA platform.prop::GpuDevice.CREATE_SHADERS_SPIRV_BOOLEAN: The app is able to provide SPIR-V shaders if applicable.prop::GpuDevice.CREATE_SHADERS_DXBC_BOOLEAN: The app is able to provide DXBC shaders if applicableprop::GpuDevice.CREATE_SHADERS_DXIL_BOOLEAN: The app is able to provide DXIL shaders if applicable.prop::GpuDevice.CREATE_SHADERS_MSL_BOOLEAN: The app is able to provide MSL shaders if applicable.prop::GpuDevice.CREATE_SHADERS_METALLIB_BOOLEAN: The app is able to provide Metal shader libraries if applicable.With the D3D12 backend:
prop::GpuDevice.CREATE_D3D12_SEMANTIC_NAME_STRING: the prefix to use for all vertex semantics, default is "TEXCOORD".prop::GpuDevice.CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN: By default, Resourcing Binding Tier 2 is required for D3D12 support. However, an application can set this property to true to enable Tier 1 support, if (and only if) the application uses 8 or fewer storage resources across all shader stages. As of writing, this property is useful for targeting Intel Haswell and Broadwell GPUs; other hardware either supports Tier 2 Resource Binding or does not support D3D12 in any capacity. Defaults to false.With the Vulkan backend:
prop::GpuDevice.CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN: By default, Vulkan device enumeration includes drivers of all types, including software renderers (for example, the Lavapipe Mesa driver). This can be useful if your application requires SDL_GPU, but if you can provide your own fallback renderer (for example, an OpenGL renderer) this property can be set to true. Defaults to false.prop::GpuDevice.CREATE_VULKAN_OPTIONS_POINTER: a pointer to an GPUVulkanOptions structure to be processed during device creation. This allows configuring a variety of Vulkan-specific options such as increasing the API version and opting into extensions aside from the minimal set SDL requires.| props | the properties to use. |
| Error | on failure. |
|
inline |
There are optional properties that can be provided through props. These are the supported properties:
prop::GPUGraphicsPipeline.CREATE_NAME_STRING: a name that can be displayed in debugging tools.| device | a GPU Context. |
| createinfo | a struct describing the state of the graphics pipeline to create. |
| Error | on failure. |
|
inline |
There are optional properties that can be provided through props. These are the supported properties:
prop::GPUSampler.CREATE_NAME_STRING: a name that can be displayed in debugging tools.| device | a GPU Context. |
| createinfo | a struct describing the state of the sampler to create. |
| Error | on failure. |
|
inline |
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:
For fragment shaders:
For DXBC and DXIL shaders, use the following register order:
For vertex shaders:
For pixel shaders:
For MSL/metallib, use the following order:
Shader semantics other than system-value semantics do not matter in D3D12 and for ease of use the SDL implementation assumes that non system-value semantics will all be TEXCOORD. If you are using HLSL as the shader source language, your vertex semantics should start at TEXCOORD0 and increment like so: TEXCOORD1, TEXCOORD2, etc. If you wish to change the semantic prefix to something other than TEXCOORD you can use prop::GpuDevice.CREATE_D3D12_SEMANTIC_NAME_STRING with GPUDevice.GPUDevice().
There are optional properties that can be provided through props. These are the supported properties:
prop::GPUShader.CREATE_NAME_STRING: a name that can be displayed in debugging tools.| device | a GPU Context. |
| createinfo | a struct describing the state of the shader to create. |
| Error | on failure. |
|
inline |
The contents of this texture are undefined until data is written to the texture, either via GPUCopyPass.UploadToTexture or by performing a render or compute pass with this texture as a target.
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.
There are optional properties that can be provided through GPUTextureCreateInfo's props. These are the supported properties:
prop::GPUTexture.CREATE_D3D12_CLEAR_R_FLOAT: (Direct3D 12 only) if the texture usage is GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture to a color with this red intensity. Defaults to zero.prop::GPUTexture.CREATE_D3D12_CLEAR_G_FLOAT: (Direct3D 12 only) if the texture usage is GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture to a color with this green intensity. Defaults to zero.prop::GPUTexture.CREATE_D3D12_CLEAR_B_FLOAT: (Direct3D 12 only) if the texture usage is GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture to a color with this blue intensity. Defaults to zero.prop::GPUTexture.CREATE_D3D12_CLEAR_A_FLOAT: (Direct3D 12 only) if the texture usage is GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture to a color with this alpha intensity. Defaults to zero.prop::GPUTexture.CREATE_D3D12_CLEAR_DEPTH_FLOAT: (Direct3D 12 only) if the texture usage is GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET, clear the texture to a depth of this value. Defaults to zero.prop::GPUTexture.CREATE_D3D12_CLEAR_STENCIL_NUMBER: (Direct3D 12 only) if the texture usage is GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET, clear the texture to a stencil of this Uint8 value. Defaults to zero.prop::GPUTexture.CREATE_NAME_STRING: a name that can be displayed in debugging tools.| device | a GPU Context. |
| createinfo | a struct describing the state of the texture to create. |
| Error | on failure. |
|
inline |
Download buffers can be particularly expensive to create, so it is good practice to reuse them if data will be downloaded regularly.
There are optional properties that can be provided through props. These are the supported properties:
prop::GPUTransferBuffer.CREATE_NAME_STRING: a name that can be displayed in debugging tools.| device | a GPU Context. |
| createinfo | a struct describing the state of the transfer buffer to create. |
| Error | on failure. |
|
inline |
There are optional properties that can be provided through props. These are the supported properties:
prop::GPUGraphicsPipeline.CREATE_NAME_STRING: a name that can be displayed in debugging tools.| createinfo | a struct describing the state of the graphics pipeline to create. |
| Error | on failure. |
|
inline |
There are optional properties that can be provided through props. These are the supported properties:
prop::GPUSampler.CREATE_NAME_STRING: a name that can be displayed in debugging tools.| createinfo | a struct describing the state of the sampler to create. |
| Error | on failure. |
|
inline |
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:
For fragment shaders:
For DXBC and DXIL shaders, use the following register order:
For vertex shaders:
For pixel shaders:
For MSL/metallib, use the following order:
Shader semantics other than system-value semantics do not matter in D3D12 and for ease of use the SDL implementation assumes that non system-value semantics will all be TEXCOORD. If you are using HLSL as the shader source language, your vertex semantics should start at TEXCOORD0 and increment like so: TEXCOORD1, TEXCOORD2, etc. If you wish to change the semantic prefix to something other than TEXCOORD you can use prop::GpuDevice.CREATE_D3D12_SEMANTIC_NAME_STRING with GPUDevice.GPUDevice().
There are optional properties that can be provided through props. These are the supported properties:
prop::GPUShader.CREATE_NAME_STRING: a name that can be displayed in debugging tools.| createinfo | a struct describing the state of the shader to create. |
| Error | on failure. |
|
inline |
The contents of this texture are undefined until data is written to the texture, either via GPUCopyPass.UploadToTexture or by performing a render or compute pass with this texture as a target.
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.
There are optional properties that can be provided through GPUTextureCreateInfo's props. These are the supported properties:
prop::GPUTexture.CREATE_D3D12_CLEAR_R_FLOAT: (Direct3D 12 only) if the texture usage is GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture to a color with this red intensity. Defaults to zero.prop::GPUTexture.CREATE_D3D12_CLEAR_G_FLOAT: (Direct3D 12 only) if the texture usage is GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture to a color with this green intensity. Defaults to zero.prop::GPUTexture.CREATE_D3D12_CLEAR_B_FLOAT: (Direct3D 12 only) if the texture usage is GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture to a color with this blue intensity. Defaults to zero.prop::GPUTexture.CREATE_D3D12_CLEAR_A_FLOAT: (Direct3D 12 only) if the texture usage is GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture to a color with this alpha intensity. Defaults to zero.prop::GPUTexture.CREATE_D3D12_CLEAR_DEPTH_FLOAT: (Direct3D 12 only) if the texture usage is GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET, clear the texture to a depth of this value. Defaults to zero.prop::GPUTexture.CREATE_D3D12_CLEAR_STENCIL_NUMBER: (Direct3D 12 only) if the texture usage is GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET, clear the texture to a stencil of this Uint8 value. Defaults to zero.prop::GPUTexture.CREATE_NAME_STRING: a name that can be displayed in debugging tools.| createinfo | a struct describing the state of the texture to create. |
| Error | on failure. |
|
inline |
Download buffers can be particularly expensive to create, so it is good practice to reuse them if data will be downloaded regularly.
There are optional properties that can be provided through props. These are the supported properties:
prop::GPUTransferBuffer.CREATE_NAME_STRING: a name that can be displayed in debugging tools.| createinfo | a struct describing the state of the transfer buffer to create. |
| Error | on failure. |
|
inline |
|
inline |
| device | a GPU Context to destroy. |
|
inline |
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.
| groupcount_x | number of local workgroups to dispatch in the X dimension. |
| groupcount_y | number of local workgroups to dispatch in the Y dimension. |
| groupcount_z | number of local workgroups to dispatch in the Z dimension. |
|
inline |
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.
| compute_pass | a compute pass handle. |
| groupcount_x | number of local workgroups to dispatch in the X dimension. |
| groupcount_y | number of local workgroups to dispatch in the Y dimension. |
| groupcount_z | number of local workgroups to dispatch in the Z dimension. |
|
inline |
The buffer layout should match the layout of 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.
| compute_pass | a compute pass handle. |
| buffer | a buffer containing dispatch parameters. |
| offset | the offset to start reading from the dispatch buffer. |
The buffer layout should match the layout of 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.
| buffer | a buffer containing dispatch parameters. |
| offset | the offset to start reading from the dispatch buffer. |
|
inline |
This data is not guaranteed to be copied until the command buffer fence is signaled.
| source | the source buffer with offset and size. |
| destination | the destination transfer buffer with offset. |
|
inline |
This data is not guaranteed to be copied until the command buffer fence is signaled.
| copy_pass | a copy pass handle. |
| source | the source buffer with offset and size. |
| destination | the destination transfer buffer with offset. |
|
inline |
This data is not guaranteed to be copied until the command buffer fence is signaled.
| copy_pass | a copy pass handle. |
| source | the source texture region. |
| destination | the destination transfer buffer with image layout information. |
|
inline |
This data is not guaranteed to be copied until the command buffer fence is signaled.
| source | the source texture region. |
| destination | the destination transfer buffer with image layout information. |
|
inline |
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); GPU APIs and shader languages do not define these built-in variables consistently, so if your shader depends on them, the only way to keep behavior consistent and portable is to always pass 0 for the correlating parameter in the draw calls.
| render_pass | a render pass handle. |
| num_indices | the number of indices to draw per instance. |
| num_instances | the number of instances to draw. |
| first_index | the starting index within the index buffer. |
| vertex_offset | value added to vertex index before indexing into the vertex buffer. |
| first_instance | the ID of the first instance to draw. |
|
inline |
The buffer must consist of tightly-packed draw parameter sets that each match the layout of GPUIndexedIndirectDrawCommand. You must not call this function before binding a graphics pipeline.
| render_pass | a render pass handle. |
| buffer | a buffer containing draw parameters. |
| offset | the offset to start reading from the draw buffer. |
| draw_count | the number of draw parameter sets that should be read from the draw buffer. |
|
inline |
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); GPU APIs and shader languages do not define these built-in variables consistently, so if your shader depends on them, the only way to keep behavior consistent and portable is to always pass 0 for the correlating parameter in the draw calls.
| render_pass | a render pass handle. |
| num_vertices | the number of vertices to draw. |
| num_instances | the number of instances that will be drawn. |
| first_vertex | the index of the first vertex to draw. |
| first_instance | the ID of the first instance to draw. |
|
inline |
The buffer must consist of tightly-packed draw parameter sets that each match the layout of GPUIndirectDrawCommand. You must not call this function before binding a graphics pipeline.
| render_pass | a render pass handle. |
| buffer | a buffer containing draw parameters. |
| offset | the offset to start reading from the draw buffer. |
| draw_count | the number of draw parameter sets that should be read from the draw buffer. |
|
inline |
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); GPU APIs and shader languages do not define these built-in variables consistently, so if your shader depends on them, the only way to keep behavior consistent and portable is to always pass 0 for the correlating parameter in the draw calls.
| num_indices | the number of indices to draw per instance. |
| num_instances | the number of instances to draw. |
| first_index | the starting index within the index buffer. |
| vertex_offset | value added to vertex index before indexing into the vertex buffer. |
| first_instance | the ID of the first instance to draw. |
|
inline |
The buffer must consist of tightly-packed draw parameter sets that each match the layout of GPUIndexedIndirectDrawCommand. You must not call this function before binding a graphics pipeline.
| buffer | a buffer containing draw parameters. |
| offset | the offset to start reading from the draw buffer. |
| draw_count | the number of draw parameter sets that should be read from the draw buffer. |
|
inline |
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); GPU APIs and shader languages do not define these built-in variables consistently, so if your shader depends on them, the only way to keep behavior consistent and portable is to always pass 0 for the correlating parameter in the draw calls.
| num_vertices | the number of vertices to draw. |
| num_instances | the number of instances that will be drawn. |
| first_vertex | the index of the first vertex to draw. |
| first_instance | the ID of the first instance to draw. |
|
inline |
The buffer must consist of tightly-packed draw parameter sets that each match the layout of GPUIndirectDrawCommand. You must not call this function before binding a graphics pipeline.
| buffer | a buffer containing draw parameters. |
| offset | the offset to start reading from the draw buffer. |
| draw_count | the number of draw parameter sets that should be read from the draw buffer. |
|
inline |
All bound graphics state on the render pass command buffer is unset. The render pass handle is now invalid.
|
inline |
All bound compute state on the command buffer is unset. The compute pass handle is now invalid.
|
inline |
|
inline |
All bound compute state on the command buffer is unset. The compute pass handle is now invalid.
| compute_pass | a compute pass handle. |
|
inline |
| copy_pass | a copy pass handle. |
|
inline |
All bound graphics state on the render pass command buffer is unset. The render pass handle is now invalid.
| render_pass | a render pass handle. |
|
inline |
When resuming, this function MUST be called before calling any other SDL_GPU functions.
|
inline |
When resuming, this function MUST be called before calling any other SDL_GPU functions.
| device | a GPU context. |
|
inline |
Do NOT call any SDL_GPU functions after calling this function! This must also be called before calling GDKSuspendComplete.
|
inline |
Do NOT call any SDL_GPU functions after calling this function! This must also be called before calling GDKSuspendComplete.
| device | a GPU context. |
|
inline |
This function must not be called inside of any pass.
| command_buffer | a command_buffer. |
| texture | a texture with more than 1 mip level. |
|
inline |
This function must not be called inside of any pass.
| texture | a texture with more than 1 mip level. |
|
inline |
|
inline |
| device | a GPU context to query. |
|
inline |
All properties are optional and may differ between GPU backends and SDL versions.
The following properties are provided by SDL:
prop::GpuDevice.NAME_STRING: Contains the name of the underlying device as reported by the system driver. This string has no standardized format, is highly inconsistent between hardware devices and drivers, and is able to change at any time. Do not attempt to parse this string as it is bound to fail at some point in the future when system drivers are updated, new hardware devices are introduced, or when SDL adds new GPU backends or modifies existing ones.
Strings that have been found in the wild include:
The above list shows that the same device can have different formats, the vendor name may or may not appear in the string, the included vendor name may not be the vendor of the chipset on the device, some manufacturers include pseudo-legal marks while others don't, some devices may not use a marketing name in the string, the device string may be wrapped by the name of a translation interface, the device may be emulated in software, or the string may contain generic text that does not identify the device at all.
prop::GpuDevice.DRIVER_NAME_STRING: Contains the self-reported name of the underlying system driver.
Strings that have been found in the wild include:
prop::GpuDevice.DRIVER_VERSION_STRING: Contains the self-reported version of the underlying system driver. This is a relatively short version string in an unspecified format. If prop::GpuDevice.DRIVER_INFO_STRING is available then that property should be preferred over this one as it may contain additional information that is useful for identifying the exact driver version used.
Strings that have been found in the wild include:
prop::GpuDevice.DRIVER_INFO_STRING: Contains the detailed version information of the underlying system driver as reported by the driver. This is an arbitrary string with no standardized format and it may contain newlines. This property should be preferred over prop::GpuDevice.DRIVER_VERSION_STRING if it is available as it usually contains the same information but in a format that is easier to read.
Strings that have been found in the wild include:
This string has also been observed to be a multiline string (which has a trailing newline):
| device | a GPU context to query. |
| Error | on failure. |
|
inline |
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.
| index | the index of a GPU driver. |
|
inline |
| device | a GPU context to query. |
|
inline |
|
inline |
| format | a pixel format. |
|
inline |
|
inline |
| format | a texture format. |
|
inline |
All properties are optional and may differ between GPU backends and SDL versions.
The following properties are provided by SDL:
prop::GpuDevice.NAME_STRING: Contains the name of the underlying device as reported by the system driver. This string has no standardized format, is highly inconsistent between hardware devices and drivers, and is able to change at any time. Do not attempt to parse this string as it is bound to fail at some point in the future when system drivers are updated, new hardware devices are introduced, or when SDL adds new GPU backends or modifies existing ones.
Strings that have been found in the wild include:
The above list shows that the same device can have different formats, the vendor name may or may not appear in the string, the included vendor name may not be the vendor of the chipset on the device, some manufacturers include pseudo-legal marks while others don't, some devices may not use a marketing name in the string, the device string may be wrapped by the name of a translation interface, the device may be emulated in software, or the string may contain generic text that does not identify the device at all.
prop::GpuDevice.DRIVER_NAME_STRING: Contains the self-reported name of the underlying system driver.
Strings that have been found in the wild include:
prop::GpuDevice.DRIVER_VERSION_STRING: Contains the self-reported version of the underlying system driver. This is a relatively short version string in an unspecified format. If prop::GpuDevice.DRIVER_INFO_STRING is available then that property should be preferred over this one as it may contain additional information that is useful for identifying the exact driver version used.
Strings that have been found in the wild include:
prop::GpuDevice.DRIVER_INFO_STRING: Contains the detailed version information of the underlying system driver as reported by the driver. This is an arbitrary string with no standardized format and it may contain newlines. This property should be preferred over prop::GpuDevice.DRIVER_VERSION_STRING if it is available as it usually contains the same information but in a format that is easier to read.
Strings that have been found in the wild include:
This string has also been observed to be a multiline string (which has a trailing newline):
| Error | on failure. |
|
inline |
|
inline |
|
inline |
| props | the properties to use. |
|
inline |
| format_flags | a bitflag indicating which shader formats the app is able to provide. |
| name | the preferred GPU driver, or nullptr to let SDL pick the optimal driver. |
|
inline |
| format | the texture format you want to know the texel size of. |
|
inline |
| device | a GPU context. |
| format | the texture format to check. |
| type | the type of texture (2D, 3D, Cube). |
| usage | a bitmask of all usage scenarios to check. |
|
inline |
| device | a GPU context. |
| format | the texture format to check. |
| sample_count | the sample count to check. |
|
inline |
Useful for debugging.
On Direct3D 12, using GPUCommandBuffer.InsertDebugLabel requires WinPixEventRuntime.dll to be in your PATH or in the same directory as your executable. See here for instructions on how to obtain it.
| text | a UTF-8 string constant to insert as the label. |
|
inline |
Useful for debugging.
On Direct3D 12, using GPUCommandBuffer.InsertDebugLabel requires WinPixEventRuntime.dll to be in your PATH or in the same directory as your executable. See here for instructions on how to obtain it.
| command_buffer | a command buffer. |
| text | a UTF-8 string constant to insert as the label. |
|
inline |
You must unmap the transfer buffer before encoding upload commands. The memory is owned by the graphics driver - do NOT call free() on the returned pointer.
| device | a GPU context. |
| transfer_buffer | a transfer buffer. |
| cycle | if true, cycles the transfer buffer if it is already bound. |
|
inline |
You must unmap the transfer buffer before encoding upload commands. The memory is owned by the graphics driver - do NOT call free() on the returned pointer.
| transfer_buffer | a transfer buffer. |
| cycle | if true, cycles the transfer buffer if it is already bound. |
|
inline |
On Direct3D 12, using GPUCommandBuffer.PopDebugGroup requires WinPixEventRuntime.dll to be in your PATH or in the same directory as your executable. See here for instructions on how to obtain it.
|
inline |
On Direct3D 12, using GPUCommandBuffer.PopDebugGroup requires WinPixEventRuntime.dll to be in your PATH or in the same directory as your executable. See here for instructions on how to obtain it.
| command_buffer | a command buffer. |
|
inline |
Subsequent draw calls in this command buffer will use this uniform data.
The data being pushed must respect std140 layout conventions. In practical terms this means you must ensure that vec3 and vec4 fields are 16-byte aligned.
| slot_index | the uniform slot to push data to. |
| data | client data to write. |
|
inline |
Used for denoting groups of calls when viewing the command buffer callstream in a graphics debugging tool.
Each call to GPUCommandBuffer.PushDebugGroup must have a corresponding call to GPUCommandBuffer.PopDebugGroup.
On Direct3D 12, using GPUCommandBuffer.PushDebugGroup requires WinPixEventRuntime.dll to be in your PATH or in the same directory as your executable. See here for instructions on how to obtain it.
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.
| name | a UTF-8 string constant that names the group. |
|
inline |
Subsequent draw calls in this command buffer will use this uniform data.
The data being pushed must respect std140 layout conventions. In practical terms this means you must ensure that vec3 and vec4 fields are 16-byte aligned.
| slot_index | the fragment uniform slot to push data to. |
| data | client data to write. |
|
inline |
Subsequent draw calls in this command buffer will use this uniform data.
The data being pushed must respect std140 layout conventions. In practical terms this means you must ensure that vec3 and vec4 fields are 16-byte aligned.
| command_buffer | a command buffer. |
| slot_index | the uniform slot to push data to. |
| data | client data to write. |
|
inline |
Used for denoting groups of calls when viewing the command buffer callstream in a graphics debugging tool.
Each call to GPUCommandBuffer.PushDebugGroup must have a corresponding call to GPUCommandBuffer.PopDebugGroup.
On Direct3D 12, using GPUCommandBuffer.PushDebugGroup requires WinPixEventRuntime.dll to be in your PATH or in the same directory as your executable. See here for instructions on how to obtain it.
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.
| command_buffer | a command buffer. |
| name | a UTF-8 string constant that names the group. |
|
inline |
Subsequent draw calls in this command buffer will use this uniform data.
The data being pushed must respect std140 layout conventions. In practical terms this means you must ensure that vec3 and vec4 fields are 16-byte aligned.
| command_buffer | a command buffer. |
| slot_index | the fragment uniform slot to push data to. |
| data | client data to write. |
|
inline |
Subsequent draw calls in this command buffer will use this uniform data.
The data being pushed must respect std140 layout conventions. In practical terms this means you must ensure that vec3 and vec4 fields are 16-byte aligned.
For detailed information about accessing uniform data from a shader, please refer to GPUShader.GPUShader.
| command_buffer | a command buffer. |
| slot_index | the vertex uniform slot to push data to. |
| data | client data to write. |
|
inline |
Subsequent draw calls in this command buffer will use this uniform data.
The data being pushed must respect std140 layout conventions. In practical terms this means you must ensure that vec3 and vec4 fields are 16-byte aligned.
For detailed information about accessing uniform data from a shader, please refer to GPUShader.GPUShader.
| slot_index | the vertex uniform slot to push data to. |
| data | client data to write. |
|
inline |
| fence | a fence. |
|
inline |
| device | a GPU context. |
| fence | a fence. |
|
inline |
You must not reference the buffer after calling this function.
| buffer | a buffer to be destroyed. |
|
inline |
You must not reference the compute pipeline after calling this function.
| compute_pipeline | a compute pipeline to be destroyed. |
|
inline |
You must not reference the fence after calling this function.
| fence | a fence. |
|
inline |
You must not reference the buffer after calling this function.
| device | a GPU context. |
| buffer | a buffer to be destroyed. |
|
inline |
You must not reference the compute pipeline after calling this function.
| device | a GPU context. |
| compute_pipeline | a compute pipeline to be destroyed. |
|
inline |
You must not reference the fence after calling this function.
| device | a GPU context. |
| fence | a fence. |
|
inline |
You must not reference the graphics pipeline after calling this function.
| device | a GPU context. |
| graphics_pipeline | a graphics pipeline to be destroyed. |
|
inline |
You must not reference the sampler after calling this function.
| device | a GPU context. |
| sampler | a sampler to be destroyed. |
|
inline |
You must not reference the shader after calling this function.
| device | a GPU context. |
| shader | a shader to be destroyed. |
|
inline |
You must not reference the texture after calling this function.
| device | a GPU context. |
| texture | a texture to be destroyed. |
|
inline |
You must not reference the transfer buffer after calling this function.
| device | a GPU context. |
| transfer_buffer | a transfer buffer to be destroyed. |
|
inline |
You must not reference the graphics pipeline after calling this function.
| graphics_pipeline | a graphics pipeline to be destroyed. |
|
inline |
You must not reference the sampler after calling this function.
| sampler | a sampler to be destroyed. |
|
inline |
You must not reference the shader after calling this function.
| shader | a shader to be destroyed. |
|
inline |
You must not reference the texture after calling this function.
| texture | a texture to be destroyed. |
|
inline |
You must not reference the transfer buffer after calling this function.
| transfer_buffer | a transfer buffer to be destroyed. |
|
inline |
| window | an Window that has been claimed. |
|
inline |
| device | a GPU context. |
| window | an Window that has been claimed. |
|
inline |
The default value when the device is created is 2. This means that after you have submitted 2 frames for presentation, if the GPU has not finished working on the first frame, GPUCommandBuffer.AcquireSwapchainTexture() will fill the swapchain texture pointer with nullptr, and GPUCommandBuffer.WaitAndAcquireSwapchainTexture() will block.
Higher values increase throughput at the expense of visual latency. Lower values decrease visual latency at the expense of throughput.
Note that calling this function will stall and flush the command queue to prevent synchronization issues.
The minimum value of allowed frames in flight is 1, and the maximum is 3.
| allowed_frames_in_flight | the maximum number of frames that can be pending on the GPU. |
|
inline |
| blend_constants | the blend constant color. |
|
inline |
You should use prop::GPUBuffer.CREATE_NAME_STRING with GPUBuffer.GPUBuffer instead of this function to avoid thread safety issues.
| buffer | a buffer to attach the name to. |
| text | a UTF-8 string constant to mark as the name of the buffer. |
|
inline |
The default value when the device is created is 2. This means that after you have submitted 2 frames for presentation, if the GPU has not finished working on the first frame, GPUCommandBuffer.AcquireSwapchainTexture() will fill the swapchain texture pointer with nullptr, and GPUCommandBuffer.WaitAndAcquireSwapchainTexture() will block.
Higher values increase throughput at the expense of visual latency. Lower values decrease visual latency at the expense of throughput.
Note that calling this function will stall and flush the command queue to prevent synchronization issues.
The minimum value of allowed frames in flight is 1, and the maximum is 3.
| device | a GPU context. |
| allowed_frames_in_flight | the maximum number of frames that can be pending on the GPU. |
|
inline |
| render_pass | a render pass handle. |
| blend_constants | the blend constant color. |
|
inline |
You should use prop::GPUBuffer.CREATE_NAME_STRING with GPUBuffer.GPUBuffer instead of this function to avoid thread safety issues.
| device | a GPU Context. |
| buffer | a buffer to attach the name to. |
| text | a UTF-8 string constant to mark as the name of the buffer. |
|
inline |
| render_pass | a render pass handle. |
| scissor | the scissor area to set. |
|
inline |
| render_pass | a render pass handle. |
| reference | the stencil reference value to set. |
|
inline |
This function will fail if the requested present mode or swapchain composition are unsupported by the device. Check if the parameters are supported via GPUDevice.WindowSupportsPresentMode / GPUDevice.WindowSupportsSwapchainComposition prior to calling this function.
GPU_PRESENTMODE_VSYNC with GPU_SWAPCHAINCOMPOSITION_SDR are always supported.
| device | a GPU context. |
| window | an Window that has been claimed. |
| swapchain_composition | the desired composition of the swapchain. |
| present_mode | the desired present mode for the swapchain. |
|
inline |
You should use prop::GPUTexture.CREATE_NAME_STRING with GPUTexture.GPUTexture instead of this function to avoid thread safety issues.
| device | a GPU Context. |
| texture | a texture to attach the name to. |
| text | a UTF-8 string constant to mark as the name of the texture. |
|
inline |
| render_pass | a render pass handle. |
| viewport | the viewport to set. |
|
inline |
| scissor | the scissor area to set. |
|
inline |
| reference | the stencil reference value to set. |
|
inline |
This function will fail if the requested present mode or swapchain composition are unsupported by the device. Check if the parameters are supported via GPUDevice.WindowSupportsPresentMode / GPUDevice.WindowSupportsSwapchainComposition prior to calling this function.
GPU_PRESENTMODE_VSYNC with GPU_SWAPCHAINCOMPOSITION_SDR is always supported.
| window | an Window that has been claimed. |
| swapchain_composition | the desired composition of the swapchain. |
| present_mode | the desired present mode for the swapchain. |
|
inline |
You should use prop::GPUTexture.CREATE_NAME_STRING with GPUTexture.GPUTexture instead of this function to avoid thread safety issues.
| texture | a texture to attach the name to. |
| text | a UTF-8 string constant to mark as the name of the texture. |
|
inline |
| viewport | the viewport to set. |
|
inline |
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.
| Error | on failure. |
|
inline |
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.
|
inline |
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.
| command_buffer | a command buffer. |
| Error | on failure. |
|
inline |
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.
| command_buffer | a command buffer. |
|
inline |
| format | the texture format to check. |
| type | the type of texture (2D, 3D, Cube). |
| usage | a bitmask of all usage scenarios to check. |
|
inline |
| format | the texture format to check. |
| sample_count | the sample count to check. |
|
inline |
| device | a GPU context. |
| transfer_buffer | a previously mapped transfer buffer. |
|
inline |
| transfer_buffer | a previously mapped transfer buffer. |
|
inline |
The upload occurs on the GPU timeline. You may assume that the upload has finished in subsequent commands.
| source | the source transfer buffer with offset. |
| destination | the destination buffer with offset and size. |
| cycle | if true, cycles the buffer if it is already bound, otherwise overwrites the data. |
|
inline |
The upload occurs on the GPU timeline. You may assume that the upload has finished in subsequent commands.
| copy_pass | a copy pass handle. |
| source | the source transfer buffer with offset. |
| destination | the destination buffer with offset and size. |
| cycle | if true, cycles the buffer if it is already bound, otherwise overwrites the data. |
|
inline |
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.
| copy_pass | a copy pass handle. |
| source | the source transfer buffer with image layout information. |
| destination | the destination texture region. |
| cycle | if true, cycles the texture if the texture is bound, otherwise overwrites the data. |
|
inline |
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.
| source | the source transfer buffer with image layout information. |
| destination | the destination texture region. |
| cycle | if true, cycles the texture if the texture is bound, otherwise overwrites the data. |
|
inline |
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. It is an error to call GPUCommandBuffer.Cancel() after a swapchain texture is acquired.
This function can fill the swapchain texture handle with nullptr in certain cases, for example if the window is minimized. This is not an error. You should always make sure to check whether the pointer is nullptr before actually using it.
The swapchain texture is managed by the implementation and must not be freed by the user. You MUST NOT call this function from any thread other than the one that created the window.
The swapchain texture is write-only and cannot be used as a sampler or for another reading operation.
| command_buffer | a command buffer. |
| window | a window that has been claimed. |
| swapchain_texture_width | a pointer filled in with the swapchain texture width, may be nullptr. |
| swapchain_texture_height | a pointer filled in with the swapchain texture height, may be nullptr. |
| Error | on failure. |
|
inline |
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. It is an error to call GPUCommandBuffer.Cancel() after a swapchain texture is acquired.
This function can fill the swapchain texture handle with nullptr in certain cases, for example if the window is minimized. This is not an error. You should always make sure to check whether the pointer is nullptr before actually using it.
The swapchain texture is managed by the implementation and must not be freed by the user. You MUST NOT call this function from any thread other than the one that created the window.
The swapchain texture is write-only and cannot be used as a sampler or for another reading operation.
| window | a window that has been claimed. |
| swapchain_texture_width | a pointer filled in with the swapchain texture width, may be nullptr. |
| swapchain_texture_height | a pointer filled in with the swapchain texture height, may be nullptr. |
| Error | on failure. |
|
inline |
|
inline |
|
inline |
| device | a GPU context. |
| Error | on failure. |
|
inline |
|
inline |
| Error | on failure. |
|
inline |
|
inline |
The window must be claimed before calling this function.
| device | a GPU context. |
| window | an Window. |
| present_mode | the presentation mode to check. |
|
inline |
The window must be claimed before calling this function.
| device | a GPU context. |
| window | an Window. |
| swapchain_composition | the swapchain composition to check. |
|
inline |
The window must be claimed before calling this function.
| window | an Window. |
| present_mode | the presentation mode to check. |
|
inline |
The window must be claimed before calling this function.
| window | an Window. |
| swapchain_composition | the swapchain composition to check. |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
The contents will be undefined.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
The contents will be undefined.
|
constexpr |
The contents in the multisample texture may then be discarded and will be undefined.
|
constexpr |
The contents in the multisample texture will be written to memory.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
This is NOT equivalent to READ | WRITE.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |