sdlxSetGpuRenderStateSamplerBindings function render

bool sdlxSetGpuRenderStateSamplerBindings(
  1. Pointer<SdlGpuRenderState> state,
  2. List<SdlxGpuTextureSamplerBinding> samplerBindings
)

Set sampler bindings variables in a custom GPU render state.

The data is copied and will be binded using SDL_BindGPUFragmentSamplers() during draw call execution.

\param state the state to modify. \param num_sampler_bindings The number of additional fragment samplers to bind. \param sampler_bindings Additional fragment samplers to bind. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety This function should be called on the thread that created the renderer.

\since This function is available since SDL 3.6.0.

extern SDL_DECLSPEC bool SDLCALL SDL_SetGPURenderStateSamplerBindings(SDL_GPURenderState *state, int num_sampler_bindings, const SDL_GPUTextureSamplerBinding *sampler_bindings)

See also:

Implementation

bool sdlxSetGpuRenderStateSamplerBindings(
  Pointer<SdlGpuRenderState> state,
  List<SdlxGpuTextureSamplerBinding> samplerBindings,
) {
  var result = false;
  if (samplerBindings.isNotEmpty) {
    final samplerBindingsPointer = samplerBindings.calloc();
    result = sdlSetGpuRenderStateSamplerBindings(
      state,
      samplerBindings.length,
      samplerBindingsPointer,
    );
    samplerBindingsPointer.callocFree();
  }
  return result;
}