How about making GPUBufferBinding size optional? If not specified, it would be the same as the buffer size passed in the binding resource of device.createBindGroup()?
I believe this would make code easier to read and digest for newcomers.
const gpuBufferSize = 4;
const gpuBuffer = device.createBuffer({
size: gpuBufferSize,
usage: GPUBufferUsage.STORAGE
});
const bindGroup = device.createBindGroup({
layout: bindGroupLayout,
bindings: [
{
binding: 0,
resource: {
buffer: myGpuBuffer,
- size: gpuBufferSize
}
}
]
});
How about making GPUBufferBinding
sizeoptional? If not specified, it would be the same as the buffer size passed in the bindingresourceofdevice.createBindGroup()?I believe this would make code easier to read and digest for newcomers.
const gpuBufferSize = 4; const gpuBuffer = device.createBuffer({ size: gpuBufferSize, usage: GPUBufferUsage.STORAGE }); const bindGroup = device.createBindGroup({ layout: bindGroupLayout, bindings: [ { binding: 0, resource: { buffer: myGpuBuffer, - size: gpuBufferSize } } ] });