KhronosGroup / KhronosGroup/glslang
HLSL: function matching for two structs with same members works in fxc but not glslang
- Dominant language
- C++
- Stars
- 3.6k
- Forks
- 989
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 31
Description
The following shader compiles with fxc 9.29.952.3111 (fxc.exe /EMainPs /Tps_5_0 test.frag), but does not compile in glslangValidator.
```
struct PS_INPUT_TEST1
{
float3 vPositionWs : TEXCOORD0;
float3 vFootPos : TEXCOORD1;
};
struct PS_INPUT_TEST2
{
float3 vPositionWs : TEXCOORD0;
float3 vFootPos : TEXCOORD1;
};
float4 TestFunc( PS_INPUT_TEST2 i, int2 vOffset, int nValue )
{
return float4( i.vPositionWs , 1.0 );
}
float4 MainPs( PS_INPUT_TEST1 i ) : SV_Target0
{
return TestFunc( i, int2( 0, 0), 0 ) ;
}
```
With glslangValidator.exe -D -V -e MainPs test.frag I get the following errors:
ERROR: test.frag:18: 'TestFunc' : no matching overloaded function found
test.frag(18): error at column 39, HLSL parsing failed.
ERROR: 2 compilation errors. No code generated.
Apparently fxc is allowing casting between two structs with the same member variables.
Contributor guide
Research direction
Reproduce the reported case from test.frag with fxc and glslangValidator.exe using the command shown. Start at the HLSL function-call and overload-matching path, then verify that equivalent struct arguments are handled consistently and that the sample compiles without the reported error.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100