Simple list of common bugs and fixes which you might have come across while learning, experimenting, testing and updating your WebGPU demos.
| Comment | |||
|---|---|---|---|
| BeN | Calling getPreferredFormat() on a GPUCanvasContext is deprecated | Calling getPreferredFormat() on a GPUCanvasContext is deprecated and will soon be removed. Call navigator.gpu.getPreferredCanvasFormat() instead, which no longer requires an adapter. Fix ``` // const presentationFormat = context.getPreferredFormat(adapter); // <-- old way const presentationFormat = gpu.getPreferredCanvasFormat(); // <-- new way ``` | 2022-05-23 07:42:14 |
| BeN | stencilLoadOp (LoadOp::Clear) must not be set if the attachment | Calling getPreferredFormat() on a GPUCanvasContext is deprecated and will soon be removed. Call navigator.gpu.getPreferredCanvasFormat() instead, which no longer requires an adapter. * stencilLoadValue has been deprecated and will soon be removed. Use stencilLoadOp and stencilClearValue instead. utility.js:181 Array(1) * stencilLoadOp (LoadOp::Clear) must not be set if the attachment ([TextureView]) has no stencil aspect or stencilReadOnly (0) is true. - While validating depthStencilAttachment. - While encoding [CommandEncoder].BeginRenderPass([RenderPassDescriptor]). * Invalid CommandBuffer] is invalid. at ValidateObject (..<URL>) at ValidateSubmit (..<URL>) --- Fix ``` depthStencilAttachment: { view : depthTexture.createView(), depthLoadOp:"clear", depthClearValue : 1, depthStoreOp : "store", // stencilLoadValue: 0, <!--- Remove these // stencilStoreOp : "store" <!--- Remove these } ``` | 2022-05-20 10:03:21 |