GPURenderPipeline: 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 theGPURenderPipeline interface returns the pipeline'sGPUBindGroupLayout object with the given index (i.e., included in the originatingGPUDevice.createRenderPipeline() orGPUDevice.createRenderPipelineAsync() call's pipeline layout).
If theGPURenderPipeline was created withlayout: "auto", this method is the only way to retrieve theGPUBindGroupLayouts generated by the pipeline.
In this article
Syntax
getBindGroupLayout(index)Parameters
indexA number representing the index of the
GPUBindGroupLayoutto 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:
indexis less than the number ofGPUBindGroupLayoutobjects used in the pipeline layout.
Examples
Note:You can see complete working examples withgetBindGroupLayout() in action in theWebGPU samples.
// …// Create a render pipeline using layout: "auto" to automatically generate// appropriate bind group layoutsconst fullscreenQuadPipeline = device.createRenderPipeline({ layout: "auto", vertex: { module: device.createShaderModule({ code: fullscreenTexturedQuadWGSL, }), entryPoint: "vert_main", }, fragment: { module: device.createShaderModule({ code: fullscreenTexturedQuadWGSL, }), entryPoint: "frag_main", targets: [ { format: presentationFormat, }, ], }, primitive: { topology: "triangle-list", },});// …// Create a bind group with the auto-generated layout from the render pipelineconst showResultBindGroup = device.createBindGroup({ layout: fullscreenQuadPipeline.getBindGroupLayout(0), entries: [ { binding: 0, resource: sampler, }, { binding: 1, resource: textures[1].createView(), }, ],});// …Specifications
| Specification |
|---|
| WebGPU> # dom-gpupipelinebase-getbindgrouplayout> |
Browser compatibility
See also
- TheWebGPU API