Lines Matching refs:ctx
76 VAOHelper(NegativeTestContext& ctx)
78 , m_ctx(ctx)
81 if (glu::isContextTypeES(ctx.getRenderContext().getType()))
100 static std::string getVtxFragVersionSources (const std::string source, NegativeTestContext& ctx)
102 const bool supportsES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
112 void enable (NegativeTestContext& ctx)
114 ctx.beginSection("GL_INVALID_ENUM is generated if cap is not one of the allowed values.");
115 ctx.glEnable(-1);
116 ctx.expectError(GL_INVALID_ENUM);
117 ctx.endSection();
120 static bool checkSupport(NegativeTestContext& ctx)
122 return contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) ||
123 contextSupports(ctx.getRenderContext().getType(), glu::ApiType::core(4, 5));
127 void enablei (NegativeTestContext& ctx)
129 TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version.");
131 ctx.beginSection("GL_INVALID_ENUM is generated if cap is not one of the allowed values.");
132 ctx.glEnablei(-1, -1);
133 ctx.expectError(GL_INVALID_ENUM);
134 ctx.endSection();
136 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to the number of indexed capabilities for cap.");
137 ctx.glEnablei(GL_BLEND, -1);
138 ctx.expectError(GL_INVALID_VALUE);
139 ctx.endSection();
142 void disable (NegativeTestContext& ctx)
144 ctx.beginSection("GL_INVALID_ENUM is generated if cap is not one of the allowed values.");
145 ctx.glDisable(-1);
146 ctx.expectError(GL_INVALID_ENUM);
147 ctx.endSection();
150 void disablei (NegativeTestContext& ctx)
152 TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version.");
154 ctx.beginSection("GL_INVALID_ENUM is generated if cap is not one of the allowed values.");
155 ctx.glDisablei(-1,-1);
156 ctx.expectError(GL_INVALID_ENUM);
157 ctx.endSection();
159 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to the number of indexed capabilities for cap.");
160 ctx.glDisablei(GL_BLEND, -1);
161 ctx.expectError(GL_INVALID_VALUE);
162 ctx.endSection();
166 void get_booleanv (NegativeTestContext& ctx)
168 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the allowed values.");
170 ctx.glGetBooleanv(-1, ¶ms);
171 ctx.expectError(GL_INVALID_ENUM);
172 ctx.endSection();
175 void get_booleani_v (NegativeTestContext& ctx)
180 ctx.beginSection("GL_INVALID_ENUM is generated if target is not indexed state queriable with these commands.");
181 ctx.glGetBooleani_v(-1, 0, &data);
182 ctx.expectError(GL_INVALID_ENUM);
183 ctx.endSection();
185 ctx.beginSection("GL_INVALID_VALUE is generated if index is outside of the valid range for the indexed state target.");
186 ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUniformBufferBindings);
187 ctx.expectError(GL_NO_ERROR);
188 ctx.glGetBooleani_v(GL_UNIFORM_BUFFER_BINDING, maxUniformBufferBindings, &data);
189 ctx.expectError(GL_INVALID_VALUE);
190 ctx.endSection();
193 void get_floatv (NegativeTestContext& ctx)
195 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the allowed values.");
197 ctx.glGetFloatv(-1, ¶ms);
198 ctx.expectError(GL_INVALID_ENUM);
199 ctx.endSection();
202 void get_integerv (NegativeTestContext& ctx)
205 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the allowed values.");
206 ctx.glGetIntegerv(-1, ¶ms);
207 ctx.expectError(GL_INVALID_ENUM);
208 ctx.endSection();
211 void get_integer64v (NegativeTestContext& ctx)
214 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the allowed values.");
215 ctx.glGetInteger64v(-1, ¶ms);
216 ctx.expectError(GL_INVALID_ENUM);
217 ctx.endSection();
220 void get_integeri_v (NegativeTestContext& ctx)
226 ctx.beginSection("GL_INVALID_ENUM is generated if name is not an accepted value.");
227 ctx.glGetIntegeri_v(-1, 0, &data);
228 ctx.expectError(GL_INVALID_ENUM);
229 ctx.endSection();
231 ctx.beginSection("GL_INVALID_VALUE is generated if index is outside of the valid range for the indexed state target.");
232 ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUniformBufferBindings);
233 ctx.expectError(GL_NO_ERROR);
234 ctx.glGetIntegeri_v(GL_UNIFORM_BUFFER_BINDING, maxUniformBufferBindings, &data);
235 ctx.expectError(GL_INVALID_VALUE);
236 ctx.endSection();
238 ctx.beginSection("GL_INVALID_VALUE is generated if index is outside of the valid range for the indexed state target.");
239 ctx.glGetIntegerv(GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS, &maxShaderStorageBufferBindings);
240 ctx.expectError(GL_NO_ERROR);
241 ctx.glGetIntegeri_v(GL_SHADER_STORAGE_BUFFER_BINDING, maxShaderStorageBufferBindings, &data);
242 ctx.expectError(GL_INVALID_VALUE);
243 ctx.endSection();
246 void get_integer64i_v (NegativeTestContext& ctx)
252 ctx.beginSection("GL_INVALID_ENUM is generated if name is not an accepted value.");
253 ctx.glGetInteger64i_v(-1, 0, &data);
254 ctx.expectError(GL_INVALID_ENUM);
255 ctx.endSection();
257 ctx.beginSection("GL_INVALID_VALUE is generated if index is outside of the valid range for the indexed state target.");
258 ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUniformBufferBindings);
259 ctx.expectError(GL_NO_ERROR);
260 ctx.glGetInteger64i_v(GL_UNIFORM_BUFFER_START, maxUniformBufferBindings, &data);
261 ctx.expectError(GL_INVALID_VALUE);
262 ctx.endSection();
264 ctx.beginSection("GL_INVALID_VALUE is generated if index is outside of the valid range for the indexed state target.");
265 ctx.glGetIntegerv(GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS, &maxShaderStorageBufferBindings);
266 ctx.expectError(GL_NO_ERROR);
267 ctx.glGetInteger64i_v(GL_SHADER_STORAGE_BUFFER_START, maxShaderStorageBufferBindings, &data);
268 ctx.expectError(GL_INVALID_VALUE);
269 ctx.glGetInteger64i_v(GL_SHADER_STORAGE_BUFFER_SIZE, maxShaderStorageBufferBindings, &data);
270 ctx.expectError(GL_INVALID_VALUE);
271 ctx.endSection();
274 void get_string (NegativeTestContext& ctx)
276 ctx.beginSection("GL_INVALID_ENUM is generated if name is not an accepted value.");
277 ctx.glGetString(-1);
278 ctx.expectError(GL_INVALID_ENUM);
279 ctx.endSection();
282 void get_stringi (NegativeTestContext& ctx)
286 ctx.beginSection("GL_INVALID_ENUM is generated if name is not an accepted value.");
287 ctx.glGetStringi(-1, 0);
288 ctx.expectError(GL_INVALID_ENUM);
289 ctx.endSection();
291 ctx.beginSection("GL_INVALID_VALUE is generated if index is outside the valid range for indexed state name.");
292 ctx.glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
293 ctx.glGetStringi(GL_EXTENSIONS, numExtensions);
294 ctx.expectError(GL_INVALID_VALUE);
295 ctx.endSection();
300 void get_attached_shaders (NegativeTestContext& ctx)
303 GLuint shaderObject = ctx.glCreateShader(GL_VERTEX_SHADER);
304 GLuint program = ctx.glCreateProgram();
307 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
308 ctx.glGetAttachedShaders(-1, 1, &count[0], &shaders[0]);
309 ctx.expectError(GL_INVALID_VALUE);
310 ctx.endSection();
312 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
313 ctx.glGetAttachedShaders(shaderObject, 1, &count[0], &shaders[0]);
314 ctx.expectError(GL_INVALID_OPERATION);
315 ctx.endSection();
317 ctx.beginSection("GL_INVALID_VALUE is generated if maxCount is less than 0.");
318 ctx.glGetAttachedShaders(program, -1, &count[0], &shaders[0]);
319 ctx.expectError(GL_INVALID_VALUE);
320 ctx.endSection();
322 ctx.glDeleteShader(shaderObject);
323 ctx.glDeleteProgram(program);
326 void get_shaderiv (NegativeTestContext& ctx)
329 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
330 GLuint program = ctx.glCreateProgram();
333 ctx.glGetBooleanv(GL_SHADER_COMPILER, &shaderCompilerSupported);
334 ctx.getLog() << TestLog::Message << "// GL_SHADER_COMPILER = " << (shaderCompilerSupported ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage;
336 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
337 ctx.glGetShaderiv(shader, -1, ¶m[0]);
338 ctx.expectError(GL_INVALID_ENUM);
339 ctx.endSection();
341 ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
342 ctx.glGetShaderiv(-1, GL_SHADER_TYPE, ¶m[0]);
343 ctx.expectError(GL_INVALID_VALUE);
344 ctx.endSection();
346 ctx.beginSection("GL_INVALID_OPERATION is generated if shader does not refer to a shader object.");
347 ctx.glGetShaderiv(program, GL_SHADER_TYPE, ¶m[0]);
348 ctx.expectError(GL_INVALID_OPERATION);
349 ctx.endSection();
351 ctx.glDeleteShader(shader);
352 ctx.glDeleteProgram(program);
355 void get_shader_info_log (NegativeTestContext& ctx)
357 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
358 GLuint program = ctx.glCreateProgram();
362 ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
363 ctx.glGetShaderInfoLog(-1, 128, &length[0], &infoLog[0]);
364 ctx.expectError(GL_INVALID_VALUE);
365 ctx.endSection();
367 ctx.beginSection("GL_INVALID_OPERATION is generated if shader is not a shader object.");
368 ctx.glGetShaderInfoLog(program, 128, &length[0], &infoLog[0]);
369 ctx.expectError(GL_INVALID_OPERATION);
370 ctx.endSection();
372 ctx.beginSection("GL_INVALID_VALUE is generated if maxLength is less than 0.");
373 ctx.glGetShaderInfoLog(shader, -1, &length[0], &infoLog[0]);
374 ctx.expectError(GL_INVALID_VALUE);
375 ctx.endSection();
377 ctx.glDeleteShader(shader);
378 ctx.glDeleteProgram(program);
381 void get_shader_precision_format (NegativeTestContext& ctx)
387 ctx.glGetBooleanv(GL_SHADER_COMPILER, &shaderCompilerSupported);
388 ctx.getLog() << TestLog::Message << "// GL_SHADER_COMPILER = " << (shaderCompilerSupported ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage;
393 ctx.beginSection("GL_INVALID_ENUM is generated if shaderType or precisionType is not an accepted value.");
394 ctx.glGetShaderPrecisionFormat (-1, GL_MEDIUM_FLOAT, &range[0], &precision[0]);
395 ctx.expectError(GL_INVALID_ENUM);
396 ctx.glGetShaderPrecisionFormat (GL_VERTEX_SHADER, -1, &range[0], &precision[0]);
397 ctx.expectError(GL_INVALID_ENUM);
398 ctx.glGetShaderPrecisionFormat (-1, -1, &range[0], &precision[0]);
399 ctx.expectError(GL_INVALID_ENUM);
400 ctx.endSection();
403 void get_shader_source (NegativeTestContext& ctx)
407 GLuint program = ctx.glCreateProgram();
408 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
410 ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
411 ctx.glGetShaderSource(-1, 1, &length[0], &source[0]);
412 ctx.expectError(GL_INVALID_VALUE);
413 ctx.endSection();
415 ctx.beginSection("GL_INVALID_OPERATION is generated if shader is not a shader object.");
416 ctx.glGetShaderSource(program, 1, &length[0], &source[0]);
417 ctx.expectError(GL_INVALID_OPERATION);
418 ctx.endSection();
420 ctx.beginSection("GL_INVALID_VALUE is generated if bufSize is less than 0.");
421 ctx.glGetShaderSource(shader, -1, &length[0], &source[0]);
422 ctx.expectError(GL_INVALID_VALUE);
423 ctx.endSection();
425 ctx.glDeleteProgram(program);
426 ctx.glDeleteShader(shader);
431 void get_programiv (NegativeTestContext& ctx)
433 GLuint program = ctx.glCreateProgram();
434 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
437 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
438 ctx.glGetProgramiv(program, -1, ¶ms[0]);
439 ctx.expectError(GL_INVALID_ENUM);
440 ctx.endSection();
442 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
443 ctx.glGetProgramiv(-1, GL_LINK_STATUS, ¶ms[0]);
444 ctx.expectError(GL_INVALID_VALUE);
445 ctx.endSection();
447 ctx.beginSection("GL_INVALID_OPERATION is generated if program does not refer to a program object.");
448 ctx.glGetProgramiv(shader, GL_LINK_STATUS, ¶ms[0]);
449 ctx.expectError(GL_INVALID_OPERATION);
450 ctx.endSection();
452 ctx.glDeleteProgram(program);
453 ctx.glDeleteShader(shader);
456 void get_program_info_log (NegativeTestContext& ctx)
458 GLuint program = ctx.glCreateProgram();
459 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
463 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
464 ctx.glGetProgramInfoLog (-1, 1, &length[0], &infoLog[0]);
465 ctx.expectError(GL_INVALID_VALUE);
466 ctx.endSection();
468 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
469 ctx.glGetProgramInfoLog (shader, 1, &length[0], &infoLog[0]);
470 ctx.expectError(GL_INVALID_OPERATION);
471 ctx.endSection();
473 ctx.beginSection("GL_INVALID_VALUE is generated if maxLength is less than 0.");
474 ctx.glGetProgramInfoLog (program, -1, &length[0], &infoLog[0]);
475 ctx.expectError(GL_INVALID_VALUE);
476 ctx.endSection();
478 ctx.glDeleteProgram(program);
479 ctx.glDeleteShader(shader);
484 void get_tex_parameterfv (NegativeTestContext& ctx)
488 ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value.");
489 ctx.glGetTexParameterfv (-1, GL_TEXTURE_MAG_FILTER, ¶ms[0]);
490 ctx.expectError(GL_INVALID_ENUM);
491 ctx.glGetTexParameterfv (GL_TEXTURE_2D, -1, ¶ms[0]);
492 ctx.expectError(GL_INVALID_ENUM);
493 ctx.glGetTexParameterfv (-1, -1, ¶ms[0]);
494 ctx.expectError(GL_INVALID_ENUM);
495 ctx.endSection();
498 void get_tex_parameteriv (NegativeTestContext& ctx)
502 ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value.");
503 ctx.glGetTexParameteriv (-1, GL_TEXTURE_MAG_FILTER, ¶ms[0]);
504 ctx.expectError(GL_INVALID_ENUM);
505 ctx.glGetTexParameteriv (GL_TEXTURE_2D, -1, ¶ms[0]);
506 ctx.expectError(GL_INVALID_ENUM);
507 ctx.glGetTexParameteriv (-1, -1, ¶ms[0]);
508 ctx.expectError(GL_INVALID_ENUM);
509 ctx.endSection();
512 void get_tex_parameteriiv (NegativeTestContext& ctx)
514 TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version.");
518 ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value.");
519 ctx.glGetTexParameterIiv(-1, GL_TEXTURE_MAG_FILTER, ¶ms[0]);
520 ctx.expectError(GL_INVALID_ENUM);
521 ctx.glGetTexParameterIiv(GL_TEXTURE_2D, -1, ¶ms[0]);
522 ctx.expectError(GL_INVALID_ENUM);
523 ctx.glGetTexParameterIiv(-1, -1, ¶ms[0]);
524 ctx.expectError(GL_INVALID_ENUM);
525 ctx.endSection();
528 void get_tex_parameteriuiv (NegativeTestContext& ctx)
530 TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version.");
534 ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value.");
535 ctx.glGetTexParameterIuiv(-1, GL_TEXTURE_MAG_FILTER, ¶ms[0]);
536 ctx.expectError(GL_INVALID_ENUM);
537 ctx.glGetTexParameterIuiv(GL_TEXTURE_2D, -1, ¶ms[0]);
538 ctx.expectError(GL_INVALID_ENUM);
539 ctx.glGetTexParameterIuiv(-1, -1, ¶ms[0]);
540 ctx.expectError(GL_INVALID_ENUM);
541 ctx.endSection();
544 void get_uniformfv (NegativeTestContext& ctx)
546 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
552 ctx.glUseProgram(program.getProgram());
554 unif = ctx.glGetUniformLocation(program.getProgram(), "vUnif_vec4"); // vec4
556 ctx.fail("Failed to retrieve uniform location");
558 shader = ctx.glCreateShader(GL_VERTEX_SHADER);
559 programEmpty = ctx.glCreateProgram();
561 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
562 ctx.glGetUniformfv (-1, unif, ¶ms[0]);
563 ctx.expectError(GL_INVALID_VALUE);
564 ctx.endSection();
566 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
567 ctx.glGetUniformfv (shader, unif, ¶ms[0]);
568 ctx.expectError(GL_INVALID_OPERATION);
569 ctx.endSection();
571 ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
572 ctx.glGetUniformfv (programEmpty, unif, ¶ms[0]);
573 ctx.expectError(GL_INVALID_OPERATION);
574 ctx.endSection();
576 ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable location for the specified program object.");
577 ctx.glGetUniformfv (program.getProgram(), -1, ¶ms[0]);
578 ctx.expectError(GL_INVALID_OPERATION);
579 ctx.endSection();
581 ctx.glDeleteShader(shader);
582 ctx.glDeleteProgram(programEmpty);
585 void get_nuniformfv (NegativeTestContext& ctx)
587 TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version.");
589 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
590 GLint unif = ctx.glGetUniformLocation(program.getProgram(), "vUnif_vec4");
596 ctx.glUseProgram(program.getProgram());
599 ctx.fail("Failed to retrieve uniform location");
601 shader = ctx.glCreateShader(GL_VERTEX_SHADER);
602 programEmpty = ctx.glCreateProgram();
604 ctx.glGetIntegerv(GL_MAX_COMBINED_UNIFORM_BLOCKS, &bufferSize);
606 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
607 ctx.glGetnUniformfv(-1, unif, bufferSize, ¶ms[0]);
608 ctx.expectError(GL_INVALID_VALUE);
609 ctx.endSection();
611 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
612 ctx.glGetnUniformfv(shader, unif, bufferSize, ¶ms[0]);
613 ctx.expectError(GL_INVALID_OPERATION);
614 ctx.endSection();
616 ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
617 ctx.glGetnUniformfv(programEmpty, unif, bufferSize, ¶ms[0]);
618 ctx.expectError(GL_INVALID_OPERATION);
619 ctx.endSection();
621 ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable location for the specified program object.");
622 ctx.glGetnUniformfv(program.getProgram(), -1, bufferSize, ¶ms[0]);
623 ctx.expectError(GL_INVALID_OPERATION);
624 ctx.endSection();
626 ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer size required to store the requested data is greater than bufSize.");
627 ctx.glGetnUniformfv(program.getProgram(), unif, 0, ¶ms[0]);
628 ctx.expectError(GL_INVALID_OPERATION);
629 ctx.endSection();
631 ctx.glDeleteShader(shader);
632 ctx.glDeleteProgram(programEmpty);
635 void get_uniformiv (NegativeTestContext& ctx)
637 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
638 GLint unif = ctx.glGetUniformLocation(program.getProgram(), "fUnif_ivec4");
643 ctx.glUseProgram(program.getProgram());
646 ctx.fail("Failed to retrieve uniform location");
648 shader = ctx.glCreateShader(GL_VERTEX_SHADER);
649 programEmpty = ctx.glCreateProgram();
651 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
652 ctx.glGetUniformiv (-1, unif, ¶ms[0]);
653 ctx.expectError(GL_INVALID_VALUE);
654 ctx.endSection();
656 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
657 ctx.glGetUniformiv (shader, unif, ¶ms[0]);
658 ctx.expectError(GL_INVALID_OPERATION);
659 ctx.endSection();
661 ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
662 ctx.glGetUniformiv (programEmpty, unif, ¶ms[0]);
663 ctx.expectError(GL_INVALID_OPERATION);
664 ctx.endSection();
666 ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable location for the specified program object.");
667 ctx.glGetUniformiv (program.getProgram(), -1, ¶ms[0]);
668 ctx.expectError(GL_INVALID_OPERATION);
669 ctx.endSection();
671 ctx.glDeleteShader(shader);
672 ctx.glDeleteProgram(programEmpty);
675 void get_nuniformiv (NegativeTestContext& ctx)
677 TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version.");
679 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
680 GLint unif = ctx.glGetUniformLocation(program.getProgram(), "fUnif_ivec4");
686 ctx.glUseProgram(program.getProgram());
689 ctx.fail("Failed to retrieve uniform location");
691 shader = ctx.glCreateShader(GL_VERTEX_SHADER);
692 programEmpty = ctx.glCreateProgram();
694 ctx.glGetIntegerv(GL_MAX_COMBINED_UNIFORM_BLOCKS, &bufferSize);
696 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
697 ctx.glGetnUniformiv(-1, unif, bufferSize, ¶ms[0]);
698 ctx.expectError(GL_INVALID_VALUE);
699 ctx.endSection();
701 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
702 ctx.glGetnUniformiv(shader, unif, bufferSize, ¶ms[0]);
703 ctx.expectError(GL_INVALID_OPERATION);
704 ctx.endSection();
706 ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
707 ctx.glGetnUniformiv(programEmpty, unif, bufferSize, ¶ms[0]);
708 ctx.expectError(GL_INVALID_OPERATION);
709 ctx.endSection();
711 ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable location for the specified program object.");
712 ctx.glGetnUniformiv(program.getProgram(), -1, bufferSize, ¶ms[0]);
713 ctx.expectError(GL_INVALID_OPERATION);
714 ctx.endSection();
716 ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer size required to store the requested data is greater than bufSize.");
717 ctx.glGetnUniformiv(program.getProgram(), unif, - 1, ¶ms[0]);
718 ctx.expectError(GL_INVALID_OPERATION);
719 ctx.endSection();
721 ctx.glDeleteShader(shader);
722 ctx.glDeleteProgram(programEmpty);
725 void get_uniformuiv (NegativeTestContext& ctx)
727 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
728 GLint unif = ctx.glGetUniformLocation(program.getProgram(), "fUnif_uvec4");
733 ctx.glUseProgram(program.getProgram());
736 ctx.fail("Failed to retrieve uniform location");
738 shader = ctx.glCreateShader(GL_VERTEX_SHADER);
739 programEmpty = ctx.glCreateProgram();
741 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
742 ctx.glGetUniformuiv (-1, unif, ¶ms[0]);
743 ctx.expectError(GL_INVALID_VALUE);
744 ctx.endSection();
746 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
747 ctx.glGetUniformuiv (shader, unif, ¶ms[0]);
748 ctx.expectError(GL_INVALID_OPERATION);
749 ctx.endSection();
751 ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
752 ctx.glGetUniformuiv (programEmpty, unif, ¶ms[0]);
753 ctx.expectError(GL_INVALID_OPERATION);
754 ctx.endSection();
756 ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable location for the specified program object.");
757 ctx.glGetUniformuiv (program.getProgram(), -1, ¶ms[0]);
758 ctx.expectError(GL_INVALID_OPERATION);
759 ctx.endSection();
761 ctx.glDeleteShader(shader);
762 ctx.glDeleteProgram(programEmpty);
765 void get_nuniformuiv (NegativeTestContext& ctx)
767 TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version.");
769 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
770 GLint unif = ctx.glGetUniformLocation(program.getProgram(), "fUnif_ivec4");
776 ctx.glUseProgram(program.getProgram());
779 ctx.fail("Failed to retrieve uniform location");
781 shader = ctx.glCreateShader(GL_VERTEX_SHADER);
782 programEmpty = ctx.glCreateProgram();
784 ctx.glGetIntegerv(GL_MAX_COMBINED_UNIFORM_BLOCKS, &bufferSize);
786 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
787 ctx.glGetnUniformuiv(-1, unif, bufferSize, ¶ms[0]);
788 ctx.expectError(GL_INVALID_VALUE);
789 ctx.endSection();
791 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
792 ctx.glGetnUniformuiv(shader, unif, bufferSize, ¶ms[0]);
793 ctx.expectError(GL_INVALID_OPERATION);
794 ctx.endSection();
796 ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
797 ctx.glGetnUniformuiv(programEmpty, unif, bufferSize, ¶ms[0]);
798 ctx.expectError(GL_INVALID_OPERATION);
799 ctx.endSection();
801 ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable location for the specified program object.");
802 ctx.glGetnUniformuiv(program.getProgram(), -1, bufferSize, ¶ms[0]);
803 ctx.expectError(GL_INVALID_OPERATION);
804 ctx.endSection();
806 ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer size required to store the requested data is greater than bufSize.");
807 ctx.glGetnUniformuiv(program.getProgram(), unif, -1, ¶ms[0]);
808 ctx.expectError(GL_INVALID_OPERATION);
809 ctx.endSection();
811 ctx.glDeleteShader(shader);
812 ctx.glDeleteProgram(programEmpty);
815 void get_active_uniform (NegativeTestContext& ctx)
817 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
818 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
821 ctx.glGetProgramiv (program.getProgram(), GL_ACTIVE_UNIFORMS, &numActiveUniforms);
822 ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORMS = " << numActiveUniforms << " (expected 4)." << TestLog::EndMessage;
824 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
825 ctx.glGetActiveUniform(-1, 0, 0, 0, 0, 0, 0);
826 ctx.expectError(GL_INVALID_VALUE);
827 ctx.endSection();
829 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
830 ctx.glGetActiveUniform(shader, 0, 0, 0, 0, 0, 0);
831 ctx.expectError(GL_INVALID_OPERATION);
832 ctx.endSection();
834 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to the number of active uniform variables in program.");
835 ctx.glUseProgram(program.getProgram());
836 ctx.glGetActiveUniform(program.getProgram(), numActiveUniforms, 0, 0, 0, 0, 0);
837 ctx.expectError(GL_INVALID_VALUE);
838 ctx.endSection();
840 ctx.beginSection("GL_INVALID_VALUE is generated if bufSize is less than 0.");
841 ctx.glGetActiveUniform(program.getProgram(), 0, -1, 0, 0, 0, 0);
842 ctx.expectError(GL_INVALID_VALUE);
843 ctx.endSection();
845 ctx.glUseProgram(0);
846 ctx.glDeleteShader(shader);
849 void get_active_uniformsiv (NegativeTestContext& ctx)
851 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
852 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
857 ctx.glUseProgram(program.getProgram());
859 ctx.glGetProgramiv (program.getProgram(), GL_ACTIVE_UNIFORMS, &numActiveUniforms);
860 ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORMS = " << numActiveUniforms << " (expected 4)." << TestLog::EndMessage;
862 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
863 ctx.glGetActiveUniformsiv(-1, 1, &unusedUniformIndex, GL_UNIFORM_TYPE, &unusedParamDst);
864 ctx.expectError(GL_INVALID_VALUE);
865 ctx.endSection();
867 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
868 ctx.glGetActiveUniformsiv(shader, 1, &unusedUniformIndex, GL_UNIFORM_TYPE, &unusedParamDst);
869 ctx.expectError(GL_INVALID_OPERATION);
870 ctx.endSection();
872 ctx.beginSection("GL_INVALID_VALUE is generated if any value in uniformIndices is greater than or equal to the value of GL_ACTIVE_UNIFORMS for program.");
881 ctx.glGetActiveUniformsiv(program.getProgram(), (GLsizei)invalidUniformIndices.size(), &invalidUniformIndices[0], GL_UNIFORM_TYPE, &unusedParamsDst[0]);
882 ctx.expectError(excess == 0 ? GL_NO_ERROR : GL_INVALID_VALUE);
884 ctx.endSection();
886 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted token.");
887 ctx.glGetActiveUniformsiv(program.getProgram(), 1, &unusedUniformIndex, -1, &unusedParamDst);
888 ctx.expectError(GL_INVALID_ENUM);
889 ctx.endSection();
891 ctx.glUseProgram(0);
892 ctx.glDeleteShader(shader);
895 void get_active_uniform_blockiv (NegativeTestContext& ctx)
897 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
898 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
902 ctx.glGetProgramiv(program.getProgram(), GL_ACTIVE_UNIFORM_BLOCKS, &numActiveBlocks);
903 ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORM_BLOCKS = " << numActiveBlocks << " (expected 1)." << TestLog::EndMessage;
904 ctx.expectError(GL_NO_ERROR);
906 ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of either a program or shader object.");
907 ctx.glGetActiveUniformBlockiv(-1, 0, GL_UNIFORM_BLOCK_BINDING, ¶ms);
908 ctx.expectError(GL_INVALID_VALUE);
909 ctx.endSection();
911 ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object");
912 ctx.glGetActiveUniformBlockiv(shader, 0, GL_UNIFORM_BLOCK_BINDING, ¶ms);
913 ctx.expectError(GL_INVALID_OPERATION);
914 ctx.endSection();
916 ctx.beginSection("GL_INVALID_VALUE is generated if uniformBlockIndex is greater than or equal to the value of GL_ACTIVE_UNIFORM_BLOCKS or is not the index of an active uniform block in program.");
917 ctx.glUseProgram(program.getProgram());
918 ctx.expectError(GL_NO_ERROR);
919 ctx.glGetActiveUniformBlockiv(program.getProgram(), numActiveBlocks, GL_UNIFORM_BLOCK_BINDING, ¶ms);
920 ctx.expectError(GL_INVALID_VALUE);
921 ctx.endSection();
923 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the accepted tokens.");
924 ctx.glGetActiveUniformBlockiv(program.getProgram(), 0, -1, ¶ms);
925 ctx.expectError(GL_INVALID_ENUM);
926 ctx.endSection();
928 ctx.glUseProgram(0);
931 void get_active_uniform_block_name (NegativeTestContext& ctx)
933 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
934 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
941 ctx.glGetProgramiv(program.getProgram(), GL_ACTIVE_UNIFORM_BLOCKS, &numActiveBlocks);
942 ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORM_BLOCKS = " << numActiveBlocks << " (expected 1)." << TestLog::EndMessage;
943 ctx.expectError(GL_NO_ERROR);
945 ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object.");
946 ctx.glGetActiveUniformBlockName(shader, numActiveBlocks, GL_UNIFORM_BLOCK_BINDING, &length, &uniformBlockName[0]);
947 ctx.expectError(GL_INVALID_OPERATION);
948 ctx.endSection();
950 ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of either a program or shader object.");
951 ctx.glGetActiveUniformBlockName(-1, numActiveBlocks, GL_UNIFORM_BLOCK_BINDING, &length, &uniformBlockName[0]);
952 ctx.expectError(GL_INVALID_VALUE);
953 ctx.endSection();
955 ctx.beginSection("GL_INVALID_VALUE is generated if uniformBlockIndex is greater than or equal to the value of GL_ACTIVE_UNIFORM_BLOCKS or is not the index of an active uniform block in program.");
956 ctx.glUseProgram(program.getProgram());
957 ctx.expectError(GL_NO_ERROR);
958 ctx.glGetActiveUniformBlockName(program.getProgram(), numActiveBlocks, (int)sizeof(uniformBlockName), &length, &uniformBlockName[0]);
959 ctx.expectError(GL_INVALID_VALUE);
960 ctx.endSection();
962 ctx.glUseProgram(0);
965 void get_active_attrib (NegativeTestContext& ctx)
967 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
968 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
977 ctx.glGetProgramiv (program.getProgram(), GL_ACTIVE_ATTRIBUTES, &numActiveAttributes);
978 ctx.getLog() << TestLog::Message << "// GL_ACTIVE_ATTRIBUTES = " << numActiveAttributes << " (expected 1)." << TestLog::EndMessage;
980 ctx.glUseProgram(program.getProgram());
982 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
983 ctx.glGetActiveAttrib(-1, 0, 32, &length, &size, &type, &name[0]);
984 ctx.expectError(GL_INVALID_VALUE);
985 ctx.endSection();
987 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
988 ctx.glGetActiveAttrib(shader, 0, 32, &length, &size, &type, &name[0]);
989 ctx.expectError(GL_INVALID_OPERATION);
990 ctx.endSection();
992 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_ACTIVE_ATTRIBUTES.");
993 ctx.glGetActiveAttrib(program.getProgram(), numActiveAttributes, (int)sizeof(name), &length, &size, &type, &name[0]);
994 ctx.expectError(GL_INVALID_VALUE);
995 ctx.endSection();
997 ctx.beginSection("GL_INVALID_VALUE is generated if bufSize is less than 0.");
998 ctx.glGetActiveAttrib(program.getProgram(), 0, -1, &length, &size, &type, &name[0]);
999 ctx.expectError(GL_INVALID_VALUE);
1000 ctx.endSection();
1002 ctx.glUseProgram(0);
1003 ctx.glDeleteShader(shader);
1006 void get_uniform_indices (NegativeTestContext& ctx)
1008 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
1009 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
1015 ctx.glGetProgramiv(program.getProgram(), GL_ACTIVE_UNIFORM_BLOCKS, &numActiveBlocks);
1016 ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORM_BLOCKS = " << numActiveBlocks << TestLog::EndMessage;
1017 ctx.expectError(GL_NO_ERROR);
1019 ctx.beginSection("GL_INVALID_OPERATION is generated if program is a name of shader object.");
1020 ctx.glGetUniformIndices(shader, 1, &uniformName, &uniformIndices);
1021 ctx.expectError(GL_INVALID_OPERATION);
1022 ctx.endSection();
1024 ctx.beginSection("GL_INVALID_VALUE is generated if program is not name of program or shader object.");
1025 ctx.glGetUniformIndices(invalid, 1, &uniformName, &uniformIndices);
1026 ctx.expectError(GL_INVALID_VALUE);
1027 ctx.endSection();
1029 ctx.glUseProgram(0);
1030 ctx.glDeleteShader(shader);
1033 void get_vertex_attribfv (NegativeTestContext& ctx)
1037 VAOHelper vao(ctx);
1039 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
1040 ctx.glGetVertexAttribfv(0, -1, ¶ms);
1041 ctx.expectError(GL_INVALID_ENUM);
1042 ctx.endSection();
1044 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
1045 ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);
1046 ctx.glGetVertexAttribfv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_ENABLED, ¶ms);
1047 ctx.expectError(GL_INVALID_VALUE);
1048 ctx.endSection();
1051 void get_vertex_attribiv (NegativeTestContext& ctx)
1055 VAOHelper vao(ctx);
1057 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
1058 ctx.glGetVertexAttribiv(0, -1, ¶ms);
1059 ctx.expectError(GL_INVALID_ENUM);
1060 ctx.endSection();
1062 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
1063 ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);
1064 ctx.glGetVertexAttribiv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_ENABLED, ¶ms);
1065 ctx.expectError(GL_INVALID_VALUE);
1066 ctx.endSection();
1069 void get_vertex_attribi_iv (NegativeTestContext& ctx)
1073 VAOHelper vao(ctx);
1075 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
1076 ctx.glGetVertexAttribIiv(0, -1, ¶ms);
1077 ctx.expectError(GL_INVALID_ENUM);
1078 ctx.endSection();
1080 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
1081 ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);
1082 ctx.glGetVertexAttribIiv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_ENABLED, ¶ms);
1083 ctx.expectError(GL_INVALID_VALUE);
1084 ctx.endSection();
1087 void get_vertex_attribi_uiv (NegativeTestContext& ctx)
1091 VAOHelper vao(ctx);
1094 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
1095 ctx.glGetVertexAttribIuiv(0, -1, ¶ms);
1096 ctx.expectError(GL_INVALID_ENUM);
1097 ctx.endSection();
1099 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
1100 ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);
1101 ctx.glGetVertexAttribIuiv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_ENABLED, ¶ms);
1102 ctx.expectError(GL_INVALID_VALUE);
1103 ctx.endSection();
1106 void get_vertex_attrib_pointerv (NegativeTestContext& ctx)
1111 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
1112 ctx.glGetVertexAttribPointerv(0, -1, &ptr[0]);
1113 ctx.expectError(GL_INVALID_ENUM);
1114 ctx.endSection();
1116 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
1117 ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);
1118 ctx.glGetVertexAttribPointerv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_POINTER, &ptr[0]);
1119 ctx.expectError(GL_INVALID_VALUE);
1120 ctx.endSection();
1123 void get_frag_data_location (NegativeTestContext& ctx)
1125 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
1126 GLuint program = ctx.glCreateProgram();
1128 ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object.");
1129 ctx.glGetFragDataLocation(shader, "gl_FragColor");
1130 ctx.expectError(GL_INVALID_OPERATION);
1131 ctx.endSection();
1133 ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been linked.");
1134 ctx.glGetFragDataLocation(program, "gl_FragColor");
1135 ctx.expectError(GL_INVALID_OPERATION);
1136 ctx.endSection();
1138 ctx.glDeleteProgram(program);
1139 ctx.glDeleteShader(shader);
1144 void get_buffer_parameteriv (NegativeTestContext& ctx)
1148 ctx.glGenBuffers(1, &buf);
1149 ctx.glBindBuffer(GL_ARRAY_BUFFER, buf);
1151 ctx.beginSection("GL_INVALID_ENUM is generated if target or value is not an accepted value.");
1152 ctx.glGetBufferParameteriv(-1, GL_BUFFER_SIZE, ¶ms);
1153 ctx.expectError(GL_INVALID_ENUM);
1154 ctx.glGetBufferParameteriv(GL_ARRAY_BUFFER, -1, ¶ms);
1155 ctx.expectError(GL_INVALID_ENUM);
1156 ctx.glGetBufferParameteriv(-1, -1, ¶ms);
1157 ctx.expectError(GL_INVALID_ENUM);
1158 ctx.endSection();
1160 ctx.beginSection("GL_INVALID_OPERATION is generated if the reserved buffer object name 0 is bound to target.");
1161 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
1162 ctx.glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, ¶ms);
1163 ctx.expectError(GL_INVALID_OPERATION);
1164 ctx.endSection();
1166 ctx.glDeleteBuffers(1, &buf);
1169 void get_buffer_parameteri64v (NegativeTestContext& ctx)
1173 ctx.glGenBuffers(1, &buf);
1174 ctx.glBindBuffer(GL_ARRAY_BUFFER, buf);
1176 ctx.beginSection("GL_INVALID_ENUM is generated if target or value is not an accepted value.");
1177 ctx.glGetBufferParameteri64v(-1, GL_BUFFER_SIZE, ¶ms);
1178 ctx.expectError(GL_INVALID_ENUM);
1179 ctx.glGetBufferParameteri64v(GL_ARRAY_BUFFER , -1, ¶ms);
1180 ctx.expectError(GL_INVALID_ENUM);
1181 ctx.glGetBufferParameteri64v(-1, -1, ¶ms);
1182 ctx.expectError(GL_INVALID_ENUM);
1183 ctx.endSection();
1185 ctx.beginSection("GL_INVALID_OPERATION is generated if the reserved buffer object name 0 is bound to target.");
1186 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
1187 ctx.glGetBufferParameteri64v(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, ¶ms);
1188 ctx.expectError(GL_INVALID_OPERATION);
1189 ctx.endSection();
1191 ctx.glDeleteBuffers(1, &buf);
1194 void get_buffer_pointerv (NegativeTestContext& ctx)
1198 ctx.glGenBuffers(1, &buf);
1199 ctx.glBindBuffer(GL_ARRAY_BUFFER, buf);
1201 ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value.");
1202 ctx.glGetBufferPointerv(GL_ARRAY_BUFFER, -1, ¶ms);
1203 ctx.expectError(GL_INVALID_ENUM);
1204 ctx.glGetBufferPointerv(-1, GL_BUFFER_MAP_POINTER, ¶ms);
1205 ctx.expectError(GL_INVALID_ENUM);
1206 ctx.endSection();
1208 ctx.beginSection("GL_INVALID_OPERATION is generated if the reserved buffer object name 0 is bound to target.");
1209 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
1210 ctx.glGetBufferPointerv(GL_ARRAY_BUFFER, GL_BUFFER_MAP_POINTER, ¶ms);
1211 ctx.expectError(GL_INVALID_OPERATION);
1212 ctx.endSection();
1214 ctx.glDeleteBuffers(1, &buf);
1217 void get_framebuffer_attachment_parameteriv (NegativeTestContext& ctx)
1223 ctx.glGenFramebuffers (1, &fbo);
1224 ctx.glGenRenderbuffers (2, rbo);
1226 ctx.glBindFramebuffer (GL_FRAMEBUFFER, fbo);
1227 ctx.glBindRenderbuffer (GL_RENDERBUFFER, rbo[0]);
1228 ctx.glRenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, 16, 16);
1229 ctx.glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rbo[0]);
1230 ctx.glBindRenderbuffer (GL_RENDERBUFFER, rbo[1]);
1231 ctx.glRenderbufferStorage (GL_RENDERBUFFER, GL_STENCIL_INDEX8, 16, 16);
1232 ctx.glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo[1]);
1233 ctx.glCheckFramebufferStatus (GL_FRAMEBUFFER);
1234 ctx.expectError (GL_NO_ERROR);
1236 ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
1237 ctx.glGetFramebufferAttachmentParameteriv(-1, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, ¶ms[0]); // TYPE is GL_RENDERBUFFER
1238 ctx.expectError(GL_INVALID_ENUM);
1239 ctx.endSection();
1241 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not valid for the value of GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE.");
1242 ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, ¶ms[0]); // TYPE is GL_RENDERBUFFER
1243 ctx.expectError(GL_INVALID_ENUM);
1244 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1246 ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_BACK, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, ¶ms[0]); // TYPE is GL_FRAMEBUFFER_DEFAULT
1247 ctx.expectError(GL_INVALID_ENUM);
1248 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1249 ctx.endSection();
1251 ctx.beginSection("GL_INVALID_OPERATION is generated if attachment is GL_DEPTH_STENCIL_ATTACHMENT and different objects are bound to the depth and stencil attachment points of target.");
1252 ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, ¶ms[0]);
1253 ctx.expectError(GL_INVALID_OPERATION);
1254 ctx.endSection();
1256 ctx.beginSection("GL_INVALID_OPERATION is generated if the value of GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is GL_NONE and pname is not GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME.");
1257 ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, ¶ms[0]); // TYPE is GL_NONE
1258 ctx.expectError(GL_NO_ERROR);
1259 ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE, ¶ms[0]); // TYPE is GL_NONE
1260 ctx.expectError(GL_INVALID_OPERATION);
1261 ctx.endSection();
1263 ctx.beginSection("GL_INVALID_OPERATION or GL_INVALID_ENUM is generated if attachment is not one of the accepted values for the current binding of target.");
1264 ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_BACK, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, ¶ms[0]); // A FBO is bound so GL_BACK is invalid
1265 ctx.expectError(GL_INVALID_OPERATION, GL_INVALID_ENUM);
1266 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1267 ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, ¶ms[0]); // Default framebuffer is bound so GL_COLOR_ATTACHMENT0 is invalid
1268 ctx.expectError(GL_INVALID_OPERATION, GL_INVALID_ENUM);
1269 ctx.endSection();
1271 ctx.glDeleteFramebuffers(1, &fbo);
1274 void get_renderbuffer_parameteriv (NegativeTestContext& ctx)
1278 ctx.glGenRenderbuffers(1, &rbo);
1279 ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo);
1281 ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER.");
1282 ctx.glGetRenderbufferParameteriv(-1, GL_RENDERBUFFER_WIDTH, ¶ms[0]);
1283 ctx.expectError(GL_INVALID_ENUM);
1284 ctx.endSection();
1286 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the accepted tokens.");
1287 ctx.glGetRenderbufferParameteriv(GL_RENDERBUFFER, -1, ¶ms[0]);
1288 ctx.expectError(GL_INVALID_ENUM);
1289 ctx.endSection();
1291 ctx.beginSection("GL_INVALID_OPERATION is generated if the renderbuffer currently bound to target is zero.");
1292 ctx.glBindRenderbuffer(GL_RENDERBUFFER, 0);
1293 ctx.expectError(GL_NO_ERROR);
1294 ctx.glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, ¶ms[0]);
1295 ctx.expectError(GL_INVALID_OPERATION);
1296 ctx.endSection();
1298 ctx.glDeleteRenderbuffers(1, &rbo);
1299 ctx.glBindRenderbuffer(GL_RENDERBUFFER, 0);
1302 void get_internalformativ (NegativeTestContext& ctx)
1304 const bool isES = glu::isContextTypeES(ctx.getRenderContext().getType());
1309 ctx.beginSection("GL_INVALID_VALUE is generated if bufSize is negative.");
1310 ctx.glGetInternalformativ (GL_RENDERBUFFER, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, -1, ¶ms[0]);
1311 ctx.expectError (GL_INVALID_VALUE);
1312 ctx.endSection();
1314 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not GL_SAMPLES or GL_NUM_SAMPLE_COUNTS.");
1315 ctx.glGetInternalformativ (GL_RENDERBUFFER, GL_RGBA8, -1, 16, ¶ms[0]);
1316 ctx.expectError (GL_INVALID_ENUM);
1317 ctx.endSection();
1319 ctx.beginSection("GL_INVALID_ENUM is generated if internalformat is not color-, depth-, or stencil-renderable.");
1323 if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_render_snorm"))
1325 ctx.glGetInternalformativ (GL_RENDERBUFFER, GL_RG8_SNORM, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]);
1326 ctx.expectError (GL_INVALID_ENUM);
1329 ctx.glGetInternalformativ (GL_RENDERBUFFER, GL_COMPRESSED_RGB8_ETC2, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]);
1330 ctx.expectError (GL_INVALID_ENUM);
1331 ctx.endSection();
1334 ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER.");
1335 ctx.glGetInternalformativ (-1, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]);
1336 ctx.expectError (GL_INVALID_ENUM);
1337 ctx.glGetInternalformativ (GL_FRAMEBUFFER, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]);
1338 ctx.expectError (GL_INVALID_ENUM);
1340 if (isES && !ctx.getContextInfo().isExtensionSupported("GL_EXT_sparse_texture"))
1342 ctx.glGetInternalformativ (GL_TEXTURE_2D, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]);
1343 ctx.expectError (GL_INVALID_ENUM);
1346 ctx.endSection();
1351 void get_queryiv (NegativeTestContext& ctx)
1355 ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value.");
1356 ctx.glGetQueryiv (GL_ANY_SAMPLES_PASSED, -1, ¶ms);
1357 ctx.expectError (GL_INVALID_ENUM);
1358 ctx.glGetQueryiv (-1, GL_CURRENT_QUERY, ¶ms);
1359 ctx.expectError (GL_INVALID_ENUM);
1360 ctx.glGetQueryiv (-1, -1, ¶ms);
1361 ctx.expectError (GL_INVALID_ENUM);
1362 ctx.endSection();
1365 void get_query_objectuiv (NegativeTestContext& ctx)
1369 ctx.glGenQueries (1, &id);
1371 ctx.beginSection("GL_INVALID_OPERATION is generated if id is not the name of a query object.");
1372 ctx.glGetQueryObjectuiv (-1, GL_QUERY_RESULT_AVAILABLE, ¶ms);
1373 ctx.expectError (GL_INVALID_OPERATION);
1374 ctx.getLog() << TestLog::Message << "// Note: " << id << " is not a query object yet, since it hasn't been used by glBeginQuery" << TestLog::EndMessage;
1375 ctx.glGetQueryObjectuiv (id, GL_QUERY_RESULT_AVAILABLE, ¶ms);
1376 ctx.expectError (GL_INVALID_OPERATION);
1377 ctx.endSection();
1379 ctx.glBeginQuery (GL_ANY_SAMPLES_PASSED, id);
1380 ctx.glEndQuery (GL_ANY_SAMPLES_PASSED);
1382 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
1383 ctx.glGetQueryObjectuiv (id, -1, ¶ms);
1384 ctx.expectError (GL_INVALID_ENUM);
1385 ctx.endSection();
1387 ctx.beginSection("GL_INVALID_OPERATION is generated if id is the name of a currently active query object.");
1388 ctx.glBeginQuery (GL_ANY_SAMPLES_PASSED, id);
1389 ctx.expectError (GL_NO_ERROR);
1390 ctx.glGetQueryObjectuiv (id, GL_QUERY_RESULT_AVAILABLE, ¶ms);
1391 ctx.expectError (GL_INVALID_OPERATION);
1392 ctx.glEndQuery (GL_ANY_SAMPLES_PASSED);
1393 ctx.expectError (GL_NO_ERROR);
1394 ctx.endSection();
1396 ctx.glDeleteQueries (1, &id);
1401 void get_synciv (NegativeTestContext& ctx)
1409 ctx.beginSection("GL_INVALID_VALUE is generated if sync is not the name of a sync object.");
1410 ctx.glGetSynciv(0, GL_OBJECT_TYPE, 32, &length, &values[0]);
1411 ctx.expectError(GL_INVALID_VALUE);
1412 ctx.endSection();
1414 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the accepted tokens.");
1415 sync = ctx.glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
1416 ctx.expectError(GL_NO_ERROR);
1417 ctx.glGetSynciv(sync, -1, 32, &length, &values[0]);
1418 ctx.expectError(GL_INVALID_ENUM);
1419 ctx.endSection();
1421 ctx.glDeleteSync(sync);
1423 ctx.beginSection("GL_INVALID_VALUE is generated if bufSize is negative.");
1424 sync = ctx.glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
1425 ctx.expectError(GL_NO_ERROR);
1426 ctx.glGetSynciv(sync, GL_OBJECT_TYPE, -1, &length, &values[0]);
1427 ctx.expectError(GL_INVALID_VALUE);
1428 ctx.endSection();
1430 ctx.glDeleteSync(sync);
1435 void is_enabled (NegativeTestContext& ctx)
1437 ctx.beginSection("GL_INVALID_ENUM is generated if cap is not an accepted value.");
1438 ctx.glIsEnabled(-1);
1439 ctx.expectError(GL_INVALID_ENUM);
1440 ctx.glIsEnabled(GL_TRIANGLES);
1441 ctx.expectError(GL_INVALID_ENUM);
1442 ctx.endSection();
1445 void is_enabledi (NegativeTestContext& ctx)
1447 TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version.");
1449 ctx.beginSection("GL_INVALID_ENUM is generated if cap is not an accepted value.");
1450 ctx.glIsEnabledi(-1, 1);
1451 ctx.expectError(GL_INVALID_ENUM);
1452 ctx.glIsEnabledi(GL_TRIANGLES, 1);
1453 ctx.expectError(GL_INVALID_ENUM);
1454 ctx.endSection();
1456 ctx.beginSection("GL_INVALID_VALUE is generated if index is outside the valid range for the indexed state cap.");
1457 ctx.glIsEnabledi(GL_BLEND, -1);
1458 ctx.expectError(GL_INVALID_VALUE);
1459 ctx.endSection();
1464 void hint (NegativeTestContext& ctx)
1466 ctx.beginSection("GL_INVALID_ENUM is generated if either target or mode is not an accepted value.");
1467 ctx.glHint(GL_GENERATE_MIPMAP_HINT, -1);
1468 ctx.expectError(GL_INVALID_ENUM);
1469 ctx.glHint(-1, GL_FASTEST);
1470 ctx.expectError(GL_INVALID_ENUM);
1471 ctx.glHint(-1, -1);
1472 ctx.expectError(GL_INVALID_ENUM);
1473 ctx.endSection();