Semantics: 'invocations' defaults to 1, not 0.
authorJohn Kessenich <cepheus@frii.com>
Sun, 13 Dec 2015 17:59:17 +0000 (10:59 -0700)
committerJohn Kessenich <cepheus@frii.com>
Sun, 13 Dec 2015 17:59:17 +0000 (10:59 -0700)
'invocations' was using 0 as the "shader never set" flag and as the
default. Formalize this and explicit set to 1 and link time.

13 files changed:
Test/baseResults/410.geom.out
Test/baseResults/420.geom.out
Test/baseResults/420_size_gl_in.geom.out
Test/baseResults/450.geom.out
Test/baseResults/mains1.frag.out
Test/baseResults/max_vertices_0.geom.out
Test/baseResults/spv.150.geom.out
Test/baseResults/spv.330.geom.out
glslang/Include/Types.h
glslang/Include/revision.h
glslang/MachineIndependent/ParseHelper.cpp
glslang/MachineIndependent/linkValidate.cpp
glslang/MachineIndependent/localintermediate.h

index b1f5a57..6f7252c 100644 (file)
@@ -12,7 +12,7 @@ ERROR: 7 compilation errors.  No code generated.
 
 
 Shader version: 410
-invocations = 0
+invocations = -1
 max_vertices = -1
 input primitive = none
 output primitive = none
@@ -65,7 +65,7 @@ ERROR: Linking geometry stage: At least one shader must specify an output layout
 ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
 
 Shader version: 410
-invocations = 0
+invocations = 1
 max_vertices = -1
 input primitive = none
 output primitive = none
index fdb2cc8..416df13 100644 (file)
@@ -10,7 +10,7 @@ ERROR: 6 compilation errors.  No code generated.
 
 
 Shader version: 420
-invocations = 0
+invocations = -1
 max_vertices = -1
 input primitive = triangles
 output primitive = none
@@ -137,7 +137,7 @@ ERROR: Linking geometry stage: At least one shader must specify an output layout
 ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
 
 Shader version: 420
-invocations = 0
+invocations = 1
 max_vertices = -1
 input primitive = triangles
 output primitive = none
index 577c246..21d1944 100644 (file)
@@ -5,7 +5,7 @@ ERROR: 1 compilation errors.  No code generated.
 
 
 Shader version: 420
-invocations = 0
+invocations = -1
 max_vertices = -1
 input primitive = triangles
 output primitive = none
@@ -44,7 +44,7 @@ ERROR: Linking geometry stage: At least one shader must specify an output layout
 ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
 
 Shader version: 420
-invocations = 0
+invocations = 1
 max_vertices = -1
 input primitive = triangles
 output primitive = none
index 0876a0c..fd98d08 100644 (file)
@@ -2,7 +2,7 @@
 Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
 
 Shader version: 450
-invocations = 0
+invocations = -1
 max_vertices = -1
 input primitive = none
 output primitive = none
@@ -40,7 +40,7 @@ ERROR: Linking geometry stage: At least one shader must specify an output layout
 ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
 
 Shader version: 450
-invocations = 0
+invocations = 1
 max_vertices = -1
 input primitive = none
 output primitive = none
index 140dae8..8ba02bf 100644 (file)
@@ -18,7 +18,7 @@ ERROR: 1 compilation errors.  No code generated.
 
 
 Shader version: 150
-invocations = 0
+invocations = -1
 max_vertices = -1
 input primitive = none
 output primitive = points
@@ -29,7 +29,7 @@ ERROR: node is still EOpNull!
 
 noMain2.geom
 Shader version: 150
-invocations = 0
+invocations = -1
 max_vertices = -1
 input primitive = none
 output primitive = line_strip
@@ -52,7 +52,7 @@ ERROR: Linking fragment stage: Multiple function bodies in multiple compilation
     main(
 
 Shader version: 150
-invocations = 0
+invocations = 1
 max_vertices = -1
 input primitive = none
 output primitive = points
index 85f2e38..94890bc 100644 (file)
@@ -1,6 +1,6 @@
 max_vertices_0.geom
 Shader version: 330
-invocations = 0
+invocations = -1
 max_vertices = 0
 input primitive = points
 output primitive = triangle_strip
@@ -19,7 +19,7 @@ Linked geometry stage:
 
 
 Shader version: 330
-invocations = 0
+invocations = 1
 max_vertices = 0
 input primitive = points
 output primitive = triangle_strip
index e3efab7..46901dc 100755 (executable)
@@ -12,7 +12,7 @@ Linked geometry stage:
                               MemoryModel Logical GLSL450
                               EntryPoint Geometry 4  "main" 18 70 10 29 33
                               ExecutionMode 4 InputTrianglesAdjacency
-                              ExecutionMode 4 Invocations 0
+                              ExecutionMode 4 Invocations 1
                               ExecutionMode 4 OutputTriangleStrip
                               ExecutionMode 4 OutputVertices 30
                               Source GLSL 150
index 1f310bb..2d48b2f 100755 (executable)
@@ -12,7 +12,7 @@ Linked geometry stage:
                               MemoryModel Logical GLSL450
                               EntryPoint Geometry 4  "main" 20 13
                               ExecutionMode 4 Triangles
-                              ExecutionMode 4 Invocations 0
+                              ExecutionMode 4 Invocations 1
                               ExecutionMode 4 OutputTriangleStrip
                               ExecutionMode 4 OutputVertices 3
                               Source GLSL 330
index ca6caf1..06e8449 100644 (file)
@@ -775,7 +775,7 @@ struct TShaderQualifiers {
     TLayoutGeometry geometry; // geometry/tessellation shader in/out primitives
     bool pixelCenterInteger;  // fragment shader
     bool originUpperLeft;     // fragment shader
-    int invocations;          // 0 means no declaration
+    int invocations;
     int vertices;             // both for tessellation "vertices" and geometry "max_vertices"
     TVertexSpacing spacing;
     TVertexOrder order;
@@ -790,7 +790,7 @@ struct TShaderQualifiers {
         geometry = ElgNone;
         originUpperLeft = false;
         pixelCenterInteger = false;
-        invocations = 0;        // 0 means no declaration
+        invocations = TQualifier::layoutNotSet;
         vertices = TQualifier::layoutNotSet;
         spacing = EvsNone;
         order = EvoNone;
@@ -813,7 +813,7 @@ struct TShaderQualifiers {
             pixelCenterInteger = src.pixelCenterInteger;
         if (src.originUpperLeft)
             originUpperLeft = src.originUpperLeft;
-        if (src.invocations != 0)
+        if (src.invocations != TQualifier::layoutNotSet)
             invocations = src.invocations;
         if (src.vertices != TQualifier::layoutNotSet)
             vertices = src.vertices;
index 99a414a..397b48c 100644 (file)
@@ -2,5 +2,5 @@
 // For the version, it uses the latest git tag followed by the number of commits.
 // For the date, it uses the current date (when then script is run).
 
-#define GLSLANG_REVISION "SPIRV99.841"
-#define GLSLANG_DATE "12-Dec-2015"
+#define GLSLANG_REVISION "SPIRV99.842"
+#define GLSLANG_DATE "13-Dec-2015"
index 7dcaa52..72e6010 100644 (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))
index e769982..5e4104c 100644 (file)
@@ -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
index 501086c..27bac7b 100644 (file)
@@ -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;