extract push_debug_group from render_pass_end_impl

This commit is contained in:
teoxoy 2024-06-25 17:19:07 +02:00 committed by Teodor Tanasoaia
parent c42c02e801
commit 4edebc6444

View File

@ -1676,23 +1676,7 @@ impl Global {
.map_pass_err(scope)?; .map_pass_err(scope)?;
} }
ArcRenderCommand::PushDebugGroup { color: _, len } => { ArcRenderCommand::PushDebugGroup { color: _, len } => {
state.debug_scope_depth += 1; push_debug_group(&mut state, &base.string_data, len);
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;
} }
ArcRenderCommand::PopDebugGroup => { ArcRenderCommand::PopDebugGroup => {
api_log!("RenderPass::pop_debug_group"); api_log!("RenderPass::pop_debug_group");
@ -2625,6 +2609,24 @@ fn multi_draw_indirect_count<A: HalApi>(
Ok(()) Ok(())
} }
fn push_debug_group<A: HalApi>(state: &mut State<A>, 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 { impl Global {
pub fn render_pass_set_bind_group( pub fn render_pass_set_bind_group(
&self, &self,