-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Implement GPU frustum culling. #12889
Merged
Merged
Commits on Apr 10, 2024
-
Implement GPU frustum culling.
This commit implements opt-in GPU frustum culling, built on top of the infrastructure in bevyengine#12773. To enable it on a camera, add the `GpuCulling` component to it. To additionally disable CPU frustum culling, add the `NoCpuCulling` component. Note that adding `GpuCulling` without `NoCpuCulling` *currently* does nothing useful. The reason why `GpuCulling` doesn't automatically imply `NoCpuCulling` is that I intend to follow this patch up with GPU two-phase occlusion culling, and CPU frustum culling plus GPU occlusion culling seems like a very commonly-desired mode. Adding the `GpuCulling` component frustum to a view puts that view into *indirect mode*. This mode makes all drawcalls indirect, relying on the mesh preprocessing shader to allocate instances dynamically. In indirect mode, the `PreprocessWorkItem` `output_index` points not to a `MeshUniform` instance slot but instead to a set of `wgpu` `IndirectParameters`, from which it allocates an instance slot dynamically if frustum culling succeeds. Batch building has been updated to allocate and track indirect parameter slots, and the AABBs are now supplied to the GPU as `MeshCullingData`. A small amount of code relating to the frustum culling has been borrowed from meshlets and moved into `maths.wgsl`. Note that standard Bevy frustum culling uses AABBs, while meshlets use bounding spheres; this means that not as much code can be shared as one might think. This patch doesn't provide any way to perform GPU culling on shadow maps, to avoid making this patch bigger than it already is. That can be a followup.
Configuration menu - View commit details
-
Copy full SHA for 37ab4de - Browse repository at this point
Copy the full SHA 37ab4deView commit details
Commits on Apr 11, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 2816333 - Browse repository at this point
Copy the full SHA 2816333View commit details
Commits on Apr 23, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 808358c - Browse repository at this point
Copy the full SHA 808358cView commit details
Commits on Apr 24, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 295ebb8 - Browse repository at this point
Copy the full SHA 295ebb8View commit details
Commits on Apr 26, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 0fa6875 - Browse repository at this point
Copy the full SHA 0fa6875View commit details -
Configuration menu - View commit details
-
Copy full SHA for e70ca83 - Browse repository at this point
Copy the full SHA e70ca83View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6ff883f - Browse repository at this point
Copy the full SHA 6ff883fView commit details
Commits on Apr 28, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 808fb3e - Browse repository at this point
Copy the full SHA 808fb3eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 907106f - Browse repository at this point
Copy the full SHA 907106fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 60ed39c - Browse repository at this point
Copy the full SHA 60ed39cView commit details -
Configuration menu - View commit details
-
Copy full SHA for e4954ad - Browse repository at this point
Copy the full SHA e4954adView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4fa60ea - Browse repository at this point
Copy the full SHA 4fa60eaView commit details -
Configuration menu - View commit details
-
Copy full SHA for af60424 - Browse repository at this point
Copy the full SHA af60424View commit details
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.