Move erroring of RenderPipeline::get_bind_group into core

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
sagudev authored and Teodor Tanasoaia committed 2026-08-25 17:37:30 +02:00
1 parent ac94609cbd
commit 6a1e377a4e
6 files changed
+14 -33

No files matched your search

-1
View File
@@ -903,7 +903,6 @@ impl GPUDevice {
(
GPURenderPipeline {
error_handler: self.error_handler.clone(),
wgpu_render_pipeline,
label: descriptor.label,
},
+1 -5
View File
@@ -19,8 +19,6 @@ use crate::webidl::GPUColorWriteFlags;
use crate::webidl::GPUPipelineLayoutOrGPUAutoLayoutMode;
pub struct GPURenderPipeline {
pub error_handler: super::error::ErrorHandler,
pub wgpu_render_pipeline: Arc<wgpu_core::pipeline::RenderPipeline>,
pub label: String,
}
@@ -56,11 +54,9 @@ impl GPURenderPipeline {
#[cppgc]
fn get_bind_group_layout(&self, #[webidl] index: u32) -> GPUBindGroupLayout {
let (wgpu_bind_group_layout, err) =
let wgpu_bind_group_layout =
self.wgpu_render_pipeline.get_bind_group_layout(index);
self.error_handler.push_error(err);
// TODO(wgpu): needs to add a way to retrieve the label
GPUBindGroupLayout {
wgpu_bind_group_layout,
+1 -1
View File
@@ -188,7 +188,7 @@ impl Player {
index,
} => {
let pipeline = self.resolve_render_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::GetComputePipelineBindGroupLayout {
+2 -7
View File
@@ -857,9 +857,6 @@ impl Global {
pipeline_id: id::RenderPipelineId,
index: u32,
id_in: id::BindGroupLayoutId,
) -> (
id::BindGroupLayoutId,
Option<binding_model::GetBindGroupLayoutError>,
) {
let mut hub = self.hub.borrow_mut();
let Hub {
@@ -870,11 +867,9 @@ impl Global {
let pipeline = render_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 render_pipeline_drop(&self, render_pipeline_id: id::RenderPipelineId) {
+9 -12
View File
@@ -1131,17 +1131,14 @@ impl RenderPipeline {
self.layout()?.get_bind_group_layout(index, self.into())
}
pub fn get_bind_group_layout(
self: &Arc<Self>,
index: u32,
) -> (Arc<BindGroupLayout>, Option<GetBindGroupLayoutError>) {
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<Self>, index: u32) -> Arc<BindGroupLayout> {
let bgl = self
.get_bind_group_layout_inner(index)
.unwrap_or_else(|err| {
self.device
.handle_error_nolabel(err, "RenderPipeline::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;
@@ -1152,7 +1149,7 @@ impl RenderPipeline {
index,
});
};
(bgl, error)
bgl
}
}
+1 -7
View File
@@ -1963,13 +1963,7 @@ impl dispatch::PipelineLayoutInterface for CorePipelineLayout {}
impl dispatch::RenderPipelineInterface for CoreRenderPipeline {
fn get_bind_group_layout(&self, index: u32) -> dispatch::DispatchBindGroupLayout {
let (wgpu_bind_group_layout, error) =
self.wgpu_render_pipeline.get_bind_group_layout(index);
if let Some(err) = error {
self.wgpu_render_pipeline
.device()
.handle_error_nolabel(err, "RenderPipeline::get_bind_group_layout")
}
let wgpu_bind_group_layout = self.wgpu_render_pipeline.get_bind_group_layout(index);
CoreBindGroupLayout {
wgpu_bind_group_layout,
}