trace only compute_pass_end_with_unresolved_commands

This commit is contained in:
teoxoy 2024-06-20 20:43:51 +02:00 committed by Teodor Tanasoaia
parent f25e07b984
commit 981db9be33
2 changed files with 19 additions and 94 deletions

View File

@ -416,6 +416,25 @@ impl Global {
let scope = PassErrorScope::PassEncoder(encoder_id);
let cmd_buf = CommandBuffer::get_encoder(hub, encoder_id).map_pass_err(scope)?;
#[cfg(feature = "trace")]
{
let mut cmd_buf_data = cmd_buf.data.lock();
let cmd_buf_data = cmd_buf_data.as_mut().unwrap();
if let Some(ref mut list) = cmd_buf_data.commands {
list.push(crate::device::trace::Command::RunComputePass {
base: BasePass {
label: base.label.clone(),
commands: base.commands.clone(),
dynamic_offsets: base.dynamic_offsets.clone(),
string_data: base.string_data.clone(),
push_constant_data: base.push_constant_data.clone(),
},
timestamp_writes: timestamp_writes.cloned(),
});
}
}
let commands =
super::ComputeCommand::resolve_compute_command_ids(A::hub(self), &base.commands)?;
@ -462,24 +481,6 @@ impl Global {
let mut cmd_buf_data = cmd_buf.data.lock();
let cmd_buf_data = cmd_buf_data.as_mut().unwrap();
#[cfg(feature = "trace")]
if let Some(ref mut list) = cmd_buf_data.commands {
list.push(crate::device::trace::Command::RunComputePass {
base: BasePass {
label: base.label.clone(),
commands: base.commands.iter().map(Into::into).collect(),
dynamic_offsets: base.dynamic_offsets.to_vec(),
string_data: base.string_data.to_vec(),
push_constant_data: base.push_constant_data.to_vec(),
},
timestamp_writes: timestamp_writes.as_ref().map(|tw| PassTimestampWrites {
query_set: tw.query_set.as_info().id(),
beginning_of_pass_write_index: tw.beginning_of_pass_write_index,
end_of_pass_write_index: tw.end_of_pass_write_index,
}),
});
}
let encoder = &mut cmd_buf_data.encoder;
let status = &mut cmd_buf_data.status;

View File

@ -239,79 +239,3 @@ pub enum ArcComputeCommand<A: HalApi> {
EndPipelineStatisticsQuery,
}
#[cfg(feature = "trace")]
impl<A: HalApi> From<&ArcComputeCommand<A>> for ComputeCommand {
fn from(value: &ArcComputeCommand<A>) -> Self {
use crate::resource::Resource as _;
match value {
ArcComputeCommand::SetBindGroup {
index,
num_dynamic_offsets,
bind_group,
} => ComputeCommand::SetBindGroup {
index: *index,
num_dynamic_offsets: *num_dynamic_offsets,
bind_group_id: bind_group.as_info().id(),
},
ArcComputeCommand::SetPipeline(pipeline) => {
ComputeCommand::SetPipeline(pipeline.as_info().id())
}
ArcComputeCommand::SetPushConstant {
offset,
size_bytes,
values_offset,
} => ComputeCommand::SetPushConstant {
offset: *offset,
size_bytes: *size_bytes,
values_offset: *values_offset,
},
ArcComputeCommand::Dispatch(dim) => ComputeCommand::Dispatch(*dim),
ArcComputeCommand::DispatchIndirect { buffer, offset } => {
ComputeCommand::DispatchIndirect {
buffer_id: buffer.as_info().id(),
offset: *offset,
}
}
ArcComputeCommand::PushDebugGroup { color, len } => ComputeCommand::PushDebugGroup {
color: *color,
len: *len,
},
ArcComputeCommand::PopDebugGroup => ComputeCommand::PopDebugGroup,
ArcComputeCommand::InsertDebugMarker { color, len } => {
ComputeCommand::InsertDebugMarker {
color: *color,
len: *len,
}
}
ArcComputeCommand::WriteTimestamp {
query_set,
query_index,
} => ComputeCommand::WriteTimestamp {
query_set_id: query_set.as_info().id(),
query_index: *query_index,
},
ArcComputeCommand::BeginPipelineStatisticsQuery {
query_set,
query_index,
} => ComputeCommand::BeginPipelineStatisticsQuery {
query_set_id: query_set.as_info().id(),
query_index: *query_index,
},
ArcComputeCommand::EndPipelineStatisticsQuery => {
ComputeCommand::EndPipelineStatisticsQuery
}
}
}
}