Open danginsburg opened 5 years ago
Seems doable. Some things to be careful about.
One question is how much the structss must be the same, but glslang could accept things just based on matching lists of member types. I supposed this should work recursively though, with member types that are themselves structures.
The other is what assumptions consumers might have about such matches in the AST and whether an explicit cast should appear, just like when calling a float with an int, etc.
The following shader compiles with fxc 9.29.952.3111 (fxc.exe /EMainPs /Tps_5_0 test.frag), but does not compile in glslangValidator.
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.