extract pop_debug_group from compute_pass_end_impl

This commit is contained in:
teoxoy 2024-06-25 14:30:43 +02:00 committed by Teodor Tanasoaia
parent c72af7b57f
commit f609e82055

View File

@ -644,21 +644,7 @@ impl Global {
}
ArcComputeCommand::PopDebugGroup => {
let scope = PassErrorScope::PopDebugGroup;
if state.debug_scope_depth == 0 {
return Err(ComputePassErrorInner::InvalidPopDebugGroup)
.map_pass_err(scope);
}
state.debug_scope_depth -= 1;
if !state
.device
.instance_flags
.contains(wgt::InstanceFlags::DISCARD_HAL_LABELS)
{
unsafe {
raw.end_debug_marker();
}
}
pop_debug_group(&mut state, raw).map_pass_err(scope)?;
}
ArcComputeCommand::InsertDebugMarker { color: _, len } => {
if !state
@ -1023,6 +1009,26 @@ fn push_debug_group<A: HalApi>(
state.string_offset += len;
}
fn pop_debug_group<A: HalApi>(
state: &mut State<A>,
raw: &mut A::CommandEncoder,
) -> Result<(), ComputePassErrorInner> {
if state.debug_scope_depth == 0 {
return Err(ComputePassErrorInner::InvalidPopDebugGroup);
}
state.debug_scope_depth -= 1;
if !state
.device
.instance_flags
.contains(wgt::InstanceFlags::DISCARD_HAL_LABELS)
{
unsafe {
raw.end_debug_marker();
}
}
Ok(())
}
// Recording a compute pass.
impl Global {
pub fn compute_pass_set_bind_group<A: HalApi>(