Make view property of GPURenderPassColorAttachment optional or accept null/undefined
Closed this issue · 2 comments
Currently it seems that there is no way to make the following code from "WebGPU Samples" work. They have disabled the strict setting which is not ideal.
https://webgpu.github.io/webgpu-samples/samples/rotatingCube
`
const renderPassDescriptor: GPURenderPassDescriptor = {
colorAttachments: [
{
view: undefined, // Assigned later
clearValue: { r: 0.5, g: 0.5, b: 0.5, a: 1.0 },
loadOp: 'clear',
storeOp: 'store',
},
],
//...
};
`
We won't make it optional here because it's not optional in the API. You can define your own type or you can use undefined!
or undefined as GPUTextureView
to bypass the type system
The samples will be using something like this in this WIP PR: webgpu/webgpu-samples#278
Ok thanks, that sounds reasonable. Small hint: the second option does not work, the compiler suggests to do the following: undefined as unknown as GPUTextureView