summaryrefslogtreecommitdiffstats
path: root/tests/spirv
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-03-11 14:52:16 -0700
committerGitHub <noreply@github.com>2024-03-11 14:52:16 -0700
commit7c7fbd572874bdbb3e6f965da3abb918013e1ac8 (patch)
tree47b09522ec72b4ab651127d67e7ebc6020bac376 /tests/spirv
parent1bbcf25af514a9ae24f7006747177f2d1b3b7c0d (diff)
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.
Diffstat (limited to 'tests/spirv')
-rw-r--r--tests/spirv/geometry-decoration-ordering.slang17
-rw-r--r--tests/spirv/rcp-w-fragment.slang7
2 files changed, 24 insertions, 0 deletions
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<float4> 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