Add link-time checks for max_vertices, input primitive, and output primitive for existence and matching.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24157 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-11-20 22:16:41 +00:00
parent 5134b9cf57
commit 1e91f5ee8d
9 changed files with 53 additions and 9 deletions

View File

@ -70,5 +70,6 @@ ERROR: node is still EOpNull!
Linked geometry stage:
ERROR: Linking geometry stage: At least one geometry shader must specify an output layout primitive

View File

@ -46,5 +46,8 @@ ERROR: node is still EOpNull!
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 geometry shader must specify an output layout primitive
ERROR: Linking geometry stage: At least one geometry shader must specify a layout(max_vertices = value)

View File

@ -120,5 +120,7 @@ ERROR: node is still EOpNull!
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 geometry shader must specify an output layout primitive
ERROR: Linking geometry stage: At least one geometry shader must specify a layout(max_vertices = value)

View File

@ -21,7 +21,7 @@ ERROR: 1 compilation errors. No code generated.
invocations = 0
max_vertices = 0
input primitive = none
output primitive = none
output primitive = points
ERROR: node is still EOpNull!
0:3 Function Definition: foo( (void)
0:3 Function Parameters:
@ -33,7 +33,7 @@ Warning, version 150 is not yet complete; some version-specific features are pre
invocations = 0
max_vertices = 0
input primitive = none
output primitive = none
output primitive = line_strip
0:? Sequence
0:3 Function Definition: bar( (void)
0:3 Function Parameters:
@ -42,7 +42,10 @@ output primitive = none
Linked geometry stage:
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: At least one geometry shader must specify an input layout primitive
ERROR: Linking geometry stage: At least one geometry shader must specify a layout(max_vertices = value)
Linked fragment stage:
@ -52,7 +55,7 @@ ERROR: Linking fragment stage: Multiple function bodies in multiple compilation
invocations = 0
max_vertices = 0
input primitive = none
output primitive = none
output primitive = points
ERROR: node is still EOpNull!
0:3 Function Definition: foo( (void)
0:3 Function Parameters:

View File

@ -3,3 +3,5 @@
void foo()
{
}
layout(points) out;

View File

@ -3,3 +3,5 @@
void bar()
{
}
layout(line_strip) out;

View File

@ -25,20 +25,20 @@ Link Validation
- number of texture image units
- texel offsets (or compile-time?)
- number of input/output compononents
- tessellation limits
- 4.x tessellation limits
- 1.50: geometry shaders: max_vertices must be checked against gl_MaxGeometryOutputVertices (maybe at compile time)
- Non ES: gl_TexCoord can only have a max array size of up to gl_MaxTextureCoords
- ...
+ exactly one main
+ ES 3.0: fragment outputs all have locations, if more than one
- ES 3.0: location aliasing/overlap (except desktop vertex shader inputs)
- Non ES: binding overlap?
- Non ES: gl_TexCoord can only have a max array size of up to gl_MaxTextureCoords
+ Non ES: geometry shader input array sizes and input layout qualifier declaration
+ Non ES: read or write to both gl_ClipVertex and gl_ClipDistance
+ Non ES: write to only one of gl_FragColor, gl_FragData, or user-declared
+ 1.50: match between all explicit input array sizes and input primitive
- 1.50: at least one geometry shader says input primitive and at least one says output primitive...
- 1.50: at least one geometry shader says max_vertices...
- 1.50: geometry shaders: max_vertices must be checked against gl_MaxGeometryOutputVertices (maybe at compile time)
+ 1.50: at least one geometry shader says input primitive and at least one says output primitive...
+ 1.50: at least one geometry shader says max_vertices...
+ 1.50: origin_upper_left and pixel_center_integer have to match
- Even the potential for recursion through subroutine uniforms is an error.
- 4.4: An interface contains two different blocks, each with no instance name, where the blocks contain a member with the same name.

View File

@ -76,6 +76,19 @@ void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit)
if (originUpperLeft != unit.originUpperLeft || pixelCenterInteger != unit.pixelCenterInteger)
error(infoSink, "gl_FragCoord redeclarations must match across shaders\n");
if (inputPrimitive == ElgNone)
inputPrimitive = unit.inputPrimitive;
else if (inputPrimitive != unit.inputPrimitive)
error(infoSink, "Contradictory input layout primitives");
if (outputPrimitive == ElgNone)
outputPrimitive = unit.outputPrimitive;
else if (outputPrimitive != unit.outputPrimitive)
error(infoSink, "Contradictory output layout primitives");
if (maxVertices == 0)
maxVertices = unit.maxVertices;
else if (maxVertices != unit.maxVertices)
error(infoSink, "Contradictory layout max_vertices values");
if (unit.treeRoot == 0)
return;
@ -259,6 +272,24 @@ void TIntermediate::errorCheck(TInfoSink& infoSink)
error(infoSink, "Cannot use gl_FragColor or gl_FragData when using user-defined outputs");
if (inIoAccessed("gl_FragColor") && inIoAccessed("gl_FragData"))
error(infoSink, "Cannot use both gl_FragColor and gl_FragData");
switch (language) {
case EShLangVertex:
case EShLangTessControl:
case EShLangTessEvaluation:
break;
case EShLangGeometry:
if (inputPrimitive == ElgNone)
error(infoSink, "At least one geometry shader must specify an input layout primitive");
if (outputPrimitive == ElgNone)
error(infoSink, "At least one geometry shader must specify an output layout primitive");
if (maxVertices == 0)
error(infoSink, "At least one geometry shader must specify a layout(max_vertices = value)");
break;
case EShLangFragment:
case EShLangCompute:
break;
}
}
//

View File

@ -184,7 +184,7 @@ protected:
bool currentPath;
bool errorGiven;
};
typedef TList<TCall> TGraph;
typedef std::list<TCall> TGraph;
TGraph callGraph;
std::set<TString> ioAccessed; // set of names of statically read/written I/O that might need extra checking