GPUBindGroupLayoutEntry.buffer constructor

GPUBindGroupLayoutEntry.buffer({
  1. int binding,
  2. int visibility,
  3. GPUBufferBindingLayout buffer,
})

A uniform or storage buffer at binding.

Exactly one of buffer, sampler, texture and storageTexture may be present, and this is why there are three constructors here rather than one with four optional members. A layout entry with two of them is a validation error, one with none is a validation error, and both arrive asynchronously as a pipeline that does not work. Named constructors turn the whole question into one the compiler answers.

visibility is a bitwise or of GpuShaderStage values.

Implementation

external factory GPUBindGroupLayoutEntry.buffer({
  int binding,
  int visibility,
  GPUBufferBindingLayout buffer,
});