Repository: shader-slang/slang (2026-02-10T21:40:39Z)

Issue:
Enum variables missing debug info
# Issue Description
6f6103c4dbc77d5bceae7c8e766ec3cabc293364 caused a regression with Enum type variables no longer showing any debug information, like SPIR-V DebugLocalVariable or DebugDeclare instructions.

# Reproducer Code
example.slang:
```
enum MyEnum {
    VALUE_A,
    VALUE_B,
    VALUE_C
};

RWStructuredBuffer<MyEnum> out;

[shader("compute")]
void main()
{
    MyEnum e = MyEnum.VALUE_A;
    out[0] = e;
}
```
`slangc.exe -target spirv-asm -g2 -O0 example.slang`

# Expected vs Actual Behavior
Expected DebugLocalVariable and DebugDeclare instructions:
```
; Types, variables and constants
...
%e = OpExtInst %void %2 DebugLocalVariable %38 %32 %4 %uint_20 %uint_12 %19 %uint_0
...
; Function main
...
%41 = OpExtInst %void %2 DebugDeclare %e %16 %40
```

Generated spirv-asm does not contain those instructions

# Environment
 - Slang v2026.2



Discussion:

Patch:
diff --git a/source/slang/slang-ir-insert-debug-value-store.cpp b/source/slang/slang-ir-insert-debug-value-store.cpp
index aeeb744ef5b..1fa27f76e63 100644
--- a/source/slang/slang-ir-insert-debug-value-store.cpp
+++ b/source/slang/slang-ir-insert-debug-value-store.cpp
@@ -88,6 +88,12 @@ bool DebugValueStoreContext::isDebuggableType(IRType* type)
             debuggable = false; // specTypeDebuggable;
             break;
         }
+    case kIROp_EnumType:
+        {
+            auto enumType = as<IREnumType>(type);
+            debuggable = isDebuggableType(enumType->getTagType());
+            break;
+        }
     default:
         if (as<IRBasicType>(type))
             debuggable = true;


Test patch:
diff --git a/tests/spirv/debug-info-enum.slang b/tests/spirv/debug-info-enum.slang
new file mode 100644
index 00000000000..ae442e175b0
--- /dev/null
+++ b/tests/spirv/debug-info-enum.slang
@@ -0,0 +1,22 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv -g2 -O0
+// Tests generation of DebugLocalVariable and DebugDeclare for enum variables
+
+//CHECK: [[E_STR:%[0-9]+]] = OpString "e"
+//CHECK: [[E_VAR:%[A-Za-z0-9_]+]] = OpExtInst {{.*}} DebugLocalVariable [[E_STR]]
+//CHECK: OpExtInst {{.*}} DebugDeclare [[E_VAR]]
+
+enum MyEnum {
+    VALUE_A,
+    VALUE_B,
+    VALUE_C
+};
+
+RWStructuredBuffer<MyEnum> out;
+
+[shader("compute")]
+[numthreads(1, 1, 1)]
+void main()
+{
+    MyEnum e = MyEnum.VALUE_A;
+    out[0] = e;
+}