hjlld/LearningWebGPU

can't run the examples

jack1232 opened this issue · 5 comments

Hi,

Thank you for your great WebGPU tutorials.

I can run Lesson0 example without any issue. However, I got the following error messages when trying to run Lession1_Triangle_and _square example:


app.ts:62 Passing a GPUDevice to getSwapChainPreferredFormat is deprecated. Pass a GPUAdapter instead, and update the calling code to expect a GPUTextureFormat to be retured instead of a Promise.
InitWebGPU @ app.ts:62

Uncaught (in promise) TypeError: Failed to execute 'setIndexBuffer' on 'GPURenderPassEncoder': 2 arguments required, but only 1 present.
at App.InitGPUBuffer (app.ts:235)
at main (main.ts:53)
localhost/:1 indexFormat must be undefined when using non-strip primitive topologies
at ValidateVertexStateDescriptor (../../third_party/dawn/src/dawn_native/RenderPipeline.cpp:106)
at ValidateRenderPipelineDescriptor (../../third_party/dawn/src/dawn_native/RenderPipeline.cpp:322)
at CreateRenderPipelineInternal (../../third_party/dawn/src/dawn_native/Device.cpp:1039)

I run this example under Google Chrome canary (64-bit) version 89.0.4379.0.

Can you look into this issue?

Thanks.

hjlld commented

Thank you! The spec has changed, now it should be fixed.

Just tried your new code. But I still got a white screen and the following message from the console:


app.ts:62 Passing a GPUDevice to getSwapChainPreferredFormat is deprecated. Pass a GPUAdapter instead, and update the calling code to expect a GPUTextureFormat to be retured instead of a Promise.
InitWebGPU @ app.ts:62
async function (async)
InitWebGPU @ app.ts:50
main @ main.ts:47
localhost/:1 indexFormat must be undefined when using non-strip primitive topologies
at ValidateVertexStateDescriptor (../../third_party/dawn/src/dawn_native/RenderPipeline.cpp:106)
at ValidateRenderPipelineDescriptor (../../third_party/dawn/src/dawn_native/RenderPipeline.cpp:322)
at CreateRenderPipelineInternal (../../third_party/dawn/src/dawn_native/Device.cpp:1039)
localhost/:1 Object is an error.
at Finish (../../third_party/dawn/src/dawn_native/EncodingContext.cpp:115)
localhost/:1 Object is an error.
at ValidateObject (../../third_party/dawn/src/dawn_native/Device.cpp:316)
at ValidateSubmit (../../third_party/dawn/src/dawn_native/Queue.cpp:340)

hjlld commented

Too many changes, i'll fix them ASAP. Thanks

hjlld commented

fixed

It works. Thank you very much.