Unlike other qualifiers, HLSL allows "sample" to be either a qualifier keyword or an
identifier (e.g, a variable or function name).
A fix to allow this was made a while ago, but that fix was insufficient when 'sample'
was used in an expression. The problem was around the initial ambiguity between:
sample float a; // "sample" is part of a fully specified type
and
sample.xyz; // sample is a keyword in a dot expression
Both start the same. The "sample" was being accepted as a qualifier before enough
further parsing was done to determine we were not a declaration after all. This
consumed the token, causing it to fail for its real purpose.
Now, when accepting a fully specified type, the token is pushed back onto the stack if
the thing is not a fully specified type. This leaves it available for subsequent
purposes.
Changed the "hlsl.identifier.sample.frag" test to exercise this situation, distilled
down from a production shaders.
HLSL has keywords for various interpolation modifiers such as "linear",
"centroid", "sample", etc. Of these, "sample" appears to be special,
as it is also accepted as an identifier string, where the others are not.
This PR adds this ability, so the construct "int sample = 42;" no longer
produces a compilation error.
New test = hlsl.identifier.sample.frag