Commit f3e2a894 by John Kessenich

Tessellation: Implicit array sizing and consistency checking of control-shader…

Tessellation: Implicit array sizing and consistency checking of control-shader output arrays based on layout(vertices=...). git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24518 e7fa87d3-cd2b-0410-9028-fcbf551c1848
parent 116c30b6
...@@ -35,3 +35,11 @@ void main() ...@@ -35,3 +35,11 @@ void main()
gl_TessLevelOuter[3] = 3.2; gl_TessLevelOuter[3] = 3.2;
gl_TessLevelInner[1] = 1.3; gl_TessLevelInner[1] = 1.3;
} }
layout(vertices = 4) in; // ERROR
layout(vertices = 5) out; // ERROR
void foo()
{
gl_out[4].gl_PointSize; // ERROR
}
\ No newline at end of file
#version 400 core
// no layout(vertices = ...) out;
int outa[gl_out.length()]; // ERROR
patch out vec4 patchOut;
void main()
{
}
#version 400 core
#extension GL_ARB_separate_shader_objects : enable
layout(vertices = 4) out;
out gl_PerVertex {
vec4 gl_Position;
} gl_out[3]; // ERROR, wrong size
out int a[gl_out.length()];
out int outb[5]; // ERROR, wrong size
out int outc[];
void main()
{
vec4 p = gl_in[1].gl_Position;
float ps = gl_in[1].gl_PointSize;
float cd = gl_in[1].gl_ClipDistance[2];
int pvi = gl_PatchVerticesIn;
int pid = gl_PrimitiveID;
int iid = gl_InvocationID;
gl_out[1].gl_Position = p;
gl_out[1].gl_PointSize = ps; // ERROR
}
#version 420 core
// testing input arrays without a gl_in[] block redeclaration, see 400.geom for with
int i;
layout(triangles) in;
in vec4 colorun[];
in vec4 color3[3];
void foo()
{
gl_in.length();
gl_in[1].gl_Position;
gl_in.length();
gl_in[i].gl_Position;
}
in gl_PerVertex { // ERROR, already used
vec4 gl_Position;
} gl_in[];
...@@ -4,8 +4,8 @@ ERROR: 0:13: 'invocations' : can only apply to a standalone qualifier ...@@ -4,8 +4,8 @@ ERROR: 0:13: 'invocations' : can only apply to a standalone qualifier
ERROR: 0:20: 'patch' : not supported in this stage: geometry ERROR: 0:20: 'patch' : not supported in this stage: geometry
ERROR: 0:20: 'gl_PointSize' : cannot add layout to redeclared block member ERROR: 0:20: 'gl_PointSize' : cannot add layout to redeclared block member
ERROR: 0:20: 'gl_PointSize' : cannot add patch to redeclared block member ERROR: 0:20: 'gl_PointSize' : cannot add patch to redeclared block member
ERROR: 0:25: 'length' : array must be declared with a size before using this method ERROR: 0:25: 'length' : array must first be sized by a redeclaration or layout qualifier
ERROR: 0:36: 'length' : array must be declared with a size before using this method ERROR: 0:36: 'length' : array must first be sized by a redeclaration or layout qualifier
ERROR: 0:40: 'triangles' : inconsistent input primitive for array size colorBad ERROR: 0:40: 'triangles' : inconsistent input primitive for array size colorBad
ERROR: 0:44: 'triangles' : inconsistent input primitive for array size colorbad2 ERROR: 0:44: 'triangles' : inconsistent input primitive for array size colorbad2
ERROR: 0:56: 'location' : repeated use of location 4 ERROR: 0:56: 'location' : repeated use of location 4
...@@ -81,7 +81,7 @@ ERROR: node is still EOpNull! ...@@ -81,7 +81,7 @@ ERROR: node is still EOpNull!
Linked geometry stage: Linked geometry stage:
ERROR: Linking geometry stage: At least one geometry shader must specify an output layout primitive ERROR: Linking geometry stage: At least one shader must specify an output layout primitive
invocations = 4 invocations = 4
max_vertices = 127 max_vertices = 127
......
400.tesc 400.tesc
Warning, version 400 is not yet complete; some version-specific features are present, but many are missing. Warning, version 400 is not yet complete; some version-specific features are present, but many are missing.
ERROR: 0:4: 'length' : array must be declared with a size before using this method
ERROR: 0:6: 'quads' : unrecognized layout identifier, or qualifier requires assignemnt (e.g., binding = 4) ERROR: 0:6: 'quads' : unrecognized layout identifier, or qualifier requires assignemnt (e.g., binding = 4)
ERROR: 0:7: 'ccw' : unrecognized layout identifier, or qualifier requires assignemnt (e.g., binding = 4) ERROR: 0:7: 'ccw' : unrecognized layout identifier, or qualifier requires assignemnt (e.g., binding = 4)
ERROR: 0:8: 'fractional_even_spacing' : unrecognized layout identifier, or qualifier requires assignemnt (e.g., binding = 4) ERROR: 0:8: 'fractional_even_spacing' : unrecognized layout identifier, or qualifier requires assignemnt (e.g., binding = 4)
ERROR: 0:10: 'patch' : can only use on output in tessellation-control shader ERROR: 0:10: 'patch' : can only use on output in tessellation-control shader
ERROR: 5 compilation errors. No code generated. ERROR: 0:39: 'vertices' : can only apply to 'out'
ERROR: 0:40: 'vertices' : cannot change previously set layout value
ERROR: 0:44: '[' : array index out of range '4'
ERROR: 7 compilation errors. No code generated.
vertices = 4 vertices = 4
...@@ -67,7 +69,7 @@ ERROR: node is still EOpNull! ...@@ -67,7 +69,7 @@ ERROR: node is still EOpNull!
0:31 move second child to first child (4-component vector of float) 0:31 move second child to first child (4-component vector of float)
0:31 gl_Position: direct index for structure (4-component vector of float) 0:31 gl_Position: direct index for structure (4-component vector of float)
0:31 direct index (block{gl_Position,gl_PointSize,gl_ClipDistance}) 0:31 direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
0:31 'gl_out' (out unsized array of block{gl_Position,gl_PointSize,gl_ClipDistance}) 0:31 'gl_out' (out 4-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:31 Constant: 0:31 Constant:
0:31 1 (const int) 0:31 1 (const int)
0:31 Constant: 0:31 Constant:
...@@ -76,7 +78,7 @@ ERROR: node is still EOpNull! ...@@ -76,7 +78,7 @@ ERROR: node is still EOpNull!
0:32 move second child to first child (float) 0:32 move second child to first child (float)
0:32 gl_PointSize: direct index for structure (float) 0:32 gl_PointSize: direct index for structure (float)
0:32 direct index (block{gl_Position,gl_PointSize,gl_ClipDistance}) 0:32 direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
0:32 'gl_out' (out unsized array of block{gl_Position,gl_PointSize,gl_ClipDistance}) 0:32 'gl_out' (out 4-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:32 Constant: 0:32 Constant:
0:32 1 (const int) 0:32 1 (const int)
0:32 Constant: 0:32 Constant:
...@@ -86,7 +88,7 @@ ERROR: node is still EOpNull! ...@@ -86,7 +88,7 @@ ERROR: node is still EOpNull!
0:33 direct index (float) 0:33 direct index (float)
0:33 gl_ClipDistance: direct index for structure (unsized array of float) 0:33 gl_ClipDistance: direct index for structure (unsized array of float)
0:33 direct index (block{gl_Position,gl_PointSize,gl_ClipDistance}) 0:33 direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
0:33 'gl_out' (out unsized array of block{gl_Position,gl_PointSize,gl_ClipDistance}) 0:33 'gl_out' (out 4-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:33 Constant: 0:33 Constant:
0:33 1 (const int) 0:33 1 (const int)
0:33 Constant: 0:33 Constant:
...@@ -108,11 +110,21 @@ ERROR: node is still EOpNull! ...@@ -108,11 +110,21 @@ ERROR: node is still EOpNull!
0:36 1 (const int) 0:36 1 (const int)
0:36 Constant: 0:36 Constant:
0:36 1.300000 0:36 1.300000
0:42 Function Definition: foo( (void)
0:42 Function Parameters:
0:44 Sequence
0:44 gl_PointSize: direct index for structure (float)
0:44 direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
0:44 'gl_out' (out 4-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:44 Constant:
0:44 4 (const int)
0:44 Constant:
0:44 1 (const int)
0:? Linker Objects 0:? Linker Objects
0:? 'outa' (1-element array of int) 0:? 'outa' (4-element array of int)
0:? 'patchIn' (patch in 4-component vector of float) 0:? 'patchIn' (patch in 4-component vector of float)
0:? 'patchOut' (patch out 4-component vector of float) 0:? 'patchOut' (patch out 4-component vector of float)
0:? 'gl_out' (out unsized array of block{gl_Position,gl_PointSize,gl_ClipDistance}) 0:? 'gl_out' (out 4-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
Linked tessellation control stage: Linked tessellation control stage:
......
...@@ -52,9 +52,9 @@ ERROR: node is still EOpNull! ...@@ -52,9 +52,9 @@ ERROR: node is still EOpNull!
Linked geometry stage: Linked geometry stage:
ERROR: Linking geometry stage: At least one geometry shader must specify an input layout primitive ERROR: Linking geometry stage: At least one shader must specify an input layout primitive
ERROR: Linking geometry stage: At least one geometry shader must specify an output layout primitive ERROR: Linking geometry stage: At least one shader must specify an output layout primitive
ERROR: Linking geometry stage: At least one geometry shader must specify a layout(max_vertices = value) ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
invocations = 0 invocations = 0
max_vertices = 0 max_vertices = 0
......
410.tesc
Warning, version 400 is not yet complete; some version-specific features are present, but many are missing.
ERROR: 0:4: 'length' : array must first be sized by a redeclaration or layout qualifier
ERROR: 1 compilation errors. No code generated.
vertices = 0
ERROR: node is still EOpNull!
0:8 Function Definition: main( (void)
0:8 Function Parameters:
0:? Linker Objects
0:? 'outa' (1-element array of int)
0:? 'patchOut' (patch out 4-component vector of float)
Linked tessellation control stage:
ERROR: Linking tessellation control stage: At least one shader must specify an output layout(vertices=...)
vertices = 0
420.geom 420.geom
Warning, version 420 is not yet complete; some version-specific features are present, but many are missing. Warning, version 420 is not yet complete; some version-specific features are present, but many are missing.
ERROR: 0:9: 'length' : array must be declared with a size before using this method ERROR: 0:9: 'length' : array must first be sized by a redeclaration or layout qualifier
ERROR: 0:11: '[' : array must be redeclared with a size before being indexed with a variable ERROR: 0:11: '[' : array must be sized by a redeclaration or layout qualifier before being indexed with a variable
ERROR: 0:42: 'assign' : l-value required (can't modify a const) ERROR: 0:42: 'assign' : l-value required (can't modify a const)
ERROR: 0:43: 'assign' : l-value required "v4" (can't modify a uniform) ERROR: 0:43: 'assign' : l-value required "v4" (can't modify a uniform)
ERROR: 0:48: 'gl_PointSize' : cannot change arrayness of redeclared block member ERROR: 0:48: 'gl_PointSize' : cannot change arrayness of redeclared block member
...@@ -123,8 +123,8 @@ ERROR: node is still EOpNull! ...@@ -123,8 +123,8 @@ ERROR: node is still EOpNull!
Linked geometry stage: Linked geometry stage:
ERROR: Linking geometry stage: Missing entry point: Each stage requires one "void main()" entry point ERROR: Linking geometry stage: Missing entry point: Each stage requires one "void main()" entry point
ERROR: Linking geometry stage: At least one geometry shader must specify an output layout primitive ERROR: Linking geometry stage: At least one shader must specify an output layout primitive
ERROR: Linking geometry stage: At least one geometry shader must specify a layout(max_vertices = value) ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
invocations = 0 invocations = 0
max_vertices = 0 max_vertices = 0
......
420.tesc
Warning, version 400 is not yet complete; some version-specific features are present, but many are missing.
ERROR: 0:7: 'vertices' : inconsistent output number of vertices for array size gl_out
ERROR: 0:11: 'vertices' : inconsistent output number of vertices for array size a
ERROR: 0:12: 'vertices' : inconsistent output number of vertices for array size outb
ERROR: 0:26: 'gl_PointSize' : no such field in structure
ERROR: 0:26: 'assign' : cannot convert from 'float' to 'block{gl_Position}'
ERROR: 5 compilation errors. No code generated.
vertices = 4
ERROR: node is still EOpNull!
0:15 Function Definition: main( (void)
0:15 Function Parameters:
0:17 Sequence
0:17 Sequence
0:17 move second child to first child (4-component vector of float)
0:17 'p' (4-component vector of float)
0:17 gl_Position: direct index for structure (4-component vector of float)
0:17 direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
0:17 'gl_in' (in 32-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:17 Constant:
0:17 1 (const int)
0:17 Constant:
0:17 0 (const int)
0:18 Sequence
0:18 move second child to first child (float)
0:18 'ps' (float)
0:18 gl_PointSize: direct index for structure (float)
0:18 direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
0:18 'gl_in' (in 32-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:18 Constant:
0:18 1 (const int)
0:18 Constant:
0:18 1 (const int)
0:19 Sequence
0:19 move second child to first child (float)
0:19 'cd' (float)
0:19 direct index (float)
0:19 gl_ClipDistance: direct index for structure (unsized array of float)
0:19 direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
0:19 'gl_in' (in 32-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:19 Constant:
0:19 1 (const int)
0:19 Constant:
0:19 2 (const int)
0:19 Constant:
0:19 2 (const int)
0:21 Sequence
0:21 move second child to first child (int)
0:21 'pvi' (int)
0:21 'gl_PatchVerticesIn' (in int)
0:22 Sequence
0:22 move second child to first child (int)
0:22 'pid' (int)
0:22 'gl_PrimitiveID' (in int)
0:23 Sequence
0:23 move second child to first child (int)
0:23 'iid' (int)
0:23 'gl_InvocationID' (in int)
0:25 move second child to first child (4-component vector of float)
0:25 gl_Position: direct index for structure (4-component vector of float)
0:25 direct index (block{gl_Position})
0:25 'gl_out' (out 3-element array of block{gl_Position})
0:25 Constant:
0:25 1 (const int)
0:25 Constant:
0:25 0 (const int)
0:25 'p' (4-component vector of float)
0:26 direct index (block{gl_Position})
0:26 'gl_out' (out 3-element array of block{gl_Position})
0:26 Constant:
0:26 1 (const int)
0:? Linker Objects
0:? 'gl_out' (out 3-element array of block{gl_Position})
0:? 'a' (out 3-element array of int)
0:? 'outb' (out 5-element array of int)
0:? 'outc' (out 4-element array of int)
Linked tessellation control stage:
vertices = 4
...@@ -163,7 +163,7 @@ ERROR: node is still EOpNull! ...@@ -163,7 +163,7 @@ ERROR: node is still EOpNull!
Linked tessellation evaluation stage: Linked tessellation evaluation stage:
ERROR: Linking tessellation evaluation stage: At least one tessellation shader must specify an input layout primitive ERROR: Linking tessellation evaluation stage: At least one shader must specify an input layout primitive
input primitive = none input primitive = none
vertex spacing = equal_spacing vertex spacing = equal_spacing
......
420_size_gl_in.geom
Warning, version 420 is not yet complete; some version-specific features are present, but many are missing.
ERROR: 0:19: 'gl_PerVertex' : can only redeclare a built-in block once, and before any use
ERROR: 1 compilation errors. No code generated.
invocations = 0
max_vertices = 0
input primitive = triangles
output primitive = none
ERROR: node is still EOpNull!
0:11 Function Definition: foo( (void)
0:11 Function Parameters:
0:13 Sequence
0:13 Constant:
0:13 3 (const int)
0:14 gl_Position: direct index for structure (4-component vector of float)
0:14 direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
0:14 'gl_in' (in 3-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:14 Constant:
0:14 1 (const int)
0:14 Constant:
0:14 0 (const int)
0:15 Constant:
0:15 3 (const int)
0:16 gl_Position: direct index for structure (4-component vector of float)
0:16 indirect index (block{gl_Position,gl_PointSize,gl_ClipDistance})
0:16 'gl_in' (in 3-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:16 'i' (int)
0:16 Constant:
0:16 0 (const int)
0:? Linker Objects
0:? 'i' (int)
0:? 'colorun' (in 3-element array of 4-component vector of float)
0:? 'color3' (in 3-element array of 4-component vector of float)
0:? 'gl_in' (in 3-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
Linked geometry stage:
ERROR: Linking geometry stage: Missing entry point: Each stage requires one "void main()" entry point
ERROR: Linking geometry stage: At least one shader must specify an output layout primitive
ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
invocations = 0
max_vertices = 0
input primitive = triangles
output primitive = none
...@@ -44,8 +44,8 @@ Linked geometry stage: ...@@ -44,8 +44,8 @@ Linked geometry stage:
ERROR: Linking geometry stage: Contradictory output layout primitives ERROR: Linking geometry stage: Contradictory output layout primitives
ERROR: Linking geometry stage: Missing entry point: Each stage requires one "void main()" entry point ERROR: Linking geometry stage: Missing entry point: Each stage requires one "void main()" entry point
ERROR: Linking geometry stage: At least one geometry shader must specify an input layout primitive ERROR: Linking geometry stage: At least one shader must specify an input layout primitive
ERROR: Linking geometry stage: At least one geometry shader must specify a layout(max_vertices = value) ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
Linked fragment stage: Linked fragment stage:
......
...@@ -49,7 +49,9 @@ tokenLength.vert ...@@ -49,7 +49,9 @@ tokenLength.vert
300scope.vert 300scope.vert
400.frag 400.frag
420.vert 420.vert
420.tesc
420.geom 420.geom
420_size_gl_in.geom
430scope.vert 430scope.vert
lineContinuation100.vert lineContinuation100.vert
lineContinuation.vert lineContinuation.vert
...@@ -58,6 +60,7 @@ numeral.frag ...@@ -58,6 +60,7 @@ numeral.frag
400.tesc 400.tesc
400.tese 400.tese
410.geom 410.geom
410.tesc
420.tese 420.tese
430.vert 430.vert
430.comp 430.comp
......
...@@ -9,5 +9,5 @@ ...@@ -9,5 +9,5 @@
// source have to figure out how to create revision.h just to get a build // source have to figure out how to create revision.h just to get a build
// going. However, if it is not updated, it can be a version behind. // going. However, if it is not updated, it can be a version behind.
#define GLSLANG_REVISION "24480" #define GLSLANG_REVISION "24486"
#define GLSLANG_DATE "2013/12/11 15:38:19" #define GLSLANG_DATE "2013/12/11 18:25:37"
...@@ -84,9 +84,13 @@ public: ...@@ -84,9 +84,13 @@ public:
TIntermTyped* handleBracketDereference(TSourceLoc, TIntermTyped* base, TIntermTyped* index); TIntermTyped* handleBracketDereference(TSourceLoc, TIntermTyped* base, TIntermTyped* index);
void checkIndex(TSourceLoc, const TType&, int& index); void checkIndex(TSourceLoc, const TType&, int& index);
void handleIndexLimits(TSourceLoc, TIntermTyped* base, TIntermTyped* index); void handleIndexLimits(TSourceLoc, TIntermTyped* base, TIntermTyped* index);
void handleInputArrayAccess(TSourceLoc, TIntermTyped* base);
void checkInputArrayConsistency(TSourceLoc, bool tailOnly = false); bool isIoResizeArray(const TType&);
void checkInputArrayConsistency(TSourceLoc, TLayoutGeometry, TType&, const TString&); void handleIoResizeArrayAccess(TSourceLoc, TIntermTyped* base);
void checkIoArraysConsistency(TSourceLoc, bool tailOnly = false);
int getIoArrayImplicitSize() const;
void checkIoArrayConsistency(TSourceLoc, int requiredSize, const char* feature, TType&, const TString&);
TIntermTyped* handleDotDereference(TSourceLoc, TIntermTyped* base, TString& field); TIntermTyped* handleDotDereference(TSourceLoc, TIntermTyped* base, TString& field);
TFunction* handleFunctionDeclarator(TSourceLoc loc, TFunction& function, bool prototype); TFunction* handleFunctionDeclarator(TSourceLoc loc, TFunction& function, bool prototype);
TIntermAggregate* handleFunctionDefinition(TSourceLoc, TFunction&); TIntermAggregate* handleFunctionDefinition(TSourceLoc, TFunction&);
...@@ -257,6 +261,11 @@ protected: ...@@ -257,6 +261,11 @@ protected:
// //
// Geometry shader input arrays: // Geometry shader input arrays:
// - array sizing is based on input primitive and/or explicit size // - array sizing is based on input primitive and/or explicit size
//
// Tessellation control output arrays:
// - array sizing is based on output layout(vertices=...) and/or explicit size
//
// Both:
// - array sizing is retroactive // - array sizing is retroactive
// - built-in block redeclarations interact with this // - built-in block redeclarations interact with this
// //
...@@ -270,23 +279,23 @@ protected: ...@@ -270,23 +279,23 @@ protected:
// - the resize-list starts empty at beginning of user-shader compilation, it does // - the resize-list starts empty at beginning of user-shader compilation, it does
// not have built-ins in it // not have built-ins in it
// //
// - on built-in input array use: copy-up symbol and add both the symbol and // - on built-in array use: copy-up symbol and add both the symbol and
// its use to resize-list // its use to resize-list
// //
// - on user-input array declaration: add it to the resize-list // - on user array declaration: add it to the resize-list
// //
// - on block redeclaration: copy-up symbol and add it to the resize-list // - on block redeclaration: copy-up symbol and add it to the resize-list
// * note, that appropriately gives an error if redeclaring a block that // * note, that appropriately gives an error if redeclaring a block that
// was already used and hence already copied-up // was already used and hence already copied-up
// //
// - on seeing an input primitive-layout declaration, fix everything in the resize-list, // - on seeing a layout declaration that sizes the array, fix everything in the
// giving errors for mismatch // resize-list, giving errors for mismatch
// //
// - on seeing an array size declaration, give errors on mismatch between it and previous // - on seeing an array size declaration, give errors on mismatch between it and previous
// input primitive declarations // array-sizing declarations
// //
TVector<TIntermSymbol*> inputArrayNodeResizeList; TVector<TIntermSymbol*> ioArrayNodeResizeList;
TVector<TSymbol*> inputArraySymbolResizeList; TVector<TSymbol*> ioArraySymbolResizeList;
}; };
} // end namespace glslang } // end namespace glslang
......
...@@ -88,8 +88,14 @@ void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit) ...@@ -88,8 +88,14 @@ void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit)
if (vertices == 0) if (vertices == 0)
vertices = unit.vertices; vertices = unit.vertices;
else if (vertices != unit.vertices) else if (vertices != unit.vertices) {
if (language == EShLangGeometry)
error(infoSink, "Contradictory layout max_vertices values"); error(infoSink, "Contradictory layout max_vertices values");
else if (language == EShLangTessControl)
error(infoSink, "Contradictory layout vertices values");
else
assert(0);
}
if (vertexSpacing == EvsNone) if (vertexSpacing == EvsNone)
vertexSpacing = unit.vertexSpacing; vertexSpacing = unit.vertexSpacing;
...@@ -297,11 +303,14 @@ void TIntermediate::finalCheck(TInfoSink& infoSink) ...@@ -297,11 +303,14 @@ void TIntermediate::finalCheck(TInfoSink& infoSink)
switch (language) { switch (language) {
case EShLangVertex: case EShLangVertex:
break;
case EShLangTessControl: case EShLangTessControl:
if (vertices == 0)
error(infoSink, "At least one shader must specify an output layout(vertices=...)");
break; break;
case EShLangTessEvaluation: case EShLangTessEvaluation:
if (inputPrimitive == ElgNone) if (inputPrimitive == ElgNone)
error(infoSink, "At least one tessellation shader must specify an input layout primitive"); error(infoSink, "At least one shader must specify an input layout primitive");
if (vertexSpacing == EvsNone) if (vertexSpacing == EvsNone)
vertexSpacing = EvsEqual; vertexSpacing = EvsEqual;
if (vertexOrder == EvoNone) if (vertexOrder == EvoNone)
...@@ -309,13 +318,14 @@ void TIntermediate::finalCheck(TInfoSink& infoSink) ...@@ -309,13 +318,14 @@ void TIntermediate::finalCheck(TInfoSink& infoSink)
break; break;
case EShLangGeometry: case EShLangGeometry:
if (inputPrimitive == ElgNone) if (inputPrimitive == ElgNone)
error(infoSink, "At least one geometry shader must specify an input layout primitive"); error(infoSink, "At least one shader must specify an input layout primitive");
if (outputPrimitive == ElgNone) if (outputPrimitive == ElgNone)
error(infoSink, "At least one geometry shader must specify an output layout primitive"); error(infoSink, "At least one shader must specify an output layout primitive");
if (vertices == 0) if (vertices == 0)
error(infoSink, "At least one geometry shader must specify a layout(max_vertices = value)"); error(infoSink, "At least one shader must specify a layout(max_vertices = value)");
break; break;
case EShLangFragment: case EShLangFragment:
break;
case EShLangCompute: case EShLangCompute:
break; break;
} }
......
...@@ -129,6 +129,7 @@ public: ...@@ -129,6 +129,7 @@ public:
vertices = m; vertices = m;
return true; return true;
} }
int getVertices() const { return vertices; }
bool setInputPrimitive(TLayoutGeometry p) bool setInputPrimitive(TLayoutGeometry p)
{ {
if (inputPrimitive != ElgNone) if (inputPrimitive != ElgNone)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment