DirectXShaderCompiler
DirectXShaderCompiler copied to clipboard
Component swizzling / vector indexing not considered a constant expression
This issue manifests when trying to define arrays where the length is a component of a constant variable or expression, which fails to compile with the error "variable length arrays are not supported in HLSL". For a minimal example int array[10]
works but int array[(10).x]
doesn't. This makes it impossible to use components of constant vectors as array lengths. See http://shader-playground.timjones.io/442b05c88862a2aff43e01ce4c15a811
This works in FXC and is causing us issues when porting shaders to DXC. Thanks in advance for resolving this.