From 8dc49424316d6a3b145ac4410108cf89ae9fac74 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Fri, 23 Jul 2021 10:48:25 -0400 Subject: [PATCH] Update naga to bbfa9a0, tweak DX12 debug output --- Cargo.lock | 2 +- wgpu-core/Cargo.toml | 2 +- wgpu-hal/Cargo.toml | 4 ++-- wgpu-hal/src/dx12/command.rs | 2 +- wgpu-hal/src/dx12/instance.rs | 31 ++++++++++++++++++++----------- wgpu/Cargo.toml | 4 ++-- 6 files changed, 27 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 81dee16a0..19dcbeda0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -932,7 +932,7 @@ dependencies = [ [[package]] name = "naga" version = "0.5.0" -source = "git+https://github.com/gfx-rs/naga?rev=cc91c77#cc91c77f7ac7e22b615bf2e188f659ce623c1fe9" +source = "git+https://github.com/gfx-rs/naga?rev=bbfa9a0#bbfa9a0f9e0599fe09ad9428bf359e6dea2664c6" dependencies = [ "bit-set", "bitflags", diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index a361f8c85..757e9cde8 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -36,7 +36,7 @@ thiserror = "1" [dependencies.naga] git = "https://github.com/gfx-rs/naga" -rev = "cc91c77" +rev = "bbfa9a0" features = ["wgsl-in"] [dependencies.wgt] diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index fc72d8b35..be435a9ea 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -65,11 +65,11 @@ core-graphics-types = "0.1" [dependencies.naga] git = "https://github.com/gfx-rs/naga" -rev = "cc91c77" +rev = "bbfa9a0" [dev-dependencies.naga] git = "https://github.com/gfx-rs/naga" -rev = "cc91c77" +rev = "bbfa9a0" features = ["wgsl-in"] [dev-dependencies] diff --git a/wgpu-hal/src/dx12/command.rs b/wgpu-hal/src/dx12/command.rs index 2906ba28c..951a797a0 100644 --- a/wgpu-hal/src/dx12/command.rs +++ b/wgpu-hal/src/dx12/command.rs @@ -533,7 +533,7 @@ impl crate::CommandEncoder for super::CommandEncoder { flags |= native::ClearFlags::STENCIL; } - if !ds_view.is_null() { + if !ds_view.is_null() && !flags.is_empty() { list.clear_depth_stencil_view( *ds_view, flags, diff --git a/wgpu-hal/src/dx12/instance.rs b/wgpu-hal/src/dx12/instance.rs index 1e40a45a8..865ebb69f 100644 --- a/wgpu-hal/src/dx12/instance.rs +++ b/wgpu-hal/src/dx12/instance.rs @@ -37,22 +37,31 @@ unsafe extern "system" fn output_debug_string_handler( _ => return excpt::EXCEPTION_CONTINUE_SEARCH, }; - let (message, level) = match message.strip_prefix("D3D12 ") { - Some(msg) => { - match MESSAGE_PREFIXES - .iter() - .find(|&&(prefix, _)| msg.starts_with(prefix)) - { - Some(&(prefix, level)) => (&msg[prefix.len() + 2..], level), - None => (msg, log::Level::Debug), - } - } + let message = match message.strip_prefix("D3D12 ") { + Some(msg) => msg + .trim_end_matches("\n\0") + .trim_end_matches("[ STATE_CREATION WARNING #0: UNKNOWN]"), None => return excpt::EXCEPTION_CONTINUE_SEARCH, }; - log::log!(level, "{}", message.trim_end_matches("\n\0")); + let (message, level) = match MESSAGE_PREFIXES + .iter() + .find(|&&(prefix, _)| message.starts_with(prefix)) + { + Some(&(prefix, level)) => (&message[prefix.len() + 2..], level), + None => (message, log::Level::Debug), + }; + + if level == log::Level::Warn && message.contains("#82") { + // This is are useless spammy warnings (#820, #821): + // "The application did not pass any clear value to resource creation" + return excpt::EXCEPTION_CONTINUE_SEARCH; + } + + log::log!(level, "{}", message); if cfg!(debug_assertions) && level == log::Level::Error { + // Panicking behind FFI is UB, so we just exit. std::process::exit(1); } diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index b35689dd2..9fad863c4 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -75,13 +75,13 @@ env_logger = "0.8" [dependencies.naga] git = "https://github.com/gfx-rs/naga" -rev = "cc91c77" +rev = "bbfa9a0" optional = true # used to test all the example shaders [dev-dependencies.naga] git = "https://github.com/gfx-rs/naga" -rev = "cc91c77" +rev = "bbfa9a0" features = ["wgsl-in"] [[example]]