mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-21 06:50:59 +01:00
Move erroring of ComputePipeline::get_bind_group into core
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
1 parent
9fcc1dd289
commit
ac94609cbd
6 files changed
+14
-33
No files matched your search
@@ -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<wgpu_core::pipeline::ComputePipeline>,
|
||||
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,
|
||||
|
||||
@@ -743,7 +743,6 @@ impl GPUDevice {
|
||||
|
||||
(
|
||||
GPUComputePipeline {
|
||||
error_handler: self.error_handler.clone(),
|
||||
wgpu_compute_pipeline,
|
||||
label: descriptor.label.clone(),
|
||||
},
|
||||
|
||||
+1
-1
@@ -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) => {
|
||||
|
||||
@@ -938,9 +938,6 @@ impl Global {
|
||||
pipeline_id: id::ComputePipelineId,
|
||||
index: u32,
|
||||
id_in: id::BindGroupLayoutId,
|
||||
) -> (
|
||||
id::BindGroupLayoutId,
|
||||
Option<binding_model::GetBindGroupLayoutError>,
|
||||
) {
|
||||
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) {
|
||||
|
||||
@@ -448,17 +448,14 @@ impl ComputePipeline {
|
||||
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, "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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user