summaryrefslogtreecommitdiff
path: root/tests/bugs/enum-different-types.slang
diff options
context:
space:
mode:
authorCopilot <198982749+Copilot@users.noreply.github.com>2025-07-24 22:05:51 -0700
committerGitHub <noreply@github.com>2025-07-25 05:05:51 +0000
commit528ca0d0e55df88a9a97ba071ae803a62a34ae5a (patch)
tree597d24c88a2afcd28ea233f19a4c2e09085b5ea0 /tests/bugs/enum-different-types.slang
parentfa946c659bd5ad577f30cf4565e13f9dcfc6937a (diff)
Fix compiler crash when enum is used as vertex output data (#7915)
* Initial plan * Initial investigation and plan for enum vertex output fix Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Fix compiler crash when enum is used as vertex output data Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Fix compiler crash when enum is used as vertex output data Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Address reviewer feedback: use SLANG_ASSERT and improve CHECK directives Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
Diffstat (limited to 'tests/bugs/enum-different-types.slang')
-rw-r--r--tests/bugs/enum-different-types.slang39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/bugs/enum-different-types.slang b/tests/bugs/enum-different-types.slang
new file mode 100644
index 000000000..93deffdd8
--- /dev/null
+++ b/tests/bugs/enum-different-types.slang
@@ -0,0 +1,39 @@
+//TEST:SIMPLE(filecheck=CHECK):-target hlsl -stage vertex -entry main
+
+// Test enum without explicit tag type (should default to int)
+public enum SimpleEnum {
+ value1,
+ value2,
+ value3
+}
+
+// Test enum with different tag types
+public enum ByteEnum : uint8_t {
+ a, b, c
+}
+
+public enum IntEnum : int {
+ x = -1, y = 0, z = 1
+}
+
+struct VertexInput {
+ float3 position : POSITION_ATTR;
+};
+
+public struct VertexOutput {
+ float4 position : SV_Position;
+ SimpleEnum simple : TEXCOORD0;
+ IntEnum intVal : TEXCOORD1;
+}
+
+[shader("vertex")]
+VertexOutput main(in VertexInput input) {
+ VertexOutput output;
+ output.position = float4(0);
+ output.simple = SimpleEnum.value1;
+ output.intVal = IntEnum.x;
+ return output;
+}
+
+//CHECK: simple_0 : TEXCOORD0
+//CHECK: intVal_0 : TEXCOORD1 \ No newline at end of file