HLSL: allow "sample" as a valid identifier.

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
This commit is contained in:
steve-lunarg
2016-11-16 13:22:11 -07:00
parent fabe7d6a61
commit 75fd223f03
4 changed files with 135 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
struct MyStruct {
sample float a;
noperspective float b;
linear float c;
centroid float d;
};
int sample(int x) { return x; } // HLSL allows this as an identifier as well.
float4 main() : SV_Target0
{
// HLSL allows this as an identifier as well.
// However, this is not true of other qualifier keywords such as "linear".
int sample = 3;
return float4(0,0,0,0);
}