summaryrefslogtreecommitdiff
path: root/tests/spirv/geometry-shader.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-09-26 23:56:06 -0700
committerGitHub <noreply@github.com>2023-09-27 14:56:06 +0800
commitebe8ddefc48478307d5f206cd3e40c41d28a36e3 (patch)
tree8e13977979909a26394eea532d8b95cd5ad0f6d1 /tests/spirv/geometry-shader.slang
parentc5c8cfbb360d9a763f549df48636effde839eacd (diff)
Various SPIRV fixes. (#3231)
* Various SPIRV fixes. - Geometry shader support (WIP). - Fix texture get dimension and load. - Fold global GetElement(MakeArray/MakeVector) insts. - Call spvopt to inline all functions. - Translate OpImageSubscript. - Emit struct member names and global variable names. - Fix lowering of OpBitNot -> OpNot, instead of OpBitReverse. * Fix test. * Fix geometry shader. * Fix geometry shader emit. * Add atomic Image access test. * Fix tests. * don't fail if spirv-opt fails. * Update comments. * Fix test. * Cleanups. * indentation --------- Co-authored-by: Yong He <yhe@nvidia.com> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
Diffstat (limited to 'tests/spirv/geometry-shader.slang')
-rw-r--r--tests/spirv/geometry-shader.slang39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/spirv/geometry-shader.slang b/tests/spirv/geometry-shader.slang
new file mode 100644
index 000000000..08080ae59
--- /dev/null
+++ b/tests/spirv/geometry-shader.slang
@@ -0,0 +1,39 @@
+//TEST:SIMPLE(filecheck=CHECK):-entry gsMain -stage geometry -target spirv -emit-spirv-directly
+
+struct GsOut
+{
+ float2 uv : TexCoord;
+ float2 texelPos : TexelPosition;
+ float4 posH : SV_Position;
+};
+
+// CHECK-DAG: OpEntryPoint Geometry %gsMain "main" %[[OUT1:[A-Za-z0-9_]+]] %[[OUT2:[A-Za-z0-9_]+]] %gl_Position
+// CHECK-DAG: %[[OUT1]] = OpVariable %_ptr_Output_v2float Output
+// CHECK-DAG: %[[OUT2]] = OpVariable %_ptr_Output_v2float Output
+// CHECK-DAG: %gl_Position = OpVariable %_ptr_Output_v4float Output
+
+// CHECK-DAG: OpExecutionMode %gsMain Invocations 1
+// CHECK-DAG: OpExecutionMode %gsMain OutputTriangleStrip
+// CHECK-DAG: OpExecutionMode %gsMain Triangles
+// CHECK-DAG: OpExecutionMode %gsMain OutputVertices 15
+
+// CHECK: OpStore %gl_Position
+// CHECK: OpEmitVertex
+// CHECK: OpEndPrimitive
+
+[maxvertexcount(15)]
+void gsMain(uint triIdx : SV_PrimitiveID, inout TriangleStream<GsOut> outStream)
+{
+ for (int j = 0; j < 5; j++)
+ {
+ for (int i = 0; i < 3; i++)
+ {
+ GsOut v;
+ v.uv = float2(j,i);
+ v.texelPos = float2(0,0);
+ v.posH = float4(j, i, 1, 1);
+ outStream.Append(v);
+ }
+ outStream.RestartStrip();
+ }
+} \ No newline at end of file