glslang/Test/hlsl.type.half.frag
steve-lunarg 5ca85ad9de HLSL: allow scalar type keywords as identifiers, and add half type support.
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.
2016-12-27 11:26:45 -07:00

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;
}