shader-slang / slang

Making it easier to work with shaders
MIT License
1.78k stars 159 forks source link

Enum can't reference previous definition #2893

Open jsmall-zzz opened 1 year ago

jsmall-zzz commented 1 year ago

Take...

enum Check { V = 1, X = V + 2 };

In Slang this produces the error

x.slang(3): error 30015: undefined identifier 'V'.
enum Check { V = 1, X = V + 2 };
                        ^
x.slang(3): error 39999: expression does not evaluate to a compile-time constant
enum Check { V = 1, X = V + 2 };

This does work correctly in DXC

natduca commented 7 months ago

This is language quality-of-life, putting Q3 tentatively