1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 3.1 Module
3 * -------------------------------------------------
5 * Copyright 2014 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief Negative Vertex Array API tests.
22 *//*--------------------------------------------------------------------*/
24 #include "es31fNegativeVertexArrayApiTests.hpp"
25 #include "gluCallLogWrapper.hpp"
26 #include "gluContextInfo.hpp"
27 #include "gluShaderProgram.hpp"
28 #include "glwDefs.hpp"
29 #include "glwEnums.hpp"
30 #include "tcuStringTemplate.hpp"
42 namespace NegativeTestShared
46 using glu::CallLogWrapper;
49 static const char* vertexShaderSource = "${GLSL_VERSION_STRING}\n"
52 " gl_Position = vec4(0.0);\n"
55 static const char* fragmentShaderSource = "${GLSL_VERSION_STRING}\n"
56 "layout(location = 0) out mediump vec4 fragColor;"
59 " fragColor = vec4(0.0);\n"
62 static const char* geometryShaderSource = "#version 320 es\n"
63 "layout(points) in;\n"
64 "layout(points, max_vertices = 3) out;\n"
69 void vertex_attribf (NegativeTestContext& ctx)
71 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
72 int maxVertexAttribs = ctx.getInteger(GL_MAX_VERTEX_ATTRIBS);
73 ctx.glVertexAttrib1f(maxVertexAttribs, 0.0f);
74 ctx.expectError(GL_INVALID_VALUE);
75 ctx.glVertexAttrib2f(maxVertexAttribs, 0.0f, 0.0f);
76 ctx.expectError(GL_INVALID_VALUE);
77 ctx.glVertexAttrib3f(maxVertexAttribs, 0.0f, 0.0f, 0.0f);
78 ctx.expectError(GL_INVALID_VALUE);
79 ctx.glVertexAttrib4f(maxVertexAttribs, 0.0f, 0.0f, 0.0f, 0.0f);
80 ctx.expectError(GL_INVALID_VALUE);
84 void vertex_attribfv (NegativeTestContext& ctx)
86 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
87 int maxVertexAttribs = ctx.getInteger(GL_MAX_VERTEX_ATTRIBS);
89 ctx.glVertexAttrib1fv(maxVertexAttribs, &v[0]);
90 ctx.expectError(GL_INVALID_VALUE);
91 ctx.glVertexAttrib2fv(maxVertexAttribs, &v[0]);
92 ctx.expectError(GL_INVALID_VALUE);
93 ctx.glVertexAttrib3fv(maxVertexAttribs, &v[0]);
94 ctx.expectError(GL_INVALID_VALUE);
95 ctx.glVertexAttrib4fv(maxVertexAttribs, &v[0]);
96 ctx.expectError(GL_INVALID_VALUE);
100 void vertex_attribi4 (NegativeTestContext& ctx)
102 int maxVertexAttribs = ctx.getInteger(GL_MAX_VERTEX_ATTRIBS);
106 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
107 ctx.glVertexAttribI4i(maxVertexAttribs, valInt, valInt, valInt, valInt);
108 ctx.expectError(GL_INVALID_VALUE);
109 ctx.glVertexAttribI4ui(maxVertexAttribs, valUint, valUint, valUint, valUint);
110 ctx.expectError(GL_INVALID_VALUE);
114 void vertex_attribi4v (NegativeTestContext& ctx)
116 int maxVertexAttribs = ctx.getInteger(GL_MAX_VERTEX_ATTRIBS);
117 GLint valInt[4] = { 0 };
118 GLuint valUint[4] = { 0 };
120 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
121 ctx.glVertexAttribI4iv(maxVertexAttribs, &valInt[0]);
122 ctx.expectError(GL_INVALID_VALUE);
123 ctx.glVertexAttribI4uiv(maxVertexAttribs, &valUint[0]);
124 ctx.expectError(GL_INVALID_VALUE);
128 void vertex_attrib_pointer (NegativeTestContext& ctx)
130 ctx.beginSection("GL_INVALID_ENUM is generated if type is not an accepted value.");
131 ctx.glVertexAttribPointer(0, 1, 0, GL_TRUE, 0, 0);
132 ctx.expectError(GL_INVALID_ENUM);
135 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
136 int maxVertexAttribs = ctx.getInteger(GL_MAX_VERTEX_ATTRIBS);
137 ctx.glVertexAttribPointer(maxVertexAttribs, 1, GL_BYTE, GL_TRUE, 0, 0);
138 ctx.expectError(GL_INVALID_VALUE);
141 ctx.beginSection("GL_INVALID_VALUE is generated if size is not 1, 2, 3, or 4.");
142 ctx.glVertexAttribPointer(0, 0, GL_BYTE, GL_TRUE, 0, 0);
143 ctx.expectError(GL_INVALID_VALUE);
146 ctx.beginSection("GL_INVALID_VALUE is generated if stride is negative.");
147 ctx.glVertexAttribPointer(0, 1, GL_BYTE, GL_TRUE, -1, 0);
148 ctx.expectError(GL_INVALID_VALUE);
151 ctx.beginSection("GL_INVALID_OPERATION is generated if type is GL_INT_2_10_10_10_REV or GL_UNSIGNED_INT_2_10_10_10_REV and size is not 4.");
152 ctx.glVertexAttribPointer(0, 2, GL_INT_2_10_10_10_REV, GL_TRUE, 0, 0);
153 ctx.expectError(GL_INVALID_OPERATION);
154 ctx.glVertexAttribPointer(0, 2, GL_UNSIGNED_INT_2_10_10_10_REV, GL_TRUE, 0, 0);
155 ctx.expectError(GL_INVALID_OPERATION);
156 ctx.glVertexAttribPointer(0, 4, GL_INT_2_10_10_10_REV, GL_TRUE, 0, 0);
157 ctx.expectError(GL_NO_ERROR);
158 ctx.glVertexAttribPointer(0, 4, GL_UNSIGNED_INT_2_10_10_10_REV, GL_TRUE, 0, 0);
159 ctx.expectError(GL_NO_ERROR);
162 ctx.beginSection("GL_INVALID_OPERATION is generated a non-zero vertex array object is bound, zero is bound to the GL_ARRAY_BUFFER buffer object binding point and the pointer argument is not NULL.");
165 ctx.glGenVertexArrays(1, &vao);
166 ctx.glBindVertexArray(vao);
167 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
168 ctx.expectError(GL_NO_ERROR);
170 ctx.glVertexAttribPointer(0, 1, GL_BYTE, GL_TRUE, 0, &offset);
171 ctx.expectError(GL_INVALID_OPERATION);
173 ctx.glBindVertexArray(0);
174 ctx.glDeleteVertexArrays(1, &vao);
175 ctx.expectError(GL_NO_ERROR);
179 void vertex_attrib_i_pointer (NegativeTestContext& ctx)
181 ctx.beginSection("GL_INVALID_ENUM is generated if type is not an accepted value.");
182 ctx.glVertexAttribIPointer(0, 1, 0, 0, 0);
183 ctx.expectError(GL_INVALID_ENUM);
184 ctx.glVertexAttribIPointer(0, 4, GL_INT_2_10_10_10_REV, 0, 0);
185 ctx.expectError(GL_INVALID_ENUM);
186 ctx.glVertexAttribIPointer(0, 4, GL_UNSIGNED_INT_2_10_10_10_REV, 0, 0);
187 ctx.expectError(GL_INVALID_ENUM);
190 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
191 int maxVertexAttribs = ctx.getInteger(GL_MAX_VERTEX_ATTRIBS);
192 ctx.glVertexAttribIPointer(maxVertexAttribs, 1, GL_BYTE, 0, 0);
193 ctx.expectError(GL_INVALID_VALUE);
196 ctx.beginSection("GL_INVALID_VALUE is generated if size is not 1, 2, 3, or 4.");
197 ctx.glVertexAttribIPointer(0, 0, GL_BYTE, 0, 0);
198 ctx.expectError(GL_INVALID_VALUE);
201 ctx.beginSection("GL_INVALID_VALUE is generated if stride is negative.");
202 ctx.glVertexAttribIPointer(0, 1, GL_BYTE, -1, 0);
203 ctx.expectError(GL_INVALID_VALUE);
206 ctx.beginSection("GL_INVALID_OPERATION is generated a non-zero vertex array object is bound, zero is bound to the GL_ARRAY_BUFFER buffer object binding point and the pointer argument is not NULL.");
209 ctx.glGenVertexArrays(1, &vao);
210 ctx.glBindVertexArray(vao);
211 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
212 ctx.expectError(GL_NO_ERROR);
214 ctx.glVertexAttribIPointer(0, 1, GL_BYTE, 0, &offset);
215 ctx.expectError(GL_INVALID_OPERATION);
217 ctx.glBindVertexArray(0);
218 ctx.glDeleteVertexArrays(1, &vao);
219 ctx.expectError(GL_NO_ERROR);
223 void vertex_attrib_format (NegativeTestContext& ctx)
225 int maxVertexAttribs = ctx.getInteger(GL_MAX_VERTEX_ATTRIBS);
226 int maxVertexAttribRelativeOffset = ctx.getInteger(GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET);
229 ctx.beginSection("GL_INVALID_VALUE is generated if attribindex is greater than or equal to the value of MAX_VERTEX_ATTRIBS.");
230 ctx.glGenVertexArrays(1, &vao);
231 ctx.glBindVertexArray(vao);
232 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
233 ctx.glVertexAttribFormat(maxVertexAttribs, 4, GL_FLOAT, GL_FALSE, maxVertexAttribRelativeOffset);
234 ctx.expectError(GL_INVALID_VALUE);
237 ctx.beginSection("GL_INVALID_VALUE is generated if size is not one of 1, 2, 3, 4.");
238 ctx.glGenVertexArrays(1, &vao);
239 ctx.glBindVertexArray(vao);
240 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
241 ctx.glVertexAttribFormat(1, 0, GL_FLOAT, GL_FALSE, maxVertexAttribRelativeOffset);
242 ctx.expectError(GL_INVALID_VALUE);
245 ctx.beginSection("GL_INVALID_ENUM is generated if type is not one of the parameter token names allowed.");
246 ctx.glGenVertexArrays(1, &vao);
247 ctx.glBindVertexArray(vao);
248 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
249 ctx.glVertexAttribFormat(1, 4, 1, GL_FALSE, 0);
250 ctx.expectError(GL_INVALID_ENUM);
253 ctx.beginSection("GL_INVALID_OPERATION is generated if type is not a token name allowed.");
254 ctx.glGenVertexArrays(1, &vao);
255 ctx.glBindVertexArray(0);
256 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
257 ctx.glVertexAttribFormat(1, 4, GL_FLOAT, GL_FALSE, 0);
258 ctx.expectError(GL_INVALID_OPERATION);
261 ctx.beginSection("GL_INVALID_OPERATION is generated if type is GL_INT_2_10_10_10_REV and size is not 4.");
262 ctx.glGenVertexArrays(1, &vao);
263 ctx.glBindVertexArray(vao);
264 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
265 ctx.glVertexAttribFormat(1, 3, GL_INT_2_10_10_10_REV, GL_FALSE, 0);
266 ctx.expectError(GL_INVALID_OPERATION);
269 ctx.beginSection("GL_INVALID_OPERATION is generated if type is GL_UNSIGNED_INT_2_10_10_10_REV and size is not 4.");
270 ctx.glGenVertexArrays(1, &vao);
271 ctx.glBindVertexArray(vao);
272 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
273 ctx.glVertexAttribFormat(1, 3, GL_UNSIGNED_INT_2_10_10_10_REV, GL_FALSE, 0);
274 ctx.expectError(GL_INVALID_OPERATION);
277 ctx.beginSection("GL_INVALID_VALUE is generated if relativeoffset is larger than the value of GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET.");
278 ctx.glGenVertexArrays(1, &vao);
279 ctx.glBindVertexArray(vao);
280 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
281 ctx.glVertexAttribFormat(1, 4, GL_FLOAT, GL_FALSE, maxVertexAttribRelativeOffset + 1);
282 ctx.expectError(GL_INVALID_VALUE);
286 void vertex_attrib_i_format (NegativeTestContext& ctx)
288 int maxVertexAttribs = ctx.getInteger(GL_MAX_VERTEX_ATTRIBS);
289 int maxVertexAttribRelativeOffset = ctx.getInteger(GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET);
292 ctx.beginSection("GL_INVALID_VALUE is generated if attribindex is greater than or equal to the value of GL_MAX_VERTEX_ATTRIBS.");
293 ctx.glGenVertexArrays(1, &vao);
294 ctx.glBindVertexArray(vao);
295 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
296 ctx.glVertexAttribIFormat(maxVertexAttribs, 4, GL_INT, 0);
297 ctx.expectError(GL_INVALID_VALUE);
300 ctx.beginSection("GL_INVALID_VALUE is generated if size is not one the values 1, 2, 3, 4.");
301 ctx.glGenVertexArrays(1, &vao);
302 ctx.glBindVertexArray(vao);
303 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
304 ctx.glVertexAttribIFormat(1, 0, GL_INT, 0);
305 ctx.expectError(GL_INVALID_VALUE);
308 ctx.beginSection("GL_INVALID_ENUM is generated if type is not one of the parameter token names allowed.");
309 ctx.glGenVertexArrays(1, &vao);
310 ctx.glBindVertexArray(vao);
311 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
312 ctx.glVertexAttribIFormat(1, 4, GL_FLOAT, 0);
313 ctx.expectError(GL_INVALID_ENUM);
316 ctx.beginSection("GL_INVALID_OPERATION is generated if type is not a token name allowed.");
317 ctx.glGenVertexArrays(1, &vao);
318 ctx.glBindVertexArray(0);
319 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
320 ctx.glVertexAttribIFormat(1, 4, GL_INT, 0);
321 ctx.expectError(GL_INVALID_OPERATION);
324 ctx.beginSection("GL_INVALID_VALUE is generated if relativeoffset is larger than the value of GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET.");
325 ctx.glGenVertexArrays(1, &vao);
326 ctx.glBindVertexArray(vao);
327 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
328 ctx.glVertexAttribIFormat(1, 4, GL_INT, maxVertexAttribRelativeOffset + 1);
329 ctx.expectError(GL_INVALID_VALUE);
333 void enable_vertex_attrib_array (NegativeTestContext& ctx)
335 int maxVertexAttribs = ctx.getInteger(GL_MAX_VERTEX_ATTRIBS);
337 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
338 ctx.glEnableVertexAttribArray(maxVertexAttribs);
339 ctx.expectError(GL_INVALID_VALUE);
343 void disable_vertex_attrib_array (NegativeTestContext& ctx)
345 int maxVertexAttribs = ctx.getInteger(GL_MAX_VERTEX_ATTRIBS);
347 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
348 ctx.glDisableVertexAttribArray(maxVertexAttribs);
349 ctx.expectError(GL_INVALID_VALUE);
353 void gen_vertex_arrays (NegativeTestContext& ctx)
357 ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
358 ctx.glGenVertexArrays(-1, &arrays);
359 ctx.expectError(GL_INVALID_VALUE);
363 void bind_vertex_array (NegativeTestContext& ctx)
365 ctx.beginSection("GL_INVALID_OPERATION is generated if array is not zero or the name of an existing vertex array object.");
366 ctx.glBindVertexArray(-1);
367 ctx.expectError(GL_INVALID_OPERATION);
371 void delete_vertex_arrays (NegativeTestContext& ctx)
373 ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
374 ctx.glDeleteVertexArrays(-1, 0);
375 ctx.expectError(GL_INVALID_VALUE);
379 void vertex_attrib_divisor (NegativeTestContext& ctx)
381 int maxVertexAttribs = ctx.getInteger(GL_MAX_VERTEX_ATTRIBS);
383 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
384 ctx.glVertexAttribDivisor(maxVertexAttribs, 0);
385 ctx.expectError(GL_INVALID_VALUE);
389 void draw_arrays (NegativeTestContext& ctx)
391 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
393 map<string, string> args;
394 args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES);
395 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args)));
397 ctx.glUseProgram(program.getProgram());
398 ctx.expectError(GL_NO_ERROR);
400 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
401 ctx.glDrawArrays(-1, 0, 1);
402 ctx.expectError(GL_INVALID_ENUM);
405 ctx.beginSection("GL_INVALID_VALUE is generated if count is negative.");
406 ctx.glDrawArrays(GL_POINTS, 0, -1);
407 ctx.expectError(GL_INVALID_VALUE);
410 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
411 ctx.glGenFramebuffers(1, &fbo);
412 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
413 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
414 ctx.glDrawArrays(GL_POINTS, 0, 1);
415 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
416 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
417 ctx.glDeleteFramebuffers(1, &fbo);
423 void draw_arrays_invalid_program (NegativeTestContext& ctx)
428 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
429 ctx.glDrawArrays(-1, 0, 1);
430 ctx.expectError(GL_INVALID_ENUM);
433 ctx.beginSection("GL_INVALID_VALUE is generated if count is negative.");
434 ctx.glDrawArrays(GL_POINTS, 0, -1);
435 ctx.expectError(GL_INVALID_VALUE);
438 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
439 ctx.glGenFramebuffers(1, &fbo);
440 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
441 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
442 ctx.glDrawArrays(GL_POINTS, 0, 1);
443 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
444 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
445 ctx.glDeleteFramebuffers(1, &fbo);
449 void draw_arrays_incomplete_primitive (NegativeTestContext& ctx)
451 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
453 map<string, string> args;
454 args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES);
455 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args)));
457 ctx.glUseProgram(program.getProgram());
458 ctx.expectError(GL_NO_ERROR);
460 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
461 ctx.glDrawArrays(-1, 0, 1);
462 ctx.expectError(GL_INVALID_ENUM);
465 ctx.beginSection("GL_INVALID_VALUE is generated if count is negative.");
466 ctx.glDrawArrays(GL_TRIANGLES, 0, -1);
467 ctx.expectError(GL_INVALID_VALUE);
470 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
471 ctx.glGenFramebuffers(1, &fbo);
472 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
473 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
474 ctx.glDrawArrays(GL_TRIANGLES, 0, 1);
475 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
476 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
477 ctx.glDeleteFramebuffers(1, &fbo);
483 void draw_elements (NegativeTestContext& ctx)
485 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
490 map<string, string> args;
491 args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES);
492 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args)));
494 ctx.glUseProgram(program.getProgram());
495 ctx.expectError(GL_NO_ERROR);
497 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
498 ctx.glDrawElements(-1, 1, GL_UNSIGNED_BYTE, vertices);
499 ctx.expectError(GL_INVALID_ENUM);
502 ctx.beginSection("GL_INVALID_ENUM is generated if type is not one of the accepted values.");
503 ctx.glDrawElements(GL_POINTS, 1, -1, vertices);
504 ctx.expectError(GL_INVALID_ENUM);
505 ctx.glDrawElements(GL_POINTS, 1, GL_FLOAT, vertices);
506 ctx.expectError(GL_INVALID_ENUM);
509 ctx.beginSection("GL_INVALID_VALUE is generated if count is negative.");
510 ctx.glDrawElements(GL_POINTS, -1, GL_UNSIGNED_BYTE, vertices);
511 ctx.expectError(GL_INVALID_VALUE);
514 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
515 ctx.glGenFramebuffers(1, &fbo);
516 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
517 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
518 ctx.glDrawElements(GL_POINTS, 1, GL_UNSIGNED_BYTE, vertices);
519 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
520 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
521 ctx.glDeleteFramebuffers(1, &fbo);
524 if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error
526 ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback is active and not paused.");
527 const char* tfVarying = "gl_Position";
529 ctx.glGenBuffers(1, &buf);
530 ctx.glGenTransformFeedbacks(1, &tfID);
532 ctx.glUseProgram(program.getProgram());
533 ctx.glTransformFeedbackVaryings(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
534 ctx.glLinkProgram(program.getProgram());
535 ctx.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, tfID);
536 ctx.glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
537 ctx.glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
538 ctx.glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
539 ctx.glBeginTransformFeedback(GL_POINTS);
540 ctx.expectError(GL_NO_ERROR);
542 ctx.glDrawElements(GL_POINTS, 1, GL_UNSIGNED_BYTE, vertices);
543 ctx.expectError(GL_INVALID_OPERATION);
545 ctx.glPauseTransformFeedback();
546 ctx.glDrawElements(GL_POINTS, 1, GL_UNSIGNED_BYTE, vertices);
547 ctx.expectError(GL_NO_ERROR);
549 ctx.glEndTransformFeedback();
550 ctx.glDeleteBuffers(1, &buf);
551 ctx.glDeleteTransformFeedbacks(1, &tfID);
552 ctx.expectError(GL_NO_ERROR);
559 void draw_elements_invalid_program (NegativeTestContext& ctx)
565 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
566 ctx.glDrawElements(-1, 1, GL_UNSIGNED_BYTE, vertices);
567 ctx.expectError(GL_INVALID_ENUM);
570 ctx.beginSection("GL_INVALID_ENUM is generated if type is not one of the accepted values.");
571 ctx.glDrawElements(GL_POINTS, 1, -1, vertices);
572 ctx.expectError(GL_INVALID_ENUM);
573 ctx.glDrawElements(GL_POINTS, 1, GL_FLOAT, vertices);
574 ctx.expectError(GL_INVALID_ENUM);
577 ctx.beginSection("GL_INVALID_VALUE is generated if count is negative.");
578 ctx.glDrawElements(GL_POINTS, -1, GL_UNSIGNED_BYTE, vertices);
579 ctx.expectError(GL_INVALID_VALUE);
582 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
583 ctx.glGenFramebuffers(1, &fbo);
584 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
585 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
586 ctx.glDrawElements(GL_POINTS, 1, GL_UNSIGNED_BYTE, vertices);
587 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
588 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
589 ctx.glDeleteFramebuffers(1, &fbo);
593 void draw_elements_incomplete_primitive (NegativeTestContext& ctx)
595 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
600 map<string, string> args;
601 args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES);
602 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args)));
604 ctx.glUseProgram(program.getProgram());
605 ctx.expectError(GL_NO_ERROR);
607 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
608 ctx.glDrawElements(-1, 1, GL_UNSIGNED_BYTE, vertices);
609 ctx.expectError(GL_INVALID_ENUM);
612 ctx.beginSection("GL_INVALID_ENUM is generated if type is not one of the accepted values.");
613 ctx.glDrawElements(GL_TRIANGLES, 1, -1, vertices);
614 ctx.expectError(GL_INVALID_ENUM);
615 ctx.glDrawElements(GL_TRIANGLES, 1, GL_FLOAT, vertices);
616 ctx.expectError(GL_INVALID_ENUM);
619 ctx.beginSection("GL_INVALID_VALUE is generated if count is negative.");
620 ctx.glDrawElements(GL_TRIANGLES, -1, GL_UNSIGNED_BYTE, vertices);
621 ctx.expectError(GL_INVALID_VALUE);
624 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
625 ctx.glGenFramebuffers(1, &fbo);
626 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
627 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
628 ctx.glDrawElements(GL_TRIANGLES, 1, GL_UNSIGNED_BYTE, vertices);
629 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
630 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
631 ctx.glDeleteFramebuffers(1, &fbo);
634 if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error
636 ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback is active and not paused.");
637 const char* tfVarying= "gl_Position";
639 ctx.glGenBuffers(1, &buf);
640 ctx.glGenTransformFeedbacks(1, &tfID);
642 ctx.glUseProgram(program.getProgram());
643 ctx.glTransformFeedbackVaryings(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
644 ctx.glLinkProgram(program.getProgram());
645 ctx.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, tfID);
646 ctx.glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
647 ctx.glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
648 ctx.glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
649 ctx.glBeginTransformFeedback(GL_TRIANGLES);
650 ctx.expectError(GL_NO_ERROR);
652 ctx.glDrawElements(GL_TRIANGLES, 1, GL_UNSIGNED_BYTE, vertices);
653 ctx.expectError(GL_INVALID_OPERATION);
655 ctx.glPauseTransformFeedback();
656 ctx.glDrawElements(GL_TRIANGLES, 1, GL_UNSIGNED_BYTE, vertices);
657 ctx.expectError(GL_NO_ERROR);
659 ctx.glEndTransformFeedback();
660 ctx.glDeleteBuffers(1, &buf);
661 ctx.glDeleteTransformFeedbacks(1, &tfID);
662 ctx.expectError(GL_NO_ERROR);
669 void draw_elements_base_vertex (NegativeTestContext& ctx)
671 TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a 3.2 context or higher context version.");
676 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
677 ctx.glDrawElementsBaseVertex(-1, 1, GL_UNSIGNED_INT, vertices, 1);
678 ctx.expectError(GL_INVALID_ENUM);
681 ctx.beginSection("GL_INVALID_ENUM is generated if type is not one of the accepted values.");
682 ctx.glDrawElementsBaseVertex(GL_POINTS, 1, -1, vertices, 1);
683 ctx.expectError(GL_INVALID_ENUM);
684 ctx.glDrawElementsBaseVertex(GL_POINTS, 1, GL_FLOAT, vertices, 1);
685 ctx.expectError(GL_INVALID_ENUM);
688 ctx.beginSection("GL_INVALID_VALUE is generated if count is negative.");
689 ctx.glDrawElementsBaseVertex(GL_POINTS, -1, GL_UNSIGNED_INT, vertices, 1);
690 ctx.expectError(GL_INVALID_VALUE);
693 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
694 ctx.glGenFramebuffers(1, &fbo);
695 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
696 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
697 ctx.glDrawElementsBaseVertex(GL_POINTS, 1, GL_UNSIGNED_INT, vertices, 1);
698 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
699 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
700 ctx.glDeleteFramebuffers(1, &fbo);
704 void draw_elements_base_vertex_primitive_mode_mismatch (NegativeTestContext& ctx)
706 TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a 3.2 context or higher context version.");
709 map<string, string> args;
710 args["GLSL_VERSION_STRING"] = getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES);
712 glu::ShaderProgram program(ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << glu::VertexSource(tcu::StringTemplate(vertexShaderSource).specialize(args)) << glu::GeometrySource(geometryShaderSource));
714 ctx.beginSection("GL_INVALID_OPERATION is generated if a geometry shader is active and mode is incompatible with the input primitive type of the geometry shader in the currently installed program object.");
715 ctx.glUseProgram(program.getProgram());
716 ctx.glDrawElementsBaseVertex(GL_TRIANGLES, 1, GL_UNSIGNED_INT, vertices, 1);
717 ctx.expectError(GL_INVALID_OPERATION);
723 void draw_arrays_instanced (NegativeTestContext& ctx)
725 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
727 map<string, string> args;
728 args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES);
729 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args)));
731 ctx.glUseProgram(program.getProgram());
732 ctx.expectError(GL_NO_ERROR);
733 ctx.glVertexAttribDivisor(0, 1);
734 ctx.expectError(GL_NO_ERROR);
736 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
737 ctx.glDrawArraysInstanced(-1, 0, 1, 1);
738 ctx.expectError(GL_INVALID_ENUM);
741 ctx.beginSection("GL_INVALID_VALUE is generated if count or primcount are negative.");
742 ctx.glDrawArraysInstanced(GL_POINTS, 0, -1, 1);
743 ctx.expectError(GL_INVALID_VALUE);
744 ctx.glDrawArraysInstanced(GL_POINTS, 0, 1, -1);
745 ctx.expectError(GL_INVALID_VALUE);
748 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
749 ctx.glGenFramebuffers(1, &fbo);
750 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
751 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
752 ctx.glDrawArraysInstanced(GL_POINTS, 0, 1, 1);
753 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
754 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
755 ctx.glDeleteFramebuffers(1, &fbo);
761 void draw_arrays_instanced_invalid_program (NegativeTestContext& ctx)
765 ctx.glVertexAttribDivisor(0, 1);
766 ctx.expectError(GL_NO_ERROR);
768 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
769 ctx.glDrawArraysInstanced(-1, 0, 1, 1);
770 ctx.expectError(GL_INVALID_ENUM);
773 ctx.beginSection("GL_INVALID_VALUE is generated if count or primcount are negative.");
774 ctx.glDrawArraysInstanced(GL_POINTS, 0, -1, 1);
775 ctx.expectError(GL_INVALID_VALUE);
776 ctx.glDrawArraysInstanced(GL_POINTS, 0, 1, -1);
777 ctx.expectError(GL_INVALID_VALUE);
780 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
781 ctx.glGenFramebuffers(1, &fbo);
782 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
783 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
784 ctx.glDrawArraysInstanced(GL_POINTS, 0, 1, 1);
785 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
786 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
787 ctx.glDeleteFramebuffers(1, &fbo);
791 void draw_arrays_instanced_incomplete_primitive (NegativeTestContext& ctx)
793 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
795 map<string, string> args;
796 args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES);
797 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args)));
799 ctx.glVertexAttribDivisor(0, 1);
800 ctx.expectError(GL_NO_ERROR);
802 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
803 ctx.glDrawArraysInstanced(-1, 0, 1, 1);
804 ctx.expectError(GL_INVALID_ENUM);
807 ctx.beginSection("GL_INVALID_VALUE is generated if count or primcount are negative.");
808 ctx.glDrawArraysInstanced(GL_TRIANGLES, 0, -1, 1);
809 ctx.expectError(GL_INVALID_VALUE);
810 ctx.glDrawArraysInstanced(GL_TRIANGLES, 0, 1, -1);
811 ctx.expectError(GL_INVALID_VALUE);
814 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
815 ctx.glGenFramebuffers(1, &fbo);
816 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
817 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
818 ctx.glDrawArraysInstanced(GL_TRIANGLES, 0, 1, 1);
819 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
820 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
821 ctx.glDeleteFramebuffers(1, &fbo);
827 void draw_elements_instanced (NegativeTestContext& ctx)
829 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
834 map<string, string> args;
835 args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES);
836 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args)));
838 ctx.glUseProgram(program.getProgram());
839 ctx.glVertexAttribDivisor(0, 1);
840 ctx.expectError(GL_NO_ERROR);
842 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
843 ctx.glDrawElementsInstanced(-1, 1, GL_UNSIGNED_BYTE, vertices, 1);
844 ctx.expectError(GL_INVALID_ENUM);
847 ctx.beginSection("GL_INVALID_ENUM is generated if type is not one of the accepted values.");
848 ctx.glDrawElementsInstanced(GL_POINTS, 1, -1, vertices, 1);
849 ctx.expectError(GL_INVALID_ENUM);
850 ctx.glDrawElementsInstanced(GL_POINTS, 1, GL_FLOAT, vertices, 1);
851 ctx.expectError(GL_INVALID_ENUM);
854 ctx.beginSection("GL_INVALID_VALUE is generated if count or primcount are negative.");
855 ctx.glDrawElementsInstanced(GL_POINTS, -1, GL_UNSIGNED_BYTE, vertices, 1);
856 ctx.expectError(GL_INVALID_VALUE);
857 ctx.glDrawElementsInstanced(GL_POINTS, 11, GL_UNSIGNED_BYTE, vertices, -1);
858 ctx.expectError(GL_INVALID_VALUE);
861 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
862 ctx.glGenFramebuffers(1, &fbo);
863 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
864 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
865 ctx.glDrawElementsInstanced(GL_POINTS, 1, GL_UNSIGNED_BYTE, vertices, 1);
866 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
867 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
868 ctx.glDeleteFramebuffers(1, &fbo);
871 if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error
873 ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback is active and not paused.");
874 const char* tfVarying = "gl_Position";
876 ctx.glGenBuffers(1, &buf);
877 ctx.glGenTransformFeedbacks(1, &tfID);
879 ctx.glUseProgram(program.getProgram());
880 ctx.glTransformFeedbackVaryings(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
881 ctx.glLinkProgram(program.getProgram());
882 ctx.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, tfID);
883 ctx.glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
884 ctx.glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
885 ctx.glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
886 ctx.glBeginTransformFeedback(GL_POINTS);
887 ctx.expectError(GL_NO_ERROR);
889 ctx.glDrawElementsInstanced(GL_POINTS, 1, GL_UNSIGNED_BYTE, vertices, 1);
890 ctx.expectError(GL_INVALID_OPERATION);
892 ctx.glPauseTransformFeedback();
893 ctx.glDrawElementsInstanced(GL_POINTS, 1, GL_UNSIGNED_BYTE, vertices, 1);
894 ctx.expectError(GL_NO_ERROR);
896 ctx.glEndTransformFeedback();
897 ctx.glDeleteBuffers(1, &buf);
898 ctx.glDeleteTransformFeedbacks(1, &tfID);
899 ctx.expectError(GL_NO_ERROR);
906 void draw_elements_instanced_invalid_program (NegativeTestContext& ctx)
911 ctx.glVertexAttribDivisor(0, 1);
912 ctx.expectError(GL_NO_ERROR);
914 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
915 ctx.glDrawElementsInstanced(-1, 1, GL_UNSIGNED_BYTE, vertices, 1);
916 ctx.expectError(GL_INVALID_ENUM);
919 ctx.beginSection("GL_INVALID_ENUM is generated if type is not one of the accepted values.");
920 ctx.glDrawElementsInstanced(GL_POINTS, 1, -1, vertices, 1);
921 ctx.expectError(GL_INVALID_ENUM);
922 ctx.glDrawElementsInstanced(GL_POINTS, 1, GL_FLOAT, vertices, 1);
923 ctx.expectError(GL_INVALID_ENUM);
926 ctx.beginSection("GL_INVALID_VALUE is generated if count or primcount are negative.");
927 ctx.glDrawElementsInstanced(GL_POINTS, -1, GL_UNSIGNED_BYTE, vertices, 1);
928 ctx.expectError(GL_INVALID_VALUE);
929 ctx.glDrawElementsInstanced(GL_POINTS, 11, GL_UNSIGNED_BYTE, vertices, -1);
930 ctx.expectError(GL_INVALID_VALUE);
933 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
934 ctx.glGenFramebuffers(1, &fbo);
935 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
936 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
937 ctx.glDrawElementsInstanced(GL_POINTS, 1, GL_UNSIGNED_BYTE, vertices, 1);
938 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
939 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
940 ctx.glDeleteFramebuffers(1, &fbo);
944 void draw_elements_instanced_incomplete_primitive (NegativeTestContext& ctx)
946 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
951 map<string, string> args;
952 args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES);
953 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args)));
955 ctx.glUseProgram(program.getProgram());
956 ctx.glVertexAttribDivisor(0, 1);
957 ctx.expectError(GL_NO_ERROR);
959 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
960 ctx.glDrawElementsInstanced(-1, 1, GL_UNSIGNED_BYTE, vertices, 1);
961 ctx.expectError(GL_INVALID_ENUM);
964 ctx.beginSection("GL_INVALID_ENUM is generated if type is not one of the accepted values.");
965 ctx.glDrawElementsInstanced(GL_TRIANGLES, 1, -1, vertices, 1);
966 ctx.expectError(GL_INVALID_ENUM);
967 ctx.glDrawElementsInstanced(GL_TRIANGLES, 1, GL_FLOAT, vertices, 1);
968 ctx.expectError(GL_INVALID_ENUM);
971 ctx.beginSection("GL_INVALID_VALUE is generated if count or primcount are negative.");
972 ctx.glDrawElementsInstanced(GL_TRIANGLES, -1, GL_UNSIGNED_BYTE, vertices, 1);
973 ctx.expectError(GL_INVALID_VALUE);
974 ctx.glDrawElementsInstanced(GL_TRIANGLES, 11, GL_UNSIGNED_BYTE, vertices, -1);
975 ctx.expectError(GL_INVALID_VALUE);
978 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
979 ctx.glGenFramebuffers(1, &fbo);
980 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
981 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
982 ctx.glDrawElementsInstanced(GL_TRIANGLES, 1, GL_UNSIGNED_BYTE, vertices, 1);
983 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
984 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
985 ctx.glDeleteFramebuffers(1, &fbo);
988 if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error
990 ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback is active and not paused.");
991 const char* tfVarying= "gl_Position";
993 ctx.glGenBuffers(1, &buf);
994 ctx.glGenTransformFeedbacks(1, &tfID);
996 ctx.glUseProgram(program.getProgram());
997 ctx.glTransformFeedbackVaryings(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
998 ctx.glLinkProgram(program.getProgram());
999 ctx.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, tfID);
1000 ctx.glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
1001 ctx.glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
1002 ctx.glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
1003 ctx.glBeginTransformFeedback(GL_TRIANGLES);
1004 ctx.expectError(GL_NO_ERROR);
1006 ctx.glDrawElementsInstanced(GL_TRIANGLES, 1, GL_UNSIGNED_BYTE, vertices, 1);
1007 ctx.expectError(GL_INVALID_OPERATION);
1009 ctx.glPauseTransformFeedback();
1010 ctx.glDrawElementsInstanced (GL_TRIANGLES, 1, GL_UNSIGNED_BYTE, vertices, 1);
1011 ctx.expectError(GL_NO_ERROR);
1013 ctx.glEndTransformFeedback();
1014 ctx.glDeleteBuffers(1, &buf);
1015 ctx.glDeleteTransformFeedbacks(1, &tfID);
1016 ctx.expectError(GL_NO_ERROR);
1020 ctx.glUseProgram(0);
1023 void draw_elements_instanced_base_vertex (NegativeTestContext& ctx)
1025 TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a 3.2 context or higher context version.");
1027 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
1029 GLfloat vertices[1];
1030 map<string, string> args;
1031 args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES);
1032 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args)));
1034 ctx.glUseProgram(program.getProgram());
1035 ctx.glVertexAttribDivisor(0, 1);
1036 ctx.expectError(GL_NO_ERROR);
1038 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
1039 ctx.glDrawElementsInstancedBaseVertex(-1, 1, GL_UNSIGNED_BYTE, vertices, 1, 1);
1040 ctx.expectError(GL_INVALID_ENUM);
1043 ctx.beginSection("GL_INVALID_ENUM is generated if type is not one of the accepted values.");
1044 ctx.glDrawElementsInstancedBaseVertex(GL_POINTS, 1, -1, vertices, 1, 1);
1045 ctx.expectError(GL_INVALID_ENUM);
1046 ctx.glDrawElementsInstancedBaseVertex(GL_POINTS, 1, GL_FLOAT, vertices, 1, 1);
1047 ctx.expectError(GL_INVALID_ENUM);
1050 ctx.beginSection("GL_INVALID_VALUE is generated if count or primcount are negative.");
1051 ctx.glDrawElementsInstancedBaseVertex(GL_POINTS, -1, GL_UNSIGNED_BYTE, vertices, 1, 1);
1052 ctx.expectError(GL_INVALID_VALUE);
1053 ctx.glDrawElementsInstancedBaseVertex(GL_POINTS, 11, GL_UNSIGNED_BYTE, vertices, -1, 1);
1054 ctx.expectError(GL_INVALID_VALUE);
1057 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
1058 ctx.glGenFramebuffers(1, &fbo);
1059 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1060 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
1061 ctx.glDrawElementsInstancedBaseVertex(GL_POINTS, 1, GL_UNSIGNED_BYTE, vertices, 1, 1);
1062 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1063 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1064 ctx.glDeleteFramebuffers(1, &fbo);
1067 ctx.glUseProgram(0);
1070 void draw_elements_instanced_base_vertex_primitive_mode_mismatch (NegativeTestContext& ctx)
1072 TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a 3.2 context or higher context version.");
1074 GLfloat vertices[1];
1075 map<string, string> args;
1076 args["GLSL_VERSION_STRING"] = getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES);
1077 glu::ShaderProgram geometryProgram(ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << glu::VertexSource(tcu::StringTemplate(vertexShaderSource).specialize(args)) << glu::GeometrySource(geometryShaderSource));
1079 ctx.beginSection("GL_INVALID_OPERATION is generated if a geometry shader is active and mode is incompatible with the input primitive type of the geometry shader in the currently installed program object.");
1080 ctx.glUseProgram(geometryProgram.getProgram());
1081 ctx.glDrawElementsInstancedBaseVertex(GL_TRIANGLES, 1, GL_UNSIGNED_INT, vertices, 1, 1);
1082 ctx.expectError(GL_INVALID_OPERATION);
1085 ctx.glUseProgram(0);
1088 void draw_range_elements (NegativeTestContext& ctx)
1090 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
1094 GLfloat vertices[1];
1095 map<string, string> args;
1096 args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES);
1097 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args)));
1099 ctx.glUseProgram(program.getProgram());
1100 ctx.expectError(GL_NO_ERROR);
1102 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
1103 ctx.glDrawRangeElements(-1, 0, 1, 1, GL_UNSIGNED_BYTE, vertices);
1104 ctx.expectError(GL_INVALID_ENUM);
1107 ctx.beginSection("GL_INVALID_ENUM is generated if type is not one of the accepted values.");
1108 ctx.glDrawRangeElements(GL_POINTS, 0, 1, 1, -1, vertices);
1109 ctx.expectError(GL_INVALID_ENUM);
1110 ctx.glDrawRangeElements(GL_POINTS, 0, 1, 1, GL_FLOAT, vertices);
1111 ctx.expectError(GL_INVALID_ENUM);
1114 ctx.beginSection("GL_INVALID_VALUE is generated if count is negative.");
1115 ctx.glDrawRangeElements(GL_POINTS, 0, 1, -1, GL_UNSIGNED_BYTE, vertices);
1116 ctx.expectError(GL_INVALID_VALUE);
1119 ctx.beginSection("GL_INVALID_VALUE is generated if end < start.");
1120 ctx.glDrawRangeElements(GL_POINTS, 1, 0, 1, GL_UNSIGNED_BYTE, vertices);
1121 ctx.expectError(GL_INVALID_VALUE);
1124 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
1125 ctx.glGenFramebuffers(1, &fbo);
1126 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1127 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
1128 ctx.glDrawRangeElements(GL_POINTS, 0, 1, 1, GL_UNSIGNED_BYTE, vertices);
1129 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1130 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1131 ctx.glDeleteFramebuffers(1, &fbo);
1134 if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error
1136 ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback is active and not paused.");
1137 const char* tfVarying= "gl_Position";
1139 ctx.glGenBuffers(1, &buf);
1140 ctx.glGenTransformFeedbacks(1, &tfID);
1142 ctx.glUseProgram(program.getProgram());
1143 ctx.glTransformFeedbackVaryings(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
1144 ctx.glLinkProgram(program.getProgram());
1145 ctx.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, tfID);
1146 ctx.glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
1147 ctx.glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
1148 ctx.glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
1149 ctx.glBeginTransformFeedback(GL_POINTS);
1150 ctx.expectError(GL_NO_ERROR);
1152 ctx.glDrawRangeElements(GL_POINTS, 0, 1, 1, GL_UNSIGNED_BYTE, vertices);
1153 ctx.expectError(GL_INVALID_OPERATION);
1155 ctx.glPauseTransformFeedback();
1156 ctx.glDrawRangeElements(GL_POINTS, 0, 1, 1, GL_UNSIGNED_BYTE, vertices);
1157 ctx.expectError(GL_NO_ERROR);
1159 ctx.glEndTransformFeedback();
1160 ctx.glDeleteBuffers(1, &buf);
1161 ctx.glDeleteTransformFeedbacks(1, &tfID);
1162 ctx.expectError(GL_NO_ERROR);
1166 ctx.glUseProgram(0);
1169 void draw_range_elements_invalid_program (NegativeTestContext& ctx)
1171 ctx.glUseProgram(0);
1173 GLfloat vertices[1];
1175 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
1176 ctx.glDrawRangeElements(-1, 0, 1, 1, GL_UNSIGNED_BYTE, vertices);
1177 ctx.expectError(GL_INVALID_ENUM);
1180 ctx.beginSection("GL_INVALID_ENUM is generated if type is not one of the accepted values.");
1181 ctx.glDrawRangeElements(GL_POINTS, 0, 1, 1, -1, vertices);
1182 ctx.expectError(GL_INVALID_ENUM);
1183 ctx.glDrawRangeElements(GL_POINTS, 0, 1, 1, GL_FLOAT, vertices);
1184 ctx.expectError(GL_INVALID_ENUM);
1187 ctx.beginSection("GL_INVALID_VALUE is generated if count is negative.");
1188 ctx.glDrawRangeElements(GL_POINTS, 0, 1, -1, GL_UNSIGNED_BYTE, vertices);
1189 ctx.expectError(GL_INVALID_VALUE);
1192 ctx.beginSection("GL_INVALID_VALUE is generated if end < start.");
1193 ctx.glDrawRangeElements(GL_POINTS, 1, 0, 1, GL_UNSIGNED_BYTE, vertices);
1194 ctx.expectError(GL_INVALID_VALUE);
1197 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
1198 ctx.glGenFramebuffers(1, &fbo);
1199 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1200 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
1201 ctx.glDrawRangeElements(GL_POINTS, 0, 1, 1, GL_UNSIGNED_BYTE, vertices);
1202 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1203 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1204 ctx.glDeleteFramebuffers(1, &fbo);
1208 void draw_range_elements_incomplete_primitive (NegativeTestContext& ctx)
1210 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
1214 GLfloat vertices[1];
1215 map<string, string> args;
1216 args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES);
1217 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args)));
1219 ctx.glUseProgram(program.getProgram());
1220 ctx.expectError(GL_NO_ERROR);
1222 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
1223 ctx.glDrawRangeElements(-1, 0, 1, 1, GL_UNSIGNED_BYTE, vertices);
1224 ctx.expectError(GL_INVALID_ENUM);
1227 ctx.beginSection("GL_INVALID_ENUM is generated if type is not one of the accepted values.");
1228 ctx.glDrawRangeElements(GL_TRIANGLES, 0, 1, 1, -1, vertices);
1229 ctx.expectError(GL_INVALID_ENUM);
1230 ctx.glDrawRangeElements(GL_TRIANGLES, 0, 1, 1, GL_FLOAT, vertices);
1231 ctx.expectError(GL_INVALID_ENUM);
1234 ctx.beginSection("GL_INVALID_VALUE is generated if count is negative.");
1235 ctx.glDrawRangeElements(GL_TRIANGLES, 0, 1, -1, GL_UNSIGNED_BYTE, vertices);
1236 ctx.expectError(GL_INVALID_VALUE);
1239 ctx.beginSection("GL_INVALID_VALUE is generated if end < start.");
1240 ctx.glDrawRangeElements(GL_TRIANGLES, 1, 0, 1, GL_UNSIGNED_BYTE, vertices);
1241 ctx.expectError(GL_INVALID_VALUE);
1244 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
1245 ctx.glGenFramebuffers(1, &fbo);
1246 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1247 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
1248 ctx.glDrawRangeElements(GL_TRIANGLES, 0, 1, 1, GL_UNSIGNED_BYTE, vertices);
1249 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1250 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1251 ctx.glDeleteFramebuffers(1, &fbo);
1254 if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error
1256 ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback is active and not paused.");
1257 const char* tfVarying = "gl_Position";
1259 ctx.glGenBuffers(1, &buf);
1260 ctx.glGenTransformFeedbacks(1, &tfID);
1262 ctx.glUseProgram(program.getProgram());
1263 ctx.glTransformFeedbackVaryings(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
1264 ctx.glLinkProgram(program.getProgram());
1265 ctx.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, tfID);
1266 ctx.glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
1267 ctx.glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
1268 ctx.glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
1269 ctx.glBeginTransformFeedback(GL_TRIANGLES);
1270 ctx.expectError(GL_NO_ERROR);
1272 ctx.glDrawRangeElements(GL_TRIANGLES, 0, 1, 1, GL_UNSIGNED_BYTE, vertices);
1273 ctx.expectError(GL_INVALID_OPERATION);
1275 ctx.glPauseTransformFeedback();
1276 ctx.glDrawRangeElements(GL_TRIANGLES, 0, 1, 1, GL_UNSIGNED_BYTE, vertices);
1277 ctx.expectError(GL_NO_ERROR);
1279 ctx.glEndTransformFeedback();
1280 ctx.glDeleteBuffers(1, &buf);
1281 ctx.glDeleteTransformFeedbacks(1, &tfID);
1282 ctx.expectError(GL_NO_ERROR);
1286 ctx.glUseProgram(0);
1289 void draw_range_elements_base_vertex (NegativeTestContext& ctx)
1291 TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a 3.2 context or higher context version.");
1294 GLfloat vertices[1];
1295 map<string, string> args;
1296 args["GLSL_VERSION_STRING"] = getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES);
1297 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args)));
1299 ctx.glUseProgram(program.getProgram());
1300 ctx.expectError(GL_NO_ERROR);
1302 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
1303 ctx.glDrawRangeElementsBaseVertex(-1, 0, 1, 1, GL_UNSIGNED_BYTE, vertices, 1);
1304 ctx.expectError(GL_INVALID_ENUM);
1307 ctx.beginSection("GL_INVALID_ENUM is generated if type is not one of the accepted values.");
1308 ctx.glDrawRangeElementsBaseVertex(GL_POINTS, 0, 1, 1, -1, vertices, 1);
1309 ctx.expectError(GL_INVALID_ENUM);
1310 ctx.glDrawRangeElementsBaseVertex(GL_POINTS, 0, 1, 1, GL_FLOAT, vertices, 1);
1311 ctx.expectError(GL_INVALID_ENUM);
1314 ctx.beginSection("GL_INVALID_VALUE is generated if count is negative.");
1315 ctx.glDrawRangeElementsBaseVertex(GL_POINTS, 0, 1, -1, GL_UNSIGNED_BYTE, vertices, 1);
1316 ctx.expectError(GL_INVALID_VALUE);
1319 ctx.beginSection("GL_INVALID_VALUE is generated if end < start.");
1320 ctx.glDrawRangeElementsBaseVertex(GL_POINTS, 1, 0, 1, GL_UNSIGNED_BYTE, vertices, 1);
1321 ctx.expectError(GL_INVALID_VALUE);
1324 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
1325 ctx.glGenFramebuffers(1, &fbo);
1326 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1327 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
1328 ctx.glDrawRangeElementsBaseVertex(GL_POINTS, 0, 1, 1, GL_UNSIGNED_BYTE, vertices, 1);
1329 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1330 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1331 ctx.glDeleteFramebuffers(1, &fbo);
1334 ctx.glUseProgram(0);
1337 void draw_range_elements_base_vertex_primitive_mode_mismatch (NegativeTestContext& ctx)
1339 TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a 3.2 context or higher context version.");
1341 GLfloat vertices[1];
1342 map<string, string> args;
1343 args["GLSL_VERSION_STRING"] = getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES);
1344 glu::ShaderProgram geometryProgram(ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << glu::VertexSource(tcu::StringTemplate(vertexShaderSource).specialize(args)) << glu::GeometrySource(geometryShaderSource));
1346 ctx.beginSection("GL_INVALID_OPERATION is generated if a geometry shader is active and mode is incompatible with the input primitive type of the geometry shader in the currently installed program object.");
1347 ctx.glUseProgram(geometryProgram.getProgram());
1348 ctx.glDrawRangeElementsBaseVertex(GL_TRIANGLES, 0, 1, 1, GL_UNSIGNED_INT, vertices, 1);
1349 ctx.expectError(GL_INVALID_OPERATION);
1352 ctx.glUseProgram(0);
1355 std::vector<FunctionContainer> getNegativeVertexArrayApiTestFunctions ()
1357 FunctionContainer funcs[] =
1359 {vertex_attribf, "vertex_attribf", "Invalid glVertexAttrib{1234}f() usage" },
1360 {vertex_attribfv, "vertex_attribfv", "Invalid glVertexAttrib{1234}fv() usage" },
1361 {vertex_attribi4, "vertex_attribi4", "Invalid glVertexAttribI4{i|ui}f() usage" },
1362 {vertex_attribi4v, "vertex_attribi4v", "Invalid glVertexAttribI4{i|ui}fv() usage" },
1363 {vertex_attrib_pointer, "vertex_attrib_pointer", "Invalid glVertexAttribPointer() usage" },
1364 {vertex_attrib_i_pointer, "vertex_attrib_i_pointer", "Invalid glVertexAttribPointer() usage" },
1365 {vertex_attrib_format, "vertex_attrib_format", "Invalid glVertexAttribFormat() usage" },
1366 {vertex_attrib_i_format, "vertex_attrib_i_format", "Invalid glVertexAttribIFormat() usage" },
1367 {enable_vertex_attrib_array, "enable_vertex_attrib_array", "Invalid glEnableVertexAttribArray() usage" },
1368 {disable_vertex_attrib_array, "disable_vertex_attrib_array", "Invalid glDisableVertexAttribArray() usage" },
1369 {gen_vertex_arrays, "gen_vertex_arrays", "Invalid glGenVertexArrays() usage" },
1370 {bind_vertex_array, "bind_vertex_array", "Invalid glBindVertexArray() usage" },
1371 {delete_vertex_arrays, "delete_vertex_arrays", "Invalid glDeleteVertexArrays() usage" },
1372 {vertex_attrib_divisor, "vertex_attrib_divisor", "Invalid glVertexAttribDivisor() usage" },
1373 {draw_arrays, "draw_arrays", "Invalid glDrawArrays() usage" },
1374 {draw_arrays_invalid_program, "draw_arrays_invalid_program", "Invalid glDrawArrays() usage" },
1375 {draw_arrays_incomplete_primitive, "draw_arrays_incomplete_primitive", "Invalid glDrawArrays() usage" },
1376 {draw_elements, "draw_elements", "Invalid glDrawElements() usage" },
1377 {draw_elements_base_vertex, "draw_elements_base_vertex", "Invalid glDrawElementsBaseVertex() usage" },
1378 {draw_elements_base_vertex_primitive_mode_mismatch, "draw_elements_base_vertex_primitive_mode_mismatch", "Invalid glDrawElementsBaseVertex() usage" },
1379 {draw_elements_invalid_program, "draw_elements_invalid_program", "Invalid glDrawElements() usage" },
1380 {draw_elements_incomplete_primitive, "draw_elements_incomplete_primitive", "Invalid glDrawElements() usage" },
1381 {draw_arrays_instanced, "draw_arrays_instanced", "Invalid glDrawArraysInstanced() usage" },
1382 {draw_arrays_instanced_invalid_program, "draw_arrays_instanced_invalid_program", "Invalid glDrawArraysInstanced() usage" },
1383 {draw_arrays_instanced_incomplete_primitive, "draw_arrays_instanced_incomplete_primitive", "Invalid glDrawArraysInstanced() usage" },
1384 {draw_elements_instanced, "draw_elements_instanced", "Invalid glDrawElementsInstanced() usage" },
1385 {draw_elements_instanced_invalid_program, "draw_elements_instanced_invalid_program", "Invalid glDrawElementsInstanced() usage" },
1386 {draw_elements_instanced_incomplete_primitive, "draw_elements_instanced_incomplete_primitive", "Invalid glDrawElementsInstanced() usage" },
1387 {draw_elements_instanced_base_vertex, "draw_elements_instanced_base_vertex", "Invalid glDrawElementsInstancedBaseVertex() usage" },
1388 {draw_elements_instanced_base_vertex_primitive_mode_mismatch, "draw_elements_instanced_base_vertex_primitive_mode_mismatch", "Invalid glDrawElementsInstancedBaseVertex() usage" },
1389 {draw_range_elements, "draw_range_elements", "Invalid glDrawRangeElements() usage" },
1390 {draw_range_elements_invalid_program, "draw_range_elements_invalid_program", "Invalid glDrawRangeElements() usage" },
1391 {draw_range_elements_incomplete_primitive, "draw_range_elements_incomplete_primitive", "Invalid glDrawRangeElements() usage" },
1392 {draw_range_elements_base_vertex, "draw_range_elements_base_vertex", "Invalid glDrawRangeElementsBaseVertex() usage" },
1393 {draw_range_elements_base_vertex_primitive_mode_mismatch, "draw_range_elements_base_vertex_primitive_mode_mismatch", "Invalid glDrawRangeElementsBaseVertex() usage" },
1396 return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs));
1399 } // NegativeTestShared