HLSL: Fix #1974: ignore input primitives on non-entry-point functions.

This commit is contained in:
John Kessenich 2020-01-17 00:11:12 -07:00
parent 3ed344dd78
commit b0ada80356
6 changed files with 244 additions and 80 deletions

View file

@ -69,7 +69,8 @@ HlslParseContext::HlslParseContext(TSymbolTable& symbolTable, TIntermediate& int
clipDistanceOutput(nullptr),
cullDistanceOutput(nullptr),
clipDistanceInput(nullptr),
cullDistanceInput(nullptr)
cullDistanceInput(nullptr),
parsingEntrypointParameters(false)
{
globalUniformDefaults.clear();
globalUniformDefaults.layoutMatrix = ElmRowMajor;
@ -2049,7 +2050,7 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct
};
// if we aren't in the entry point, fix the IO as such and exit
if (userFunction.getName().compare(intermediate.getEntryPointName().c_str()) != 0) {
if (! isEntrypointName(userFunction.getName())) {
remapNonEntryPointIO(userFunction);
return nullptr;
}
@ -8884,6 +8885,10 @@ void HlslParseContext::addQualifierToExisting(const TSourceLoc& loc, TQualifier
//
bool HlslParseContext::handleInputGeometry(const TSourceLoc& loc, const TLayoutGeometry& geometry)
{
// these can be declared on non-entry-points, in which case they lose their meaning
if (! parsingEntrypointParameters)
return true;
switch (geometry) {
case ElgPoints: // fall through
case ElgLines: // ...
@ -8914,6 +8919,10 @@ bool HlslParseContext::handleOutputGeometry(const TSourceLoc& loc, const TLayout
if (language != EShLangGeometry)
return true;
// these can be declared on non-entry-points, in which case they lose their meaning
if (! parsingEntrypointParameters)
return true;
switch (geometry) {
case ElgPoints:
case ElgLineStrip: