这是indexloc提供的服务,不要输入任何密码
Skip to content

Feature request: Support GPUBuffer in GPUBindingResource #5095

@beaufortfrancois

Description

@beaufortfrancois

Following up on #331, we could make things even simpler for developers if we'd support GPUBuffer in GPUBindingResource. Because we don't, developers have to think about treating GPUBuffer differently in simple cases (where size and offset don't matter). By simply adding GPUBuffer in GPUBindingResource, this would allow developers to write the following code:

  const bindGroup = device.createBindGroup({
    layout: pipeline.getBindGroupLayout(0),
    entries: [
      { binding: 0, resource: mySampler },
      { binding: 1, resource: myTextureView },
      { binding: 2, resource: myExternalTexture },
-     { binding: 3, resource: { buffer: myBuffer } }, // Why is that different?
+     { binding: 3, resource: myBuffer },             // Yeah for consistency in simple cases!
    ],
  });

Here's the proposed IDL modification:

- typedef (GPUSampler or GPUTextureView or GPUBufferBinding or GPUExternalTexture) GPUBindingResource;
+ typedef (GPUSampler or GPUTextureView or GPUBuffer or GPUBufferBinding or GPUExternalTexture) GPUBindingResource;

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiWebGPU APIapi resolvedResolved - waiting for a change to the API specificationfeature requestA request for a new GPU feature exposed in the API

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions