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:
John Kessenich 2015-12-13 10:59:17 -07:00
parent 04bb8a01d6
commit 61d9fb9048
13 changed files with 34 additions and 26 deletions

View file

@ -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))