extract insert_debug_marker from compute_pass_end_impl

This commit is contained in:
teoxoy 2024-06-25 14:31:48 +02:00 committed by Teodor Tanasoaia
parent f609e82055
commit 3ff680261d

View File

@ -647,18 +647,7 @@ impl Global {
pop_debug_group(&mut state, raw).map_pass_err(scope)?;
}
ArcComputeCommand::InsertDebugMarker { color: _, 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();
unsafe { raw.insert_debug_marker(label) }
}
state.string_offset += len;
insert_debug_marker(&mut state, raw, &base.string_data, len);
}
ArcComputeCommand::WriteTimestamp {
query_set,
@ -1029,6 +1018,24 @@ fn pop_debug_group<A: HalApi>(
Ok(())
}
fn insert_debug_marker<A: HalApi>(
state: &mut State<A>,
raw: &mut A::CommandEncoder,
string_data: &[u8],
len: usize,
) {
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();
unsafe { raw.insert_debug_marker(label) }
}
state.string_offset += len;
}
// Recording a compute pass.
impl Global {
pub fn compute_pass_set_bind_group<A: HalApi>(