mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-23 07:51:08 +01:00
Move erroring from create_bind_group_layout into wgc (#10215)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
6 files changed
+22
-27
No files matched your search
@@ -75,6 +75,7 @@ webgpu:api,validation,buffer,destroy:*
|
||||
webgpu:api,validation,capability_checks,features,clip_distances:*
|
||||
webgpu:api,validation,capability_checks,features,texture_component_swizzle:*
|
||||
webgpu:api,validation,capability_checks,features,texture_formats:render_bundle_encoder_descriptor_depth_stencil_format:*
|
||||
webgpu:api,validation,capability_checks,features,texture_formats:storage_texture_binding_layout:*
|
||||
webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:*
|
||||
webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:*
|
||||
webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:*
|
||||
|
||||
@@ -332,9 +332,11 @@ impl GPUDevice {
|
||||
multisampled: texture.multisampled,
|
||||
}
|
||||
} else if let Some(storage_texture) = entry.storage_texture {
|
||||
let format = storage_texture.format.into();
|
||||
self.validate_texture_format_required_feature(format)?;
|
||||
BindingType::StorageTexture {
|
||||
access: storage_texture.access.into(),
|
||||
format: storage_texture.format.into(),
|
||||
format,
|
||||
view_dimension: storage_texture.view_dimension.into(),
|
||||
}
|
||||
} else if entry.external_texture.is_some() {
|
||||
@@ -356,11 +358,9 @@ impl GPUDevice {
|
||||
entries: Cow::Owned(entries),
|
||||
};
|
||||
|
||||
let (wgpu_bind_group_layout, err) =
|
||||
let wgpu_bind_group_layout =
|
||||
self.wgpu_device.create_bind_group_layout(&wgpu_descriptor);
|
||||
|
||||
self.error_handler.push_error(err);
|
||||
|
||||
Ok(GPUBindGroupLayout {
|
||||
wgpu_bind_group_layout,
|
||||
label: descriptor.label,
|
||||
|
||||
+1
-1
@@ -186,7 +186,7 @@ impl Player {
|
||||
unimplemented!()
|
||||
}
|
||||
Action::CreateBindGroupLayout(id, desc) => {
|
||||
let (bind_group_layout, _error) = device.create_bind_group_layout(&desc);
|
||||
let bind_group_layout = device.create_bind_group_layout(&desc);
|
||||
self.bind_group_layouts.insert(id, bind_group_layout);
|
||||
}
|
||||
Action::GetRenderPipelineBindGroupLayout {
|
||||
|
||||
@@ -453,9 +453,6 @@ impl Global {
|
||||
device_id: DeviceId,
|
||||
desc: &BindGroupLayoutDescriptor,
|
||||
id_in: id::BindGroupLayoutId,
|
||||
) -> (
|
||||
id::BindGroupLayoutId,
|
||||
Option<binding_model::CreateBindGroupLayoutError>,
|
||||
) {
|
||||
let mut hub = self.hub.borrow_mut();
|
||||
let Hub {
|
||||
@@ -471,11 +468,9 @@ impl Global {
|
||||
entries: Cow::Borrowed(&desc.entries),
|
||||
};
|
||||
|
||||
let (bgl, error) = device.create_bind_group_layout(&desc);
|
||||
let bgl = device.create_bind_group_layout(&desc);
|
||||
|
||||
let id = bind_group_layouts.assign(id_in, bgl);
|
||||
|
||||
(id, error)
|
||||
bind_group_layouts.assign(id_in, bgl);
|
||||
}
|
||||
|
||||
pub fn bind_group_layout_remove(
|
||||
|
||||
@@ -2920,16 +2920,20 @@ impl Device {
|
||||
pub fn create_bind_group_layout(
|
||||
self: &Arc<Self>,
|
||||
desc: &binding_model::BindGroupLayoutDescriptor,
|
||||
) -> (Arc<BindGroupLayout>, Option<CreateBindGroupLayoutError>) {
|
||||
) -> Arc<BindGroupLayout> {
|
||||
profiling::scope!("Device::create_bind_group_layout");
|
||||
|
||||
let (bgl, error) = match self.create_bind_group_layout_inner(desc) {
|
||||
Ok(layout) => (layout, None),
|
||||
Err(e) => (
|
||||
BindGroupLayout::invalid(self, desc.label.to_string()),
|
||||
Some(e),
|
||||
),
|
||||
};
|
||||
let bgl = self
|
||||
.create_bind_group_layout_inner(desc)
|
||||
.unwrap_or_else(|err| {
|
||||
self.handle_error(
|
||||
err,
|
||||
desc.label.as_deref(),
|
||||
"Device::create_bind_group_layout",
|
||||
);
|
||||
BindGroupLayout::invalid(self, desc.label.to_string())
|
||||
});
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
if let Some(ref mut trace) = *self.trace.lock() {
|
||||
use crate::device::trace::IntoTrace;
|
||||
@@ -2943,7 +2947,7 @@ impl Device {
|
||||
"Device::create_bind_group_layout -> {:?}",
|
||||
Arc::as_ptr(&bgl)
|
||||
);
|
||||
(bgl, error)
|
||||
bgl
|
||||
}
|
||||
|
||||
fn create_bind_group_layout_inner(
|
||||
|
||||
@@ -883,12 +883,7 @@ impl dispatch::DeviceInterface for CoreDevice {
|
||||
label: desc.label.map(Borrowed),
|
||||
entries: Borrowed(desc.entries),
|
||||
};
|
||||
let (wgpu_bind_group_layout, error) =
|
||||
self.wgpu_device.create_bind_group_layout(&descriptor);
|
||||
if let Some(cause) = error {
|
||||
self.wgpu_device
|
||||
.handle_error(cause, desc.label, "Device::create_bind_group_layout");
|
||||
}
|
||||
let wgpu_bind_group_layout = self.wgpu_device.create_bind_group_layout(&descriptor);
|
||||
CoreBindGroupLayout {
|
||||
wgpu_bind_group_layout,
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user