fix(webgpu): set_unclipped_depth #7841
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
wgpu/wgpu/src/backend/webgpu.rs
Line 384 in 440b33f
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
cargo fmt
.taplo format
.cargo clippy --tests
. If applicable, add:--target wasm32-unknown-unknown
cargo xtask test
to run tests.CHANGELOG.md
entry.