GPUComputePipeline: getBindGroupLayout() method
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.
Note: This feature is available inWeb Workers.
ThegetBindGroupLayout()
method of theGPUComputePipeline
interface returns the pipeline'sGPUBindGroupLayout
object with the given index (i.e., included in the originatingGPUDevice.createComputePipeline()
orGPUDevice.createComputePipelineAsync()
call's pipeline layout).
If theGPUComputePipeline
was created withlayout: "auto"
, this method is the only way to retrieve theGPUBindGroupLayout
s generated by the pipeline.
In this article
Syntax
getBindGroupLayout(index)
Parameters
index
A number representing the index of the
GPUBindGroupLayout
to return.
Return value
AGPUBindGroupLayout
object instance.
Validation
The following criteria must be met when callinggetBindGroupLayout()
, otherwise aGPUValidationError
is generated and an invalidGPUBindGroupLayout
object is returned:
index
is less than the number ofGPUBindGroupLayout
objects used in the pipeline layout.
Examples
Note:You can see complete working examples withgetBindGroupLayout()
in action in theWebGPU samples.
// …// Create a compute pipeline using layout: "auto" to automatically generate// appropriate bind group layoutsconst computePipeline = device.createComputePipeline({ layout: "auto", compute: { module: shaderModule, entryPoint: "main", },});// Create a bind group with the auto-generated layout from the compute pipelineconst computeBindGroup = device.createBindGroup({ layout: computePipeline.getBindGroupLayout(0), entries: [ { binding: 0, resource: { buffer: storageBuffer }, }, ],});// …
Specifications
Specification |
---|
WebGPU> # dom-gpupipelinebase-getbindgrouplayout> |
Browser compatibility
Loading…
See also
- TheWebGPU API