Lines Matching refs:ctx

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);
81 ctx.endSection();
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);
97 ctx.endSection();
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);
111 ctx.endSection();
114 void vertex_attribi4v (NegativeTestContext& ctx)
116 int maxVertexAttribs = ctx.getInteger(GL_MAX_VERTEX_ATTRIBS);
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);
125 ctx.endSection();
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);
133 ctx.endSection();
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);
139 ctx.endSection();
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);
144 ctx.endSection();
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);
149 ctx.endSection();
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);
160 ctx.endSection();
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);
176 ctx.endSection();
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);
188 ctx.endSection();
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);
194 ctx.endSection();
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);
199 ctx.endSection();
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);
204 ctx.endSection();
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);
220 ctx.endSection();
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);
235 ctx.endSection();
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);
243 ctx.endSection();
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);
251 ctx.endSection();
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);
259 ctx.endSection();
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);
267 ctx.endSection();
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);
275 ctx.endSection();
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);
283 ctx.endSection();
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);
298 ctx.endSection();
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);
306 ctx.endSection();
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);
314 ctx.endSection();
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);
322 ctx.endSection();
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);
330 ctx.endSection();
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);
340 ctx.endSection();
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);
350 ctx.endSection();
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);
360 ctx.endSection();
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);
368 ctx.endSection();
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);
376 ctx.endSection();
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);
386 ctx.endSection();
389 void draw_arrays (NegativeTestContext& ctx)
391 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
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);
403 ctx.endSection();
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);
408 ctx.endSection();
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);
418 ctx.endSection();
420 ctx.glUseProgram(0);
423 void draw_arrays_invalid_program (NegativeTestContext& ctx)
426 ctx.glUseProgram(0);
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);
431 ctx.endSection();
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);
436 ctx.endSection();
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);
446 ctx.endSection();
449 void draw_arrays_incomplete_primitive (NegativeTestContext& ctx)
451 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
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);
463 ctx.endSection();
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);
468 ctx.endSection();
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);
478 ctx.endSection();
480 ctx.glUseProgram(0);
483 void draw_elements (NegativeTestContext& ctx)
485 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
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);
500 ctx.endSection();
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);
507 ctx.endSection();
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);
512 ctx.endSection();
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);
522 ctx.endSection();
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.");
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);
553 ctx.endSection();
556 ctx.glUseProgram(0);
559 void draw_elements_invalid_program (NegativeTestContext& ctx)
561 ctx.glUseProgram(0);
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);
568 ctx.endSection();
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);
575 ctx.endSection();
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);
580 ctx.endSection();
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);
590 ctx.endSection();
593 void draw_elements_incomplete_primitive (NegativeTestContext& ctx)
595 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
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);
610 ctx.endSection();
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);
617 ctx.endSection();
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);
622 ctx.endSection();
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);
632 ctx.endSection();
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.");
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);
663 ctx.endSection();
666 ctx.glUseProgram(0);
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);
679 ctx.endSection();
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);
686 ctx.endSection();
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);
691 ctx.endSection();
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);
701 ctx.endSection();
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.");
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);
718 ctx.endSection();
720 ctx.glUseProgram(0);
723 void draw_arrays_instanced (NegativeTestContext& ctx)
725 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
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);
739 ctx.endSection();
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);
746 ctx.endSection();
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);
756 ctx.endSection();
758 ctx.glUseProgram(0);
761 void draw_arrays_instanced_invalid_program (NegativeTestContext& ctx)
763 ctx.glUseProgram(0);
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);
771 ctx.endSection();
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);
778 ctx.endSection();
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);
788 ctx.endSection();
791 void draw_arrays_instanced_incomplete_primitive (NegativeTestContext& ctx)
793 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
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);
805 ctx.endSection();
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);
812 ctx.endSection();
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);
822 ctx.endSection();
824 ctx.glUseProgram(0);
827 void draw_elements_instanced (NegativeTestContext& ctx)
829 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
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);
845 ctx.endSection();
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);
852 ctx.endSection();
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);
859 ctx.endSection();
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);
869 ctx.endSection();
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.");
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);
900 ctx.endSection();
903 ctx.glUseProgram(0);
906 void draw_elements_instanced_invalid_program (NegativeTestContext& ctx)
908 ctx.glUseProgram(0);
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);
917 ctx.endSection();
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);
924 ctx.endSection();
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);
931 ctx.endSection();
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);
941 ctx.endSection();
944 void draw_elements_instanced_incomplete_primitive (NegativeTestContext& ctx)
946 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
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);
962 ctx.endSection();
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);
969 ctx.endSection();
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);
976 ctx.endSection();
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);
986 ctx.endSection();
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.");
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);
1017 ctx.endSection();
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));
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);
1041 ctx.endSection();
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);
1048 ctx.endSection();
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);
1055 ctx.endSection();
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);
1065 ctx.endSection();
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.");
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);
1083 ctx.endSection();
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));
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);
1105 ctx.endSection();
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);
1112 ctx.endSection();
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);
1117 ctx.endSection();
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);
1122 ctx.endSection();
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);
1132 ctx.endSection();
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.");
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);
1163 ctx.endSection();
1166 ctx.glUseProgram(0);
1169 void draw_range_elements_invalid_program (NegativeTestContext& ctx)
1171 ctx.glUseProgram(0);
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);
1178 ctx.endSection();
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);
1185 ctx.endSection();
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);
1190 ctx.endSection();
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);
1195 ctx.endSection();
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);
1205 ctx.endSection();
1208 void draw_range_elements_incomplete_primitive (NegativeTestContext& ctx)
1210 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
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);
1225 ctx.endSection();
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);
1232 ctx.endSection();
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);
1237 ctx.endSection();
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);
1242 ctx.endSection();
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);
1252 ctx.endSection();
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.");
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);
1283 ctx.endSection();
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.");
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);
1305 ctx.endSection();
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);
1312 ctx.endSection();
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);
1317 ctx.endSection();
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);
1322 ctx.endSection();
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);
1332 ctx.endSection();
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.");
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);
1350 ctx.endSection();
1352 ctx.glUseProgram(0);