diff --git a/tests/in/debug-printf.ron b/tests/in/debug-printf.ron new file mode 100644 index 0000000000..72873dd667 --- /dev/null +++ b/tests/in/debug-printf.ron @@ -0,0 +1,2 @@ +( +) diff --git a/tests/in/debug-printf.wgsl b/tests/in/debug-printf.wgsl new file mode 100644 index 0000000000..1adcf9aa64 --- /dev/null +++ b/tests/in/debug-printf.wgsl @@ -0,0 +1,4 @@ +@compute @workgroup_size(1) +fn main() { + debugPrintf("%d", 42); +} diff --git a/tests/in/spv/debug-printf.spv b/tests/in/spv/debug-printf.spv new file mode 100644 index 0000000000..96ca19fdcd Binary files /dev/null and b/tests/in/spv/debug-printf.spv differ diff --git a/tests/in/spv/debug-printf.spvasm b/tests/in/spv/debug-printf.spvasm new file mode 100644 index 0000000000..992f133ff8 --- /dev/null +++ b/tests/in/spv/debug-printf.spvasm @@ -0,0 +1,28 @@ +; SPIR-V +; Version: 1.1 +; Generator: rspirv +; Bound: 18 +OpCapability Shader +OpCapability Linkage +OpExtension "SPV_KHR_non_semantic_info" +%1 = OpExtInstImport "GLSL.std.450" +%15 = OpExtInstImport "NonSemantic.DebugPrintf" +OpMemoryModel Logical GLSL450 +%13 = OpString "%d" +%16 = OpString "%v4f" +%2 = OpTypeVoid +%5 = OpTypeFunction %2 +%6 = OpTypeInt 32 1 +%7 = OpConstant %6 42 +%8 = OpTypeFloat 32 +%9 = OpConstant %8 3.3 +%10 = OpTypeVector %8 4 +%11 = OpConstantComposite %10 %9 %9 %9 %9 +%4 = OpFunction %2 None %5 +%3 = OpLabel +OpBranch %12 +%12 = OpLabel +%14 = OpExtInst %2 %15 1 %13 %7 +%17 = OpExtInst %2 %15 1 %16 %11 +OpReturn +OpFunctionEnd \ No newline at end of file diff --git a/tests/out/glsl/debug-printf.main.Compute.glsl b/tests/out/glsl/debug-printf.main.Compute.glsl new file mode 100644 index 0000000000..1630568a6c --- /dev/null +++ b/tests/out/glsl/debug-printf.main.Compute.glsl @@ -0,0 +1,15 @@ +#version 310 es +#extension GL_EXT_debug_printf : enable + +precision highp float; +precision highp int; + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + + +void main() { + debugPrintfEXT("%d",42); + debugPrintfEXT("%v4f",vec4(3.3)); + return; +} + diff --git a/tests/out/hlsl/debug-printf.hlsl b/tests/out/hlsl/debug-printf.hlsl new file mode 100644 index 0000000000..52aa7555dc --- /dev/null +++ b/tests/out/hlsl/debug-printf.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void main() +{ + printf("%d",42); + printf("%v4f",(3.3).xxxx); + return; +} diff --git a/tests/out/hlsl/debug-printf.ron b/tests/out/hlsl/debug-printf.ron new file mode 100644 index 0000000000..a07b03300b --- /dev/null +++ b/tests/out/hlsl/debug-printf.ron @@ -0,0 +1,12 @@ +( + vertex:[ + ], + fragment:[ + ], + compute:[ + ( + entry_point:"main", + target_profile:"cs_5_1", + ), + ], +) diff --git a/tests/out/spv/debug-printf.spvasm b/tests/out/spv/debug-printf.spvasm new file mode 100644 index 0000000000..52ab9d8121 --- /dev/null +++ b/tests/out/spv/debug-printf.spvasm @@ -0,0 +1,29 @@ +; SPIR-V +; Version: 1.1 +; Generator: rspirv +; Bound: 18 +OpCapability Shader +OpExtension "SPV_KHR_non_semantic_info" +%1 = OpExtInstImport "GLSL.std.450" +%15 = OpExtInstImport "NonSemantic.DebugPrintf" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %4 "main" +OpExecutionMode %4 LocalSize 1 1 1 +%13 = OpString "%d" +%16 = OpString "%v4f" +%2 = OpTypeVoid +%5 = OpTypeFunction %2 +%6 = OpTypeInt 32 1 +%7 = OpConstant %6 42 +%8 = OpTypeFloat 32 +%9 = OpConstant %8 3.3 +%10 = OpTypeVector %8 4 +%11 = OpConstantComposite %10 %9 %9 %9 %9 +%4 = OpFunction %2 None %5 +%3 = OpLabel +OpBranch %12 +%12 = OpLabel +%14 = OpExtInst %2 %15 1 %13 %7 +%17 = OpExtInst %2 %15 1 %16 %11 +OpReturn +OpFunctionEnd \ No newline at end of file diff --git a/tests/out/wgsl/debug-printf.wgsl b/tests/out/wgsl/debug-printf.wgsl new file mode 100644 index 0000000000..3bb0ce9390 --- /dev/null +++ b/tests/out/wgsl/debug-printf.wgsl @@ -0,0 +1,6 @@ +@compute @workgroup_size(1, 1, 1) +fn main() { + debugPrintf("%d",42); + debugPrintf("%v4f",vec4(3.3)); + return; +} diff --git a/tests/snapshots.rs b/tests/snapshots.rs index 2bc7f45444..164ff67338 100644 --- a/tests/snapshots.rs +++ b/tests/snapshots.rs @@ -781,6 +781,10 @@ fn convert_wgsl() { "const-exprs", Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, ), + ( + "debug-printf", + Targets::WGSL | Targets::GLSL | Targets::SPIRV | Targets::HLSL, + ), ]; for &(name, targets) in inputs.iter() { @@ -855,6 +859,11 @@ fn convert_spv_all() { true, Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, ); + convert_spv( + "debug-printf", + false, + Targets::GLSL | Targets::HLSL | Targets::WGSL, + ); } #[cfg(feature = "glsl-in")]