diff --git a/Test/baseResults/410.geom.out b/Test/baseResults/410.geom.out index b1f5a575..6f7252c9 100644 --- a/Test/baseResults/410.geom.out +++ b/Test/baseResults/410.geom.out @@ -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 diff --git a/Test/baseResults/420.geom.out b/Test/baseResults/420.geom.out index fdb2cc88..416df139 100644 --- a/Test/baseResults/420.geom.out +++ b/Test/baseResults/420.geom.out @@ -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 diff --git a/Test/baseResults/420_size_gl_in.geom.out b/Test/baseResults/420_size_gl_in.geom.out index 577c246d..21d1944f 100644 --- a/Test/baseResults/420_size_gl_in.geom.out +++ b/Test/baseResults/420_size_gl_in.geom.out @@ -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 diff --git a/Test/baseResults/450.geom.out b/Test/baseResults/450.geom.out index 0876a0c3..fd98d088 100644 --- a/Test/baseResults/450.geom.out +++ b/Test/baseResults/450.geom.out @@ -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 diff --git a/Test/baseResults/mains1.frag.out b/Test/baseResults/mains1.frag.out index 140dae81..8ba02bf1 100644 --- a/Test/baseResults/mains1.frag.out +++ b/Test/baseResults/mains1.frag.out @@ -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 diff --git a/Test/baseResults/max_vertices_0.geom.out b/Test/baseResults/max_vertices_0.geom.out index 85f2e385..94890bc8 100644 --- a/Test/baseResults/max_vertices_0.geom.out +++ b/Test/baseResults/max_vertices_0.geom.out @@ -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 diff --git a/Test/baseResults/spv.150.geom.out b/Test/baseResults/spv.150.geom.out index e3efab7f..46901dc3 100755 --- a/Test/baseResults/spv.150.geom.out +++ b/Test/baseResults/spv.150.geom.out @@ -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 diff --git a/Test/baseResults/spv.330.geom.out b/Test/baseResults/spv.330.geom.out index 1f310bb0..2d48b2f1 100755 --- a/Test/baseResults/spv.330.geom.out +++ b/Test/baseResults/spv.330.geom.out @@ -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 diff --git a/glslang/Include/Types.h b/glslang/Include/Types.h index ca6caf11..06e84492 100644 --- a/glslang/Include/Types.h +++ b/glslang/Include/Types.h @@ -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; diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h index 99a414a3..397b48c4 100644 --- a/glslang/Include/revision.h +++ b/glslang/Include/revision.h @@ -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" diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 7dcaa52d..72e6010f 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -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)) diff --git a/glslang/MachineIndependent/linkValidate.cpp b/glslang/MachineIndependent/linkValidate.cpp index e769982c..5e4104cb 100644 --- a/glslang/MachineIndependent/linkValidate.cpp +++ b/glslang/MachineIndependent/linkValidate.cpp @@ -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 diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h index 501086c1..27bac7bd 100644 --- a/glslang/MachineIndependent/localintermediate.h +++ b/glslang/MachineIndependent/localintermediate.h @@ -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;