Semantics: 'invocations' defaults to 1, not 0.
'invocations' was using 0 as the "shader never set" flag and as the default. Formalize this and explicit set to 1 and link time.
This commit is contained in:
parent
04bb8a01d6
commit
61d9fb9048
13 changed files with 34 additions and 26 deletions
|
|
@ -3889,7 +3889,10 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
|
|||
case EShLangGeometry:
|
||||
if (id == "invocations") {
|
||||
profileRequires(loc, ECompatibilityProfile | ECoreProfile, 400, nullptr, "invocations");
|
||||
publicType.shaderQualifiers.invocations = value;
|
||||
if (value == 0)
|
||||
error(loc, "must be at least 1", "invocations", "");
|
||||
else
|
||||
publicType.shaderQualifiers.invocations = value;
|
||||
return;
|
||||
}
|
||||
if (id == "max_vertices") {
|
||||
|
|
@ -4276,7 +4279,7 @@ void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQua
|
|||
|
||||
if (shaderQualifiers.geometry != ElgNone)
|
||||
error(loc, message, TQualifier::getGeometryString(shaderQualifiers.geometry), "");
|
||||
if (shaderQualifiers.invocations > 0)
|
||||
if (shaderQualifiers.invocations != TQualifier::layoutNotSet)
|
||||
error(loc, message, "invocations", "");
|
||||
if (shaderQualifiers.vertices != TQualifier::layoutNotSet) {
|
||||
if (language == EShLangGeometry)
|
||||
|
|
@ -5453,7 +5456,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
|
|||
if (language == EShLangTessControl)
|
||||
checkIoArraysConsistency(loc);
|
||||
}
|
||||
if (publicType.shaderQualifiers.invocations) {
|
||||
if (publicType.shaderQualifiers.invocations != TQualifier::layoutNotSet) {
|
||||
if (publicType.qualifier.storage != EvqVaryingIn)
|
||||
error(loc, "can only apply to 'in'", "invocations", "");
|
||||
if (! intermediate.setInvocations(publicType.shaderQualifiers.invocations))
|
||||
|
|
|
|||
|
|
@ -359,6 +359,10 @@ void TIntermediate::finalCheck(TInfoSink& infoSink)
|
|||
// overlap/alias/missing I/O, etc.
|
||||
inOutLocationCheck(infoSink);
|
||||
|
||||
// invocations
|
||||
if (invocations == TQualifier::layoutNotSet)
|
||||
invocations = 1;
|
||||
|
||||
if (inIoAccessed("gl_ClipDistance") && inIoAccessed("gl_ClipVertex"))
|
||||
error(infoSink, "Can only use one of gl_ClipDistance or gl_ClipVertex (gl_ClipDistance is preferred)");
|
||||
|
||||
|
|
@ -561,7 +565,7 @@ void TIntermediate::inOutLocationCheck(TInfoSink& infoSink)
|
|||
if (profile == EEsProfile) {
|
||||
if (numFragOut > 1 && fragOutWithNoLocation)
|
||||
error(infoSink, "when more than one fragment shader output, all must have location qualifiers");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TIntermSequence& TIntermediate::findLinkerObjects() const
|
||||
|
|
|
|||
|
|
@ -126,7 +126,8 @@ class TIntermediate {
|
|||
public:
|
||||
explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) : language(l), treeRoot(0), profile(p), version(v), spv(0),
|
||||
numMains(0), numErrors(0), recursive(false),
|
||||
invocations(0), vertices(TQualifier::layoutNotSet), inputPrimitive(ElgNone), outputPrimitive(ElgNone), pixelCenterInteger(false), originUpperLeft(false),
|
||||
invocations(TQualifier::layoutNotSet), vertices(TQualifier::layoutNotSet), inputPrimitive(ElgNone), outputPrimitive(ElgNone),
|
||||
pixelCenterInteger(false), originUpperLeft(false),
|
||||
vertexSpacing(EvsNone), vertexOrder(EvoNone), pointMode(false), earlyFragmentTests(false), depthLayout(EldNone), depthReplacing(false), blendEquations(0), xfbMode(false)
|
||||
{
|
||||
localSize[0] = 1;
|
||||
|
|
@ -204,7 +205,7 @@ public:
|
|||
|
||||
bool setInvocations(int i)
|
||||
{
|
||||
if (invocations > 0)
|
||||
if (invocations != TQualifier::layoutNotSet)
|
||||
return invocations == i;
|
||||
invocations = i;
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue