sdlxSetGpuRenderStateStorageTextures function render

bool sdlxSetGpuRenderStateStorageTextures(
  1. Pointer<SdlGpuRenderState> state,
  2. List<Pointer<SdlGpuTexture>> storageTextures
)

Set storage textures variables in a custom GPU render state.

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

\param state the state to modify. \param num_storage_textures The number of storage textures to bind. \param storage_textures Storage textures 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_SetGPURenderStateStorageTextures(SDL_GPURenderState *state, int num_storage_textures, SDL_GPUTexture *const *storage_textures)

See also:

Implementation

bool sdlxSetGpuRenderStateStorageTextures(
  Pointer<SdlGpuRenderState> state,
  List<Pointer<SdlGpuTexture>> storageTextures,
) {
  var result = false;
  if (storageTextures.isNotEmpty) {
    final storageTexturesPointer = ffi.calloc<Pointer<SdlGpuTexture>>(
      storageTextures.length,
    );
    for (var i = 0; i < storageTextures.length; i++) {
      storageTexturesPointer[i] = storageTextures[i];
    }
    result = sdlSetGpuRenderStateStorageTextures(
      state,
      storageTextures.length,
      storageTexturesPointer,
    );
    storageTexturesPointer.callocFree();
  }
  return result;
}