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;
Following up on #331, we could make things even simpler for developers if we'd support
GPUBufferinGPUBindingResource. Because we don't, developers have to think about treatingGPUBufferdifferently in simple cases (where size and offset don't matter). By simply addingGPUBufferinGPUBindingResource, 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: