From 7c7fbd572874bdbb3e6f965da3abb918013e1ac8 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 11 Mar 2024 14:52:16 -0700 Subject: Add `-fvk-use-dx-position-w` and fix ExecutionMode ordering for geometry shaders. (#3731) * Add `-fvk-use-dx-position-w`. * Fix ordering of OutputVertices and output primitive type decoration in spirv. * Fix. * fix * Fix. * Move test around. --- tests/spirv/geometry-decoration-ordering.slang | 17 +++++++++++++++++ tests/spirv/rcp-w-fragment.slang | 7 +++++++ 2 files changed, 24 insertions(+) create mode 100644 tests/spirv/geometry-decoration-ordering.slang create mode 100644 tests/spirv/rcp-w-fragment.slang (limited to 'tests') diff --git a/tests/spirv/geometry-decoration-ordering.slang b/tests/spirv/geometry-decoration-ordering.slang new file mode 100644 index 000000000..be6eee878 --- /dev/null +++ b/tests/spirv/geometry-decoration-ordering.slang @@ -0,0 +1,17 @@ +//TEST:SIMPLE(filecheck=CHECK):-target spirv -emit-spirv-directly -entry main -stage geometry + +// Make sure InputPoints always appears before OutputVertices and OutputTriangleStrip, +// otherwise, the shader won't work correctly. + +// CHECK: OpExecutionMode {{.*}} InputPoints +// CHECK: OpExecutionMode {{.*}} OutputVertices 4 +// CHECK: OpExecutionMode {{.*}} OutputTriangleStrip + +[maxvertexcount(4)] +void main( point float4 input[1], inout TriangleStream OutputStream ) +{ + OutputStream.Append(float4(0)); + OutputStream.Append(float4(1)); + OutputStream.Append(float4(2)); + OutputStream.Append(float4(3)); +} \ No newline at end of file diff --git a/tests/spirv/rcp-w-fragment.slang b/tests/spirv/rcp-w-fragment.slang new file mode 100644 index 000000000..1cd1b8ee8 --- /dev/null +++ b/tests/spirv/rcp-w-fragment.slang @@ -0,0 +1,7 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv -entry main -stage fragment -fvk-use-dx-position-w -emit-spirv-directly + +// CHECK: OpFDiv +float4 main(float4 pos : SV_Position) : SV_Target +{ + return pos; +} \ No newline at end of file -- cgit v1.2.3