GPUPipelineLayout

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 in secure contexts (HTTPS), in some or all supporting browsers.

Note: This feature is available in Web Workers.

Giao diện GPUPipelineLayout của WebGPU API xác định các GPUBindGroupLayout được sử dụng bởi một pipeline. Các GPUBindGroup được sử dụng với pipeline trong quá trình mã hóa lệnh phải có GPUBindGroupLayout tương thích.

Đối tượng GPUPipelineLayout được tạo bằng phương thức GPUDevice.createPipelineLayout().

Thuộc tính phiên bản

label

Một chuỗi cung cấp nhãn có thể được sử dụng để nhận dạng đối tượng, ví dụ trong thông báo GPUError hoặc cảnh báo bảng điều khiển.

Ví dụ

Note: WebGPU samples có nhiều ví dụ hơn.

Ví dụ bố cục pipeline cơ bản

Đoạn mã sau:

js
// …

const bindGroupLayout = device.createBindGroupLayout({
  entries: [
    {
      binding: 0,
      visibility: GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT,
      buffer: {},
    },
    {
      binding: 1,
      visibility: GPUShaderStage.FRAGMENT,
      texture: {},
    },
    {
      binding: 2,
      visibility: GPUShaderStage.FRAGMENT,
      sampler: {},
    },
  ],
});

const pipelineLayout = device.createPipelineLayout({
  bindGroupLayouts: [bindGroupLayout],
});

// …

Thông số kỹ thuật

Specification
WebGPU
# gpupipelinelayout

Tương thích trình duyệt

Xem thêm