mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
trace only render_pass_end_with_unresolved_commands
This commit is contained in:
parent
981db9be33
commit
fc6fe76fce
@ -1506,6 +1506,33 @@ impl Global {
|
||||
timestamp_writes: Option<&PassTimestampWrites>,
|
||||
occlusion_query_set: Option<id::QuerySetId>,
|
||||
) -> Result<(), RenderPassError> {
|
||||
let pass_scope = PassErrorScope::PassEncoder(encoder_id);
|
||||
#[cfg(feature = "trace")]
|
||||
{
|
||||
let hub = A::hub(self);
|
||||
let cmd_buf: Arc<CommandBuffer<A>> =
|
||||
CommandBuffer::get_encoder(hub, encoder_id).map_pass_err(pass_scope)?;
|
||||
|
||||
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::RunRenderPass {
|
||||
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(),
|
||||
},
|
||||
target_colors: color_attachments.to_vec(),
|
||||
target_depth_stencil: depth_stencil_attachment.cloned(),
|
||||
timestamp_writes: timestamp_writes.cloned(),
|
||||
occlusion_query_set_id: occlusion_query_set,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
let BasePass {
|
||||
label,
|
||||
commands,
|
||||
@ -1526,7 +1553,7 @@ impl Global {
|
||||
);
|
||||
if let Some(err) = encoder_error {
|
||||
return Err(RenderPassError {
|
||||
scope: PassErrorScope::PassEncoder(encoder_id),
|
||||
scope: pass_scope,
|
||||
inner: err.into(),
|
||||
});
|
||||
};
|
||||
@ -1583,48 +1610,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::RunRenderPass {
|
||||
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(),
|
||||
},
|
||||
target_colors: pass
|
||||
.color_attachments
|
||||
.iter()
|
||||
.map(|attachment| {
|
||||
attachment.as_ref().map(|a| RenderPassColorAttachment {
|
||||
view: a.view.as_info().id(),
|
||||
resolve_target: a.resolve_target.as_ref().map(|a| a.as_info().id()),
|
||||
channel: a.channel.clone(),
|
||||
})
|
||||
})
|
||||
.collect(),
|
||||
target_depth_stencil: pass.depth_stencil_attachment.as_ref().map(|d| {
|
||||
RenderPassDepthStencilAttachment {
|
||||
view: d.view.as_info().id(),
|
||||
depth: d.depth.clone(),
|
||||
stencil: d.stencil.clone(),
|
||||
}
|
||||
}),
|
||||
timestamp_writes: pass.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,
|
||||
}
|
||||
}),
|
||||
occlusion_query_set_id: pass
|
||||
.occlusion_query_set
|
||||
.as_ref()
|
||||
.map(|q| q.as_info().id()),
|
||||
});
|
||||
}
|
||||
|
||||
device.check_is_valid().map_pass_err(pass_scope)?;
|
||||
|
||||
let encoder = &mut cmd_buf_data.encoder;
|
||||
|
@ -487,179 +487,3 @@ pub enum ArcRenderCommand<A: HalApi> {
|
||||
EndPipelineStatisticsQuery,
|
||||
ExecuteBundle(Arc<RenderBundle<A>>),
|
||||
}
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
impl<A: HalApi> From<&ArcRenderCommand<A>> for RenderCommand {
|
||||
fn from(value: &ArcRenderCommand<A>) -> Self {
|
||||
use crate::resource::Resource as _;
|
||||
|
||||
match value {
|
||||
ArcRenderCommand::SetBindGroup {
|
||||
index,
|
||||
num_dynamic_offsets,
|
||||
bind_group,
|
||||
} => RenderCommand::SetBindGroup {
|
||||
index: *index,
|
||||
num_dynamic_offsets: *num_dynamic_offsets,
|
||||
bind_group_id: bind_group.as_info().id(),
|
||||
},
|
||||
|
||||
ArcRenderCommand::SetPipeline(pipeline) => {
|
||||
RenderCommand::SetPipeline(pipeline.as_info().id())
|
||||
}
|
||||
|
||||
ArcRenderCommand::SetPushConstant {
|
||||
offset,
|
||||
size_bytes,
|
||||
values_offset,
|
||||
stages,
|
||||
} => RenderCommand::SetPushConstant {
|
||||
offset: *offset,
|
||||
size_bytes: *size_bytes,
|
||||
values_offset: *values_offset,
|
||||
stages: *stages,
|
||||
},
|
||||
|
||||
ArcRenderCommand::PushDebugGroup { color, len } => RenderCommand::PushDebugGroup {
|
||||
color: *color,
|
||||
len: *len,
|
||||
},
|
||||
|
||||
ArcRenderCommand::PopDebugGroup => RenderCommand::PopDebugGroup,
|
||||
|
||||
ArcRenderCommand::InsertDebugMarker { color, len } => {
|
||||
RenderCommand::InsertDebugMarker {
|
||||
color: *color,
|
||||
len: *len,
|
||||
}
|
||||
}
|
||||
|
||||
ArcRenderCommand::WriteTimestamp {
|
||||
query_set,
|
||||
query_index,
|
||||
} => RenderCommand::WriteTimestamp {
|
||||
query_set_id: query_set.as_info().id(),
|
||||
query_index: *query_index,
|
||||
},
|
||||
|
||||
ArcRenderCommand::BeginPipelineStatisticsQuery {
|
||||
query_set,
|
||||
query_index,
|
||||
} => RenderCommand::BeginPipelineStatisticsQuery {
|
||||
query_set_id: query_set.as_info().id(),
|
||||
query_index: *query_index,
|
||||
},
|
||||
|
||||
ArcRenderCommand::EndPipelineStatisticsQuery => {
|
||||
RenderCommand::EndPipelineStatisticsQuery
|
||||
}
|
||||
ArcRenderCommand::SetIndexBuffer {
|
||||
buffer,
|
||||
index_format,
|
||||
offset,
|
||||
size,
|
||||
} => RenderCommand::SetIndexBuffer {
|
||||
buffer_id: buffer.as_info().id(),
|
||||
index_format: *index_format,
|
||||
offset: *offset,
|
||||
size: *size,
|
||||
},
|
||||
|
||||
ArcRenderCommand::SetVertexBuffer {
|
||||
slot,
|
||||
buffer,
|
||||
offset,
|
||||
size,
|
||||
} => RenderCommand::SetVertexBuffer {
|
||||
slot: *slot,
|
||||
buffer_id: buffer.as_info().id(),
|
||||
offset: *offset,
|
||||
size: *size,
|
||||
},
|
||||
|
||||
ArcRenderCommand::SetBlendConstant(color) => RenderCommand::SetBlendConstant(*color),
|
||||
|
||||
ArcRenderCommand::SetStencilReference(reference) => {
|
||||
RenderCommand::SetStencilReference(*reference)
|
||||
}
|
||||
|
||||
ArcRenderCommand::SetViewport {
|
||||
rect,
|
||||
depth_min,
|
||||
depth_max,
|
||||
} => RenderCommand::SetViewport {
|
||||
rect: *rect,
|
||||
depth_min: *depth_min,
|
||||
depth_max: *depth_max,
|
||||
},
|
||||
|
||||
ArcRenderCommand::SetScissor(scissor) => RenderCommand::SetScissor(*scissor),
|
||||
|
||||
ArcRenderCommand::Draw {
|
||||
vertex_count,
|
||||
instance_count,
|
||||
first_vertex,
|
||||
first_instance,
|
||||
} => RenderCommand::Draw {
|
||||
vertex_count: *vertex_count,
|
||||
instance_count: *instance_count,
|
||||
first_vertex: *first_vertex,
|
||||
first_instance: *first_instance,
|
||||
},
|
||||
|
||||
ArcRenderCommand::DrawIndexed {
|
||||
index_count,
|
||||
instance_count,
|
||||
first_index,
|
||||
base_vertex,
|
||||
first_instance,
|
||||
} => RenderCommand::DrawIndexed {
|
||||
index_count: *index_count,
|
||||
instance_count: *instance_count,
|
||||
first_index: *first_index,
|
||||
base_vertex: *base_vertex,
|
||||
first_instance: *first_instance,
|
||||
},
|
||||
|
||||
ArcRenderCommand::MultiDrawIndirect {
|
||||
buffer,
|
||||
offset,
|
||||
count,
|
||||
indexed,
|
||||
} => RenderCommand::MultiDrawIndirect {
|
||||
buffer_id: buffer.as_info().id(),
|
||||
offset: *offset,
|
||||
count: *count,
|
||||
indexed: *indexed,
|
||||
},
|
||||
|
||||
ArcRenderCommand::MultiDrawIndirectCount {
|
||||
buffer,
|
||||
offset,
|
||||
count_buffer,
|
||||
count_buffer_offset,
|
||||
max_count,
|
||||
indexed,
|
||||
} => RenderCommand::MultiDrawIndirectCount {
|
||||
buffer_id: buffer.as_info().id(),
|
||||
offset: *offset,
|
||||
count_buffer_id: count_buffer.as_info().id(),
|
||||
count_buffer_offset: *count_buffer_offset,
|
||||
max_count: *max_count,
|
||||
indexed: *indexed,
|
||||
},
|
||||
|
||||
ArcRenderCommand::BeginOcclusionQuery { query_index } => {
|
||||
RenderCommand::BeginOcclusionQuery {
|
||||
query_index: *query_index,
|
||||
}
|
||||
}
|
||||
|
||||
ArcRenderCommand::EndOcclusionQuery => RenderCommand::EndOcclusionQuery,
|
||||
|
||||
ArcRenderCommand::ExecuteBundle(bundle) => {
|
||||
RenderCommand::ExecuteBundle(bundle.as_info().id())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user