Repository navigation
Enable GPU occlusion culling on WebGPU - #26372
Open
alexander-busarov wants to merge 4 commits into
Open
alexander-busarov wants to merge 4 commits into
alexander-busarov wants to merge 4 commits into
Conversation
# Objective GPU culling requires immediates and twelve storage textures per shader stage, preventing WebGPU devices without these capabilities from using occlusion culling. ## Solution - Add a uniform-buffer fallback for scalar parameters in mesh preprocessing (late-preprocess indirect-parameter offset) and depth downsampling (mip count) when immediates are unavailable. - Add a depth-pyramid fallback that generates one output mip per dispatch on devices with fewer than twelve storage textures per shader stage. - Replace infinite bounds in the mesh-preprocessing shader with finite values, since WebGPU shader validation rejects the non-finite constant expressions. - Update GPU culling capability checks to account for these fallbacks. ## Testing - cargo check -p bevy_pbr - Compiled and validated 13 shader variants using WESL and Naga, including uniform fallbacks with immediate support disabled. - rustfmt and git diff --check passed. - Tested in browsers with WebGPU and confirmed the changes work. ## AI Disclosure AI assisted with porting the existing changes to current upstream, adapting the shaders to WESL and the depth-texture API, and preparing and running shader validation checks.
Contributor
|
Welcome, new contributor! Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly ✨ |
IceSentry
reviewed
Nov 4, 2026
| /// parameter building passes. | ||
| #[derive(Resource)] | ||
| pub struct PreprocessPipelines { | ||
| u32_immediates: TinyU32Immediates, |
Contributor
There was a problem hiding this comment.
It's not clear to me what this is supposed to be. Could you add some docs?
Author
There was a problem hiding this comment.
Added a doc comment explaining the parameter’s purpose and how the uniform-buffer fallback works
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Objective
GPU culling requires immediates and twelve storage textures per shader stage, preventing WebGPU devices without these capabilities from using occlusion culling.
Solution
Testing
AI Disclosure
AI assisted with porting the existing changes to current upstream, adapting the shaders to WESL and the depth-texture API, and preparing and running shader validation checks.