From 4edebc6444ae9b40e42e76397c3af5fc9c42c0ae Mon Sep 17 00:00:00 2001 From: teoxoy <28601907+teoxoy@users.noreply.github.com> Date: Tue, 25 Jun 2024 17:19:07 +0200 Subject: [PATCH] extract `push_debug_group` from `render_pass_end_impl` --- wgpu-core/src/command/render.rs | 36 +++++++++++++++++---------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/wgpu-core/src/command/render.rs b/wgpu-core/src/command/render.rs index f82b5275ac..391fdba490 100644 --- a/wgpu-core/src/command/render.rs +++ b/wgpu-core/src/command/render.rs @@ -1676,23 +1676,7 @@ impl Global { .map_pass_err(scope)?; } ArcRenderCommand::PushDebugGroup { color: _, len } => { - state.debug_scope_depth += 1; - if !state - .device - .instance_flags - .contains(wgt::InstanceFlags::DISCARD_HAL_LABELS) - { - let label = str::from_utf8( - &base.string_data[state.string_offset..state.string_offset + len], - ) - .unwrap(); - - api_log!("RenderPass::push_debug_group {label:?}"); - unsafe { - state.raw_encoder.begin_debug_marker(label); - } - } - state.string_offset += len; + push_debug_group(&mut state, &base.string_data, len); } ArcRenderCommand::PopDebugGroup => { api_log!("RenderPass::pop_debug_group"); @@ -2625,6 +2609,24 @@ fn multi_draw_indirect_count( Ok(()) } +fn push_debug_group(state: &mut State, string_data: &[u8], len: usize) { + state.debug_scope_depth += 1; + if !state + .device + .instance_flags + .contains(wgt::InstanceFlags::DISCARD_HAL_LABELS) + { + let label = + str::from_utf8(&string_data[state.string_offset..state.string_offset + len]).unwrap(); + + api_log!("RenderPass::push_debug_group {label:?}"); + unsafe { + state.raw_encoder.begin_debug_marker(label); + } + } + state.string_offset += len; +} + impl Global { pub fn render_pass_set_bind_group( &self,