sdlxSetGpuRenderStateStorageBuffers function render

bool sdlxSetGpuRenderStateStorageBuffers(
  1. Pointer<SdlGpuRenderState> state,
  2. List<Pointer<SdlGpuBuffer>> storageBuffers
)

Set storage buffers variables in a custom GPU render state.

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

\param state the state to modify. \param num_storage_buffers The number of storage buffers to bind. \param storage_buffers Storage buffers 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_SetGPURenderStateStorageBuffers(SDL_GPURenderState *state, int num_storage_buffers, SDL_GPUBuffer *const *storage_buffers)

See also:

Implementation

bool sdlxSetGpuRenderStateStorageBuffers(
  Pointer<SdlGpuRenderState> state,
  List<Pointer<SdlGpuBuffer>> storageBuffers,
) {
  var result = false;
  if (storageBuffers.isNotEmpty) {
    final storageBuffersPointer = ffi.calloc<Pointer<SdlGpuBuffer>>(
      storageBuffers.length,
    );
    for (var i = 0; i < storageBuffers.length; i++) {
      storageBuffersPointer[i] = storageBuffers[i];
    }
    result = sdlSetGpuRenderStateStorageBuffers(
      state,
      storageBuffers.length,
      storageBuffersPointer,
    );
    storageBuffersPointer.callocFree();
  }
  return result;
}