From 9a36c031207f8efd64980658c76529b5f155b44c Mon Sep 17 00:00:00 2001 From: Jacob Hughes Date: Wed, 24 Jan 2024 22:24:06 -0500 Subject: [PATCH] debug_printf: Skip naga tests on DXC --- naga/hlsl-snapshots/src/lib.rs | 1 + naga/tests/snapshots.rs | 4 +++- naga/xtask/src/validate.rs | 39 +++++++++++++++++++++------------- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/naga/hlsl-snapshots/src/lib.rs b/naga/hlsl-snapshots/src/lib.rs index 616aa73f01..b67ee1c1f6 100644 --- a/naga/hlsl-snapshots/src/lib.rs +++ b/naga/hlsl-snapshots/src/lib.rs @@ -94,4 +94,5 @@ pub struct ConfigItem { /// See also /// . pub target_profile: String, + pub debug_printf: bool, } diff --git a/naga/tests/snapshots.rs b/naga/tests/snapshots.rs index ac122a3a6c..814b48c53a 100644 --- a/naga/tests/snapshots.rs +++ b/naga/tests/snapshots.rs @@ -549,7 +549,7 @@ fn write_output_hlsl( info: &naga::valid::ModuleInfo, options: &naga::back::hlsl::Options, ) { - use naga::back::hlsl; + use naga::back::hlsl::{self, WriterFlags}; use std::fmt::Write as _; println!("generating HLSL"); @@ -576,6 +576,8 @@ fn write_output_hlsl( } .push(hlsl_snapshots::ConfigItem { entry_point: name.clone(), + // Skip DXC until it supports debug printf + debug_printf: options.flags.contains(WriterFlags::EMIT_DEBUG_PRINTF), target_profile: format!( "{}_{}", ep.stage.to_hlsl_str(), diff --git a/naga/xtask/src/validate.rs b/naga/xtask/src/validate.rs index 394b7b00d4..2a379e070c 100644 --- a/naga/xtask/src/validate.rs +++ b/naga/xtask/src/validate.rs @@ -311,21 +311,29 @@ fn validate_hlsl_with_dxc( config_item: hlsl_snapshots::ConfigItem, dxc: &str, ) -> anyhow::Result<()> { - // Reference: - // . - validate_hlsl( - file, - dxc, - config_item, - &[ - "-Wno-parentheses-equality", - "-Zi", - "-Qembed_debug", - "-Od", - "-HV", - "2018", - ], - ) + if config_item.debug_printf { + log::debug!( + "skipping config. item {config_item:?} because it \ + uses debug printf which is not supported on DXC" + ); + Ok(()) + } else { + // Reference: + // . + validate_hlsl( + file, + dxc, + config_item, + &[ + "-Wno-parentheses-equality", + "-Zi", + "-Qembed_debug", + "-Od", + "-HV", + "2018", + ], + ) + } } fn validate_hlsl_with_fxc( @@ -370,6 +378,7 @@ fn validate_hlsl( let hlsl_snapshots::ConfigItem { entry_point, target_profile, + .. } = config_item; EasyCommand::new(bin, |cmd| { cmd.arg(file)