A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/createBindGroupLayout below:

GPUDevice: createBindGroupLayout() method - Web APIs

GPUDevice: createBindGroupLayout() method

Limited availability

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Note: This feature is available in Web Workers.

The createBindGroupLayout() method of the GPUDevice interface creates a GPUBindGroupLayout that defines the structure and purpose of related GPU resources such as buffers that will be used in a pipeline, and is used as a template when creating GPUBindGroups.

Syntax
createBindGroupLayout(descriptor)
Parameters
descriptor

An object containing the following properties:

entries

An array of entry objects, each one of which describes a single shader resource binding to be included in the GPUBindGroupLayout. Each entry will correspond to an entry defined in a GPUBindGroup (created via a GPUDevice.createBindGroup() call) that uses this GPUBindGroupLayout object as a template.

label Optional

A string providing a label that can be used to identify the object, for example in GPUError messages or console warnings.

Entry objects

An entry object includes the following properties:

binding

A number representing a unique identifier for this particular entry, which matches the binding value of a corresponding GPUBindGroup entry. In addition, it matches the n index value of the corresponding @binding(n) attribute in the shader (GPUShaderModule) used in the related pipeline.

visibility

One or more bitwise flags defining the shader stages that a GPUBindGroup entry corresponding to this entry will be visible to. Possible values are:

Note that multiple stages can be specified by separating values with bitwise OR, for example: GPUShaderStage.FRAGMENT | GPUShaderStage.VERTEX.

"Resource layout object"

An object that defines the required binding resource type and structure of the GPUBindGroup entry corresponding to this entry. This property can be one of buffer, externalTexture, sampler, storageTexture, or texture, the object structures of which are described in the next section.

Resource layout objects

The resource layout object can be one of the following (see also GPUDevice.createBindGroup() for details of how the required resources for each entry are structured):

Return value

A GPUBindGroupLayout object instance.

Validation

The following criteria must be met when calling createBindGroupLayout(), otherwise a GPUValidationError is generated and an invalid GPUBindGroupLayout object is returned:

Examples

Note: The WebGPU samples feature many more examples.

Basic example

Our basic compute demo shows an example of creating a bind group layout and then using that as a template when creating a bind group.

// …

const bindGroupLayout = device.createBindGroupLayout({
  entries: [
    {
      binding: 0,
      visibility: GPUShaderStage.COMPUTE,
      buffer: {
        type: "storage",
      },
    },
  ],
});

const bindGroup = device.createBindGroup({
  layout: bindGroupLayout,
  entries: [
    {
      binding: 0,
      resource: {
        buffer: output,
      },
    },
  ],
});

// …
Specifications Browser compatibility See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4