Commit b0ada803 by John Kessenich

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

parent 3ed344dd
hlsl.gs-hs-mix.tesc hlsl.gs-hs-mix.tesc
Shader version: 500 Shader version: 500
vertices = 3 vertices = 3
input primitive = triangles
vertex spacing = fractional_odd_spacing vertex spacing = fractional_odd_spacing
triangle order = ccw triangle order = ccw
0:? Sequence 0:? Sequence
...@@ -402,7 +401,6 @@ Linked tessellation control stage: ...@@ -402,7 +401,6 @@ Linked tessellation control stage:
Shader version: 500 Shader version: 500
vertices = 3 vertices = 3
input primitive = triangles
vertex spacing = fractional_odd_spacing vertex spacing = fractional_odd_spacing
triangle order = ccw triangle order = ccw
0:? Sequence 0:? Sequence
......
...@@ -14,3 +14,11 @@ void main(triangle in uint VertexID[3] : VertexID, ...@@ -14,3 +14,11 @@ void main(triangle in uint VertexID[3] : VertexID,
S s; S s;
OutputStream.Append(s); OutputStream.Append(s);
} }
[maxvertexcount(4)]
void notmain(line in uint VertexID[2] : VertexID,
inout LineStream<S> OutputStream)
{
S s;
OutputStream.Append(s);
}
...@@ -2516,6 +2516,8 @@ bool HlslGrammar::acceptMemberFunctionDefinition(TIntermNode*& nodeList, const T ...@@ -2516,6 +2516,8 @@ bool HlslGrammar::acceptMemberFunctionDefinition(TIntermNode*& nodeList, const T
// //
bool HlslGrammar::acceptFunctionParameters(TFunction& function) bool HlslGrammar::acceptFunctionParameters(TFunction& function)
{ {
parseContext.beginParameterParsing(function);
// LEFT_PAREN // LEFT_PAREN
if (! acceptTokenClass(EHTokLeftParen)) if (! acceptTokenClass(EHTokLeftParen))
return false; return false;
......
...@@ -69,7 +69,8 @@ HlslParseContext::HlslParseContext(TSymbolTable& symbolTable, TIntermediate& int ...@@ -69,7 +69,8 @@ HlslParseContext::HlslParseContext(TSymbolTable& symbolTable, TIntermediate& int
clipDistanceOutput(nullptr), clipDistanceOutput(nullptr),
cullDistanceOutput(nullptr), cullDistanceOutput(nullptr),
clipDistanceInput(nullptr), clipDistanceInput(nullptr),
cullDistanceInput(nullptr) cullDistanceInput(nullptr),
parsingEntrypointParameters(false)
{ {
globalUniformDefaults.clear(); globalUniformDefaults.clear();
globalUniformDefaults.layoutMatrix = ElmRowMajor; globalUniformDefaults.layoutMatrix = ElmRowMajor;
...@@ -2049,7 +2050,7 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct ...@@ -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 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); remapNonEntryPointIO(userFunction);
return nullptr; return nullptr;
} }
...@@ -8884,6 +8885,10 @@ void HlslParseContext::addQualifierToExisting(const TSourceLoc& loc, TQualifier ...@@ -8884,6 +8885,10 @@ void HlslParseContext::addQualifierToExisting(const TSourceLoc& loc, TQualifier
// //
bool HlslParseContext::handleInputGeometry(const TSourceLoc& loc, const TLayoutGeometry& geometry) 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) { switch (geometry) {
case ElgPoints: // fall through case ElgPoints: // fall through
case ElgLines: // ... case ElgLines: // ...
...@@ -8914,6 +8919,10 @@ bool HlslParseContext::handleOutputGeometry(const TSourceLoc& loc, const TLayout ...@@ -8914,6 +8919,10 @@ bool HlslParseContext::handleOutputGeometry(const TSourceLoc& loc, const TLayout
if (language != EShLangGeometry) if (language != EShLangGeometry)
return true; return true;
// these can be declared on non-entry-points, in which case they lose their meaning
if (! parsingEntrypointParameters)
return true;
switch (geometry) { switch (geometry) {
case ElgPoints: case ElgPoints:
case ElgLineStrip: case ElgLineStrip:
......
...@@ -183,6 +183,11 @@ public: ...@@ -183,6 +183,11 @@ public:
void getFullNamespaceName(TString*&) const; void getFullNamespaceName(TString*&) const;
void addScopeMangler(TString&); void addScopeMangler(TString&);
void beginParameterParsing(TFunction& function)
{
parsingEntrypointParameters = isEntrypointName(function.getName());
}
void pushSwitchSequence(TIntermSequence* sequence) { switchSequenceStack.push_back(sequence); } void pushSwitchSequence(TIntermSequence* sequence) { switchSequenceStack.push_back(sequence); }
void popSwitchSequence() { switchSequenceStack.pop_back(); } void popSwitchSequence() { switchSequenceStack.pop_back(); }
...@@ -241,6 +246,7 @@ protected: ...@@ -241,6 +246,7 @@ protected:
TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer, TIntermTyped* scalarInit); TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer, TIntermTyped* scalarInit);
bool isScalarConstructor(const TIntermNode*); bool isScalarConstructor(const TIntermNode*);
TOperator mapAtomicOp(const TSourceLoc& loc, TOperator op, bool isImage); TOperator mapAtomicOp(const TSourceLoc& loc, TOperator op, bool isImage);
bool isEntrypointName(const TString& name) { return name.compare(intermediate.getEntryPointName().c_str()) == 0; }
// Return true if this node requires L-value conversion (e.g, to an imageStore). // Return true if this node requires L-value conversion (e.g, to an imageStore).
bool shouldConvertLValue(const TIntermNode*) const; bool shouldConvertLValue(const TIntermNode*) const;
...@@ -494,6 +500,7 @@ protected: ...@@ -494,6 +500,7 @@ protected:
}; };
TMap<int, tShadowTextureSymbols*> textureShadowVariant; TMap<int, tShadowTextureSymbols*> textureShadowVariant;
bool parsingEntrypointParameters;
}; };
// This is the prefix we use for built-in methods to avoid namespace collisions with // This is the prefix we use for built-in methods to avoid namespace collisions with
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment