Skip to content

Commit a61c201

Browse files
authored
Fix crash with RenderDiagnosticsPlugin on mac (#21238)
# Objective - Fixes #21167 (happens with `trace_tracy` feature too, as it adds the plugin automatically) - There are some uses of `time_span` inside passes, which go around [the check](https://github.com/bevyengine/bevy/blob/10325593d5bae88e1089bdf1fa1395f232d5248b/crates/bevy_render/src/diagnostic/internal.rs#L289) for [TIMESTAMP_QUERY_INSIDE_PASSES](https://docs.rs/wgpu-types/latest/wgpu_types/struct.FeaturesWGPU.html#associatedconstant.TIMESTAMP_QUERY_INSIDE_PASSES) feature (unsupported on Apple GPU). introduced in #19191 ## Solution - They look like just typos (all in `let pass_span = time_span` form), so replaced with `pass_span`. There's an occurence of this pattern in `meshlet/visibility_buffer_raster_node.rs`, but it's the variable name that seems incorrect in this case. I renamed it instead. ## Testing - Running `log_diagnostics` example no longer crashes on Mac.
1 parent c78c41c commit a61c201

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

crates/bevy_anti_alias/src/contrast_adaptive_sharpening/node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl Node for CasNode {
113113
let mut render_pass = render_context
114114
.command_encoder()
115115
.begin_render_pass(&pass_descriptor);
116-
let pass_span = diagnostics.time_span(&mut render_pass, "contrast_adaptive_sharpening");
116+
let pass_span = diagnostics.pass_span(&mut render_pass, "contrast_adaptive_sharpening");
117117

118118
render_pass.set_pipeline(pipeline);
119119
render_pass.set_bind_group(0, bind_group, &[uniform_index.index()]);

crates/bevy_pbr/src/atmosphere/node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl ViewNode for AtmosphereLutsNode {
8080
label: Some("atmosphere_luts"),
8181
timestamp_writes: None,
8282
});
83-
let pass_span = diagnostics.time_span(&mut luts_pass, "atmosphere_luts");
83+
let pass_span = diagnostics.pass_span(&mut luts_pass, "atmosphere_luts");
8484

8585
fn dispatch_2d(compute_pass: &mut ComputePass, size: UVec2) {
8686
const WORKGROUP_SIZE: u32 = 16;

crates/bevy_pbr/src/meshlet/visibility_buffer_raster_node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ impl Node for MeshletVisibilityBufferRasterPassNode {
246246
"meshlet_visibility_buffer_raster: {}",
247247
shadow_view.pass_name
248248
));
249-
let pass_span = diagnostics.time_span(
249+
let time_span_shadow = diagnostics.time_span(
250250
render_context.command_encoder(),
251251
shadow_view.pass_name.clone(),
252252
);
@@ -342,7 +342,7 @@ impl Node for MeshletVisibilityBufferRasterPassNode {
342342
downsample_depth_second_shadow_view_pipeline,
343343
);
344344
render_context.command_encoder().pop_debug_group();
345-
pass_span.end(render_context.command_encoder());
345+
time_span_shadow.end(render_context.command_encoder());
346346
}
347347

348348
time_span.end(render_context.command_encoder());

crates/bevy_pbr/src/render/gpu_preprocess.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ impl Node for EarlyGpuPreprocessNode {
598598
label: Some("early_mesh_preprocessing"),
599599
timestamp_writes: None,
600600
});
601-
let pass_span = diagnostics.time_span(&mut compute_pass, "early_mesh_preprocessing");
601+
let pass_span = diagnostics.pass_span(&mut compute_pass, "early_mesh_preprocessing");
602602

603603
let mut all_views: SmallVec<[_; 8]> = SmallVec::new();
604604
all_views.push(graph.view_entity());
@@ -839,7 +839,7 @@ impl Node for LateGpuPreprocessNode {
839839
label: Some("late_mesh_preprocessing"),
840840
timestamp_writes: None,
841841
});
842-
let pass_span = diagnostics.time_span(&mut compute_pass, "late_mesh_preprocessing");
842+
let pass_span = diagnostics.pass_span(&mut compute_pass, "late_mesh_preprocessing");
843843

844844
// Run the compute passes.
845845
for (view, bind_groups, view_uniform_offset) in self.view_query.iter_manual(world) {
@@ -1056,7 +1056,7 @@ fn run_build_indirect_parameters_node(
10561056
label: Some(label),
10571057
timestamp_writes: None,
10581058
});
1059-
let pass_span = diagnostics.time_span(&mut compute_pass, label);
1059+
let pass_span = diagnostics.pass_span(&mut compute_pass, label);
10601060

10611061
// Fetch the pipeline.
10621062
let (

crates/bevy_post_process/src/auto_exposure/node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl Node for AutoExposureNode {
128128
label: Some("auto_exposure"),
129129
timestamp_writes: None,
130130
});
131-
let pass_span = diagnostics.time_span(&mut compute_pass, "auto_exposure");
131+
let pass_span = diagnostics.pass_span(&mut compute_pass, "auto_exposure");
132132

133133
compute_pass.set_bind_group(0, &compute_bind_group, &[view_uniform_offset.offset]);
134134
compute_pass.set_pipeline(histogram_pipeline);

0 commit comments

Comments
 (0)