mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-21 22:33:49 +00:00
remove label getters from Global
Also removes label from `Element::Error` and slightly refactors ContextError.
This commit is contained in:
parent
9d3d4ee297
commit
ed1e8ecf4b
@ -146,7 +146,6 @@ pub fn op_webgpu_create_compute_pipeline(
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PipelineLayout {
|
||||
rid: ResourceId,
|
||||
label: String,
|
||||
err: Option<WebGpuError>,
|
||||
}
|
||||
|
||||
@ -165,9 +164,6 @@ pub fn op_webgpu_compute_pipeline_get_bind_group_layout(
|
||||
|
||||
let (bind_group_layout, maybe_err) = gfx_select!(compute_pipeline => instance.compute_pipeline_get_bind_group_layout(compute_pipeline, index, None));
|
||||
|
||||
let label =
|
||||
gfx_select!(bind_group_layout => instance.bind_group_layout_label(bind_group_layout));
|
||||
|
||||
let rid = state
|
||||
.resource_table
|
||||
.add(super::binding::WebGpuBindGroupLayout(
|
||||
@ -177,7 +173,6 @@ pub fn op_webgpu_compute_pipeline_get_bind_group_layout(
|
||||
|
||||
Ok(PipelineLayout {
|
||||
rid,
|
||||
label,
|
||||
err: maybe_err.map(WebGpuError::from),
|
||||
})
|
||||
}
|
||||
@ -441,9 +436,6 @@ pub fn op_webgpu_render_pipeline_get_bind_group_layout(
|
||||
|
||||
let (bind_group_layout, maybe_err) = gfx_select!(render_pipeline => instance.render_pipeline_get_bind_group_layout(render_pipeline, index, None));
|
||||
|
||||
let label =
|
||||
gfx_select!(bind_group_layout => instance.bind_group_layout_label(bind_group_layout));
|
||||
|
||||
let rid = state
|
||||
.resource_table
|
||||
.add(super::binding::WebGpuBindGroupLayout(
|
||||
@ -453,7 +445,6 @@ pub fn op_webgpu_render_pipeline_get_bind_group_layout(
|
||||
|
||||
Ok(PipelineLayout {
|
||||
rid,
|
||||
label,
|
||||
err: maybe_err.map(WebGpuError::from),
|
||||
})
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ use crate::{
|
||||
api_log, binding_model, command, conv,
|
||||
device::{
|
||||
bgl, life::WaitIdleError, map_buffer, queue, DeviceError, DeviceLostClosure,
|
||||
DeviceLostReason, HostMap, IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL,
|
||||
DeviceLostReason, HostMap,
|
||||
},
|
||||
global::Global,
|
||||
hal_api::HalApi,
|
||||
@ -17,7 +17,7 @@ use crate::{
|
||||
self, BufferAccessError, BufferAccessResult, BufferMapOperation, CreateBufferError,
|
||||
Trackable,
|
||||
},
|
||||
Label, LabelHelpers as _,
|
||||
Label,
|
||||
};
|
||||
|
||||
use arrayvec::ArrayVec;
|
||||
@ -284,7 +284,7 @@ impl Global {
|
||||
.schedule_resource_destruction(queue::TempResource::Buffer(Arc::new(buffer)), !0);
|
||||
}
|
||||
|
||||
let id = fid.assign_error(desc.label.borrow_or_default());
|
||||
let id = fid.assign_error();
|
||||
(id, Some(error))
|
||||
}
|
||||
|
||||
@ -316,32 +316,28 @@ impl Global {
|
||||
/// [`device_create_buffer`]: Global::device_create_buffer
|
||||
/// [`usage`]: https://www.w3.org/TR/webgpu/#dom-gputexturedescriptor-usage
|
||||
/// [`wgpu_types::BufferUsages`]: wgt::BufferUsages
|
||||
pub fn create_buffer_error<A: HalApi>(&self, id_in: Option<id::BufferId>, label: Label) {
|
||||
pub fn create_buffer_error<A: HalApi>(&self, id_in: Option<id::BufferId>) {
|
||||
let hub = A::hub(self);
|
||||
let fid = hub.buffers.prepare(id_in);
|
||||
|
||||
fid.assign_error(label.borrow_or_default());
|
||||
fid.assign_error();
|
||||
}
|
||||
|
||||
pub fn create_render_bundle_error<A: HalApi>(
|
||||
&self,
|
||||
id_in: Option<id::RenderBundleId>,
|
||||
label: Label,
|
||||
) {
|
||||
pub fn create_render_bundle_error<A: HalApi>(&self, id_in: Option<id::RenderBundleId>) {
|
||||
let hub = A::hub(self);
|
||||
let fid = hub.render_bundles.prepare(id_in);
|
||||
|
||||
fid.assign_error(label.borrow_or_default());
|
||||
fid.assign_error();
|
||||
}
|
||||
|
||||
/// Assign `id_in` an error with the given `label`.
|
||||
///
|
||||
/// See `create_buffer_error` for more context and explanation.
|
||||
pub fn create_texture_error<A: HalApi>(&self, id_in: Option<id::TextureId>, label: Label) {
|
||||
pub fn create_texture_error<A: HalApi>(&self, id_in: Option<id::TextureId>) {
|
||||
let hub = A::hub(self);
|
||||
let fid = hub.textures.prepare(id_in);
|
||||
|
||||
fid.assign_error(label.borrow_or_default());
|
||||
fid.assign_error();
|
||||
}
|
||||
|
||||
#[cfg(feature = "replay")]
|
||||
@ -474,10 +470,6 @@ impl Global {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn buffer_label<A: HalApi>(&self, id: id::BufferId) -> String {
|
||||
A::hub(self).buffers.label_for_resource(id)
|
||||
}
|
||||
|
||||
pub fn buffer_destroy<A: HalApi>(
|
||||
&self,
|
||||
buffer_id: id::BufferId,
|
||||
@ -598,7 +590,7 @@ impl Global {
|
||||
|
||||
log::error!("Device::create_texture error: {error}");
|
||||
|
||||
let id = fid.assign_error(desc.label.borrow_or_default());
|
||||
let id = fid.assign_error();
|
||||
(id, Some(error))
|
||||
}
|
||||
|
||||
@ -671,7 +663,7 @@ impl Global {
|
||||
|
||||
log::error!("Device::create_texture error: {error}");
|
||||
|
||||
let id = fid.assign_error(desc.label.borrow_or_default());
|
||||
let id = fid.assign_error();
|
||||
(id, Some(error))
|
||||
}
|
||||
|
||||
@ -721,14 +713,10 @@ impl Global {
|
||||
|
||||
log::error!("Device::create_buffer error: {error}");
|
||||
|
||||
let id = fid.assign_error(desc.label.borrow_or_default());
|
||||
let id = fid.assign_error();
|
||||
(id, Some(error))
|
||||
}
|
||||
|
||||
pub fn texture_label<A: HalApi>(&self, id: id::TextureId) -> String {
|
||||
A::hub(self).textures.label_for_resource(id)
|
||||
}
|
||||
|
||||
pub fn texture_destroy<A: HalApi>(
|
||||
&self,
|
||||
texture_id: id::TextureId,
|
||||
@ -855,14 +843,10 @@ impl Global {
|
||||
};
|
||||
|
||||
log::error!("Texture::create_view({texture_id:?}) error: {error}");
|
||||
let id = fid.assign_error(desc.label.borrow_or_default());
|
||||
let id = fid.assign_error();
|
||||
(id, Some(error))
|
||||
}
|
||||
|
||||
pub fn texture_view_label<A: HalApi>(&self, id: id::TextureViewId) -> String {
|
||||
A::hub(self).texture_views.label_for_resource(id)
|
||||
}
|
||||
|
||||
pub fn texture_view_drop<A: HalApi>(
|
||||
&self,
|
||||
texture_view_id: id::TextureViewId,
|
||||
@ -933,14 +917,10 @@ impl Global {
|
||||
return (id, None);
|
||||
};
|
||||
|
||||
let id = fid.assign_error(desc.label.borrow_or_default());
|
||||
let id = fid.assign_error();
|
||||
(id, Some(error))
|
||||
}
|
||||
|
||||
pub fn sampler_label<A: HalApi>(&self, id: id::SamplerId) -> String {
|
||||
A::hub(self).samplers.label_for_resource(id)
|
||||
}
|
||||
|
||||
pub fn sampler_drop<A: HalApi>(&self, sampler_id: id::SamplerId) {
|
||||
profiling::scope!("Sampler::drop");
|
||||
api_log!("Sampler::drop {sampler_id:?}");
|
||||
@ -1042,14 +1022,10 @@ impl Global {
|
||||
};
|
||||
|
||||
let fid = hub.bind_group_layouts.prepare(id_in);
|
||||
let id = fid.assign_error(desc.label.borrow_or_default());
|
||||
let id = fid.assign_error();
|
||||
(id, Some(error))
|
||||
}
|
||||
|
||||
pub fn bind_group_layout_label<A: HalApi>(&self, id: id::BindGroupLayoutId) -> String {
|
||||
A::hub(self).bind_group_layouts.label_for_resource(id)
|
||||
}
|
||||
|
||||
pub fn bind_group_layout_drop<A: HalApi>(&self, bind_group_layout_id: id::BindGroupLayoutId) {
|
||||
profiling::scope!("BindGroupLayout::drop");
|
||||
api_log!("BindGroupLayout::drop {bind_group_layout_id:?}");
|
||||
@ -1106,14 +1082,10 @@ impl Global {
|
||||
return (id, None);
|
||||
};
|
||||
|
||||
let id = fid.assign_error(desc.label.borrow_or_default());
|
||||
let id = fid.assign_error();
|
||||
(id, Some(error))
|
||||
}
|
||||
|
||||
pub fn pipeline_layout_label<A: HalApi>(&self, id: id::PipelineLayoutId) -> String {
|
||||
A::hub(self).pipeline_layouts.label_for_resource(id)
|
||||
}
|
||||
|
||||
pub fn pipeline_layout_drop<A: HalApi>(&self, pipeline_layout_id: id::PipelineLayoutId) {
|
||||
profiling::scope!("PipelineLayout::drop");
|
||||
api_log!("PipelineLayout::drop {pipeline_layout_id:?}");
|
||||
@ -1192,14 +1164,10 @@ impl Global {
|
||||
return (id, None);
|
||||
};
|
||||
|
||||
let id = fid.assign_error(desc.label.borrow_or_default());
|
||||
let id = fid.assign_error();
|
||||
(id, Some(error))
|
||||
}
|
||||
|
||||
pub fn bind_group_label<A: HalApi>(&self, id: id::BindGroupId) -> String {
|
||||
A::hub(self).bind_groups.label_for_resource(id)
|
||||
}
|
||||
|
||||
pub fn bind_group_drop<A: HalApi>(&self, bind_group_id: id::BindGroupId) {
|
||||
profiling::scope!("BindGroup::drop");
|
||||
api_log!("BindGroup::drop {bind_group_id:?}");
|
||||
@ -1300,7 +1268,7 @@ impl Global {
|
||||
|
||||
log::error!("Device::create_shader_module error: {error}");
|
||||
|
||||
let id = fid.assign_error(desc.label.borrow_or_default());
|
||||
let id = fid.assign_error();
|
||||
(id, Some(error))
|
||||
}
|
||||
|
||||
@ -1354,14 +1322,10 @@ impl Global {
|
||||
|
||||
log::error!("Device::create_shader_module_spirv error: {error}");
|
||||
|
||||
let id = fid.assign_error(desc.label.borrow_or_default());
|
||||
let id = fid.assign_error();
|
||||
(id, Some(error))
|
||||
}
|
||||
|
||||
pub fn shader_module_label<A: HalApi>(&self, id: id::ShaderModuleId) -> String {
|
||||
A::hub(self).shader_modules.label_for_resource(id)
|
||||
}
|
||||
|
||||
pub fn shader_module_drop<A: HalApi>(&self, shader_module_id: id::ShaderModuleId) {
|
||||
profiling::scope!("ShaderModule::drop");
|
||||
api_log!("ShaderModule::drop {shader_module_id:?}");
|
||||
@ -1406,14 +1370,10 @@ impl Global {
|
||||
return (id.into_command_encoder_id(), None);
|
||||
};
|
||||
|
||||
let id = fid.assign_error(desc.label.borrow_or_default());
|
||||
let id = fid.assign_error();
|
||||
(id.into_command_encoder_id(), Some(error))
|
||||
}
|
||||
|
||||
pub fn command_buffer_label<A: HalApi>(&self, id: id::CommandBufferId) -> String {
|
||||
A::hub(self).command_buffers.label_for_resource(id)
|
||||
}
|
||||
|
||||
pub fn command_encoder_drop<A: HalApi>(&self, command_encoder_id: id::CommandEncoderId) {
|
||||
profiling::scope!("CommandEncoder::drop");
|
||||
api_log!("CommandEncoder::drop {command_encoder_id:?}");
|
||||
@ -1501,14 +1461,10 @@ impl Global {
|
||||
return (id, None);
|
||||
};
|
||||
|
||||
let id = fid.assign_error(desc.label.borrow_or_default());
|
||||
let id = fid.assign_error();
|
||||
(id, Some(error))
|
||||
}
|
||||
|
||||
pub fn render_bundle_label<A: HalApi>(&self, id: id::RenderBundleId) -> String {
|
||||
A::hub(self).render_bundles.label_for_resource(id)
|
||||
}
|
||||
|
||||
pub fn render_bundle_drop<A: HalApi>(&self, render_bundle_id: id::RenderBundleId) {
|
||||
profiling::scope!("RenderBundle::drop");
|
||||
api_log!("RenderBundle::drop {render_bundle_id:?}");
|
||||
@ -1567,7 +1523,7 @@ impl Global {
|
||||
return (id, None);
|
||||
};
|
||||
|
||||
let id = fid.assign_error("");
|
||||
let id = fid.assign_error();
|
||||
(id, Some(error))
|
||||
}
|
||||
|
||||
@ -1593,10 +1549,6 @@ impl Global {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn query_set_label<A: HalApi>(&self, id: id::QuerySetId) -> String {
|
||||
A::hub(self).query_sets.label_for_resource(id)
|
||||
}
|
||||
|
||||
pub fn device_create_render_pipeline<A: HalApi>(
|
||||
&self,
|
||||
device_id: DeviceId,
|
||||
@ -1648,7 +1600,7 @@ impl Global {
|
||||
return (id, None);
|
||||
};
|
||||
|
||||
let id = fid.assign_error(desc.label.borrow_or_default());
|
||||
let id = fid.assign_error();
|
||||
|
||||
// We also need to assign errors to the implicit pipeline layout and the
|
||||
// implicit bind group layout. We have to remove any existing entries first.
|
||||
@ -1658,12 +1610,12 @@ impl Global {
|
||||
if pipeline_layout_guard.contains(ids.root_id) {
|
||||
pipeline_layout_guard.remove(ids.root_id);
|
||||
}
|
||||
pipeline_layout_guard.insert_error(ids.root_id, IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL);
|
||||
pipeline_layout_guard.insert_error(ids.root_id);
|
||||
for &bgl_id in ids.group_ids.iter() {
|
||||
if bgl_guard.contains(bgl_id) {
|
||||
bgl_guard.remove(bgl_id);
|
||||
}
|
||||
bgl_guard.insert_error(bgl_id, IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL);
|
||||
bgl_guard.insert_error(bgl_id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1699,17 +1651,10 @@ impl Global {
|
||||
return (id, None);
|
||||
};
|
||||
|
||||
let id = hub
|
||||
.bind_group_layouts
|
||||
.prepare(id_in)
|
||||
.assign_error("<derived>");
|
||||
let id = hub.bind_group_layouts.prepare(id_in).assign_error();
|
||||
(id, Some(error))
|
||||
}
|
||||
|
||||
pub fn render_pipeline_label<A: HalApi>(&self, id: id::RenderPipelineId) -> String {
|
||||
A::hub(self).render_pipelines.label_for_resource(id)
|
||||
}
|
||||
|
||||
pub fn render_pipeline_drop<A: HalApi>(&self, render_pipeline_id: id::RenderPipelineId) {
|
||||
profiling::scope!("RenderPipeline::drop");
|
||||
api_log!("RenderPipeline::drop {render_pipeline_id:?}");
|
||||
@ -1786,7 +1731,7 @@ impl Global {
|
||||
return (id, None);
|
||||
};
|
||||
|
||||
let id = fid.assign_error(desc.label.borrow_or_default());
|
||||
let id = fid.assign_error();
|
||||
|
||||
// We also need to assign errors to the implicit pipeline layout and the
|
||||
// implicit bind group layout. We have to remove any existing entries first.
|
||||
@ -1796,12 +1741,12 @@ impl Global {
|
||||
if pipeline_layout_guard.contains(ids.root_id) {
|
||||
pipeline_layout_guard.remove(ids.root_id);
|
||||
}
|
||||
pipeline_layout_guard.insert_error(ids.root_id, IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL);
|
||||
pipeline_layout_guard.insert_error(ids.root_id);
|
||||
for &bgl_id in ids.group_ids.iter() {
|
||||
if bgl_guard.contains(bgl_id) {
|
||||
bgl_guard.remove(bgl_id);
|
||||
}
|
||||
bgl_guard.insert_error(bgl_id, IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL);
|
||||
bgl_guard.insert_error(bgl_id);
|
||||
}
|
||||
}
|
||||
(id, Some(error))
|
||||
@ -1836,17 +1781,10 @@ impl Global {
|
||||
return (id, None);
|
||||
};
|
||||
|
||||
let id = hub
|
||||
.bind_group_layouts
|
||||
.prepare(id_in)
|
||||
.assign_error("<derived>");
|
||||
let id = hub.bind_group_layouts.prepare(id_in).assign_error();
|
||||
(id, Some(error))
|
||||
}
|
||||
|
||||
pub fn compute_pipeline_label<A: HalApi>(&self, id: id::ComputePipelineId) -> String {
|
||||
A::hub(self).compute_pipelines.label_for_resource(id)
|
||||
}
|
||||
|
||||
pub fn compute_pipeline_drop<A: HalApi>(&self, compute_pipeline_id: id::ComputePipelineId) {
|
||||
profiling::scope!("ComputePipeline::drop");
|
||||
api_log!("ComputePipeline::drop {compute_pipeline_id:?}");
|
||||
@ -1916,7 +1854,7 @@ impl Global {
|
||||
}
|
||||
};
|
||||
|
||||
let id = fid.assign_error(desc.label.borrow_or_default());
|
||||
let id = fid.assign_error();
|
||||
|
||||
(id, Some(error))
|
||||
}
|
||||
@ -2350,10 +2288,6 @@ impl Global {
|
||||
Ok(all_queue_empty)
|
||||
}
|
||||
|
||||
pub fn device_label<A: HalApi>(&self, id: DeviceId) -> String {
|
||||
A::hub(self).devices.label_for_resource(id)
|
||||
}
|
||||
|
||||
pub fn device_start_capture<A: HalApi>(&self, id: DeviceId) {
|
||||
api_log!("Device::start_capture");
|
||||
|
||||
@ -2385,8 +2319,7 @@ impl Global {
|
||||
// the registry.
|
||||
pub fn device_make_invalid<A: HalApi>(&self, device_id: DeviceId) {
|
||||
let hub = A::hub(self);
|
||||
hub.devices
|
||||
.force_replace_with_error(device_id, "Made invalid.");
|
||||
hub.devices.force_replace_with_error(device_id);
|
||||
}
|
||||
|
||||
pub fn pipeline_cache_get_data<A: HalApi>(&self, id: id::PipelineCacheId) -> Option<Vec<u8>> {
|
||||
|
@ -39,7 +39,6 @@ pub(crate) const ZERO_BUFFER_SIZE: BufferAddress = 512 << 10;
|
||||
// See https://github.com/gfx-rs/wgpu/issues/4589. 60s to reduce the chances of this.
|
||||
const CLEANUP_WAIT_MS: u32 = 60000;
|
||||
|
||||
const IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL: &str = "Implicit BindGroupLayout in the Error State";
|
||||
const ENTRYPOINT_FAILURE_ERROR: &str = "The given EntryPoint is Invalid";
|
||||
|
||||
pub type DeviceDescriptor<'a> = wgt::DeviceDescriptor<Label<'a>>;
|
||||
|
@ -42,7 +42,7 @@ pub struct Queue<A: HalApi> {
|
||||
}
|
||||
|
||||
crate::impl_resource_type!(Queue);
|
||||
// TODO: remove once we get rid of Registry.label_for_resource
|
||||
// TODO: https://github.com/gfx-rs/wgpu/issues/4014
|
||||
impl<A: HalApi> Labeled for Queue<A> {
|
||||
fn label(&self) -> &str {
|
||||
""
|
||||
|
@ -60,7 +60,7 @@ use super::{
|
||||
life::ResourceMaps,
|
||||
queue::{self, Queue},
|
||||
DeviceDescriptor, DeviceError, ImplicitPipelineContext, UserClosures, ENTRYPOINT_FAILURE_ERROR,
|
||||
IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL, ZERO_BUFFER_SIZE,
|
||||
ZERO_BUFFER_SIZE,
|
||||
};
|
||||
|
||||
/// Structure describing a logical device. Some members are internally mutable,
|
||||
@ -2615,10 +2615,10 @@ impl<A: HalApi> Device<A> {
|
||||
// that are not even in the storage.
|
||||
if let Some(ref ids) = implicit_context {
|
||||
let mut pipeline_layout_guard = hub.pipeline_layouts.write();
|
||||
pipeline_layout_guard.insert_error(ids.root_id, IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL);
|
||||
pipeline_layout_guard.insert_error(ids.root_id);
|
||||
let mut bgl_guard = hub.bind_group_layouts.write();
|
||||
for &bgl_id in ids.group_ids.iter() {
|
||||
bgl_guard.insert_error(bgl_id, IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL);
|
||||
bgl_guard.insert_error(bgl_id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2780,9 +2780,9 @@ impl<A: HalApi> Device<A> {
|
||||
//TODO: only lock mutable if the layout is derived
|
||||
let mut pipeline_layout_guard = hub.pipeline_layouts.write();
|
||||
let mut bgl_guard = hub.bind_group_layouts.write();
|
||||
pipeline_layout_guard.insert_error(ids.root_id, IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL);
|
||||
pipeline_layout_guard.insert_error(ids.root_id);
|
||||
for &bgl_id in ids.group_ids.iter() {
|
||||
bgl_guard.insert_error(bgl_id, IMPLICIT_BIND_GROUP_LAYOUT_ERROR_LABEL);
|
||||
bgl_guard.insert_error(bgl_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,89 +1,14 @@
|
||||
use core::fmt;
|
||||
use std::{error::Error, sync::Arc};
|
||||
|
||||
use crate::{gfx_select, global::Global};
|
||||
|
||||
pub struct ErrorFormatter<'a> {
|
||||
writer: &'a mut dyn fmt::Write,
|
||||
global: &'a Global,
|
||||
}
|
||||
|
||||
impl<'a> ErrorFormatter<'a> {
|
||||
pub fn error(&mut self, err: &dyn Error) {
|
||||
writeln!(self.writer, " {err}").expect("Error formatting error");
|
||||
}
|
||||
|
||||
pub fn note(&mut self, note: &dyn fmt::Display) {
|
||||
writeln!(self.writer, " note: {note}").expect("Error formatting error");
|
||||
}
|
||||
|
||||
pub fn label(&mut self, label_key: &str, label_value: &String) {
|
||||
if !label_key.is_empty() && !label_value.is_empty() {
|
||||
self.note(&format!("{label_key} = `{label_value}`"));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn bind_group_label(&mut self, id: &crate::id::BindGroupId) {
|
||||
let label: String = gfx_select!(id => self.global.bind_group_label(*id));
|
||||
self.label("bind group", &label);
|
||||
}
|
||||
|
||||
pub fn bind_group_layout_label(&mut self, id: &crate::id::BindGroupLayoutId) {
|
||||
let label: String = gfx_select!(id => self.global.bind_group_layout_label(*id));
|
||||
self.label("bind group layout", &label);
|
||||
}
|
||||
|
||||
pub fn render_pipeline_label(&mut self, id: &crate::id::RenderPipelineId) {
|
||||
let label: String = gfx_select!(id => self.global.render_pipeline_label(*id));
|
||||
self.label("render pipeline", &label);
|
||||
}
|
||||
|
||||
pub fn compute_pipeline_label(&mut self, id: &crate::id::ComputePipelineId) {
|
||||
let label: String = gfx_select!(id => self.global.compute_pipeline_label(*id));
|
||||
self.label("compute pipeline", &label);
|
||||
}
|
||||
|
||||
pub fn buffer_label_with_key(&mut self, id: &crate::id::BufferId, key: &str) {
|
||||
let label: String = gfx_select!(id => self.global.buffer_label(*id));
|
||||
self.label(key, &label);
|
||||
}
|
||||
|
||||
pub fn buffer_label(&mut self, id: &crate::id::BufferId) {
|
||||
self.buffer_label_with_key(id, "buffer");
|
||||
}
|
||||
|
||||
pub fn texture_label_with_key(&mut self, id: &crate::id::TextureId, key: &str) {
|
||||
let label: String = gfx_select!(id => self.global.texture_label(*id));
|
||||
self.label(key, &label);
|
||||
}
|
||||
|
||||
pub fn texture_label(&mut self, id: &crate::id::TextureId) {
|
||||
self.texture_label_with_key(id, "texture");
|
||||
}
|
||||
|
||||
pub fn texture_view_label_with_key(&mut self, id: &crate::id::TextureViewId, key: &str) {
|
||||
let label: String = gfx_select!(id => self.global.texture_view_label(*id));
|
||||
self.label(key, &label);
|
||||
}
|
||||
|
||||
pub fn texture_view_label(&mut self, id: &crate::id::TextureViewId) {
|
||||
self.texture_view_label_with_key(id, "texture view");
|
||||
}
|
||||
|
||||
pub fn sampler_label(&mut self, id: &crate::id::SamplerId) {
|
||||
let label: String = gfx_select!(id => self.global.sampler_label(*id));
|
||||
self.label("sampler", &label);
|
||||
}
|
||||
|
||||
pub fn command_buffer_label(&mut self, id: &crate::id::CommandBufferId) {
|
||||
let label: String = gfx_select!(id => self.global.command_buffer_label(*id));
|
||||
self.label("command buffer", &label);
|
||||
}
|
||||
|
||||
pub fn query_set_label(&mut self, id: &crate::id::QuerySetId) {
|
||||
let label: String = gfx_select!(id => self.global.query_set_label(*id));
|
||||
self.label("query set", &label);
|
||||
}
|
||||
}
|
||||
|
||||
pub trait PrettyError: Error + Sized {
|
||||
@ -92,12 +17,8 @@ pub trait PrettyError: Error + Sized {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn format_pretty_any(
|
||||
writer: &mut dyn fmt::Write,
|
||||
global: &Global,
|
||||
error: &(dyn Error + 'static),
|
||||
) {
|
||||
let mut fmt = ErrorFormatter { writer, global };
|
||||
pub fn format_pretty_any(writer: &mut dyn fmt::Write, error: &(dyn Error + 'static)) {
|
||||
let mut fmt = ErrorFormatter { writer };
|
||||
|
||||
if let Some(pretty_err) = error.downcast_ref::<ContextError>() {
|
||||
return pretty_err.fmt_pretty(&mut fmt);
|
||||
@ -152,31 +73,33 @@ pub fn format_pretty_any(
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ContextError {
|
||||
pub string: &'static str,
|
||||
pub fn_ident: &'static str,
|
||||
#[cfg(send_sync)]
|
||||
pub cause: Box<dyn Error + Send + Sync + 'static>,
|
||||
pub source: Box<dyn Error + Send + Sync + 'static>,
|
||||
#[cfg(not(send_sync))]
|
||||
pub cause: Box<dyn Error + 'static>,
|
||||
pub label_key: &'static str,
|
||||
pub source: Box<dyn Error + 'static>,
|
||||
pub label: String,
|
||||
}
|
||||
|
||||
impl PrettyError for ContextError {
|
||||
fn fmt_pretty(&self, fmt: &mut ErrorFormatter) {
|
||||
fmt.error(self);
|
||||
fmt.label(self.label_key, &self.label);
|
||||
writeln!(fmt.writer, " In {}", self.fn_ident).expect("Error formatting error");
|
||||
if !self.label.is_empty() {
|
||||
writeln!(fmt.writer, " note: label = `{}`", self.label)
|
||||
.expect("Error formatting error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for ContextError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "In {}", self.string)
|
||||
write!(f, "In {}", self.fn_ident)
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for ContextError {
|
||||
fn source(&self) -> Option<&(dyn Error + 'static)> {
|
||||
Some(self.cause.as_ref())
|
||||
Some(self.source.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,8 @@ use crate::{
|
||||
id::{markers, AdapterId, DeviceId, Id, Marker, QueueId, SurfaceId},
|
||||
lock::{rank, Mutex},
|
||||
present::Presentation,
|
||||
resource::{Labeled, ResourceType},
|
||||
resource_log, LabelHelpers, DOWNLEVEL_WARNING_MESSAGE,
|
||||
resource::ResourceType,
|
||||
resource_log, DOWNLEVEL_WARNING_MESSAGE,
|
||||
};
|
||||
|
||||
use wgt::{Backend, Backends, PowerPreference};
|
||||
@ -147,12 +147,6 @@ pub struct Surface {
|
||||
impl ResourceType for Surface {
|
||||
const TYPE: &'static str = "Surface";
|
||||
}
|
||||
// TODO: remove once we get rid of Registry.label_for_resource
|
||||
impl Labeled for Surface {
|
||||
fn label(&self) -> &str {
|
||||
""
|
||||
}
|
||||
}
|
||||
impl crate::storage::StorageItem for Surface {
|
||||
type Marker = markers::Surface;
|
||||
}
|
||||
@ -367,12 +361,6 @@ impl<A: HalApi> Adapter<A> {
|
||||
}
|
||||
|
||||
crate::impl_resource_type!(Adapter);
|
||||
// TODO: remove once we get rid of Registry.label_for_resource
|
||||
impl<A: HalApi> Labeled for Adapter<A> {
|
||||
fn label(&self) -> &str {
|
||||
""
|
||||
}
|
||||
}
|
||||
crate::impl_storage_item!(Adapter);
|
||||
|
||||
#[derive(Clone, Debug, Error)]
|
||||
@ -1103,8 +1091,8 @@ impl Global {
|
||||
return (device_id, queue_id, None);
|
||||
};
|
||||
|
||||
let device_id = device_fid.assign_error(desc.label.borrow_or_default());
|
||||
let queue_id = queue_fid.assign_error(desc.label.borrow_or_default());
|
||||
let device_id = device_fid.assign_error();
|
||||
let queue_id = queue_fid.assign_error();
|
||||
(device_id, queue_id, Some(error))
|
||||
}
|
||||
|
||||
@ -1154,8 +1142,8 @@ impl Global {
|
||||
return (device_id, queue_id, None);
|
||||
};
|
||||
|
||||
let device_id = devices_fid.assign_error(desc.label.borrow_or_default());
|
||||
let queue_id = queues_fid.assign_error(desc.label.borrow_or_default());
|
||||
let device_id = devices_fid.assign_error();
|
||||
let queue_id = queues_fid.assign_error();
|
||||
(device_id, queue_id, Some(error))
|
||||
}
|
||||
}
|
||||
|
@ -96,15 +96,10 @@ pub type RawString = *const c_char;
|
||||
pub type Label<'a> = Option<Cow<'a, str>>;
|
||||
|
||||
trait LabelHelpers<'a> {
|
||||
fn borrow_option(&'a self) -> Option<&'a str>;
|
||||
fn to_hal(&'a self, flags: wgt::InstanceFlags) -> Option<&'a str>;
|
||||
fn borrow_or_default(&'a self) -> &'a str;
|
||||
fn to_string(&self) -> String;
|
||||
}
|
||||
impl<'a> LabelHelpers<'a> for Label<'a> {
|
||||
fn borrow_option(&'a self) -> Option<&'a str> {
|
||||
self.as_ref().map(|cow| cow.as_ref())
|
||||
}
|
||||
fn to_hal(&'a self, flags: wgt::InstanceFlags) -> Option<&'a str> {
|
||||
if flags.contains(wgt::InstanceFlags::DISCARD_HAL_LABELS) {
|
||||
return None;
|
||||
@ -112,9 +107,6 @@ impl<'a> LabelHelpers<'a> for Label<'a> {
|
||||
|
||||
self.as_ref().map(|cow| cow.as_ref())
|
||||
}
|
||||
fn borrow_or_default(&'a self) -> &'a str {
|
||||
self.borrow_option().unwrap_or_default()
|
||||
}
|
||||
fn to_string(&self) -> String {
|
||||
self.as_ref().map(|cow| cow.to_string()).unwrap_or_default()
|
||||
}
|
||||
|
@ -92,8 +92,8 @@ impl<T: StorageItem> FutureId<'_, T> {
|
||||
self.id
|
||||
}
|
||||
|
||||
pub fn assign_error(self, label: &str) -> Id<T::Marker> {
|
||||
self.data.write().insert_error(self.id, label);
|
||||
pub fn assign_error(self) -> Id<T::Marker> {
|
||||
self.data.write().insert_error(self.id);
|
||||
self.id
|
||||
}
|
||||
}
|
||||
@ -136,10 +136,10 @@ impl<T: StorageItem> Registry<T> {
|
||||
let mut storage = self.storage.write();
|
||||
storage.force_replace(id, value)
|
||||
}
|
||||
pub(crate) fn force_replace_with_error(&self, id: Id<T::Marker>, label: &str) {
|
||||
pub(crate) fn force_replace_with_error(&self, id: Id<T::Marker>) {
|
||||
let mut storage = self.storage.write();
|
||||
storage.remove(id);
|
||||
storage.insert_error(id, label);
|
||||
storage.insert_error(id);
|
||||
}
|
||||
pub(crate) fn unregister(&self, id: Id<T::Marker>) -> Option<Arc<T>> {
|
||||
let value = self.storage.write().remove(id);
|
||||
@ -151,33 +151,6 @@ impl<T: StorageItem> Registry<T> {
|
||||
value
|
||||
}
|
||||
|
||||
pub(crate) fn label_for_resource(&self, id: Id<T::Marker>) -> String {
|
||||
let guard = self.storage.read();
|
||||
|
||||
let type_name = guard.kind();
|
||||
|
||||
// Using `get` over `try_get` is fine for the most part.
|
||||
// However, there's corner cases where it can happen that a resource still holds an Arc
|
||||
// to another resource that was already dropped explicitly from the registry.
|
||||
// That resource is now in an invalid state, likely causing an error that lead
|
||||
// us here, trying to print its label but failing because the id is now vacant.
|
||||
match guard.try_get(id) {
|
||||
Ok(Some(res)) => {
|
||||
let label = res.label();
|
||||
if label.is_empty() {
|
||||
format!("<{}-{:?}>", type_name, id.unzip())
|
||||
} else {
|
||||
label.to_owned()
|
||||
}
|
||||
}
|
||||
_ => format!(
|
||||
"<Invalid-{} label={}>",
|
||||
type_name,
|
||||
guard.label_for_invalid_id(id)
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn generate_report(&self) -> RegistryReport {
|
||||
let storage = self.storage.read();
|
||||
let mut report = RegistryReport {
|
||||
@ -189,7 +162,7 @@ impl<T: StorageItem> Registry<T> {
|
||||
match *element {
|
||||
Element::Occupied(..) => report.num_kept_from_user += 1,
|
||||
Element::Vacant => report.num_released_from_user += 1,
|
||||
Element::Error(..) => report.num_error += 1,
|
||||
Element::Error(_) => report.num_error += 1,
|
||||
}
|
||||
}
|
||||
report
|
||||
@ -200,11 +173,7 @@ impl<T: StorageItem> Registry<T> {
|
||||
mod tests {
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::{
|
||||
id::Marker,
|
||||
resource::{Labeled, ResourceType},
|
||||
storage::StorageItem,
|
||||
};
|
||||
use crate::{id::Marker, resource::ResourceType, storage::StorageItem};
|
||||
|
||||
use super::Registry;
|
||||
struct TestData;
|
||||
@ -214,12 +183,6 @@ mod tests {
|
||||
impl ResourceType for TestData {
|
||||
const TYPE: &'static str = "TestData";
|
||||
}
|
||||
// TODO: remove once we get rid of Registry.label_for_resource
|
||||
impl Labeled for TestData {
|
||||
fn label(&self) -> &str {
|
||||
""
|
||||
}
|
||||
}
|
||||
impl StorageItem for TestData {
|
||||
type Marker = TestDataId;
|
||||
}
|
||||
|
@ -893,7 +893,7 @@ impl<A: HalApi> Drop for StagingBuffer<A> {
|
||||
}
|
||||
|
||||
crate::impl_resource_type!(StagingBuffer);
|
||||
// TODO: remove once we get rid of Registry.label_for_resource
|
||||
// TODO: add label
|
||||
impl<A: HalApi> Labeled for StagingBuffer<A> {
|
||||
fn label(&self) -> &str {
|
||||
""
|
||||
|
@ -4,7 +4,7 @@ use std::sync::Arc;
|
||||
use wgt::Backend;
|
||||
|
||||
use crate::id::{Id, Marker};
|
||||
use crate::resource::{Labeled, ResourceType};
|
||||
use crate::resource::ResourceType;
|
||||
use crate::{Epoch, Index};
|
||||
|
||||
/// An entry in a `Storage::map` table.
|
||||
@ -19,16 +19,13 @@ pub(crate) enum Element<T> {
|
||||
|
||||
/// Like `Occupied`, but an error occurred when creating the
|
||||
/// resource.
|
||||
///
|
||||
/// The given `String` is the resource's descriptor label.
|
||||
Error(Epoch, String),
|
||||
Error(Epoch),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct InvalidId;
|
||||
|
||||
// The Labeled bound is still needed because of label_for_resource
|
||||
pub(crate) trait StorageItem: ResourceType + Labeled {
|
||||
pub(crate) trait StorageItem: ResourceType {
|
||||
type Marker: Marker;
|
||||
}
|
||||
|
||||
@ -88,7 +85,7 @@ where
|
||||
let (index, epoch, _) = id.unzip();
|
||||
match self.map.get(index as usize) {
|
||||
Some(&Element::Vacant) => false,
|
||||
Some(&Element::Occupied(_, storage_epoch) | &Element::Error(storage_epoch, _)) => {
|
||||
Some(&Element::Occupied(_, storage_epoch) | &Element::Error(storage_epoch)) => {
|
||||
storage_epoch == epoch
|
||||
}
|
||||
None => false,
|
||||
@ -107,7 +104,7 @@ where
|
||||
let (result, storage_epoch) = match self.map.get(index as usize) {
|
||||
Some(&Element::Occupied(ref v, epoch)) => (Ok(Some(v)), epoch),
|
||||
Some(&Element::Vacant) => return Ok(None),
|
||||
Some(&Element::Error(epoch, ..)) => (Err(InvalidId), epoch),
|
||||
Some(&Element::Error(epoch)) => (Err(InvalidId), epoch),
|
||||
None => return Err(InvalidId),
|
||||
};
|
||||
assert_eq!(
|
||||
@ -125,7 +122,7 @@ where
|
||||
let (result, storage_epoch) = match self.map.get(index as usize) {
|
||||
Some(&Element::Occupied(ref v, epoch)) => (Ok(v), epoch),
|
||||
Some(&Element::Vacant) => panic!("{}[{:?}] does not exist", self.kind, id),
|
||||
Some(&Element::Error(epoch, ..)) => (Err(InvalidId), epoch),
|
||||
Some(&Element::Error(epoch)) => (Err(InvalidId), epoch),
|
||||
None => return Err(InvalidId),
|
||||
};
|
||||
assert_eq!(
|
||||
@ -142,14 +139,6 @@ where
|
||||
Ok(Arc::clone(self.get(id)?))
|
||||
}
|
||||
|
||||
pub(crate) fn label_for_invalid_id(&self, id: Id<T::Marker>) -> &str {
|
||||
let (index, _, _) = id.unzip();
|
||||
match self.map.get(index as usize) {
|
||||
Some(Element::Error(_, label)) => label,
|
||||
_ => "",
|
||||
}
|
||||
}
|
||||
|
||||
fn insert_impl(&mut self, index: usize, epoch: Epoch, element: Element<T>) {
|
||||
if index >= self.map.len() {
|
||||
self.map.resize_with(index + 1, || Element::Vacant);
|
||||
@ -164,7 +153,7 @@ where
|
||||
T::TYPE
|
||||
);
|
||||
}
|
||||
Element::Error(storage_epoch, _) => {
|
||||
Element::Error(storage_epoch) => {
|
||||
assert_ne!(
|
||||
epoch,
|
||||
storage_epoch,
|
||||
@ -181,22 +170,15 @@ where
|
||||
self.insert_impl(index as usize, epoch, Element::Occupied(value, epoch))
|
||||
}
|
||||
|
||||
pub(crate) fn insert_error(&mut self, id: Id<T::Marker>, label: &str) {
|
||||
pub(crate) fn insert_error(&mut self, id: Id<T::Marker>) {
|
||||
log::trace!("User is inserting as error {}{:?}", T::TYPE, id);
|
||||
let (index, epoch, _) = id.unzip();
|
||||
self.insert_impl(
|
||||
index as usize,
|
||||
epoch,
|
||||
Element::Error(epoch, label.to_string()),
|
||||
)
|
||||
self.insert_impl(index as usize, epoch, Element::Error(epoch))
|
||||
}
|
||||
|
||||
pub(crate) fn replace_with_error(&mut self, id: Id<T::Marker>) -> Result<Arc<T>, InvalidId> {
|
||||
let (index, epoch, _) = id.unzip();
|
||||
match std::mem::replace(
|
||||
&mut self.map[index as usize],
|
||||
Element::Error(epoch, String::new()),
|
||||
) {
|
||||
match std::mem::replace(&mut self.map[index as usize], Element::Error(epoch)) {
|
||||
Element::Vacant => panic!("Cannot access vacant resource"),
|
||||
Element::Occupied(value, storage_epoch) => {
|
||||
assert_eq!(epoch, storage_epoch);
|
||||
@ -220,7 +202,7 @@ where
|
||||
assert_eq!(epoch, storage_epoch);
|
||||
Some(value)
|
||||
}
|
||||
Element::Error(..) => None,
|
||||
Element::Error(_) => None,
|
||||
Element::Vacant => panic!("Cannot remove a vacant resource"),
|
||||
}
|
||||
}
|
||||
@ -237,10 +219,6 @@ where
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn kind(&self) -> &str {
|
||||
self.kind
|
||||
}
|
||||
|
||||
pub(crate) fn len(&self) -> usize {
|
||||
self.map.len()
|
||||
}
|
||||
|
@ -29,8 +29,6 @@ use wgc::{
|
||||
};
|
||||
use wgt::WasmNotSendSync;
|
||||
|
||||
const LABEL: &str = "label";
|
||||
|
||||
pub struct ContextWgpuCore(wgc::global::Global);
|
||||
|
||||
impl Drop for ContextWgpuCore {
|
||||
@ -63,10 +61,6 @@ impl ContextWgpuCore {
|
||||
Self(unsafe { wgc::global::Global::from_instance(core_instance) })
|
||||
}
|
||||
|
||||
pub(crate) fn global(&self) -> &wgc::global::Global {
|
||||
&self.0
|
||||
}
|
||||
|
||||
pub fn enumerate_adapters(&self, backends: wgt::Backends) -> Vec<wgc::id::AdapterId> {
|
||||
self.0
|
||||
.enumerate_adapters(wgc::instance::AdapterInputs::Mask(backends, |_| None))
|
||||
@ -150,7 +144,6 @@ impl ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&device.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
desc.label,
|
||||
"Device::create_texture_from_hal",
|
||||
);
|
||||
@ -179,7 +172,6 @@ impl ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&device.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
desc.label,
|
||||
"Device::create_buffer_from_hal",
|
||||
);
|
||||
@ -273,16 +265,14 @@ impl ContextWgpuCore {
|
||||
fn handle_error(
|
||||
&self,
|
||||
sink_mutex: &Mutex<ErrorSinkRaw>,
|
||||
cause: impl Error + WasmNotSendSync + 'static,
|
||||
label_key: &'static str,
|
||||
source: impl Error + WasmNotSendSync + 'static,
|
||||
label: Label<'_>,
|
||||
string: &'static str,
|
||||
fn_ident: &'static str,
|
||||
) {
|
||||
let error = wgc::error::ContextError {
|
||||
string,
|
||||
cause: Box::new(cause),
|
||||
fn_ident,
|
||||
source: Box::new(source),
|
||||
label: label.unwrap_or_default().to_string(),
|
||||
label_key,
|
||||
};
|
||||
let mut sink = sink_mutex.lock();
|
||||
let mut source_opt: Option<&(dyn Error + 'static)> = Some(&error);
|
||||
@ -307,10 +297,10 @@ impl ContextWgpuCore {
|
||||
fn handle_error_nolabel(
|
||||
&self,
|
||||
sink_mutex: &Mutex<ErrorSinkRaw>,
|
||||
cause: impl Error + WasmNotSendSync + 'static,
|
||||
string: &'static str,
|
||||
source: impl Error + WasmNotSendSync + 'static,
|
||||
fn_ident: &'static str,
|
||||
) {
|
||||
self.handle_error(sink_mutex, cause, "", None, string)
|
||||
self.handle_error(sink_mutex, source, None, fn_ident)
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
@ -323,24 +313,18 @@ impl ContextWgpuCore {
|
||||
}
|
||||
|
||||
fn format_error(&self, err: &(impl Error + 'static)) -> String {
|
||||
let global = self.global();
|
||||
let mut err_descs = vec![];
|
||||
let mut level = 0;
|
||||
|
||||
fn print_tree(
|
||||
err_descs: &mut Vec<String>,
|
||||
level: &mut usize,
|
||||
global: &wgc::global::Global,
|
||||
e: &(dyn Error + 'static),
|
||||
) {
|
||||
fn print_tree(err_descs: &mut Vec<String>, level: &mut usize, e: &(dyn Error + 'static)) {
|
||||
let mut print = |e| {
|
||||
let mut err_str = " ".repeat(*level * 2);
|
||||
wgc::error::format_pretty_any(&mut err_str, global, e);
|
||||
wgc::error::format_pretty_any(&mut err_str, e);
|
||||
err_descs.push(err_str);
|
||||
|
||||
if let Some(e) = e.source() {
|
||||
*level += 1;
|
||||
print_tree(err_descs, level, global, e);
|
||||
print_tree(err_descs, level, e);
|
||||
*level -= 1;
|
||||
}
|
||||
};
|
||||
@ -353,7 +337,7 @@ impl ContextWgpuCore {
|
||||
}
|
||||
}
|
||||
|
||||
print_tree(&mut err_descs, &mut level, global, err);
|
||||
print_tree(&mut err_descs, &mut level, err);
|
||||
|
||||
format!("Validation Error\n\nCaused by:\n{}", err_descs.join(""))
|
||||
}
|
||||
@ -940,7 +924,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
cause.clone(),
|
||||
LABEL,
|
||||
desc.label,
|
||||
"Device::create_shader_module",
|
||||
);
|
||||
@ -972,7 +955,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
cause.clone(),
|
||||
LABEL,
|
||||
desc.label,
|
||||
"Device::create_shader_module_spirv",
|
||||
);
|
||||
@ -1000,7 +982,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
desc.label,
|
||||
"Device::create_bind_group_layout",
|
||||
);
|
||||
@ -1114,7 +1095,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
desc.label,
|
||||
"Device::create_bind_group",
|
||||
);
|
||||
@ -1156,7 +1136,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
desc.label,
|
||||
"Device::create_pipeline_layout",
|
||||
);
|
||||
@ -1241,7 +1220,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
desc.label,
|
||||
"Device::create_render_pipeline",
|
||||
);
|
||||
@ -1296,7 +1274,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
desc.label,
|
||||
"Device::create_compute_pipeline",
|
||||
);
|
||||
@ -1326,7 +1303,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
desc.label,
|
||||
"Device::device_create_pipeline_cache_init",
|
||||
);
|
||||
@ -1349,7 +1325,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
desc.label,
|
||||
"Device::create_buffer",
|
||||
);
|
||||
@ -1377,7 +1352,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
desc.label,
|
||||
"Device::create_texture",
|
||||
);
|
||||
@ -1422,7 +1396,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
desc.label,
|
||||
"Device::create_sampler",
|
||||
);
|
||||
@ -1460,7 +1433,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
desc.label,
|
||||
"Device::create_command_encoder",
|
||||
);
|
||||
@ -1671,7 +1643,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&texture_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
desc.label,
|
||||
"Texture::create_view",
|
||||
);
|
||||
@ -1945,7 +1916,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&encoder_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
desc.label,
|
||||
"CommandEncoder::begin_compute_pass",
|
||||
);
|
||||
@ -2017,7 +1987,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&encoder_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
desc.label,
|
||||
"CommandEncoder::begin_compute_pass",
|
||||
);
|
||||
@ -2425,7 +2394,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"ComputePass::set_pipeline",
|
||||
);
|
||||
@ -2448,7 +2416,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"ComputePass::set_bind_group",
|
||||
);
|
||||
@ -2466,7 +2433,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"ComputePass::set_push_constant",
|
||||
);
|
||||
@ -2483,7 +2449,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"ComputePass::insert_debug_marker",
|
||||
);
|
||||
@ -2500,7 +2465,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"ComputePass::push_debug_group",
|
||||
);
|
||||
@ -2516,7 +2480,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"ComputePass::pop_debug_group",
|
||||
);
|
||||
@ -2538,7 +2501,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"ComputePass::write_timestamp",
|
||||
);
|
||||
@ -2561,7 +2523,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"ComputePass::begin_pipeline_statistics_query",
|
||||
);
|
||||
@ -2577,7 +2538,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"ComputePass::end_pipeline_statistics_query",
|
||||
);
|
||||
@ -2596,7 +2556,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"ComputePass::dispatch_workgroups",
|
||||
);
|
||||
@ -2619,7 +2578,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"ComputePass::dispatch_workgroups_indirect",
|
||||
);
|
||||
@ -2635,7 +2593,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"ComputePass::end",
|
||||
);
|
||||
@ -2838,7 +2795,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::set_pipeline",
|
||||
);
|
||||
@ -2861,7 +2817,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::set_bind_group",
|
||||
);
|
||||
@ -2886,7 +2841,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::set_index_buffer",
|
||||
);
|
||||
@ -2910,7 +2864,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::set_vertex_buffer",
|
||||
);
|
||||
@ -2932,7 +2885,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::set_push_constants",
|
||||
);
|
||||
@ -2956,7 +2908,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::draw",
|
||||
);
|
||||
@ -2982,7 +2933,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::draw_indexed",
|
||||
);
|
||||
@ -3004,7 +2954,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::draw_indirect",
|
||||
);
|
||||
@ -3027,7 +2976,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::draw_indexed_indirect",
|
||||
);
|
||||
@ -3051,7 +2999,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::multi_draw_indirect",
|
||||
);
|
||||
@ -3076,7 +3023,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::multi_draw_indexed_indirect",
|
||||
);
|
||||
@ -3106,7 +3052,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::multi_draw_indirect_count",
|
||||
);
|
||||
@ -3136,7 +3081,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::multi_draw_indexed_indirect_count",
|
||||
);
|
||||
@ -3153,7 +3097,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::set_blend_constant",
|
||||
);
|
||||
@ -3176,7 +3119,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::set_scissor_rect",
|
||||
);
|
||||
@ -3201,7 +3143,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::set_viewport",
|
||||
);
|
||||
@ -3218,7 +3159,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::set_stencil_reference",
|
||||
);
|
||||
@ -3235,7 +3175,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::insert_debug_marker",
|
||||
);
|
||||
@ -3252,7 +3191,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::push_debug_group",
|
||||
);
|
||||
@ -3268,7 +3206,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::pop_debug_group",
|
||||
);
|
||||
@ -3290,7 +3227,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::write_timestamp",
|
||||
);
|
||||
@ -3307,7 +3243,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::begin_occlusion_query",
|
||||
);
|
||||
@ -3323,7 +3258,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::end_occlusion_query",
|
||||
);
|
||||
@ -3346,7 +3280,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::begin_pipeline_statistics_query",
|
||||
);
|
||||
@ -3362,7 +3295,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::end_pipeline_statistics_query",
|
||||
);
|
||||
@ -3383,7 +3315,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::execute_bundles",
|
||||
);
|
||||
@ -3399,7 +3330,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
self.handle_error(
|
||||
&pass_data.error_sink,
|
||||
cause,
|
||||
LABEL,
|
||||
pass_data.pass.label(),
|
||||
"RenderPass::end",
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user