Skip to content

fix(webgpu): set_unclipped_depth #7841

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

Merged
merged 2 commits into from
Jun 24, 2025
Merged

Conversation

atlv24
Copy link
Collaborator

@atlv24 atlv24 commented Jun 23, 2025

Connections
bevyengine/bevy#19626

Description
At Bevy we've been dealing with shadows disappearing at certain view angles on WebGPU: bevyengine/bevy#19626

One potential fix we found was ignoring the reported value of DEPTH_CLIP_CONTROL on WebGPU: bevyengine/bevy#19785

This suggests that WebGPU is either incorrectly reporting support of the feature, or there is a wgpu bug. I scanned through the codebase and found this line:

//mapped.unclipped_depth(primitive.unclipped_depth);

    //TODO:
    //mapped.unclipped_depth(primitive.unclipped_depth);

I went digging through git blame for an explanation, and it was moved around and renamed as a comment since but originated here: i509VCB@756ea0e#diff-22b854c44dc9db01eda3ade5dee571eb22a526b759ce2a6da4739f28435faedb

I couldn't find a PR for this, seems like it was just commited directly to master and may have been an oversight, but I'm not sure.

So I uncommented the line, got it to compile by using the set_ variant, and tested it, and it fixes our problem.

Testing
Linked bevy issue has a repro case

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

@robtfm
Copy link
Collaborator

robtfm commented Jun 23, 2025

should it be gated on cfg=web_sys_unstable_apis or is that implied to reach here already?

@cwfitzgerald
Copy link
Member

cwfitzgerald commented Jun 23, 2025

@robtfm We explictly vendor the webgpu bindings out of web-sys and remove those cfgs

Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! no idea either what happend there, but see nothing wrong with this & great you confirmed this working as-is 👍

@Wumpf Wumpf merged commit 0c05dbf into gfx-rs:trunk Jun 24, 2025
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants