Commit Graph

3 Commits

Author SHA1 Message Date
John Kessenich
0320d090e2 HLSL: Recognize types declared as identifiers as identifiers.
E.g., in

    float float;
    (float) * float;

The "(float)" is not a type cast, it is an expression.
2017-06-13 22:22:52 -06:00
John Kessenich
96f65521b4 HLSL: Implement half matrices, and map all half* -> float*. 2017-06-06 23:35:25 -06:00
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