Skip to content

Commit

Permalink
debug_printf: Skip naga tests on DXC
Browse files Browse the repository at this point in the history
  • Loading branch information
exrook committed Jan 25, 2024
1 parent b010834 commit 9a36c03
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
1 change: 1 addition & 0 deletions naga/hlsl-snapshots/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,5 @@ pub struct ConfigItem {
/// See also
/// <https://learn.microsoft.com/en-us/windows/win32/direct3dtools/dx-graphics-tools-fxc-using>.
pub target_profile: String,
pub debug_printf: bool,
}
4 changes: 3 additions & 1 deletion naga/tests/snapshots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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(),
Expand Down
39 changes: 24 additions & 15 deletions naga/xtask/src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,21 +311,29 @@ fn validate_hlsl_with_dxc(
config_item: hlsl_snapshots::ConfigItem,
dxc: &str,
) -> anyhow::Result<()> {
// Reference:
// <https://github.com/microsoft/DirectXShaderCompiler/blob/6ee4074a4b43fa23bf5ad27e4f6cafc6b835e437/tools/clang/docs/UsingDxc.rst>.
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:
// <https://github.com/microsoft/DirectXShaderCompiler/blob/6ee4074a4b43fa23bf5ad27e4f6cafc6b835e437/tools/clang/docs/UsingDxc.rst>.
validate_hlsl(
file,
dxc,
config_item,
&[
"-Wno-parentheses-equality",
"-Zi",
"-Qembed_debug",
"-Od",
"-HV",
"2018",
],
)
}
}

fn validate_hlsl_with_fxc(
Expand Down Expand Up @@ -370,6 +378,7 @@ fn validate_hlsl(
let hlsl_snapshots::ConfigItem {
entry_point,
target_profile,
..
} = config_item;
EasyCommand::new(bin, |cmd| {
cmd.arg(file)
Expand Down

0 comments on commit 9a36c03

Please sign in to comment.