mirror of
https://github.com/RPCS3/glslang.git
synced 2024-11-28 05:30:33 +00:00
5ca85ad9de
HLSL allows type keywords to also be identifiers, so a sequence such as "float half = 3" is valid, or more bizzarely, something like "float.float = int.uint + bool;" There are places this is not supported. E.g, it's permitted for struct members, but not struct names or functions. Also, vector or matrix types such as "float3" are not permitted as identifiers. This PR adds that support, as well as support for the "half" type. In production shaders, this was seen with variables named "half". The PR attempts to support this without breaking useful grammar errors such as "; expected" at the end of unterminated statements, so it errs on that side at the possible expense of failing to accept valid constructs containing a type keyword identifier. If others are discovered, they can be added. Also, half is now accepted as a valid type, alongside the min*float types.
12 lines
139 B
GLSL
12 lines
139 B
GLSL
|
|
float4 main() : SV_Target0
|
|
{
|
|
half h0 = 0;
|
|
half1 h1 = 1;
|
|
half2 h2 = 2;
|
|
half3 h3 = 3;
|
|
half4 h4 = 4;
|
|
|
|
return 0.0;
|
|
}
|