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

@ -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;
}
}
//