HLSL: Flesh out misc. declaration grammar: semantics/registers/annotations/precise/etc.

Details within these bear even more fleshing out, but would like to have
that driven by actual need.
This commit is contained in:
John Kessenich
2016-06-12 23:52:12 -06:00
parent e6e7494e2a
commit 630dd7da43
10 changed files with 273 additions and 80 deletions

View File

@@ -1212,6 +1212,38 @@ TFunction* HlslParseContext::handleConstructorCall(const TSourceLoc& loc, const
return new TFunction(&empty, type, op);
}
//
// Handle seeing a "COLON semantic" at the end of a type declaration,
// by updating the type according to the semantic.
//
void HlslParseContext::handleSemantic(TType& type, const TString& semantic)
{
// TODO: need to know if it's an input or an output
// The following sketches what needs to be done, but can't be right
// without taking into account stage and input/output.
if (semantic == "PSIZE")
type.getQualifier().builtIn = EbvPointSize;
else if (semantic == "POSITION")
type.getQualifier().builtIn = EbvPosition;
else if (semantic == "FOG")
type.getQualifier().builtIn = EbvFogFragCoord;
else if (semantic == "DEPTH" || semantic == "SV_Depth")
type.getQualifier().builtIn = EbvFragDepth;
else if (semantic == "VFACE" || semantic == "SV_IsFrontFace")
type.getQualifier().builtIn = EbvFace;
else if (semantic == "VPOS" || semantic == "SV_Position")
type.getQualifier().builtIn = EbvFragCoord;
else if (semantic == "SV_ClipDistance")
type.getQualifier().builtIn = EbvClipDistance;
else if (semantic == "SV_CullDistance")
type.getQualifier().builtIn = EbvCullDistance;
else if (semantic == "SV_VertexID")
type.getQualifier().builtIn = EbvVertexId;
else if (semantic == "SV_ViewportArrayIndex")
type.getQualifier().builtIn = EbvViewportIndex;
}
//
// Given a type, find what operation would fully construct it.
//