bind method

void bind(
  1. RenderPass pass,
  2. Shader shader,
  3. HostBuffer transientsBuffer
)

Binds the uniform block and the sampler parameters on shader into pass.

Implementation

void bind(
  gpu.RenderPass pass,
  gpu.Shader shader,
  gpu.HostBuffer transientsBuffer,
) {
  if (_block.lengthInBytes > 0) {
    pass.bindUniform(
      shader.getUniformSlot(_blockName),
      transientsBuffer.emplace(_block),
    );
  }
  for (final entry in _samplers.entries) {
    final slot = entry.value;
    pass.bindTexture(
      shader.getUniformSlot(entry.key),
      slot.texture ?? _placeholder(slot.defaultPlaceholder),
      sampler: slot.sampler ?? gpu.SamplerOptions(),
    );
  }
}