Open BenoitAmbry opened 11 months ago
The hlsl parser fails to parse type names when they are prefixed by a namespace, for example Test::TestS ts; will fail, but TestS ts;will parse (improperly).
Test::TestS ts;
TestS ts;
The following code reproduces the issue with the command line:
/usr/local/bin/glslc -x hlsl -fentry-point=pixelShader -fshader-stage=fragment --target-env=vulkan1.2 -o x.spirv ./example.hlsl
struct v2p { float4 p : SV_POSITION; float2 uv : TEXCOORD0; float4 c : TEXCOORD1; }; namespace Test { struct TestS { float4 t; float4 v; }; float4 testF(TestS ts) { return ts.t * ts.v; } } sampler2D MyTexture; float4 pixelShader(v2p i) : SV_TARGET { Test::TestS ts; // FAILS HERE, /*Test::*/TestS ts; works, but should fail. ts.v = i.c; ts.t = tex2D(MyTexture, i.uv); return Test::testF(ts); }
Note: glslc version tested:
/usr/local/bin/glslc --version shaderc v2023.6 v2023.6 spirv-tools v2023.4 v2022.4-296-ge553b884 glslang 11.1.0-763-g76b52ebf Target: SPIR-V 1.0
The hlsl parser fails to parse type names when they are prefixed by a namespace, for example
Test::TestS ts;
will fail, butTestS ts;
will parse (improperly).The following code reproduces the issue with the command line:
Note: glslc version tested: