mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-23 07:51:08 +01:00
Move erroring of RenderPipeline::get_bind_group into core
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
1 parent
ac94609cbd
commit
6a1e377a4e
6 files changed
+14
-33
No files matched your search
@@ -903,7 +903,6 @@ impl GPUDevice {
|
||||
|
||||
(
|
||||
GPURenderPipeline {
|
||||
error_handler: self.error_handler.clone(),
|
||||
wgpu_render_pipeline,
|
||||
label: descriptor.label,
|
||||
},
|
||||
|
||||
@@ -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
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user