sdlCreateGpuComputePipeline function

Pointer<SdlGpuComputePipeline> sdlCreateGpuComputePipeline(
  1. Pointer<SdlGpuDevice> device,
  2. Pointer<SdlGpuComputePipelineCreateInfo> createinfo
)

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

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

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

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

For DXBC and DXIL shaders, use the following register order:

  • (tn, space0): Sampled textures, followed by read-only storage textures, followed by read-only storage buffers
  • (un, space1): Write-only storage textures, followed by write-only storage buffers
  • (bn, space2): Uniform buffers

For MSL/metallib, use the following order:

  • [buffer]: Uniform buffers, followed by write-only storage buffers, followed by write-only storage buffers
  • [texture]: Sampled textures, followed by read-only storage textures, followed by write-only storage textures

\param device a GPU Context. \param createinfo a struct describing the state of the compute pipeline to create. \returns a compute pipeline object on success, or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

\sa SDL_BindGPUComputePipeline \sa SDL_ReleaseGPUComputePipeline

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

Implementation

Pointer<SdlGpuComputePipeline> sdlCreateGpuComputePipeline(
    Pointer<SdlGpuDevice> device,
    Pointer<SdlGpuComputePipelineCreateInfo> createinfo) {
  final sdlCreateGpuComputePipelineLookupFunction = libSdl3.lookupFunction<
          Pointer<SdlGpuComputePipeline> Function(Pointer<SdlGpuDevice> device,
              Pointer<SdlGpuComputePipelineCreateInfo> createinfo),
          Pointer<SdlGpuComputePipeline> Function(Pointer<SdlGpuDevice> device,
              Pointer<SdlGpuComputePipelineCreateInfo> createinfo)>(
      'SDL_CreateGPUComputePipeline');
  return sdlCreateGpuComputePipelineLookupFunction(device, createinfo);
}