sdlCreateGpuComputePipeline function gpu

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: Read-write storage textures, followed by read-write 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): Read-write storage textures, followed by read-write storage buffers
  • (bn, space2): Uniform buffers

For MSL/metallib, use the following order:

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

There are optional properties that can be provided through props. These are the supported properties:

  • SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING: a name that can be displayed in debugging tools.

\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.2.0.

\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 = _libSdl
      .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);
}