mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
[rs] Handle PassErrorScope Ids
This commit is contained in:
parent
dc61d7fb22
commit
add09fb33c
@ -26,14 +26,14 @@ vulkan-portability = ["wgc/gfx-backend-vulkan", "gfx-backend-vulkan"]
|
|||||||
package = "wgpu-core"
|
package = "wgpu-core"
|
||||||
#version = "0.6"
|
#version = "0.6"
|
||||||
git = "https://github.com/gfx-rs/wgpu"
|
git = "https://github.com/gfx-rs/wgpu"
|
||||||
rev = "9d35aea08eb5cdd5ad408e8a13838a7beab11ad3"
|
rev = "feac96d3151f08188bdd270fdf021117944c01b0"
|
||||||
features = ["raw-window-handle"]
|
features = ["raw-window-handle"]
|
||||||
|
|
||||||
[dependencies.wgt]
|
[dependencies.wgt]
|
||||||
package = "wgpu-types"
|
package = "wgpu-types"
|
||||||
#version = "0.6"
|
#version = "0.6"
|
||||||
git = "https://github.com/gfx-rs/wgpu"
|
git = "https://github.com/gfx-rs/wgpu"
|
||||||
rev = "9d35aea08eb5cdd5ad408e8a13838a7beab11ad3"
|
rev = "feac96d3151f08188bdd270fdf021117944c01b0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
arrayvec = "0.5"
|
arrayvec = "0.5"
|
||||||
|
|||||||
@ -37,9 +37,18 @@ fn fmt_pretty_any(error: &(dyn Error + 'static), context: &Context) -> String {
|
|||||||
if let Some(pretty_err) = error.downcast_ref::<wgc::command::RenderPassErrorInner>() {
|
if let Some(pretty_err) = error.downcast_ref::<wgc::command::RenderPassErrorInner>() {
|
||||||
return pretty_err.fmt_pretty(context);
|
return pretty_err.fmt_pretty(context);
|
||||||
}
|
}
|
||||||
|
if let Some(pretty_err) = error.downcast_ref::<wgc::command::RenderPassError>() {
|
||||||
|
return pretty_err.fmt_pretty(context);
|
||||||
|
}
|
||||||
if let Some(pretty_err) = error.downcast_ref::<wgc::command::ComputePassErrorInner>() {
|
if let Some(pretty_err) = error.downcast_ref::<wgc::command::ComputePassErrorInner>() {
|
||||||
return pretty_err.fmt_pretty(context);
|
return pretty_err.fmt_pretty(context);
|
||||||
}
|
}
|
||||||
|
if let Some(pretty_err) = error.downcast_ref::<wgc::command::ComputePassError>() {
|
||||||
|
return pretty_err.fmt_pretty(context);
|
||||||
|
}
|
||||||
|
if let Some(pretty_err) = error.downcast_ref::<wgc::command::RenderBundleError>() {
|
||||||
|
return pretty_err.fmt_pretty(context);
|
||||||
|
}
|
||||||
if let Some(pretty_err) = error.downcast_ref::<wgc::command::TransferError>() {
|
if let Some(pretty_err) = error.downcast_ref::<wgc::command::TransferError>() {
|
||||||
return pretty_err.fmt_pretty(context);
|
return pretty_err.fmt_pretty(context);
|
||||||
}
|
}
|
||||||
@ -175,6 +184,29 @@ impl PrettyError for wgc::command::RenderPassErrorInner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl PrettyError for wgc::command::RenderPassError {
|
||||||
|
fn fmt_pretty(&self, context: &Context) -> String {
|
||||||
|
// This error is wrapper for the inner error,
|
||||||
|
// but the scope has useful labels
|
||||||
|
format_error_line(self) + &self.scope.fmt_pretty(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PrettyError for wgc::command::ComputePassError {
|
||||||
|
fn fmt_pretty(&self, context: &Context) -> String {
|
||||||
|
// This error is wrapper for the inner error,
|
||||||
|
// but the scope has useful labels
|
||||||
|
format_error_line(self) + &self.scope.fmt_pretty(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl PrettyError for wgc::command::RenderBundleError {
|
||||||
|
fn fmt_pretty(&self, context: &Context) -> String {
|
||||||
|
// This error is wrapper for the inner error,
|
||||||
|
// but the scope has useful labels
|
||||||
|
format_error_line(self) + &self.scope.fmt_pretty(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl PrettyError for wgc::command::ComputePassErrorInner {
|
impl PrettyError for wgc::command::ComputePassErrorInner {
|
||||||
fn fmt_pretty(&self, context: &Context) -> String {
|
fn fmt_pretty(&self, context: &Context) -> String {
|
||||||
let global = context.global();
|
let global = context.global();
|
||||||
@ -236,3 +268,37 @@ impl PrettyError for wgc::command::TransferError {
|
|||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl PrettyError for wgc::command::PassErrorScope {
|
||||||
|
fn fmt_pretty(&self, context: &Context) -> String {
|
||||||
|
// This error is not in the error chain, only notes are needed
|
||||||
|
let global = context.global();
|
||||||
|
match *self {
|
||||||
|
Self::Pass(id) => {
|
||||||
|
let name = wgc::gfx_select!(id => global.command_buffer_label(id));
|
||||||
|
format_label_line("command buffer", &name)
|
||||||
|
}
|
||||||
|
Self::SetBindGroup(id) => {
|
||||||
|
let name = wgc::gfx_select!(id => global.bind_group_label(id));
|
||||||
|
format_label_line("bind group", &name)
|
||||||
|
}
|
||||||
|
Self::SetPipelineRender(id) => {
|
||||||
|
let name = wgc::gfx_select!(id => global.render_pipeline_label(id));
|
||||||
|
format_label_line("render pipeline", &name)
|
||||||
|
}
|
||||||
|
Self::SetPipelineCompute(id) => {
|
||||||
|
let name = wgc::gfx_select!(id => global.compute_pipeline_label(id));
|
||||||
|
format_label_line("compute pipeline", &name)
|
||||||
|
}
|
||||||
|
Self::SetVertexBuffer(id) => {
|
||||||
|
let name = wgc::gfx_select!(id => global.buffer_label(id));
|
||||||
|
format_label_line("buffer", &name)
|
||||||
|
}
|
||||||
|
Self::SetIndexBuffer(id) => {
|
||||||
|
let name = wgc::gfx_select!(id => global.buffer_label(id));
|
||||||
|
format_label_line("buffer", &name)
|
||||||
|
}
|
||||||
|
_ => String::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user