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/out/hlsl/access.ron b/naga/tests/out/hlsl/access.ron index 73c9e44448..192821730c 100644 --- a/naga/tests/out/hlsl/access.ron +++ b/naga/tests/out/hlsl/access.ron @@ -3,18 +3,21 @@ ( entry_point:"foo_vert", target_profile:"vs_5_1", + debug_printf:false, ), ], fragment:[ ( entry_point:"foo_frag", target_profile:"ps_5_1", + debug_printf:false, ), ], compute:[ ( entry_point:"assign_through_ptr", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/array-in-ctor.ron b/naga/tests/out/hlsl/array-in-ctor.ron index 5c261e59b2..5d12c87175 100644 --- a/naga/tests/out/hlsl/array-in-ctor.ron +++ b/naga/tests/out/hlsl/array-in-ctor.ron @@ -7,6 +7,7 @@ ( entry_point:"cs_main", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/atomicOps.ron b/naga/tests/out/hlsl/atomicOps.ron index 5c261e59b2..5d12c87175 100644 --- a/naga/tests/out/hlsl/atomicOps.ron +++ b/naga/tests/out/hlsl/atomicOps.ron @@ -7,6 +7,7 @@ ( entry_point:"cs_main", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/binding-arrays.ron b/naga/tests/out/hlsl/binding-arrays.ron index 341a4c528e..af020fcb28 100644 --- a/naga/tests/out/hlsl/binding-arrays.ron +++ b/naga/tests/out/hlsl/binding-arrays.ron @@ -5,6 +5,7 @@ ( entry_point:"main", target_profile:"ps_5_1", + debug_printf:false, ), ], compute:[ diff --git a/naga/tests/out/hlsl/bitcast.ron b/naga/tests/out/hlsl/bitcast.ron index a07b03300b..a3f6571767 100644 --- a/naga/tests/out/hlsl/bitcast.ron +++ b/naga/tests/out/hlsl/bitcast.ron @@ -7,6 +7,7 @@ ( entry_point:"main", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/bits.ron b/naga/tests/out/hlsl/bits.ron index a07b03300b..a3f6571767 100644 --- a/naga/tests/out/hlsl/bits.ron +++ b/naga/tests/out/hlsl/bits.ron @@ -7,6 +7,7 @@ ( entry_point:"main", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/boids.ron b/naga/tests/out/hlsl/boids.ron index a07b03300b..a3f6571767 100644 --- a/naga/tests/out/hlsl/boids.ron +++ b/naga/tests/out/hlsl/boids.ron @@ -7,6 +7,7 @@ ( entry_point:"main", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/break-if.ron b/naga/tests/out/hlsl/break-if.ron index a07b03300b..a3f6571767 100644 --- a/naga/tests/out/hlsl/break-if.ron +++ b/naga/tests/out/hlsl/break-if.ron @@ -7,6 +7,7 @@ ( entry_point:"main", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/collatz.ron b/naga/tests/out/hlsl/collatz.ron index a07b03300b..a3f6571767 100644 --- a/naga/tests/out/hlsl/collatz.ron +++ b/naga/tests/out/hlsl/collatz.ron @@ -7,6 +7,7 @@ ( entry_point:"main", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/const-exprs.ron b/naga/tests/out/hlsl/const-exprs.ron index a07b03300b..a3f6571767 100644 --- a/naga/tests/out/hlsl/const-exprs.ron +++ b/naga/tests/out/hlsl/const-exprs.ron @@ -7,6 +7,7 @@ ( entry_point:"main", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/constructors.ron b/naga/tests/out/hlsl/constructors.ron index a07b03300b..a3f6571767 100644 --- a/naga/tests/out/hlsl/constructors.ron +++ b/naga/tests/out/hlsl/constructors.ron @@ -7,6 +7,7 @@ ( entry_point:"main", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/control-flow.ron b/naga/tests/out/hlsl/control-flow.ron index a07b03300b..a3f6571767 100644 --- a/naga/tests/out/hlsl/control-flow.ron +++ b/naga/tests/out/hlsl/control-flow.ron @@ -7,6 +7,7 @@ ( entry_point:"main", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/debug-printf-s.hlsl b/naga/tests/out/hlsl/debug-printf-s.hlsl index 638bbf0d9a..a7ee013445 100644 --- a/naga/tests/out/hlsl/debug-printf-s.hlsl +++ b/naga/tests/out/hlsl/debug-printf-s.hlsl @@ -1,6 +1,5 @@ void main_1() { - printf("%d",42); return; } diff --git a/naga/tests/out/hlsl/debug-printf-s.ron b/naga/tests/out/hlsl/debug-printf-s.ron index a07b03300b..a3f6571767 100644 --- a/naga/tests/out/hlsl/debug-printf-s.ron +++ b/naga/tests/out/hlsl/debug-printf-s.ron @@ -7,6 +7,7 @@ ( entry_point:"main", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/debug-printf.hlsl b/naga/tests/out/hlsl/debug-printf.hlsl new file mode 100644 index 0000000000..e79d36b9c8 --- /dev/null +++ b/naga/tests/out/hlsl/debug-printf.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void main() +{ + return; +} diff --git a/naga/tests/out/hlsl/debug-printf.ron b/naga/tests/out/hlsl/debug-printf.ron new file mode 100644 index 0000000000..a3f6571767 --- /dev/null +++ b/naga/tests/out/hlsl/debug-printf.ron @@ -0,0 +1,13 @@ +( + vertex:[ + ], + fragment:[ + ], + compute:[ + ( + entry_point:"main", + target_profile:"cs_5_1", + debug_printf:false, + ), + ], +) diff --git a/naga/tests/out/hlsl/do-while.ron b/naga/tests/out/hlsl/do-while.ron index 341a4c528e..af020fcb28 100644 --- a/naga/tests/out/hlsl/do-while.ron +++ b/naga/tests/out/hlsl/do-while.ron @@ -5,6 +5,7 @@ ( entry_point:"main", target_profile:"ps_5_1", + debug_printf:false, ), ], compute:[ diff --git a/naga/tests/out/hlsl/dualsource.ron b/naga/tests/out/hlsl/dualsource.ron index 341a4c528e..af020fcb28 100644 --- a/naga/tests/out/hlsl/dualsource.ron +++ b/naga/tests/out/hlsl/dualsource.ron @@ -5,6 +5,7 @@ ( entry_point:"main", target_profile:"ps_5_1", + debug_printf:false, ), ], compute:[ diff --git a/naga/tests/out/hlsl/empty-global-name.ron b/naga/tests/out/hlsl/empty-global-name.ron index a07b03300b..a3f6571767 100644 --- a/naga/tests/out/hlsl/empty-global-name.ron +++ b/naga/tests/out/hlsl/empty-global-name.ron @@ -7,6 +7,7 @@ ( entry_point:"main", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/empty.ron b/naga/tests/out/hlsl/empty.ron index a07b03300b..a3f6571767 100644 --- a/naga/tests/out/hlsl/empty.ron +++ b/naga/tests/out/hlsl/empty.ron @@ -7,6 +7,7 @@ ( entry_point:"main", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/f64.ron b/naga/tests/out/hlsl/f64.ron index a07b03300b..a3f6571767 100644 --- a/naga/tests/out/hlsl/f64.ron +++ b/naga/tests/out/hlsl/f64.ron @@ -7,6 +7,7 @@ ( entry_point:"main", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/fragment-output.ron b/naga/tests/out/hlsl/fragment-output.ron index 9dfaf7393b..e894433476 100644 --- a/naga/tests/out/hlsl/fragment-output.ron +++ b/naga/tests/out/hlsl/fragment-output.ron @@ -5,10 +5,12 @@ ( entry_point:"main_vec4vec3_", target_profile:"ps_5_1", + debug_printf:false, ), ( entry_point:"main_vec2scalar", target_profile:"ps_5_1", + debug_printf:false, ), ], compute:[ diff --git a/naga/tests/out/hlsl/functions.ron b/naga/tests/out/hlsl/functions.ron index a07b03300b..a3f6571767 100644 --- a/naga/tests/out/hlsl/functions.ron +++ b/naga/tests/out/hlsl/functions.ron @@ -7,6 +7,7 @@ ( entry_point:"main", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/globals.ron b/naga/tests/out/hlsl/globals.ron index a07b03300b..a3f6571767 100644 --- a/naga/tests/out/hlsl/globals.ron +++ b/naga/tests/out/hlsl/globals.ron @@ -7,6 +7,7 @@ ( entry_point:"main", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/hlsl-keyword.ron b/naga/tests/out/hlsl/hlsl-keyword.ron index eac1b945d2..a21e73bcf7 100644 --- a/naga/tests/out/hlsl/hlsl-keyword.ron +++ b/naga/tests/out/hlsl/hlsl-keyword.ron @@ -5,6 +5,7 @@ ( entry_point:"fs_main", target_profile:"ps_5_1", + debug_printf:false, ), ], compute:[ diff --git a/naga/tests/out/hlsl/image.ron b/naga/tests/out/hlsl/image.ron index f5ca4931d4..5eedb86818 100644 --- a/naga/tests/out/hlsl/image.ron +++ b/naga/tests/out/hlsl/image.ron @@ -3,38 +3,46 @@ ( entry_point:"queries", target_profile:"vs_5_1", + debug_printf:false, ), ( entry_point:"levels_queries", target_profile:"vs_5_1", + debug_printf:false, ), ], fragment:[ ( entry_point:"texture_sample", target_profile:"ps_5_1", + debug_printf:false, ), ( entry_point:"texture_sample_comparison", target_profile:"ps_5_1", + debug_printf:false, ), ( entry_point:"gather", target_profile:"ps_5_1", + debug_printf:false, ), ( entry_point:"depth_no_comparison", target_profile:"ps_5_1", + debug_printf:false, ), ], compute:[ ( entry_point:"main", target_profile:"cs_5_1", + debug_printf:false, ), ( entry_point:"depth_load", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/interface.ron b/naga/tests/out/hlsl/interface.ron index 948962b991..3fbe892516 100644 --- a/naga/tests/out/hlsl/interface.ron +++ b/naga/tests/out/hlsl/interface.ron @@ -3,22 +3,26 @@ ( entry_point:"vertex", target_profile:"vs_5_1", + debug_printf:false, ), ( entry_point:"vertex_two_structs", target_profile:"vs_5_1", + debug_printf:false, ), ], fragment:[ ( entry_point:"fragment", target_profile:"ps_5_1", + debug_printf:false, ), ], compute:[ ( entry_point:"compute", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/interpolate.ron b/naga/tests/out/hlsl/interpolate.ron index d0046b04dd..88bc23f276 100644 --- a/naga/tests/out/hlsl/interpolate.ron +++ b/naga/tests/out/hlsl/interpolate.ron @@ -3,12 +3,14 @@ ( entry_point:"vert_main", target_profile:"vs_5_1", + debug_printf:false, ), ], fragment:[ ( entry_point:"frag_main", target_profile:"ps_5_1", + debug_printf:false, ), ], compute:[ diff --git a/naga/tests/out/hlsl/inv-hyperbolic-trig-functions.ron b/naga/tests/out/hlsl/inv-hyperbolic-trig-functions.ron index 341a4c528e..af020fcb28 100644 --- a/naga/tests/out/hlsl/inv-hyperbolic-trig-functions.ron +++ b/naga/tests/out/hlsl/inv-hyperbolic-trig-functions.ron @@ -5,6 +5,7 @@ ( entry_point:"main", target_profile:"ps_5_1", + debug_printf:false, ), ], compute:[ diff --git a/naga/tests/out/hlsl/math-functions.ron b/naga/tests/out/hlsl/math-functions.ron index 341a4c528e..af020fcb28 100644 --- a/naga/tests/out/hlsl/math-functions.ron +++ b/naga/tests/out/hlsl/math-functions.ron @@ -5,6 +5,7 @@ ( entry_point:"main", target_profile:"ps_5_1", + debug_printf:false, ), ], compute:[ diff --git a/naga/tests/out/hlsl/operators.ron b/naga/tests/out/hlsl/operators.ron index a07b03300b..a3f6571767 100644 --- a/naga/tests/out/hlsl/operators.ron +++ b/naga/tests/out/hlsl/operators.ron @@ -7,6 +7,7 @@ ( entry_point:"main", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/padding.ron b/naga/tests/out/hlsl/padding.ron index 46dfdd83e3..0c164d4243 100644 --- a/naga/tests/out/hlsl/padding.ron +++ b/naga/tests/out/hlsl/padding.ron @@ -3,6 +3,7 @@ ( entry_point:"vertex", target_profile:"vs_5_1", + debug_printf:false, ), ], fragment:[ diff --git a/naga/tests/out/hlsl/push-constants.ron b/naga/tests/out/hlsl/push-constants.ron index e444486559..90d92ee5b2 100644 --- a/naga/tests/out/hlsl/push-constants.ron +++ b/naga/tests/out/hlsl/push-constants.ron @@ -3,12 +3,14 @@ ( entry_point:"vert_main", target_profile:"vs_5_1", + debug_printf:false, ), ], fragment:[ ( entry_point:"main", target_profile:"ps_5_1", + debug_printf:false, ), ], compute:[ diff --git a/naga/tests/out/hlsl/quad-vert.ron b/naga/tests/out/hlsl/quad-vert.ron index 8240856a5c..3142b9b2f7 100644 --- a/naga/tests/out/hlsl/quad-vert.ron +++ b/naga/tests/out/hlsl/quad-vert.ron @@ -3,6 +3,7 @@ ( entry_point:"main", target_profile:"vs_5_1", + debug_printf:false, ), ], fragment:[ diff --git a/naga/tests/out/hlsl/quad.ron b/naga/tests/out/hlsl/quad.ron index de90552356..3c7e251a95 100644 --- a/naga/tests/out/hlsl/quad.ron +++ b/naga/tests/out/hlsl/quad.ron @@ -3,16 +3,19 @@ ( entry_point:"vert_main", target_profile:"vs_5_1", + debug_printf:false, ), ], fragment:[ ( entry_point:"frag_main", target_profile:"ps_5_1", + debug_printf:false, ), ( entry_point:"fs_extra", target_profile:"ps_5_1", + debug_printf:false, ), ], compute:[ diff --git a/naga/tests/out/hlsl/shadow.ron b/naga/tests/out/hlsl/shadow.ron index 69be5b25e0..3b25fe1aaa 100644 --- a/naga/tests/out/hlsl/shadow.ron +++ b/naga/tests/out/hlsl/shadow.ron @@ -3,16 +3,19 @@ ( entry_point:"vs_main", target_profile:"vs_5_1", + debug_printf:false, ), ], fragment:[ ( entry_point:"fs_main", target_profile:"ps_5_1", + debug_printf:false, ), ( entry_point:"fs_main_without_storage", target_profile:"ps_5_1", + debug_printf:false, ), ], compute:[ diff --git a/naga/tests/out/hlsl/skybox.ron b/naga/tests/out/hlsl/skybox.ron index 27b0c4af4d..2f126ce7c1 100644 --- a/naga/tests/out/hlsl/skybox.ron +++ b/naga/tests/out/hlsl/skybox.ron @@ -3,12 +3,14 @@ ( entry_point:"vs_main", target_profile:"vs_5_1", + debug_printf:false, ), ], fragment:[ ( entry_point:"fs_main", target_profile:"ps_5_1", + debug_printf:false, ), ], compute:[ diff --git a/naga/tests/out/hlsl/standard.ron b/naga/tests/out/hlsl/standard.ron index 82373299d8..b2a703049b 100644 --- a/naga/tests/out/hlsl/standard.ron +++ b/naga/tests/out/hlsl/standard.ron @@ -5,6 +5,7 @@ ( entry_point:"derivatives", target_profile:"ps_5_1", + debug_printf:false, ), ], compute:[ diff --git a/naga/tests/out/hlsl/struct-layout.ron b/naga/tests/out/hlsl/struct-layout.ron index 04fe25e38a..16469b2de6 100644 --- a/naga/tests/out/hlsl/struct-layout.ron +++ b/naga/tests/out/hlsl/struct-layout.ron @@ -3,30 +3,36 @@ ( entry_point:"no_padding_vert", target_profile:"vs_5_1", + debug_printf:false, ), ( entry_point:"needs_padding_vert", target_profile:"vs_5_1", + debug_printf:false, ), ], fragment:[ ( entry_point:"no_padding_frag", target_profile:"ps_5_1", + debug_printf:false, ), ( entry_point:"needs_padding_frag", target_profile:"ps_5_1", + debug_printf:false, ), ], compute:[ ( entry_point:"no_padding_comp", target_profile:"cs_5_1", + debug_printf:false, ), ( entry_point:"needs_padding_comp", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/texture-arg.ron b/naga/tests/out/hlsl/texture-arg.ron index 341a4c528e..af020fcb28 100644 --- a/naga/tests/out/hlsl/texture-arg.ron +++ b/naga/tests/out/hlsl/texture-arg.ron @@ -5,6 +5,7 @@ ( entry_point:"main", target_profile:"ps_5_1", + debug_printf:false, ), ], compute:[ diff --git a/naga/tests/out/hlsl/workgroup-uniform-load.ron b/naga/tests/out/hlsl/workgroup-uniform-load.ron index 17e926cdeb..4956d5bda8 100644 --- a/naga/tests/out/hlsl/workgroup-uniform-load.ron +++ b/naga/tests/out/hlsl/workgroup-uniform-load.ron @@ -7,6 +7,7 @@ ( entry_point:"test_workgroupUniformLoad", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/out/hlsl/workgroup-var-init.ron b/naga/tests/out/hlsl/workgroup-var-init.ron index a07b03300b..a3f6571767 100644 --- a/naga/tests/out/hlsl/workgroup-var-init.ron +++ b/naga/tests/out/hlsl/workgroup-var-init.ron @@ -7,6 +7,7 @@ ( entry_point:"main", target_profile:"cs_5_1", + debug_printf:false, ), ], ) diff --git a/naga/tests/snapshots.rs b/naga/tests/snapshots.rs index ac122a3a6c..311c204e43 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(), @@ -816,7 +818,7 @@ fn convert_wgsl() { ), ( "debug-printf", - Targets::WGSL | Targets::GLSL | Targets::SPIRV, + Targets::WGSL | Targets::GLSL | Targets::SPIRV | Targets::HLSL, ), ]; @@ -897,7 +899,11 @@ fn convert_spv_all() { true, Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, ); - convert_spv("debug-printf-s", false, Targets::GLSL | Targets::WGSL); + convert_spv( + "debug-printf-s", + false, + Targets::GLSL | Targets::WGSL | Targets::HLSL, + ); } #[cfg(feature = "glsl-in")] 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)