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: 3d_scene example panics when pbr_pcss feature is enabled #16000

Open
rparrett opened this issue Oct 19, 2024 · 3 comments
Open

webgpu: 3d_scene example panics when pbr_pcss feature is enabled #16000

rparrett opened this issue Oct 19, 2024 · 3 comments
Labels
A-Rendering Drawing game state to the screen O-WebGPU Specific to the WebGPU render API P-Crash A sudden unexpected crash

Comments

@rparrett
Copy link
Contributor

rparrett commented Oct 19, 2024

Bevy version

main
bisected to #13497

Relevant system information

AdapterInfo { name: "", vendor: 0, device: 0, device_type: Other, driver: "", driver_info: "", backend: BrowserWebGpu }
Chrome Version 129.0.6668.101 (Official Build) (arm64)
(macos / m1 max)

This does not seem to be platform-specific. I also tested on:

win11 / nvidia 4080
Chrome 129

What you did

cargo run -p build-wasm-example -- --api webgpu 3d_scene --features=pbr_pcss
basic-http-server examples/wasm/

What went wrong

Compilation log for [Invalid ShaderModule (unlabeled)]:
1 error(s) generated while compiling the shader:
:704:25 error: no matching call to 'textureSampleLevel(texture_depth_2d_array, sampler, vec2<f32>, i32, f32)'

14 candidate functions:
 • 'textureSampleLevel(texture: texture_depth_2d_array  ✓ , sampler: sampler  ✓ , coords: vec2<f32>  ✓ , array_index: A  ✓ , level: L  ✗ ) -> f32' where:
      ✓  'A' is 'i32' or 'u32'
      ✗  'L' is 'i32' or 'u32'
 • 'textureSampleLevel(texture: texture_2d_array<f32>  ✗ , sampler: sampler  ✓ , coords: vec2<f32>  ✓ , array_index: A  ✓ , level: f32  ✓ ) -> vec4<f32>' where:
      ✓  'A' is 'i32' or 'u32'
 • 'textureSampleLevel(texture: texture_cube_array<f32>  ✗ , sampler: sampler  ✓ , coords: vec3<f32>  ✗ , array_index: A  ✓ , level: f32  ✓ ) -> vec4<f32>' where:
      ✓  'A' is 'i32' or 'u32'
 • 'textureSampleLevel(texture: texture_depth_2d  ✗ , sampler: sampler  ✓ , coords: vec2<f32>  ✓ , level: L  ✓ , offset: vec2<i32>  ✗ ) -> f32' where:
      ✓  'L' is 'i32' or 'u32'
 • 'textureSampleLevel(texture: texture_depth_2d_array  ✓ , sampler: sampler  ✓ , coords: vec2<f32>  ✓ , array_index: A  ✓ , level: L  ✗ , offset: vec2<i32>  ✗ ) -> f32' where:
      ✓  'A' is 'i32' or 'u32'
      ✗  'L' is 'i32' or 'u32'
 • 'textureSampleLevel(texture: texture_2d_array<f32>  ✗ , sampler: sampler  ✓ , coords: vec2<f32>  ✓ , array_index: A  ✓ , level: f32  ✓ , offset: vec2<i32>  ✗ ) -> vec4<f32>' where:
      ✓  'A' is 'i32' or 'u32'
 • 'textureSampleLevel(texture: texture_depth_2d  ✗ , sampler: sampler  ✓ , coords: vec2<f32>  ✓ , level: L  ✓ ) -> f32' where:
      ✓  'L' is 'i32' or 'u32'
 • 'textureSampleLevel(texture: texture_depth_cube_array  ✗ , sampler: sampler  ✓ , coords: vec3<f32>  ✗ , array_index: A  ✓ , level: L  ✗ ) -> f32' where:
      ✓  'A' is 'i32' or 'u32'
      ✗  'L' is 'i32' or 'u32'
 • 'textureSampleLevel(texture: texture_2d<f32>  ✗ , sampler: sampler  ✓ , coords: vec2<f32>  ✓ , level: f32  ✗ , offset: vec2<i32>  ✗ ) -> vec4<f32>'
 • 'textureSampleLevel(texture: texture_2d<f32>  ✗ , sampler: sampler  ✓ , coords: vec2<f32>  ✓ , level: f32  ✗ ) -> vec4<f32>'
 • 'textureSampleLevel(texture: texture_depth_cube  ✗ , sampler: sampler  ✓ , coords: vec3<f32>  ✗ , level: L  ✓ ) -> f32' where:
      ✓  'L' is 'i32' or 'u32'
 • 'textureSampleLevel(texture: texture_3d<f32>  ✗ , sampler: sampler  ✓ , coords: vec3<f32>  ✗ , level: f32  ✗ , offset: vec3<i32>  ✗ ) -> vec4<f32>'
 • 'textureSampleLevel(texture: texture_3d<f32>  ✗ , sampler: sampler  ✓ , coords: vec3<f32>  ✗ , level: f32  ✗ ) -> vec4<f32>'
 • 'textureSampleLevel(texture: texture_cube<f32>  ✗ , sampler: sampler  ✓ , coords: vec3<f32>  ✗ , level: f32  ✗ ) -> vec4<f32>'

    let sampled_depth = textureSampleLevel(directional_shadow_texturesX_naga_oil_mod_XMJSXM6K7OBRHEOR2NVSXG2C7OZUWK527MJUW4ZDJNZTXGX, directional_shadow_textures_linear_samplerX_naga_oil_mod_XMJSXM6K7OBRHEOR2NVSXG2C7OZUWK527MJUW4ZDJNZTXGX, light_local_3, array_index_3, 0f);
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Understand this warning
127.0.0.1/:1 [Invalid ShaderModule (unlabeled)] is invalid.
 - While validating fragment stage ([Invalid ShaderModule (unlabeled)], entryPoint: fragment).
 - While validating fragment state.
 - While calling [Device].CreateRenderPipeline([RenderPipelineDescriptor "pbr_opaque_mesh_pipeline"]).
Understand this warning
225[Invalid RenderPipeline "pbr_opaque_mesh_pipeline"] is invalid.
 - While encoding [RenderPassEncoder "main_opaque_pass_3d"].SetPipeline([Invalid RenderPipeline "pbr_opaque_mesh_pipeline"]).
 - While finishing [CommandEncoder "main_opaque_pass_3d_command_encoder"].
Understand this warning
225[Invalid CommandBuffer "main_opaque_pass_3d_command_encoder" from CommandEncoder "main_opaque_pass_3d_command_encoder"] is invalid.
 - While calling [Queue].Submit([[CommandBuffer], [CommandBuffer "shadow_pass_command_encoder" from CommandEncoder "shadow_pass_command_encoder"], [CommandBuffer "shadow_pass_command_encoder" from CommandEncoder "shadow_pass_command_encoder"], [CommandBuffer "shadow_pass_command_encoder" from CommandEncoder "shadow_pass_command_encoder"], [CommandBuffer "shadow_pass_command_encoder" from CommandEncoder "shadow_pass_command_encoder"], [CommandBuffer "shadow_pass_command_encoder" from CommandEncoder "shadow_pass_command_encoder"], [CommandBuffer "shadow_pass_command_encoder" from CommandEncoder "shadow_pass_command_encoder"], [CommandBuffer], [Invalid CommandBuffer "main_opaque_pass_3d_command_encoder" from CommandEncoder "main_opaque_pass_3d_command_encoder"], [CommandBuffer]])

Additional information

Seems to be a separate issue from what's going on with webgl2, which is documented here: #15998

@rparrett rparrett added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Oct 19, 2024
@rparrett rparrett changed the title webgpu: 3d_scene panics webgpu: 3d_scene example panics Oct 19, 2024
@alice-i-cecile alice-i-cecile added this to the 0.15 milestone Oct 19, 2024
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen P-Crash A sudden unexpected crash O-WebGPU Specific to the WebGPU render API and removed S-Needs-Triage This issue needs to be labelled C-Bug An unexpected or incorrect behavior labels Oct 19, 2024
@pcwalton
Copy link
Contributor

This seems to be a bug in wgpu/Naga? The WGSL spec agrees with Chrome: the level parameter of textureSampleLevel when applied to a texture_depth_2d_array is u32. But wgpu/Naga requires that it be an f32, and this is what we supply. That breaks Chrome.

@rparrett rparrett changed the title webgpu: 3d_scene example panics webgpu: 3d_scene example panics when pbr_pcss feature is enabled Nov 7, 2024
@rparrett
Copy link
Contributor Author

rparrett commented Nov 7, 2024

This is no longer a major issue after #16068. Users targetting webgpu can just not use the pbr_pcss feature.

Edited the title/description to reflrect this.

I also double-checked, and this wasn't fixed by wgpu 0.23.

Linking the upstream bug: gfx-rs/wgpu#4548

@alice-i-cecile alice-i-cecile removed this from the 0.15 milestone Nov 7, 2024
@alice-i-cecile
Copy link
Member

Cut from the milestone; I agree that it's no longer vital.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen O-WebGPU Specific to the WebGPU render API P-Crash A sudden unexpected crash
Projects
None yet
Development

No branches or pull requests

3 participants