From ac94609cbde8d077e66162f0ce985960fd7d7c97 Mon Sep 17 00:00:00 2001 From: sagudev <16504129+sagudev@users.noreply.github.com> Date: Fri, 21 Aug 2026 08:07:15 +0200 Subject: [PATCH] Move erroring of ComputePipeline::get_bind_group into core Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --- deno_webgpu/compute_pipeline.rs | 6 +----- deno_webgpu/device.rs | 1 - player/src/lib.rs | 2 +- wgpu-core-remote/src/global/device.rs | 9 ++------- wgpu-core/src/pipeline.rs | 21 +++++++++------------ wgpu/src/backend/wgpu_core.rs | 8 +------- 6 files changed, 14 insertions(+), 33 deletions(-) diff --git a/deno_webgpu/compute_pipeline.rs b/deno_webgpu/compute_pipeline.rs index dbcb9d3bf..4d7a2fe7c 100644 --- a/deno_webgpu/compute_pipeline.rs +++ b/deno_webgpu/compute_pipeline.rs @@ -15,8 +15,6 @@ use crate::shader::GPUShaderModule; use crate::webidl::GPUPipelineLayoutOrGPUAutoLayoutMode; pub struct GPUComputePipeline { - pub error_handler: super::error::ErrorHandler, - pub wgpu_compute_pipeline: Arc, pub label: String, } @@ -52,11 +50,9 @@ impl GPUComputePipeline { #[cppgc] fn get_bind_group_layout(&self, #[webidl] index: u32) -> GPUBindGroupLayout { - let (wgpu_bind_group_layout, err) = + let wgpu_bind_group_layout = self.wgpu_compute_pipeline.get_bind_group_layout(index); - self.error_handler.push_error(err); - // TODO(wgpu): needs to support retrieving the label GPUBindGroupLayout { wgpu_bind_group_layout, diff --git a/deno_webgpu/device.rs b/deno_webgpu/device.rs index 151a53495..8dfca8b44 100644 --- a/deno_webgpu/device.rs +++ b/deno_webgpu/device.rs @@ -743,7 +743,6 @@ impl GPUDevice { ( GPUComputePipeline { - error_handler: self.error_handler.clone(), wgpu_compute_pipeline, label: descriptor.label.clone(), }, diff --git a/player/src/lib.rs b/player/src/lib.rs index f0ddbd61d..cafea75c0 100644 --- a/player/src/lib.rs +++ b/player/src/lib.rs @@ -197,7 +197,7 @@ impl Player { index, } => { let pipeline = self.resolve_compute_pipeline_id(pipeline); - let (bgl, _error) = pipeline.get_bind_group_layout(index); + let bgl = pipeline.get_bind_group_layout(index); self.bind_group_layouts.insert(id, bgl); } Action::DropBindGroupLayout(id) => { diff --git a/wgpu-core-remote/src/global/device.rs b/wgpu-core-remote/src/global/device.rs index 6d10f851f..5317485de 100644 --- a/wgpu-core-remote/src/global/device.rs +++ b/wgpu-core-remote/src/global/device.rs @@ -938,9 +938,6 @@ impl Global { pipeline_id: id::ComputePipelineId, index: u32, id_in: id::BindGroupLayoutId, - ) -> ( - id::BindGroupLayoutId, - Option, ) { let mut hub = self.hub.borrow_mut(); let Hub { @@ -951,11 +948,9 @@ impl Global { let pipeline = compute_pipelines.get(pipeline_id); - let (bgl, error) = pipeline.get_bind_group_layout(index); + let bgl = pipeline.get_bind_group_layout(index); - let id = bind_group_layouts.assign(id_in, bgl); - - (id, error) + bind_group_layouts.assign(id_in, bgl); } pub fn compute_pipeline_drop(&self, compute_pipeline_id: id::ComputePipelineId) { diff --git a/wgpu-core/src/pipeline.rs b/wgpu-core/src/pipeline.rs index a9e842622..0fbcabbf7 100644 --- a/wgpu-core/src/pipeline.rs +++ b/wgpu-core/src/pipeline.rs @@ -448,17 +448,14 @@ impl ComputePipeline { self.layout()?.get_bind_group_layout(index, self.into()) } - pub fn get_bind_group_layout( - self: &Arc, - index: u32, - ) -> (Arc, Option) { - let (bgl, error) = match self.get_bind_group_layout_inner(index) { - Ok(bgl) => (bgl, None), - Err(e) => ( - BindGroupLayout::invalid(&self.device, String::new()), - Some(e), - ), - }; + pub fn get_bind_group_layout(self: &Arc, index: u32) -> Arc { + let bgl = self + .get_bind_group_layout_inner(index) + .unwrap_or_else(|err| { + self.device + .handle_error_nolabel(err, "ComputePipeline::get_bind_group_layout"); + BindGroupLayout::invalid(&self.device, String::new()) + }); #[cfg(feature = "trace")] if let Some(ref mut trace) = *self.device.trace.lock() { use crate::device::trace; @@ -469,7 +466,7 @@ impl ComputePipeline { index, }); }; - (bgl, error) + bgl } } diff --git a/wgpu/src/backend/wgpu_core.rs b/wgpu/src/backend/wgpu_core.rs index e9a9e39b8..4d5a15712 100644 --- a/wgpu/src/backend/wgpu_core.rs +++ b/wgpu/src/backend/wgpu_core.rs @@ -1979,13 +1979,7 @@ impl dispatch::RenderPipelineInterface for CoreRenderPipeline { impl dispatch::ComputePipelineInterface for CoreComputePipeline { fn get_bind_group_layout(&self, index: u32) -> dispatch::DispatchBindGroupLayout { - let (wgpu_bind_group_layout, error) = - self.wgpu_compute_pipeline.get_bind_group_layout(index); - if let Some(err) = error { - self.wgpu_compute_pipeline - .device() - .handle_error_nolabel(err, "ComputePipeline::get_bind_group_layout") - } + let wgpu_bind_group_layout = self.wgpu_compute_pipeline.get_bind_group_layout(index); CoreBindGroupLayout { wgpu_bind_group_layout, }