HLSL: handle split InputPatch templat type in patch constant functions

InputPatch parameters to patch constant functions were not using the
internal (temporary) variable type.  That could cause validation errors
if the input patch had a mixture of builtins and user qualified members.

This uses the entry point's internal form.

There is currently a limitation: if an InputPatch is used in a PCF,
it must also have appeared in the main entry point's parameter list.
That is not a limitation of HLSL.  Currently that situation is detected
and an "implemented" error results.  The limitation can be addressed,
but isn't yet in the current form of the PR.
This commit is contained in:
LoopDawg 2017-09-13 08:44:39 -06:00
parent a5d8616478
commit 4a145dbf45
8 changed files with 961 additions and 239 deletions

View file

@ -316,6 +316,9 @@ protected:
static bool isClipOrCullDistance(const TQualifier& qual) { return isClipOrCullDistance(qual.builtIn); }
static bool isClipOrCullDistance(const TType& type) { return isClipOrCullDistance(type.getQualifier()); }
// Find the patch constant function (issues error, returns nullptr if not found)
const TFunction* findPatchConstantFunction(const TSourceLoc& loc);
// Pass through to base class after remembering built-in mappings.
using TParseContextBase::trackLinkage;
void trackLinkage(TSymbol& variable) override;
@ -415,7 +418,8 @@ protected:
};
TMap<tInterstageIoData, TVariable*> splitBuiltIns; // split built-ins, indexed by built-in type.
TVariable* inputPatch;
TVariable* inputPatch; // input patch is special for PCF: it's the only non-builtin PCF input,
// and is handled as a pseudo-builtin.
unsigned int nextInLocation;
unsigned int nextOutLocation;