To do this, more generally use a named -1 as a not set value.
{\r
;\r
}\r
-}
\ No newline at end of file
+}\r
+\r
+layout(vertices = 0) out; // ERROR, can't be 0\r
Shader version: 400
-vertices = 0
+vertices = -1
ERROR: node is still EOpNull!
0:8 Function Definition: main( (global void)
0:8 Function Parameters:
ERROR: 0:26: 'gl_PointSize' : no such field in structure
ERROR: 0:26: 'assign' : cannot convert from 'temp float' to 'temp block{out 4-component vector of float Position gl_Position}'
ERROR: 0:29: 'out' : type must be an array: outf
-ERROR: 6 compilation errors. No code generated.
+ERROR: 0:43: 'vertices' : must be greater than 0
+ERROR: 7 compilation errors. No code generated.
Shader version: 420
Shader version: 410
invocations = 0
-max_vertices = 0
+max_vertices = -1
input primitive = none
output primitive = none
ERROR: node is still EOpNull!
Shader version: 410
invocations = 0
-max_vertices = 0
+max_vertices = -1
input primitive = none
output primitive = none
ERROR: node is still EOpNull!
Shader version: 400
-vertices = 0
+vertices = -1
ERROR: node is still EOpNull!
0:8 Function Definition: main( (global void)
0:8 Function Parameters:
ERROR: Linking tessellation control stage: At least one shader must specify an output layout(vertices=...)
Shader version: 400
-vertices = 0
+vertices = -1
ERROR: node is still EOpNull!
0:8 Function Definition: main( (global void)
0:8 Function Parameters:
Shader version: 420
invocations = 0
-max_vertices = 0
+max_vertices = -1
input primitive = triangles
output primitive = none
ERROR: node is still EOpNull!
Shader version: 420
invocations = 0
-max_vertices = 0
+max_vertices = -1
input primitive = triangles
output primitive = none
ERROR: node is still EOpNull!
ERROR: 0:26: 'gl_PointSize' : no such field in structure
ERROR: 0:26: 'assign' : cannot convert from 'temp float' to 'temp block{out 4-component vector of float Position gl_Position}'
ERROR: 0:29: 'out' : type must be an array: outf
-ERROR: 6 compilation errors. No code generated.
+ERROR: 0:43: 'vertices' : must be greater than 0
+ERROR: 7 compilation errors. No code generated.
Shader version: 420
Shader version: 420
invocations = 0
-max_vertices = 0
+max_vertices = -1
input primitive = triangles
output primitive = none
ERROR: node is still EOpNull!
Shader version: 420
invocations = 0
-max_vertices = 0
+max_vertices = -1
input primitive = triangles
output primitive = none
ERROR: node is still EOpNull!
Shader version: 450
invocations = 0
-max_vertices = 0
+max_vertices = -1
input primitive = none
output primitive = none
0:? Sequence
Shader version: 450
invocations = 0
-max_vertices = 0
+max_vertices = -1
input primitive = none
output primitive = none
0:? Sequence
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
Shader version: 450
-vertices = 0
+vertices = -1
0:? Sequence
0:11 Function Definition: main( (global void)
0:11 Function Parameters:
ERROR: Linking tessellation control stage: At least one shader must specify an output layout(vertices=...)
Shader version: 450
-vertices = 0
+vertices = -1
0:? Sequence
0:11 Function Definition: main( (global void)
0:11 Function Parameters:
Shader version: 150
invocations = 0
-max_vertices = 0
+max_vertices = -1
input primitive = none
output primitive = points
ERROR: node is still EOpNull!
noMain2.geom
Shader version: 150
invocations = 0
-max_vertices = 0
+max_vertices = -1
input primitive = none
output primitive = line_strip
0:? Sequence
Shader version: 150
invocations = 0
-max_vertices = 0
+max_vertices = -1
input primitive = none
output primitive = points
ERROR: node is still EOpNull!
--- /dev/null
+max_vertices_0.geom
+Shader version: 330
+invocations = 0
+max_vertices = 0
+input primitive = points
+output primitive = triangle_strip
+0:? Sequence
+0:8 Function Definition: main( (global void)
+0:8 Function Parameters:
+0:10 Sequence
+0:10 EndPrimitive (global void)
+0:11 EndPrimitive (global void)
+0:? Linker Objects
+0:? 'v_geom_FragColor' (in 1-element array of 4-component vector of float)
+0:? 'v_frag_FragColor' (layout(stream=0 ) out 4-component vector of float)
+
+
+Linked geometry stage:
+
+
+Shader version: 330
+invocations = 0
+max_vertices = 0
+input primitive = points
+output primitive = triangle_strip
+0:? Sequence
+0:8 Function Definition: main( (global void)
+0:8 Function Parameters:
+0:10 Sequence
+0:10 EndPrimitive (global void)
+0:11 EndPrimitive (global void)
+0:? Linker Objects
+0:? 'v_geom_FragColor' (in 1-element array of 4-component vector of float)
+0:? 'v_frag_FragColor' (layout(stream=0 ) out 4-component vector of float)
+
--- /dev/null
+#version 330\r
+\r
+layout(points) in;\r
+layout(triangle_strip, max_vertices = 0) out;\r
+in highp vec4 v_geom_FragColor[];\r
+out highp vec4 v_frag_FragColor;\r
+\r
+void main (void)\r
+{\r
+ EndPrimitive();\r
+ EndPrimitive();\r
+}\r
runBulkTest 300link3.frag
runBulkTest empty.frag empty2.frag empty3.frag
runBulkTest 150.tesc 150.tese 400.tesc 400.tese 410.tesc 420.tesc 420.tese
+runBulkTest max_vertices_0.geom
#
# reflection tests
class TQualifier {
public:
+ static const int layoutNotSet = -1;
+
void clear()
{
precision = EpqNone;
{
layoutMatrix = ElmNone;
layoutPacking = ElpNone;
- layoutOffset = -1;
- layoutAlign = -1;
+ layoutOffset = layoutNotSet;
+ layoutAlign = layoutNotSet;
layoutLocation = layoutLocationEnd;
layoutComponent = layoutComponentEnd;
}
bool hasOffset() const
{
- return layoutOffset != -1;
+ return layoutOffset != layoutNotSet;
}
bool hasAlign() const
{
- return layoutAlign != -1;
+ return layoutAlign != layoutNotSet;
}
bool hasAnyLocation() const
{
originUpperLeft = false;
pixelCenterInteger = false;
invocations = 0; // 0 means no declaration
- vertices = 0;
+ vertices = TQualifier::layoutNotSet;
spacing = EvsNone;
order = EvoNone;
pointMode = false;
originUpperLeft = src.originUpperLeft;
if (src.invocations != 0)
invocations = src.invocations;
- if (src.vertices != 0)
+ if (src.vertices != TQualifier::layoutNotSet)
vertices = src.vertices;
if (src.spacing != EvsNone)
spacing = src.spacing;
// 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.839"
+#define GLSLANG_REVISION "SPIRV99.841"
#define GLSLANG_DATE "11-Dec-2015"
// fix array size, if it can be fixed and needs to be fixed (will allow variable indexing)
if (symbolNode->getType().isImplicitlySizedArray()) {
int newSize = getIoArrayImplicitSize();
- if (newSize)
+ if (newSize > 0)
symbolNode->getWritableType().changeOuterArraySize(newSize);
}
}
if (language == EShLangGeometry)
return TQualifier::mapGeometryToSize(intermediate.getInputPrimitive());
else if (language == EShLangTessControl)
- return intermediate.getVertices();
+ return intermediate.getVertices() != TQualifier::layoutNotSet ? intermediate.getVertices() : 0;
else
return 0;
}
case EShLangTessControl:
if (id == "vertices") {
- publicType.shaderQualifiers.vertices = value;
+ if (value == 0)
+ error(loc, "must be greater than 0", "vertices", "");
+ else
+ publicType.shaderQualifiers.vertices = value;
return;
}
break;
error(loc, message, TQualifier::getGeometryString(shaderQualifiers.geometry), "");
if (shaderQualifiers.invocations > 0)
error(loc, message, "invocations", "");
- if (shaderQualifiers.vertices > 0) {
+ if (shaderQualifiers.vertices != TQualifier::layoutNotSet) {
if (language == EShLangGeometry)
error(loc, message, "max_vertices", "");
else if (language == EShLangTessControl)
//
void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, const TPublicType& publicType)
{
- if (publicType.shaderQualifiers.vertices) {
+ if (publicType.shaderQualifiers.vertices != TQualifier::layoutNotSet) {
assert(language == EShLangTessControl || language == EShLangGeometry);
const char* id = (language == EShLangTessControl) ? "vertices" : "max_vertices";
else if (outputPrimitive != unit.outputPrimitive)
error(infoSink, "Contradictory output layout primitives");
- if (vertices == 0)
+ if (vertices == TQualifier::layoutNotSet)
vertices = unit.vertices;
else if (vertices != unit.vertices) {
if (language == EShLangGeometry)
case EShLangVertex:
break;
case EShLangTessControl:
- if (vertices == 0)
+ if (vertices == TQualifier::layoutNotSet)
error(infoSink, "At least one shader must specify an output layout(vertices=...)");
break;
case EShLangTessEvaluation:
error(infoSink, "At least one shader must specify an input layout primitive");
if (outputPrimitive == ElgNone)
error(infoSink, "At least one shader must specify an output layout primitive");
- if (vertices == 0)
+ if (vertices == TQualifier::layoutNotSet)
error(infoSink, "At least one shader must specify a layout(max_vertices = value)");
break;
case EShLangFragment:
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(0), inputPrimitive(ElgNone), outputPrimitive(ElgNone), pixelCenterInteger(false), originUpperLeft(false),
+ invocations(0), 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;
int getInvocations() const { return invocations; }
bool setVertices(int m)
{
- if (vertices > 0)
+ if (vertices != TQualifier::layoutNotSet)
return vertices == m;
vertices = m;
return true;