sdlxBindGpuFragmentSamplers function gpu

void sdlxBindGpuFragmentSamplers(
  1. Pointer<SdlGpuRenderPass> renderPass, {
  2. required List<SdlxGpuTextureSamplerBinding> bindings,
  3. int firstSlot = 0,
})

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

The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER.

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

\param render_pass a render pass handle. \param first_slot the fragment 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 pairs to bind from the array.

\since This function is available since SDL 3.2.0.

\sa SDL_CreateGPUShader

extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentSamplers( SDL_GPURenderPass *render_pass, Uint32 first_slot, const SDL_GPUTextureSamplerBinding *texture_sampler_bindings, Uint32 num_bindings)

Implementation

void sdlxBindGpuFragmentSamplers(
  Pointer<SdlGpuRenderPass> renderPass, {
  required List<SdlxGpuTextureSamplerBinding> bindings,
  int firstSlot = 0,
}) {
  if (bindings.isNotEmpty) {
    final bindingsPointer = bindings.calloc();
    sdlBindGpuFragmentSamplers(
      renderPass,
      firstSlot,
      bindingsPointer,
      bindings.length,
    );
    bindingsPointer.callocFree();
  }
}