From 400372ff57e3ba89cea15947cb4fd6cb349827be Mon Sep 17 00:00:00 2001 From: teoxoy <28601907+teoxoy@users.noreply.github.com> Date: Wed, 26 Jun 2024 12:02:25 +0200 Subject: [PATCH] remove buffer id from set index/vertex buffer scopes all relevant inner errors already print the label of the buffers --- wgpu-core/src/command/bundle.rs | 4 ++-- wgpu-core/src/command/mod.rs | 10 ++-------- wgpu-core/src/command/render.rs | 8 ++++---- wgpu-core/src/command/render_command.rs | 4 ++-- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/wgpu-core/src/command/bundle.rs b/wgpu-core/src/command/bundle.rs index 3623ec27e2..aa98df797d 100644 --- a/wgpu-core/src/command/bundle.rs +++ b/wgpu-core/src/command/bundle.rs @@ -438,7 +438,7 @@ impl RenderBundleEncoder { offset, size, } => { - let scope = PassErrorScope::SetIndexBuffer(buffer_id); + let scope = PassErrorScope::SetIndexBuffer; set_index_buffer( &mut state, &buffer_guard, @@ -455,7 +455,7 @@ impl RenderBundleEncoder { offset, size, } => { - let scope = PassErrorScope::SetVertexBuffer(buffer_id); + let scope = PassErrorScope::SetVertexBuffer; set_vertex_buffer(&mut state, &buffer_guard, slot, buffer_id, offset, size) .map_pass_err(scope)?; } diff --git a/wgpu-core/src/command/mod.rs b/wgpu-core/src/command/mod.rs index f27982905d..58ce0a162d 100644 --- a/wgpu-core/src/command/mod.rs +++ b/wgpu-core/src/command/mod.rs @@ -875,9 +875,9 @@ pub enum PassErrorScope { #[error("In a set_push_constant command")] SetPushConstant, #[error("In a set_vertex_buffer command")] - SetVertexBuffer(id::BufferId), + SetVertexBuffer, #[error("In a set_index_buffer command")] - SetIndexBuffer(id::BufferId), + SetIndexBuffer, #[error("In a set_blend_constant command")] SetBlendConstant, #[error("In a set_stencil_reference command")] @@ -931,12 +931,6 @@ impl PrettyError for PassErrorScope { Self::SetPipelineCompute(id) => { fmt.compute_pipeline_label(&id); } - Self::SetVertexBuffer(id) => { - fmt.buffer_label(&id); - } - Self::SetIndexBuffer(id) => { - fmt.buffer_label(&id); - } _ => {} } } diff --git a/wgpu-core/src/command/render.rs b/wgpu-core/src/command/render.rs index 56be96b28c..9860b16a89 100644 --- a/wgpu-core/src/command/render.rs +++ b/wgpu-core/src/command/render.rs @@ -1551,7 +1551,7 @@ impl Global { offset, size, } => { - let scope = PassErrorScope::SetIndexBuffer(buffer.as_info().id()); + let scope = PassErrorScope::SetIndexBuffer; set_index_buffer(&mut state, &cmd_buf, buffer, index_format, offset, size) .map_pass_err(scope)?; } @@ -1561,7 +1561,7 @@ impl Global { offset, size, } => { - let scope = PassErrorScope::SetVertexBuffer(buffer.as_info().id()); + let scope = PassErrorScope::SetVertexBuffer; set_vertex_buffer(&mut state, &cmd_buf, slot, buffer, offset, size) .map_pass_err(scope)?; } @@ -2697,7 +2697,7 @@ impl Global { offset: BufferAddress, size: Option, ) -> Result<(), RenderPassError> { - let scope = PassErrorScope::SetIndexBuffer(buffer_id); + let scope = PassErrorScope::SetIndexBuffer; let base = pass.base_mut(scope)?; base.commands.push(RenderCommand::SetIndexBuffer { @@ -2718,7 +2718,7 @@ impl Global { offset: BufferAddress, size: Option, ) -> Result<(), RenderPassError> { - let scope = PassErrorScope::SetVertexBuffer(buffer_id); + let scope = PassErrorScope::SetVertexBuffer; let base = pass.base_mut(scope)?; base.commands.push(RenderCommand::SetVertexBuffer { diff --git a/wgpu-core/src/command/render_command.rs b/wgpu-core/src/command/render_command.rs index 9dd2f00437..125e642eec 100644 --- a/wgpu-core/src/command/render_command.rs +++ b/wgpu-core/src/command/render_command.rs @@ -228,7 +228,7 @@ impl RenderCommand { } => ArcRenderCommand::SetIndexBuffer { buffer: buffers_guard.get_owned(buffer_id).map_err(|_| { RenderPassError { - scope: PassErrorScope::SetIndexBuffer(buffer_id), + scope: PassErrorScope::SetIndexBuffer, inner: RenderCommandError::InvalidBufferId(buffer_id).into(), } })?, @@ -246,7 +246,7 @@ impl RenderCommand { slot, buffer: buffers_guard.get_owned(buffer_id).map_err(|_| { RenderPassError { - scope: PassErrorScope::SetVertexBuffer(buffer_id), + scope: PassErrorScope::SetVertexBuffer, inner: RenderCommandError::InvalidBufferId(buffer_id).into(), } })?,