sdlBeginGpuComputePass function
- Pointer<
SdlGpuCommandBuffer> commandBuffer, - Pointer<
SdlGpuStorageTextureReadWriteBinding> storageTextureBindings, - int numStorageTextureBindings,
- Pointer<
SdlGpuStorageBufferReadWriteBinding> storageBufferBindings, - int numStorageBufferBindings,
Begins a compute pass on a command buffer.
A compute pass is defined by a set of texture subresources and buffers that may be written to by compute pipelines. These textures and buffers must have been created with the COMPUTE_STORAGE_WRITE bit or the COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE bit. If you do not create a texture with COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE, you must not read from the texture in the compute pass. All operations related to compute pipelines must take place inside of a compute pass. You must not begin another compute pass, or a render pass or copy pass before ending the compute pass.
A VERY IMPORTANT NOTE - Reads and writes in compute passes are NOT implicitly synchronized. This means you may cause data races by both reading and writing a resource region in a compute pass, or by writing multiple times to a resource region. If your compute work depends on reading the completed output from a previous dispatch, you MUST end the current compute pass and begin a new one before you can safely access the data. Otherwise you will receive unexpected results. Reading and writing a texture in the same compute pass is only supported by specific texture formats. Make sure you check the format support!
\param command_buffer a command buffer. \param storage_texture_bindings an array of writeable storage texture binding structs. \param num_storage_texture_bindings the number of storage textures to bind from the array. \param storage_buffer_bindings an array of writeable storage buffer binding structs. \param num_storage_buffer_bindings the number of storage buffers to bind from the array. \returns a compute pass handle.
\since This function is available since SDL 3.1.3.
\sa SDL_EndGPUComputePass
extern SDL_DECLSPEC SDL_GPUComputePass *SDLCALL SDL_BeginGPUComputePass( SDL_GPUCommandBuffer *command_buffer, const SDL_GPUStorageTextureReadWriteBinding *storage_texture_bindings, Uint32 num_storage_texture_bindings, const SDL_GPUStorageBufferReadWriteBinding *storage_buffer_bindings, Uint32 num_storage_buffer_bindings)
Implementation
Pointer<SdlGpuComputePass> sdlBeginGpuComputePass(
Pointer<SdlGpuCommandBuffer> commandBuffer,
Pointer<SdlGpuStorageTextureReadWriteBinding> storageTextureBindings,
int numStorageTextureBindings,
Pointer<SdlGpuStorageBufferReadWriteBinding> storageBufferBindings,
int numStorageBufferBindings) {
final sdlBeginGpuComputePassLookupFunction = libSdl3.lookupFunction<
Pointer<SdlGpuComputePass> Function(
Pointer<SdlGpuCommandBuffer> commandBuffer,
Pointer<SdlGpuStorageTextureReadWriteBinding> storageTextureBindings,
Uint32 numStorageTextureBindings,
Pointer<SdlGpuStorageBufferReadWriteBinding> storageBufferBindings,
Uint32 numStorageBufferBindings),
Pointer<SdlGpuComputePass> Function(
Pointer<SdlGpuCommandBuffer> commandBuffer,
Pointer<SdlGpuStorageTextureReadWriteBinding> storageTextureBindings,
int numStorageTextureBindings,
Pointer<SdlGpuStorageBufferReadWriteBinding> storageBufferBindings,
int numStorageBufferBindings)>('SDL_BeginGPUComputePass');
return sdlBeginGpuComputePassLookupFunction(
commandBuffer,
storageTextureBindings,
numStorageTextureBindings,
storageBufferBindings,
numStorageBufferBindings);
}