sdlxBindGpuComputeSamplers function gpu

void sdlxBindGpuComputeSamplers(
  1. Pointer<SdlGpuComputePass> computePass,
  2. List<SdlxGpuTextureSamplerBinding> bindings, {
  3. int firstSlot = 0,
})

Binds texture-sampler pairs for use on the compute shader.

The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER.

The textures being bound must have a matching type declared in the shader (2D, 3D, etc.). Multisample textures are not allowed.

Be sure your shader is set up according to the requirements documented in SDL_CreateGPUComputePipeline().

\param compute_pass a compute pass handle. \param first_slot the compute sampler slot to begin binding from. \param texture_sampler_bindings an array of texture-sampler binding structs. \param num_bindings the number of texture-sampler bindings to bind from the array.

\since This function is available since SDL 3.2.0.

\sa SDL_CreateGPUComputePipeline

extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeSamplers( SDL_GPUComputePass *compute_pass, Uint32 first_slot, const SDL_GPUTextureSamplerBinding *texture_sampler_bindings, Uint32 num_bindings)

See also:

Implementation

void sdlxBindGpuComputeSamplers(
  Pointer<SdlGpuComputePass> computePass,
  List<SdlxGpuTextureSamplerBinding> bindings, {
  int firstSlot = 0,
}) {
  if (bindings.isNotEmpty) {
    final bindingsPointer = bindings.calloc();
    sdlBindGpuComputeSamplers(
      computePass,
      firstSlot,
      bindingsPointer,
      bindings.length,
    );
    bindingsPointer.callocFree();
  }
}