WIP: HLSL: Support InputPatch variables in patch constant functions
Previously, patch constant functions only accepted OutputPatch. This adds InputPatch support, via a pseudo-builtin variable type, so that the patch can be tracked clear through from the qualifier.
This commit is contained in:
parent
b68b9a8b23
commit
067eb9b48a
8 changed files with 739 additions and 34 deletions
|
|
@ -963,14 +963,14 @@ bool HlslGrammar::acceptOutputPrimitiveGeometry(TLayoutGeometry& geometry)
|
|||
// : INPUTPATCH
|
||||
// | OUTPUTPATCH
|
||||
//
|
||||
bool HlslGrammar::acceptTessellationDeclType()
|
||||
bool HlslGrammar::acceptTessellationDeclType(TBuiltInVariable& patchType)
|
||||
{
|
||||
// read geometry type
|
||||
const EHlslTokenClass tessType = peek();
|
||||
|
||||
switch (tessType) {
|
||||
case EHTokInputPatch: break;
|
||||
case EHTokOutputPatch: break;
|
||||
case EHTokInputPatch: patchType = EbvInputPatch; break;
|
||||
case EHTokOutputPatch: patchType = EbvOutputPatch; break;
|
||||
default:
|
||||
return false; // not a tessellation decl
|
||||
}
|
||||
|
|
@ -984,7 +984,9 @@ bool HlslGrammar::acceptTessellationDeclType()
|
|||
//
|
||||
bool HlslGrammar::acceptTessellationPatchTemplateType(TType& type)
|
||||
{
|
||||
if (! acceptTessellationDeclType())
|
||||
TBuiltInVariable patchType;
|
||||
|
||||
if (! acceptTessellationDeclType(patchType))
|
||||
return false;
|
||||
|
||||
if (! acceptTokenClass(EHTokLeftAngle))
|
||||
|
|
@ -1011,6 +1013,7 @@ bool HlslGrammar::acceptTessellationPatchTemplateType(TType& type)
|
|||
TArraySizes* arraySizes = new TArraySizes;
|
||||
arraySizes->addInnerSize(size->getAsConstantUnion()->getConstArray()[0].getIConst());
|
||||
type.newArraySizes(*arraySizes);
|
||||
type.getQualifier().builtIn = patchType;
|
||||
|
||||
if (! acceptTokenClass(EHTokRightAngle)) {
|
||||
expected("right angle bracket");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue