From 79cbe845db1a5d59c0d76638b874bd2e24810b9c Mon Sep 17 00:00:00 2001 From: Greeble <166992735+greeble-dev@users.noreply.github.com> Date: Mon, 5 May 2025 19:04:43 +0100 Subject: [PATCH] Fix occlusion culling not respecting device limits (#18974) The occlusion culling plugin checks for a GPU feature by looking at `RenderAdapter`. This is wrong - it should be checking `RenderDevice`. See these notes for background: https://github.com/bevyengine/bevy/discussions/18973 I don't have any evidence that this was causing any bugs, so right now it's just a precaution. ## Testing ``` cargo run --example occlusion_culling ``` Tested on Win10/Nvidia across Vulkan, WebGL/Chrome, WebGPU/Chrome. --- examples/3d/occlusion_culling.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/3d/occlusion_culling.rs b/examples/3d/occlusion_culling.rs index 4c69db0a4a..9268f1dc6a 100644 --- a/examples/3d/occlusion_culling.rs +++ b/examples/3d/occlusion_culling.rs @@ -32,7 +32,7 @@ use bevy::{ experimental::occlusion_culling::OcclusionCulling, render_graph::{self, NodeRunError, RenderGraphApp, RenderGraphContext, RenderLabel}, render_resource::{Buffer, BufferDescriptor, BufferUsages, MapMode}, - renderer::{RenderAdapter, RenderContext, RenderDevice}, + renderer::{RenderContext, RenderDevice}, settings::WgpuFeatures, Render, RenderApp, RenderDebugFlags, RenderPlugin, RenderSet, }, @@ -140,7 +140,7 @@ struct SavedIndirectParametersData { impl FromWorld for SavedIndirectParameters { fn from_world(world: &mut World) -> SavedIndirectParameters { - let render_adapter = world.resource::(); + let render_device = world.resource::(); SavedIndirectParameters(Arc::new(Mutex::new(SavedIndirectParametersData { data: vec![], count: 0, @@ -152,7 +152,7 @@ impl FromWorld for SavedIndirectParameters { // supports `multi_draw_indirect_count`. So, if we don't have that // feature, then we don't bother to display how many meshes were // culled. - occlusion_culling_introspection_supported: render_adapter + occlusion_culling_introspection_supported: render_device .features() .contains(WgpuFeatures::MULTI_DRAW_INDIRECT_COUNT), })))