mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-01-08 22:08:23 -05:00
Panic on errors in pass_end_with_unresolved_commands (#7765)
This commit is contained in:
@@ -102,8 +102,7 @@ impl GlobalPlay for wgc::global::Global {
|
||||
encoder,
|
||||
base,
|
||||
timestamp_writes.as_ref(),
|
||||
)
|
||||
.unwrap();
|
||||
);
|
||||
}
|
||||
trace::Command::RunRenderPass {
|
||||
base,
|
||||
@@ -119,8 +118,7 @@ impl GlobalPlay for wgc::global::Global {
|
||||
target_depth_stencil.as_ref(),
|
||||
timestamp_writes.as_ref(),
|
||||
occlusion_query_set_id,
|
||||
)
|
||||
.unwrap();
|
||||
);
|
||||
}
|
||||
trace::Command::BuildAccelerationStructuresUnsafeTlas { blas, tlas } => {
|
||||
let blas_iter = blas.iter().map(|x| {
|
||||
|
||||
@@ -321,6 +321,9 @@ impl Global {
|
||||
|
||||
/// Note that this differs from [`Self::compute_pass_end`], it will
|
||||
/// create a new pass, replay the commands and end the pass.
|
||||
///
|
||||
/// # Panics
|
||||
/// On any error.
|
||||
#[doc(hidden)]
|
||||
#[cfg(any(feature = "serde", feature = "replay"))]
|
||||
pub fn compute_pass_end_with_unresolved_commands(
|
||||
@@ -328,9 +331,7 @@ impl Global {
|
||||
encoder_id: id::CommandEncoderId,
|
||||
base: BasePass<super::ComputeCommand>,
|
||||
timestamp_writes: Option<&PassTimestampWrites>,
|
||||
) -> Result<(), ComputePassError> {
|
||||
let pass_scope = PassErrorScope::Pass;
|
||||
|
||||
) {
|
||||
#[cfg(feature = "trace")]
|
||||
{
|
||||
let cmd_buf = self
|
||||
@@ -338,7 +339,7 @@ impl Global {
|
||||
.command_buffers
|
||||
.get(encoder_id.into_command_buffer_id());
|
||||
let mut cmd_buf_data = cmd_buf.data.lock();
|
||||
let cmd_buf_data = cmd_buf_data.get_inner().map_pass_err(pass_scope)?;
|
||||
let cmd_buf_data = cmd_buf_data.get_inner();
|
||||
|
||||
if let Some(ref mut list) = cmd_buf_data.commands {
|
||||
list.push(crate::device::trace::Command::RunComputePass {
|
||||
@@ -370,21 +371,19 @@ impl Global {
|
||||
},
|
||||
);
|
||||
if let Some(err) = encoder_error {
|
||||
return Err(ComputePassError {
|
||||
scope: pass_scope,
|
||||
inner: err.into(),
|
||||
});
|
||||
panic!("{:?}", err);
|
||||
};
|
||||
|
||||
compute_pass.base = Some(BasePass {
|
||||
label,
|
||||
commands: super::ComputeCommand::resolve_compute_command_ids(&self.hub, &commands)?,
|
||||
commands: super::ComputeCommand::resolve_compute_command_ids(&self.hub, &commands)
|
||||
.unwrap(),
|
||||
dynamic_offsets,
|
||||
string_data,
|
||||
push_constant_data,
|
||||
});
|
||||
|
||||
self.compute_pass_end(&mut compute_pass)
|
||||
self.compute_pass_end(&mut compute_pass).unwrap();
|
||||
}
|
||||
|
||||
pub fn compute_pass_end(&self, pass: &mut ComputePass) -> Result<(), ComputePassError> {
|
||||
|
||||
@@ -108,10 +108,14 @@ impl CommandEncoderStatus {
|
||||
}
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
fn get_inner(&mut self) -> Result<&mut CommandBufferMutable, CommandEncoderError> {
|
||||
fn get_inner(&mut self) -> &mut CommandBufferMutable {
|
||||
match self {
|
||||
Self::Locked(inner) | Self::Finished(inner) | Self::Recording(inner) => Ok(inner),
|
||||
Self::Error => Err(CommandEncoderError::Invalid),
|
||||
Self::Locked(inner) | Self::Finished(inner) | Self::Recording(inner) => inner,
|
||||
// This is unreachable because this function is only used when
|
||||
// playing back a recorded trace. If only to avoid having to
|
||||
// implement serialization for all the error types, we don't support
|
||||
// storing the errors in a trace.
|
||||
Self::Error => unreachable!("passes in a trace do not store errors"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ impl Global {
|
||||
#[cfg(feature = "trace")]
|
||||
let trace_tlas: Vec<TlasBuildEntry> = tlas_iter.collect();
|
||||
#[cfg(feature = "trace")]
|
||||
if let Some(ref mut list) = cmd_buf.data.lock().get_inner()?.commands {
|
||||
if let Some(ref mut list) = cmd_buf.data.lock().get_inner().commands {
|
||||
list.push(
|
||||
crate::device::trace::Command::BuildAccelerationStructuresUnsafeTlas {
|
||||
blas: trace_blas.clone(),
|
||||
@@ -444,7 +444,7 @@ impl Global {
|
||||
.collect();
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
if let Some(ref mut list) = cmd_buf.data.lock().get_inner()?.commands {
|
||||
if let Some(ref mut list) = cmd_buf.data.lock().get_inner().commands {
|
||||
list.push(crate::device::trace::Command::BuildAccelerationStructures {
|
||||
blas: trace_blas.clone(),
|
||||
tlas: trace_tlas.clone(),
|
||||
|
||||
@@ -1630,9 +1630,7 @@ impl Global {
|
||||
depth_stencil_attachment: Option<&RenderPassDepthStencilAttachment>,
|
||||
timestamp_writes: Option<&PassTimestampWrites>,
|
||||
occlusion_query_set: Option<id::QuerySetId>,
|
||||
) -> Result<(), RenderPassError> {
|
||||
let pass_scope = PassErrorScope::Pass;
|
||||
|
||||
) {
|
||||
#[cfg(feature = "trace")]
|
||||
{
|
||||
let cmd_buf = self
|
||||
@@ -1640,7 +1638,7 @@ impl Global {
|
||||
.command_buffers
|
||||
.get(encoder_id.into_command_buffer_id());
|
||||
let mut cmd_buf_data = cmd_buf.data.lock();
|
||||
let cmd_buf_data = cmd_buf_data.get_inner().map_pass_err(pass_scope)?;
|
||||
let cmd_buf_data = cmd_buf_data.get_inner();
|
||||
|
||||
if let Some(ref mut list) = cmd_buf_data.commands {
|
||||
list.push(crate::device::trace::Command::RunRenderPass {
|
||||
@@ -1678,21 +1676,19 @@ impl Global {
|
||||
},
|
||||
);
|
||||
if let Some(err) = encoder_error {
|
||||
return Err(RenderPassError {
|
||||
scope: pass_scope,
|
||||
inner: err.into(),
|
||||
});
|
||||
panic!("{:?}", err);
|
||||
};
|
||||
|
||||
render_pass.base = Some(BasePass {
|
||||
label,
|
||||
commands: super::RenderCommand::resolve_render_command_ids(&self.hub, &commands)?,
|
||||
commands: super::RenderCommand::resolve_render_command_ids(&self.hub, &commands)
|
||||
.unwrap(),
|
||||
dynamic_offsets,
|
||||
string_data,
|
||||
push_constant_data,
|
||||
});
|
||||
|
||||
self.render_pass_end(&mut render_pass)
|
||||
self.render_pass_end(&mut render_pass).unwrap();
|
||||
}
|
||||
|
||||
pub fn render_pass_end(&self, pass: &mut RenderPass) -> Result<(), RenderPassError> {
|
||||
|
||||
Reference in New Issue
Block a user