11889817926aa62a5f8d308c118f38acd882565eeJohn Richardson/*-------------------------------------------------------------------------
21889817926aa62a5f8d308c118f38acd882565eeJohn Richardson * drawElements Quality Program OpenGL ES 3.1 Module
31889817926aa62a5f8d308c118f38acd882565eeJohn Richardson * -------------------------------------------------
41889817926aa62a5f8d308c118f38acd882565eeJohn Richardson *
51889817926aa62a5f8d308c118f38acd882565eeJohn Richardson * Copyright 2016 The Android Open Source Project
61889817926aa62a5f8d308c118f38acd882565eeJohn Richardson *
71889817926aa62a5f8d308c118f38acd882565eeJohn Richardson * Licensed under the Apache License, Version 2.0 (the "License");
81889817926aa62a5f8d308c118f38acd882565eeJohn Richardson * you may not use this file except in compliance with the License.
91889817926aa62a5f8d308c118f38acd882565eeJohn Richardson * You may obtain a copy of the License at
101889817926aa62a5f8d308c118f38acd882565eeJohn Richardson *
111889817926aa62a5f8d308c118f38acd882565eeJohn Richardson *      http://www.apache.org/licenses/LICENSE-2.0
121889817926aa62a5f8d308c118f38acd882565eeJohn Richardson *
131889817926aa62a5f8d308c118f38acd882565eeJohn Richardson * Unless required by applicable law or agreed to in writing, software
141889817926aa62a5f8d308c118f38acd882565eeJohn Richardson * distributed under the License is distributed on an "AS IS" BASIS,
151889817926aa62a5f8d308c118f38acd882565eeJohn Richardson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
161889817926aa62a5f8d308c118f38acd882565eeJohn Richardson * See the License for the specific language governing permissions and
171889817926aa62a5f8d308c118f38acd882565eeJohn Richardson * limitations under the License.
181889817926aa62a5f8d308c118f38acd882565eeJohn Richardson *
191889817926aa62a5f8d308c118f38acd882565eeJohn Richardson *//*!
201889817926aa62a5f8d308c118f38acd882565eeJohn Richardson * \file
211889817926aa62a5f8d308c118f38acd882565eeJohn Richardson * \brief Negative Tessellation tests.
221889817926aa62a5f8d308c118f38acd882565eeJohn Richardson *//*--------------------------------------------------------------------*/
231889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
241889817926aa62a5f8d308c118f38acd882565eeJohn Richardson#include "es31fNegativeTessellationTests.hpp"
251889817926aa62a5f8d308c118f38acd882565eeJohn Richardson#include "gluContextInfo.hpp"
261889817926aa62a5f8d308c118f38acd882565eeJohn Richardson#include "gluShaderProgram.hpp"
271889817926aa62a5f8d308c118f38acd882565eeJohn Richardson#include "glwDefs.hpp"
281889817926aa62a5f8d308c118f38acd882565eeJohn Richardson#include "glwEnums.hpp"
291889817926aa62a5f8d308c118f38acd882565eeJohn Richardson#include "tcuStringTemplate.hpp"
301889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
311889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonnamespace deqp
321889817926aa62a5f8d308c118f38acd882565eeJohn Richardson{
331889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
341889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonusing std::string;
351889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonusing std::map;
361889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
371889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonnamespace gles31
381889817926aa62a5f8d308c118f38acd882565eeJohn Richardson{
391889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonnamespace Functional
401889817926aa62a5f8d308c118f38acd882565eeJohn Richardson{
411889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonnamespace NegativeTestShared
421889817926aa62a5f8d308c118f38acd882565eeJohn Richardson{
431889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
441889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonusing tcu::TestLog;
451889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonusing namespace glw;
461889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
471889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonstatic const char* vertexShaderSource		=	"${GLSL_VERSION_STRING}\n"
481889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"\n"
491889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"void main (void)\n"
501889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"{\n"
511889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"	gl_Position = vec4(0.0);\n"
521889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"}\n";
531889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
541889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonstatic const char* fragmentShaderSource		=	"${GLSL_VERSION_STRING}\n"
551889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"precision mediump float;\n"
561889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"layout(location = 0) out mediump vec4 fragColor;\n"
571889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"\n"
581889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"void main (void)\n"
591889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"{\n"
601889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"	fragColor = vec4(1.0);\n"
611889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"}\n";
621889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
631889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonstatic const char* tessControlShaderSource	=	"${GLSL_VERSION_STRING}\n"
641889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"${GLSL_TESS_EXTENSION_STRING}\n"
651889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"layout (vertices=3) out;\n"
661889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"\n"
671889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"void main()\n"
681889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"{\n"
691889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"	gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;\n"
701889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"}\n";
711889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
721889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonstatic const char* tessEvalShaderSource		=	"${GLSL_VERSION_STRING}\n"
731889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"${GLSL_TESS_EXTENSION_STRING}\n"
741889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"layout(triangles) in;\n"
751889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"\n"
761889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"void main()\n"
771889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"{\n"
781889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"	gl_Position = gl_TessCoord[0] * gl_in[0].gl_Position;\n"
791889817926aa62a5f8d308c118f38acd882565eeJohn Richardson												"}\n";
801889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
811889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonstatic void checkExtensionSupport (NegativeTestContext& ctx, const char* extName)
821889817926aa62a5f8d308c118f38acd882565eeJohn Richardson{
831889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	if (!ctx.getContextInfo().isExtensionSupported(extName))
841889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		throw tcu::NotSupportedError(string(extName) + " not supported");
851889817926aa62a5f8d308c118f38acd882565eeJohn Richardson}
861889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
871889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonstatic void checkTessellationSupport (NegativeTestContext& ctx)
881889817926aa62a5f8d308c118f38acd882565eeJohn Richardson{
891889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	checkExtensionSupport(ctx, "GL_EXT_tessellation_shader");
901889817926aa62a5f8d308c118f38acd882565eeJohn Richardson}
911889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
921889817926aa62a5f8d308c118f38acd882565eeJohn Richardson// Helper for constructing tessellation pipeline sources.
931889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonstatic glu::ProgramSources makeTessPipelineSources (const std::string& vertexSrc, const std::string& fragmentSrc, const std::string& tessCtrlSrc, const std::string& tessEvalSrc)
941889817926aa62a5f8d308c118f38acd882565eeJohn Richardson{
951889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	glu::ProgramSources sources;
961889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	sources.sources[glu::SHADERTYPE_VERTEX].push_back(vertexSrc);
971889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	sources.sources[glu::SHADERTYPE_FRAGMENT].push_back(fragmentSrc);
981889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
991889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	if (!tessCtrlSrc.empty())
1001889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		sources.sources[glu::SHADERTYPE_TESSELLATION_CONTROL].push_back(tessCtrlSrc);
1011889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
1021889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	if (!tessEvalSrc.empty())
1031889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		sources.sources[glu::SHADERTYPE_TESSELLATION_EVALUATION].push_back(tessEvalSrc);
1041889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
1051889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	return sources;
1061889817926aa62a5f8d308c118f38acd882565eeJohn Richardson}
1071889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
1081889817926aa62a5f8d308c118f38acd882565eeJohn Richardson// Incomplete active tess shaders
1091889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonvoid single_tessellation_stage (NegativeTestContext& ctx)
1101889817926aa62a5f8d308c118f38acd882565eeJohn Richardson{
1111889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	const bool					isES32	= glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
1122c74c73891c545cfe4d8462a2d865087efd879dbMark Adams	const bool					requireTES = !ctx.getContextInfo().isExtensionSupported("GL_NV_gpu_shader5");
1131889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	map<string, string>			args;
1141889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	args["GLSL_VERSION_STRING"]			= isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES);
1151889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	args["GLSL_TESS_EXTENSION_STRING"]	= isES32 ? "" : "#extension GL_EXT_tessellation_shader : require";
1161889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
1171889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	checkTessellationSupport(ctx);
1181889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
1191889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	{
1201889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		glu::ShaderProgram program(ctx.getRenderContext(),
1211889817926aa62a5f8d308c118f38acd882565eeJohn Richardson								   makeTessPipelineSources(tcu::StringTemplate(vertexShaderSource).specialize(args),
1221889817926aa62a5f8d308c118f38acd882565eeJohn Richardson														   tcu::StringTemplate(fragmentShaderSource).specialize(args),
1231889817926aa62a5f8d308c118f38acd882565eeJohn Richardson														   tcu::StringTemplate(tessControlShaderSource).specialize(args),
1240a9f969930a90484eae0ebcecd475f77236ce691Kenneth Graunke														   "")); // missing tessEvalShaderSource
1250a9f969930a90484eae0ebcecd475f77236ce691Kenneth Graunke		tcu::TestLog& log = ctx.getLog();
1260a9f969930a90484eae0ebcecd475f77236ce691Kenneth Graunke		log << program;
1270a9f969930a90484eae0ebcecd475f77236ce691Kenneth Graunke
1282c74c73891c545cfe4d8462a2d865087efd879dbMark Adams		ctx.beginSection("A link error is generated if a non-separable program has a tessellation control shader but no tessellation evaluation shader, unless GL_NV_gpu_shader5 is supported.");
1290a9f969930a90484eae0ebcecd475f77236ce691Kenneth Graunke
1302c74c73891c545cfe4d8462a2d865087efd879dbMark Adams		if (requireTES && program.isOk())
1310a9f969930a90484eae0ebcecd475f77236ce691Kenneth Graunke			ctx.fail("Program was not expected to link");
1322c74c73891c545cfe4d8462a2d865087efd879dbMark Adams		else if (!requireTES && !program.isOk())
1332c74c73891c545cfe4d8462a2d865087efd879dbMark Adams			ctx.fail("Program was expected to link");
1340a9f969930a90484eae0ebcecd475f77236ce691Kenneth Graunke
1350a9f969930a90484eae0ebcecd475f77236ce691Kenneth Graunke		ctx.endSection();
1360a9f969930a90484eae0ebcecd475f77236ce691Kenneth Graunke	}
1370a9f969930a90484eae0ebcecd475f77236ce691Kenneth Graunke
1380a9f969930a90484eae0ebcecd475f77236ce691Kenneth Graunke	{
1390a9f969930a90484eae0ebcecd475f77236ce691Kenneth Graunke		glu::ShaderProgram program(ctx.getRenderContext(),
1400a9f969930a90484eae0ebcecd475f77236ce691Kenneth Graunke								   makeTessPipelineSources(tcu::StringTemplate(vertexShaderSource).specialize(args),
1410a9f969930a90484eae0ebcecd475f77236ce691Kenneth Graunke														   tcu::StringTemplate(fragmentShaderSource).specialize(args),
1420a9f969930a90484eae0ebcecd475f77236ce691Kenneth Graunke														   tcu::StringTemplate(tessControlShaderSource).specialize(args),
1431b9d89f86ae4045fad08b2775cdab9dd459c86d3Kenneth Graunke														   "") // missing tessEvalShaderSource
1441b9d89f86ae4045fad08b2775cdab9dd459c86d3Kenneth Graunke								   << glu::ProgramSeparable(true));
1451889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		tcu::TestLog& log = ctx.getLog();
1461889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		log << program;
1471889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
1481b9d89f86ae4045fad08b2775cdab9dd459c86d3Kenneth Graunke		if (!program.isOk())
1491b9d89f86ae4045fad08b2775cdab9dd459c86d3Kenneth Graunke			TCU_THROW(TestError, "failed to build program");
1501b9d89f86ae4045fad08b2775cdab9dd459c86d3Kenneth Graunke
1511889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		ctx.glUseProgram(program.getProgram());
1521889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		ctx.expectError(GL_NO_ERROR);
1531889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
1542c74c73891c545cfe4d8462a2d865087efd879dbMark Adams		ctx.beginSection("GL_INVALID_OPERATION is generated if current program state has tessellation control shader but no tessellation evaluation shader, unless GL_NV_gpu_shader5 is supported.");
1551889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		ctx.glDrawArrays(GL_PATCHES, 0, 3);
1562c74c73891c545cfe4d8462a2d865087efd879dbMark Adams		ctx.expectError(requireTES ? GL_INVALID_OPERATION : GL_NO_ERROR);
1571889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		ctx.endSection();
1581889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
1591889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		ctx.glUseProgram(0);
1601889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	}
1611889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
1621889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	{
1631889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		glu::ShaderProgram program(ctx.getRenderContext(),
1641889817926aa62a5f8d308c118f38acd882565eeJohn Richardson								   makeTessPipelineSources(tcu::StringTemplate(vertexShaderSource).specialize(args),
1651889817926aa62a5f8d308c118f38acd882565eeJohn Richardson														   tcu::StringTemplate(fragmentShaderSource).specialize(args),
1661889817926aa62a5f8d308c118f38acd882565eeJohn Richardson														   "", // missing tessControlShaderSource
1671889817926aa62a5f8d308c118f38acd882565eeJohn Richardson														   tcu::StringTemplate(tessEvalShaderSource).specialize(args)));
1681889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		tcu::TestLog& log = ctx.getLog();
1691889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		log << program;
1701889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
17159999de58c98533dafb70d04928101bff647536cJohn Richardson		ctx.beginSection("A link error is generated if a non-separable program has a tessellation evaluation shader but no tessellation control shader.");
17259999de58c98533dafb70d04928101bff647536cJohn Richardson
17359999de58c98533dafb70d04928101bff647536cJohn Richardson		if (program.isOk())
17459999de58c98533dafb70d04928101bff647536cJohn Richardson			ctx.fail("Program was not expected to link");
17559999de58c98533dafb70d04928101bff647536cJohn Richardson
17659999de58c98533dafb70d04928101bff647536cJohn Richardson		ctx.endSection();
17759999de58c98533dafb70d04928101bff647536cJohn Richardson	}
17859999de58c98533dafb70d04928101bff647536cJohn Richardson
17959999de58c98533dafb70d04928101bff647536cJohn Richardson	{
18059999de58c98533dafb70d04928101bff647536cJohn Richardson		glu::ShaderProgram program(ctx.getRenderContext(),
18159999de58c98533dafb70d04928101bff647536cJohn Richardson								   makeTessPipelineSources(tcu::StringTemplate(vertexShaderSource).specialize(args),
18259999de58c98533dafb70d04928101bff647536cJohn Richardson														   tcu::StringTemplate(fragmentShaderSource).specialize(args),
18359999de58c98533dafb70d04928101bff647536cJohn Richardson														   "", // missing tessControlShaderSource
18459999de58c98533dafb70d04928101bff647536cJohn Richardson														   tcu::StringTemplate(tessEvalShaderSource).specialize(args))
18559999de58c98533dafb70d04928101bff647536cJohn Richardson									<< glu::ProgramSeparable(true));
18659999de58c98533dafb70d04928101bff647536cJohn Richardson		tcu::TestLog& log = ctx.getLog();
18759999de58c98533dafb70d04928101bff647536cJohn Richardson		log << program;
18859999de58c98533dafb70d04928101bff647536cJohn Richardson
18959999de58c98533dafb70d04928101bff647536cJohn Richardson		if (!program.isOk())
19059999de58c98533dafb70d04928101bff647536cJohn Richardson			TCU_THROW(TestError, "failed to build program");
19159999de58c98533dafb70d04928101bff647536cJohn Richardson
1921889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		ctx.glUseProgram(program.getProgram());
1931889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		ctx.expectError(GL_NO_ERROR);
1941889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
1951889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		ctx.beginSection("GL_INVALID_OPERATION is generated if current program state has tessellation evaluation shader but no tessellation control shader.");
1961889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		ctx.glDrawArrays(GL_PATCHES, 0, 3);
1971889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		ctx.expectError(GL_INVALID_OPERATION);
1981889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		ctx.endSection();
1991889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2001889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		ctx.glUseProgram(0);
2011889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	}
2021889817926aa62a5f8d308c118f38acd882565eeJohn Richardson}
2031889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2041889817926aa62a5f8d308c118f38acd882565eeJohn Richardson// Complete active tess shaders invalid primitive mode
2051889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonvoid invalid_primitive_mode (NegativeTestContext& ctx)
2061889817926aa62a5f8d308c118f38acd882565eeJohn Richardson{
2071889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	checkTessellationSupport(ctx);
2081889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2091889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	const bool					isES32	= glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
2101889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	map<string, string>			args;
2111889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	args["GLSL_VERSION_STRING"]			= isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES);
2121889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	args["GLSL_TESS_EXTENSION_STRING"]	= isES32 ? "" : "#extension GL_EXT_tessellation_shader : require";
2131889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2141889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	glu::ShaderProgram program(ctx.getRenderContext(),
2151889817926aa62a5f8d308c118f38acd882565eeJohn Richardson							   makeTessPipelineSources(tcu::StringTemplate(vertexShaderSource).specialize(args),
2161889817926aa62a5f8d308c118f38acd882565eeJohn Richardson													   tcu::StringTemplate(fragmentShaderSource).specialize(args),
2171889817926aa62a5f8d308c118f38acd882565eeJohn Richardson													   tcu::StringTemplate(tessControlShaderSource).specialize(args),
2181889817926aa62a5f8d308c118f38acd882565eeJohn Richardson													   tcu::StringTemplate(tessEvalShaderSource).specialize(args)));
2191889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	tcu::TestLog& log = ctx.getLog();
2201889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	log << program;
2211889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2221889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glUseProgram(program.getProgram());
2231889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.expectError(GL_NO_ERROR);
2241889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2251889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.beginSection("GL_INVALID_OPERATION is generated if tessellation is active and primitive mode is not GL_PATCHES.");
2261889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glDrawArrays(GL_TRIANGLES, 0, 3);
2271889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.expectError(GL_INVALID_OPERATION);
2281889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.endSection();
2291889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2301889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glUseProgram(0);
2311889817926aa62a5f8d308c118f38acd882565eeJohn Richardson}
2321889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2331889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonvoid tessellation_not_active (NegativeTestContext& ctx)
2341889817926aa62a5f8d308c118f38acd882565eeJohn Richardson{
2351889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	checkTessellationSupport(ctx);
2361889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2371889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	const bool					isES32	= glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
2380e7a9e61aed02cd14b597c89cd0c47a3b61aa497Mark Adams	const glw::GLenum			tessErr = ctx.getContextInfo().isExtensionSupported("GL_NV_gpu_shader5") ? GL_NO_ERROR : GL_INVALID_OPERATION;
2391889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	map<string, string>			args;
2401889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	args["GLSL_VERSION_STRING"]			= isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES);
2411889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	args["GLSL_TESS_EXTENSION_STRING"]	= isES32 ? "" : "#extension GL_EXT_tessellation_shader : require";
2421889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2431889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	glu::ShaderProgram program(ctx.getRenderContext(),
2441889817926aa62a5f8d308c118f38acd882565eeJohn Richardson							   makeTessPipelineSources(tcu::StringTemplate(vertexShaderSource).specialize(args),
2451889817926aa62a5f8d308c118f38acd882565eeJohn Richardson													   tcu::StringTemplate(fragmentShaderSource).specialize(args),
2461889817926aa62a5f8d308c118f38acd882565eeJohn Richardson													   "",		// missing tessControlShaderSource
2471889817926aa62a5f8d308c118f38acd882565eeJohn Richardson													   ""));	// missing tessEvalShaderSource
2481889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	tcu::TestLog& log = ctx.getLog();
2491889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	log << program;
2501889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2511889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glUseProgram(program.getProgram());
2521889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.expectError(GL_NO_ERROR);
2531889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2540e7a9e61aed02cd14b597c89cd0c47a3b61aa497Mark Adams	ctx.beginSection("GL_INVALID_OPERATION is generated if tessellation is not active and primitive mode is GL_PATCHES, unless GL_NV_gpu_shader5 is supported.");
2551889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glDrawArrays(GL_PATCHES, 0, 3);
2560e7a9e61aed02cd14b597c89cd0c47a3b61aa497Mark Adams	ctx.expectError(tessErr);
2571889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.endSection();
2581889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2591889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glUseProgram(0);
2601889817926aa62a5f8d308c118f38acd882565eeJohn Richardson}
2611889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2621889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonvoid invalid_program_state (NegativeTestContext& ctx)
2631889817926aa62a5f8d308c118f38acd882565eeJohn Richardson{
2641889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	checkTessellationSupport(ctx);
2651889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2661889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	const bool					isES32	= glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
2671889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	map<string, string>			args;
2681889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	args["GLSL_VERSION_STRING"]			= isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES);
2691889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	args["GLSL_TESS_EXTENSION_STRING"]	= isES32 ? "" : "#extension GL_EXT_tessellation_shader : require";
2701889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2711889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	glu::FragmentSource frgSource(tcu::StringTemplate(fragmentShaderSource).specialize(args));
2721889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	glu::TessellationControlSource tessCtrlSource(tcu::StringTemplate(tessControlShaderSource).specialize(args));
2731889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	glu::TessellationEvaluationSource tessEvalSource(tcu::StringTemplate(tessEvalShaderSource).specialize(args));
2741889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2751889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	glu::ProgramPipeline pipeline(ctx.getRenderContext());
2761889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2771889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	glu::ShaderProgram	fragProgram	(ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << frgSource);
2781889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	glu::ShaderProgram	tessCtrlProgram	(ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << tessCtrlSource);
2791889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	glu::ShaderProgram	tessEvalProgram	(ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << tessEvalSource);
2801889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2811889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	tcu::TestLog& log = ctx.getLog();
2821889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	log << fragProgram << tessCtrlProgram << tessEvalProgram;
2831889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2841889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	if (!fragProgram.isOk() || !tessCtrlProgram.isOk() || !tessEvalProgram.isOk())
2851889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		throw tcu::TestError("failed to build program");
2861889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2871889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glBindProgramPipeline(pipeline.getPipeline());
2881889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.expectError(GL_NO_ERROR);
2891889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2901889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glUseProgramStages(pipeline.getPipeline(), GL_FRAGMENT_SHADER_BIT, fragProgram.getProgram());
2911889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glUseProgramStages(pipeline.getPipeline(), GL_TESS_CONTROL_SHADER_BIT, tessCtrlProgram.getProgram());
2921889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glUseProgramStages(pipeline.getPipeline(), GL_TESS_EVALUATION_SHADER_BIT, tessEvalProgram.getProgram());
2931889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.expectError(GL_NO_ERROR);
2941889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
2951889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.beginSection("GL_INVALID_OPERATION is generated if tessellation is active and vertex shader is missing.");
2961889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glDrawArrays(GL_PATCHES, 0, 3);
2971889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.expectError(GL_INVALID_OPERATION);
2981889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.endSection();
2991889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3001889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glBindProgramPipeline(0);
3011889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.expectError(GL_NO_ERROR);
3021889817926aa62a5f8d308c118f38acd882565eeJohn Richardson}
3031889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3041889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonvoid tessellation_control_invalid_vertex_count (NegativeTestContext& ctx)
3051889817926aa62a5f8d308c118f38acd882565eeJohn Richardson{
3061889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	checkTessellationSupport(ctx);
3071889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3081889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	const char* const tessControlVertLimitSource	=	"${GLSL_VERSION_STRING}\n"
3091889817926aa62a5f8d308c118f38acd882565eeJohn Richardson														"${GLSL_TESS_EXTENSION_STRING}\n"
3101889817926aa62a5f8d308c118f38acd882565eeJohn Richardson														"layout (vertices=${GL_MAX_PATCH_LIMIT}) out;\n"
3111889817926aa62a5f8d308c118f38acd882565eeJohn Richardson														"void main()\n"
3121889817926aa62a5f8d308c118f38acd882565eeJohn Richardson														"{\n"
3131889817926aa62a5f8d308c118f38acd882565eeJohn Richardson														"	gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;\n"
3141889817926aa62a5f8d308c118f38acd882565eeJohn Richardson														"}\n";
3151889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3161889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	const bool					isES32	= glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
3171889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	map<string, string>			args;
3181889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	args["GLSL_VERSION_STRING"]			= isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES);
3191889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	args["GLSL_TESS_EXTENSION_STRING"]	= isES32 ? "" : "#extension GL_EXT_tessellation_shader : require";
3201889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3211889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	int maxPatchVertices= 0;
3221889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3231889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.beginSection("Output vertex count exceeds GL_MAX_PATCH_VERTICES.");
3241889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glGetIntegerv(GL_MAX_PATCH_VERTICES, &maxPatchVertices);
3251889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.expectError(GL_NO_ERROR);
3261889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3271889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	std::ostringstream				oss;
3281889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	oss << (maxPatchVertices + 1);
3291889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	args["GL_MAX_PATCH_LIMIT"] =	oss.str();
3301889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3311889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3321889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	glu::ShaderProgram program(ctx.getRenderContext(),
3331889817926aa62a5f8d308c118f38acd882565eeJohn Richardson							   makeTessPipelineSources(tcu::StringTemplate(vertexShaderSource).specialize(args),
3341889817926aa62a5f8d308c118f38acd882565eeJohn Richardson													   tcu::StringTemplate(fragmentShaderSource).specialize(args),
3351889817926aa62a5f8d308c118f38acd882565eeJohn Richardson													   tcu::StringTemplate(tessControlVertLimitSource).specialize(args),
3361889817926aa62a5f8d308c118f38acd882565eeJohn Richardson													   tcu::StringTemplate(tessEvalShaderSource).specialize(args)));
3371889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	tcu::TestLog& log = ctx.getLog();
3381889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	log << program;
3391889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3401889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	bool testFailed = program.getProgramInfo().linkOk;
3411889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3421889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	if (testFailed)
3431889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		ctx.fail("Program was not expected to link");
3441889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3451889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.endSection();
3461889817926aa62a5f8d308c118f38acd882565eeJohn Richardson}
3471889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3481889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonvoid invalid_get_programiv (NegativeTestContext& ctx)
3491889817926aa62a5f8d308c118f38acd882565eeJohn Richardson{
3501889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	checkTessellationSupport(ctx);
3511889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3521889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	GLuint	program		= ctx.glCreateProgram();
3531889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	GLint	params[1]	= { 0 };
3541889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3551889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.beginSection("GL_INVALID_OPERATION is generated if GL_TESS_CONTROL_OUTPUT_VERTICES is queried for a program which has not been linked properly.");
3561889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glGetProgramiv(program, GL_TESS_CONTROL_OUTPUT_VERTICES, &params[0]);
3571889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.expectError(GL_INVALID_OPERATION);
3581889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.endSection();
3591889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3601889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.beginSection("GL_INVALID_OPERATION is generated if GL_TESS_GEN_MODE is queried for a program which has not been linked properly.");
3611889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glGetProgramiv(program, GL_TESS_GEN_MODE, &params[0]);
3621889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.expectError(GL_INVALID_OPERATION);
3631889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.endSection();
3641889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3651889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.beginSection("GL_INVALID_OPERATION is generated if GL_TESS_GEN_SPACING is queried for a program which has not been linked properly.");
3661889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glGetProgramiv(program, GL_TESS_GEN_SPACING, &params[0]);
3671889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.expectError(GL_INVALID_OPERATION);
3681889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.endSection();
3691889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3701889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.beginSection("GL_INVALID_OPERATION is generated if GL_TESS_GEN_VERTEX_ORDER is queried for a program which has not been linked properly.");
3711889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glGetProgramiv(program, GL_TESS_GEN_VERTEX_ORDER, &params[0]);
3721889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.expectError(GL_INVALID_OPERATION);
3731889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.endSection();
3741889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3751889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.beginSection("GL_INVALID_OPERATION is generated if GL_TESS_GEN_POINT_MODE is queried for a program which has not been linked properly.");
3761889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glGetProgramiv(program, GL_TESS_GEN_POINT_MODE, &params[0]);
3771889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.expectError(GL_INVALID_OPERATION);
3781889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.endSection();
3791889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3801889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glDeleteProgram(program);
3811889817926aa62a5f8d308c118f38acd882565eeJohn Richardson}
3821889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3831889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonvoid invalid_patch_parameteri (NegativeTestContext& ctx)
3841889817926aa62a5f8d308c118f38acd882565eeJohn Richardson{
3851889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	checkTessellationSupport(ctx);
3861889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3871889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.beginSection("GL_INVALID_ENUM is generated if pname is not GL_PATCH_VERTICES.");
3881889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glPatchParameteri(-1, 1);
3891889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.expectError(GL_INVALID_ENUM);
3901889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.endSection();
3911889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3921889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.beginSection("GL_INVALID_VALUE is generated if value is less than or equal to zero.");
3931889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glPatchParameteri(GL_PATCH_VERTICES, 0);
3941889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.expectError(GL_INVALID_VALUE);
3951889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.endSection();
3961889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
3971889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	int maxPatchVertices= 0;
3981889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glGetIntegerv(GL_MAX_PATCH_VERTICES, &maxPatchVertices);
3991889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.expectError(GL_NO_ERROR);
4001889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
4011889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.beginSection("GL_INVALID_VALUE is generated if value is greater than GL_MAX_PATCH_VERTICES.");
4021889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.glPatchParameteri(GL_PATCH_VERTICES, maxPatchVertices + 1);
4031889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.expectError(GL_INVALID_VALUE);
4041889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	ctx.endSection();
4051889817926aa62a5f8d308c118f38acd882565eeJohn Richardson}
4061889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
4071889817926aa62a5f8d308c118f38acd882565eeJohn Richardsonstd::vector<FunctionContainer> getNegativeTessellationTestFunctions (void)
4081889817926aa62a5f8d308c118f38acd882565eeJohn Richardson{
4091889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	const FunctionContainer funcs[] =
4101889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	{
4111889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		{ single_tessellation_stage,					"single_tessellation_stage",					"Invalid program state with single tessellation stage"							},
4121889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		{ invalid_primitive_mode,						"invalid_primitive_mode",						"Invalid primitive mode when tessellation is active"							},
4131889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		{ tessellation_not_active,						"tessellation_not_active",						"Use of GL_PATCHES when tessellation is not active"								},
4141889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		{ invalid_program_state,						"invalid_program_state",						"Invalid program state when tessellation active but no vertex shader present"	},
4151889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		{ invalid_get_programiv,						"get_programiv",								"Invalid glGetProgramiv() usage"												},
4161889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		{ invalid_patch_parameteri,						"invalid_program_queries",						"Invalid glPatchParameteri() usage"												},
4171889817926aa62a5f8d308c118f38acd882565eeJohn Richardson		{ tessellation_control_invalid_vertex_count,	"tessellation_control_invalid_vertex_count",	"Exceed vertex count limit in tessellation control shader"						},
4181889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	};
4191889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
4201889817926aa62a5f8d308c118f38acd882565eeJohn Richardson	return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs));
4211889817926aa62a5f8d308c118f38acd882565eeJohn Richardson}
4221889817926aa62a5f8d308c118f38acd882565eeJohn Richardson
4231889817926aa62a5f8d308c118f38acd882565eeJohn Richardson} // NegativeTestShared
4241889817926aa62a5f8d308c118f38acd882565eeJohn Richardson} // Functional
4251889817926aa62a5f8d308c118f38acd882565eeJohn Richardson} // gles31
4261889817926aa62a5f8d308c118f38acd882565eeJohn Richardson} // deqp
427