sdlxBindGpuFragmentStorageTextures function gpu

void sdlxBindGpuFragmentStorageTextures(
  1. Pointer<SdlGpuRenderPass> renderPass,
  2. List<Pointer<SdlGpuTexture>> storageTextures, {
  3. int firstSlot = 0,
})

Binds storage textures for use on the fragment shader.

These textures must have been created with SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ.

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

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 storage texture slot to begin binding from. \param storage_textures an array of storage textures. \param num_bindings the number of storage textures to bind from the array.

\since This function is available since SDL 3.2.0.

\sa SDL_CreateGPUShader

extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentStorageTextures( SDL_GPURenderPass *render_pass, Uint32 first_slot, SDL_GPUTexture *const *storage_textures, Uint32 num_bindings)

See also:

Implementation

void sdlxBindGpuFragmentStorageTextures(
  Pointer<SdlGpuRenderPass> renderPass,
  List<Pointer<SdlGpuTexture>> storageTextures, {
  int firstSlot = 0,
}) {
  final pointer = ffi.calloc<Pointer<SdlGpuTexture>>(storageTextures.length);
  for (var i = 0; i < storageTextures.length; i++) {
    pointer[i] = storageTextures[i];
  }
  sdlBindGpuFragmentStorageTextures(
    renderPass,
    firstSlot,
    pointer,
    storageTextures.length,
  );
  pointer.callocFree();
}