Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGPU: Failed to read the 'depthStencilAttachment' property from 'GPURenderPassDescriptor' #3663

Closed
mockersf opened this issue Apr 10, 2023 · 4 comments · Fixed by #3670
Closed
Labels
api: webgpu Issues with direct interface with WebGPU type: bug Something isn't working

Comments

@mockersf
Copy link
Contributor

mockersf commented Apr 10, 2023

Description

I'm trying to use WebGPU in Bevy. This PR make some of the Bevy pipelines render in WebGPU, but still a lot of errors.

Some of those errors are fixed on wgpu trunk. This branch is updated to wgpu trunk: https://github.com/mockersf/bevy/tree/webgpu-support-not-async-wgpu-trunk. On commit cfc038a when I ran it.

Repro steps

Checking out the above branch

cargo run -p build-wasm-example -- --api webgpu load_gltf

and then serve the folder examples/wasm

Expected vs observed behavior

Only a black screen renders, with the following error in the console:

wasm_example.js:1132 Uncaught TypeError: Failed to execute 'beginRenderPass' on 'GPUCommandEncoder': Failed to read the 'depthStencilAttachment' property from 'GPURenderPassDescriptor': Failed to read the 'view' property from 'GPURenderPassDepthStencilAttachment': Required member is undefined.
    at imports.wbg.__wbg_beginRenderPass_db57aa384a7aef06 (wasm_example.js:1132:37)
    at web_sys::features::gen_GpuCommandEncoder::GpuCommandEncoder::begin_render_pass::hd5e58f25ad812db1 (wasm_example_bg.wasm:0xe64118)
    at <wgpu::backend::web::Context as wgpu::context::Context>::command_encoder_begin_render_pass::hbdc8e17b1b349284 (wasm_example_bg.wasm:0xa5fbb8)
    at <T as wgpu::context::DynContext>::command_encoder_begin_render_pass::h25d5e0611a50491f (wasm_example_bg.wasm:0xdf327c)
    at wgpu::CommandEncoder::begin_render_pass::h70acf822126d6290 (wasm_example_bg.wasm:0xd68410)
    at bevy_render::renderer::RenderContext::begin_tracked_render_pass::hd762be9423cd007e (wasm_example_bg.wasm:0xbf9476)
    at <bevy_core_pipeline::core_3d::main_opaque_pass_3d_node::MainOpaquePass3dNode as bevy_render::render_graph::node::Node>::run::h2fabea3ed534a938 (wasm_example_bg.wasm:0x36ca75)
    at bevy_render::renderer::graph_runner::RenderGraphRunner::run_graph::hbee3fc9f5504ca56 (wasm_example_bg.wasm:0x110105)
    at bevy_render::renderer::graph_runner::RenderGraphRunner::run_graph::hbee3fc9f5504ca56 (wasm_example_bg.wasm:0x11029e)
    at bevy_render::renderer::graph_runner::RenderGraphRunner::run::he524a0e8137aa4a9 (wasm_example_bg.wasm:0x6fa3ad)

Extra materials
Screenshot 2023-04-10 at 22 49 55

Platform
macOS 13.3, chromium 114.0.5700.0

@teoxoy teoxoy added type: bug Something isn't working api: webgpu Issues with direct interface with WebGPU labels Apr 11, 2023
@maxammann
Copy link
Contributor

Having the same problem and can confirm a fix later.

@mockersf
Copy link
Contributor Author

mockersf commented Apr 12, 2023

Adding some logs, there is an issue when down casting the texture on

wgpu/wgpu/src/backend/web.rs

Lines 2100 to 2101 in f3bf0f7

let depth_stencil_attachment: &<Context as crate::Context>::TextureViewData =
downcast_ref(&dsa.view.data);

dsa.view:

TextureView { context: Context { type: "Web" }, id: ObjectId { id: Some(1) }, data: Any { .. } }

depth_stencil_attachment:

Sendable(GpuTextureView { obj: Object { obj: JsValue(undefined) } })

@grovesNL
Copy link
Collaborator

@mockersf thanks! Could you try #3670 to see if that helps?

@maxammann
Copy link
Contributor

Works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: webgpu Issues with direct interface with WebGPU type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants