Lines Matching refs:ctx

71 static std::string getVtxFragVersionSources (const std::string source, NegativeTestContext& ctx)
73 const bool supportsES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
83 void enable (NegativeTestContext& ctx)
85 ctx.beginSection("GL_INVALID_ENUM is generated if cap is not one of the allowed values.");
86 ctx.glEnable(-1);
87 ctx.expectError(GL_INVALID_ENUM);
88 ctx.endSection();
92 void enablei (NegativeTestContext& ctx)
94 TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a higher context version.");
96 ctx.beginSection("GL_INVALID_ENUM is generated if cap is not one of the allowed values.");
97 ctx.glEnablei(-1, -1);
98 ctx.expectError(GL_INVALID_ENUM);
99 ctx.endSection();
101 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to the number of indexed capabilities for cap.");
102 ctx.glEnablei(GL_BLEND, -1);
103 ctx.expectError(GL_INVALID_VALUE);
104 ctx.endSection();
107 void disable (NegativeTestContext& ctx)
109 ctx.beginSection("GL_INVALID_ENUM is generated if cap is not one of the allowed values.");
110 ctx.glDisable(-1);
111 ctx.expectError(GL_INVALID_ENUM);
112 ctx.endSection();
115 void disablei (NegativeTestContext& ctx)
117 TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a higher context version.");
119 ctx.beginSection("GL_INVALID_ENUM is generated if cap is not one of the allowed values.");
120 ctx.glDisablei(-1,-1);
121 ctx.expectError(GL_INVALID_ENUM);
122 ctx.endSection();
124 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to the number of indexed capabilities for cap.");
125 ctx.glDisablei(GL_BLEND, -1);
126 ctx.expectError(GL_INVALID_VALUE);
127 ctx.endSection();
131 void get_booleanv (NegativeTestContext& ctx)
133 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the allowed values.");
135 ctx.glGetBooleanv(-1, &params);
136 ctx.expectError(GL_INVALID_ENUM);
137 ctx.endSection();
140 void get_booleani_v (NegativeTestContext& ctx)
145 ctx.beginSection("GL_INVALID_ENUM is generated if target is not indexed state queriable with these commands.");
146 ctx.glGetBooleani_v(-1, 0, &data);
147 ctx.expectError(GL_INVALID_ENUM);
148 ctx.endSection();
150 ctx.beginSection("GL_INVALID_VALUE is generated if index is outside of the valid range for the indexed state target.");
151 ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUniformBufferBindings);
152 ctx.expectError(GL_NO_ERROR);
153 ctx.glGetBooleani_v(GL_UNIFORM_BUFFER_BINDING, maxUniformBufferBindings, &data);
154 ctx.expectError(GL_INVALID_VALUE);
155 ctx.endSection();
158 void get_floatv (NegativeTestContext& ctx)
160 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the allowed values.");
162 ctx.glGetFloatv(-1, &params);
163 ctx.expectError(GL_INVALID_ENUM);
164 ctx.endSection();
167 void get_integerv (NegativeTestContext& ctx)
170 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the allowed values.");
171 ctx.glGetIntegerv(-1, &params);
172 ctx.expectError(GL_INVALID_ENUM);
173 ctx.endSection();
176 void get_integer64v (NegativeTestContext& ctx)
179 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the allowed values.");
180 ctx.glGetInteger64v(-1, &params);
181 ctx.expectError(GL_INVALID_ENUM);
182 ctx.endSection();
185 void get_integeri_v (NegativeTestContext& ctx)
191 ctx.beginSection("GL_INVALID_ENUM is generated if name is not an accepted value.");
192 ctx.glGetIntegeri_v(-1, 0, &data);
193 ctx.expectError(GL_INVALID_ENUM);
194 ctx.endSection();
196 ctx.beginSection("GL_INVALID_VALUE is generated if index is outside of the valid range for the indexed state target.");
197 ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUniformBufferBindings);
198 ctx.expectError(GL_NO_ERROR);
199 ctx.glGetIntegeri_v(GL_UNIFORM_BUFFER_BINDING, maxUniformBufferBindings, &data);
200 ctx.expectError(GL_INVALID_VALUE);
201 ctx.endSection();
203 ctx.beginSection("GL_INVALID_VALUE is generated if index is outside of the valid range for the indexed state target.");
204 ctx.glGetIntegerv(GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS, &maxShaderStorageBufferBindings);
205 ctx.expectError(GL_NO_ERROR);
206 ctx.glGetIntegeri_v(GL_SHADER_STORAGE_BUFFER_BINDING, maxShaderStorageBufferBindings, &data);
207 ctx.expectError(GL_INVALID_VALUE);
208 ctx.endSection();
211 void get_integer64i_v (NegativeTestContext& ctx)
217 ctx.beginSection("GL_INVALID_ENUM is generated if name is not an accepted value.");
218 ctx.glGetInteger64i_v(-1, 0, &data);
219 ctx.expectError(GL_INVALID_ENUM);
220 ctx.endSection();
222 ctx.beginSection("GL_INVALID_VALUE is generated if index is outside of the valid range for the indexed state target.");
223 ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUniformBufferBindings);
224 ctx.expectError(GL_NO_ERROR);
225 ctx.glGetInteger64i_v(GL_UNIFORM_BUFFER_START, maxUniformBufferBindings, &data);
226 ctx.expectError(GL_INVALID_VALUE);
227 ctx.endSection();
229 ctx.beginSection("GL_INVALID_VALUE is generated if index is outside of the valid range for the indexed state target.");
230 ctx.glGetIntegerv(GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS, &maxShaderStorageBufferBindings);
231 ctx.expectError(GL_NO_ERROR);
232 ctx.glGetInteger64i_v(GL_SHADER_STORAGE_BUFFER_START, maxShaderStorageBufferBindings, &data);
233 ctx.expectError(GL_INVALID_VALUE);
234 ctx.glGetInteger64i_v(GL_SHADER_STORAGE_BUFFER_SIZE, maxShaderStorageBufferBindings, &data);
235 ctx.expectError(GL_INVALID_VALUE);
236 ctx.endSection();
239 void get_string (NegativeTestContext& ctx)
241 ctx.beginSection("GL_INVALID_ENUM is generated if name is not an accepted value.");
242 ctx.glGetString(-1);
243 ctx.expectError(GL_INVALID_ENUM);
244 ctx.endSection();
247 void get_stringi (NegativeTestContext& ctx)
251 ctx.beginSection("GL_INVALID_ENUM is generated if name is not an accepted value.");
252 ctx.glGetStringi(-1, 0);
253 ctx.expectError(GL_INVALID_ENUM);
254 ctx.endSection();
256 ctx.beginSection("GL_INVALID_VALUE is generated if index is outside the valid range for indexed state name.");
257 ctx.glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
258 ctx.glGetStringi(GL_EXTENSIONS, numExtensions);
259 ctx.expectError(GL_INVALID_VALUE);
260 ctx.endSection();
265 void get_attached_shaders (NegativeTestContext& ctx)
268 GLuint shaderObject = ctx.glCreateShader(GL_VERTEX_SHADER);
269 GLuint program = ctx.glCreateProgram();
272 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
273 ctx.glGetAttachedShaders(-1, 1, &count[0], &shaders[0]);
274 ctx.expectError(GL_INVALID_VALUE);
275 ctx.endSection();
277 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
278 ctx.glGetAttachedShaders(shaderObject, 1, &count[0], &shaders[0]);
279 ctx.expectError(GL_INVALID_OPERATION);
280 ctx.endSection();
282 ctx.beginSection("GL_INVALID_VALUE is generated if maxCount is less than 0.");
283 ctx.glGetAttachedShaders(program, -1, &count[0], &shaders[0]);
284 ctx.expectError(GL_INVALID_VALUE);
285 ctx.endSection();
287 ctx.glDeleteShader(shaderObject);
288 ctx.glDeleteProgram(program);
291 void get_shaderiv (NegativeTestContext& ctx)
294 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
295 GLuint program = ctx.glCreateProgram();
298 ctx.glGetBooleanv(GL_SHADER_COMPILER, &shaderCompilerSupported);
299 ctx.getLog() << TestLog::Message << "// GL_SHADER_COMPILER = " << (shaderCompilerSupported ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage;
301 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
302 ctx.glGetShaderiv(shader, -1, &param[0]);
303 ctx.expectError(GL_INVALID_ENUM);
304 ctx.endSection();
306 ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
307 ctx.glGetShaderiv(-1, GL_SHADER_TYPE, &param[0]);
308 ctx.expectError(GL_INVALID_VALUE);
309 ctx.endSection();
311 ctx.beginSection("GL_INVALID_OPERATION is generated if shader does not refer to a shader object.");
312 ctx.glGetShaderiv(program, GL_SHADER_TYPE, &param[0]);
313 ctx.expectError(GL_INVALID_OPERATION);
314 ctx.endSection();
316 ctx.glDeleteShader(shader);
317 ctx.glDeleteProgram(program);
320 void get_shader_info_log (NegativeTestContext& ctx)
322 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
323 GLuint program = ctx.glCreateProgram();
327 ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
328 ctx.glGetShaderInfoLog(-1, 128, &length[0], &infoLog[0]);
329 ctx.expectError(GL_INVALID_VALUE);
330 ctx.endSection();
332 ctx.beginSection("GL_INVALID_OPERATION is generated if shader is not a shader object.");
333 ctx.glGetShaderInfoLog(program, 128, &length[0], &infoLog[0]);
334 ctx.expectError(GL_INVALID_OPERATION);
335 ctx.endSection();
337 ctx.beginSection("GL_INVALID_VALUE is generated if maxLength is less than 0.");
338 ctx.glGetShaderInfoLog(shader, -1, &length[0], &infoLog[0]);
339 ctx.expectError(GL_INVALID_VALUE);
340 ctx.endSection();
342 ctx.glDeleteShader(shader);
343 ctx.glDeleteProgram(program);
346 void get_shader_precision_format (NegativeTestContext& ctx)
352 ctx.glGetBooleanv(GL_SHADER_COMPILER, &shaderCompilerSupported);
353 ctx.getLog() << TestLog::Message << "// GL_SHADER_COMPILER = " << (shaderCompilerSupported ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage;
358 ctx.beginSection("GL_INVALID_ENUM is generated if shaderType or precisionType is not an accepted value.");
359 ctx.glGetShaderPrecisionFormat (-1, GL_MEDIUM_FLOAT, &range[0], &precision[0]);
360 ctx.expectError(GL_INVALID_ENUM);
361 ctx.glGetShaderPrecisionFormat (GL_VERTEX_SHADER, -1, &range[0], &precision[0]);
362 ctx.expectError(GL_INVALID_ENUM);
363 ctx.glGetShaderPrecisionFormat (-1, -1, &range[0], &precision[0]);
364 ctx.expectError(GL_INVALID_ENUM);
365 ctx.endSection();
368 void get_shader_source (NegativeTestContext& ctx)
372 GLuint program = ctx.glCreateProgram();
373 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
375 ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
376 ctx.glGetShaderSource(-1, 1, &length[0], &source[0]);
377 ctx.expectError(GL_INVALID_VALUE);
378 ctx.endSection();
380 ctx.beginSection("GL_INVALID_OPERATION is generated if shader is not a shader object.");
381 ctx.glGetShaderSource(program, 1, &length[0], &source[0]);
382 ctx.expectError(GL_INVALID_OPERATION);
383 ctx.endSection();
385 ctx.beginSection("GL_INVALID_VALUE is generated if bufSize is less than 0.");
386 ctx.glGetShaderSource(shader, -1, &length[0], &source[0]);
387 ctx.expectError(GL_INVALID_VALUE);
388 ctx.endSection();
390 ctx.glDeleteProgram(program);
391 ctx.glDeleteShader(shader);
396 void get_programiv (NegativeTestContext& ctx)
398 GLuint program = ctx.glCreateProgram();
399 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
402 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
403 ctx.glGetProgramiv(program, -1, &params[0]);
404 ctx.expectError(GL_INVALID_ENUM);
405 ctx.endSection();
407 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
408 ctx.glGetProgramiv(-1, GL_LINK_STATUS, &params[0]);
409 ctx.expectError(GL_INVALID_VALUE);
410 ctx.endSection();
412 ctx.beginSection("GL_INVALID_OPERATION is generated if program does not refer to a program object.");
413 ctx.glGetProgramiv(shader, GL_LINK_STATUS, &params[0]);
414 ctx.expectError(GL_INVALID_OPERATION);
415 ctx.endSection();
417 ctx.glDeleteProgram(program);
418 ctx.glDeleteShader(shader);
421 void get_program_info_log (NegativeTestContext& ctx)
423 GLuint program = ctx.glCreateProgram();
424 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
428 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
429 ctx.glGetProgramInfoLog (-1, 1, &length[0], &infoLog[0]);
430 ctx.expectError(GL_INVALID_VALUE);
431 ctx.endSection();
433 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
434 ctx.glGetProgramInfoLog (shader, 1, &length[0], &infoLog[0]);
435 ctx.expectError(GL_INVALID_OPERATION);
436 ctx.endSection();
438 ctx.beginSection("GL_INVALID_VALUE is generated if maxLength is less than 0.");
439 ctx.glGetProgramInfoLog (program, -1, &length[0], &infoLog[0]);
440 ctx.expectError(GL_INVALID_VALUE);
441 ctx.endSection();
443 ctx.glDeleteProgram(program);
444 ctx.glDeleteShader(shader);
449 void get_tex_parameterfv (NegativeTestContext& ctx)
453 ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value.");
454 ctx.glGetTexParameterfv (-1, GL_TEXTURE_MAG_FILTER, &params[0]);
455 ctx.expectError(GL_INVALID_ENUM);
456 ctx.glGetTexParameterfv (GL_TEXTURE_2D, -1, &params[0]);
457 ctx.expectError(GL_INVALID_ENUM);
458 ctx.glGetTexParameterfv (-1, -1, &params[0]);
459 ctx.expectError(GL_INVALID_ENUM);
460 ctx.endSection();
463 void get_tex_parameteriv (NegativeTestContext& ctx)
467 ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value.");
468 ctx.glGetTexParameteriv (-1, GL_TEXTURE_MAG_FILTER, &params[0]);
469 ctx.expectError(GL_INVALID_ENUM);
470 ctx.glGetTexParameteriv (GL_TEXTURE_2D, -1, &params[0]);
471 ctx.expectError(GL_INVALID_ENUM);
472 ctx.glGetTexParameteriv (-1, -1, &params[0]);
473 ctx.expectError(GL_INVALID_ENUM);
474 ctx.endSection();
477 void get_tex_parameteriiv (NegativeTestContext& ctx)
479 TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a higher context version.");
483 ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value.");
484 ctx.glGetTexParameterIiv(-1, GL_TEXTURE_MAG_FILTER, &params[0]);
485 ctx.expectError(GL_INVALID_ENUM);
486 ctx.glGetTexParameterIiv(GL_TEXTURE_2D, -1, &params[0]);
487 ctx.expectError(GL_INVALID_ENUM);
488 ctx.glGetTexParameterIiv(-1, -1, &params[0]);
489 ctx.expectError(GL_INVALID_ENUM);
490 ctx.endSection();
493 void get_tex_parameteriuiv (NegativeTestContext& ctx)
495 TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a higher context version.");
499 ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value.");
500 ctx.glGetTexParameterIuiv(-1, GL_TEXTURE_MAG_FILTER, &params[0]);
501 ctx.expectError(GL_INVALID_ENUM);
502 ctx.glGetTexParameterIuiv(GL_TEXTURE_2D, -1, &params[0]);
503 ctx.expectError(GL_INVALID_ENUM);
504 ctx.glGetTexParameterIuiv(-1, -1, &params[0]);
505 ctx.expectError(GL_INVALID_ENUM);
506 ctx.endSection();
509 void get_uniformfv (NegativeTestContext& ctx)
511 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
517 ctx.glUseProgram(program.getProgram());
519 unif = ctx.glGetUniformLocation(program.getProgram(), "vUnif_vec4"); // vec4
521 ctx.fail("Failed to retrieve uniform location");
523 shader = ctx.glCreateShader(GL_VERTEX_SHADER);
524 programEmpty = ctx.glCreateProgram();
526 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
527 ctx.glGetUniformfv (-1, unif, &params[0]);
528 ctx.expectError(GL_INVALID_VALUE);
529 ctx.endSection();
531 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
532 ctx.glGetUniformfv (shader, unif, &params[0]);
533 ctx.expectError(GL_INVALID_OPERATION);
534 ctx.endSection();
536 ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
537 ctx.glGetUniformfv (programEmpty, unif, &params[0]);
538 ctx.expectError(GL_INVALID_OPERATION);
539 ctx.endSection();
541 ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable location for the specified program object.");
542 ctx.glGetUniformfv (program.getProgram(), -1, &params[0]);
543 ctx.expectError(GL_INVALID_OPERATION);
544 ctx.endSection();
546 ctx.glDeleteShader(shader);
547 ctx.glDeleteProgram(programEmpty);
550 void get_nuniformfv (NegativeTestContext& ctx)
552 TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a higher context version.");
554 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
555 GLint unif = ctx.glGetUniformLocation(program.getProgram(), "vUnif_vec4");
561 ctx.glUseProgram(program.getProgram());
564 ctx.fail("Failed to retrieve uniform location");
566 shader = ctx.glCreateShader(GL_VERTEX_SHADER);
567 programEmpty = ctx.glCreateProgram();
569 ctx.glGetIntegerv(GL_MAX_COMBINED_UNIFORM_BLOCKS, &bufferSize);
571 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
572 ctx.glGetnUniformfv(-1, unif, bufferSize, &params[0]);
573 ctx.expectError(GL_INVALID_VALUE);
574 ctx.endSection();
576 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
577 ctx.glGetnUniformfv(shader, unif, bufferSize, &params[0]);
578 ctx.expectError(GL_INVALID_OPERATION);
579 ctx.endSection();
581 ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
582 ctx.glGetnUniformfv(programEmpty, unif, bufferSize, &params[0]);
583 ctx.expectError(GL_INVALID_OPERATION);
584 ctx.endSection();
586 ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable location for the specified program object.");
587 ctx.glGetnUniformfv(program.getProgram(), -1, bufferSize, &params[0]);
588 ctx.expectError(GL_INVALID_OPERATION);
589 ctx.endSection();
591 ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer size required to store the requested data is greater than bufSize.");
592 ctx.glGetnUniformfv(program.getProgram(), unif, 0, &params[0]);
593 ctx.expectError(GL_INVALID_OPERATION);
594 ctx.endSection();
596 ctx.glDeleteShader(shader);
597 ctx.glDeleteProgram(programEmpty);
600 void get_uniformiv (NegativeTestContext& ctx)
602 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
603 GLint unif = ctx.glGetUniformLocation(program.getProgram(), "fUnif_ivec4");
608 ctx.glUseProgram(program.getProgram());
611 ctx.fail("Failed to retrieve uniform location");
613 shader = ctx.glCreateShader(GL_VERTEX_SHADER);
614 programEmpty = ctx.glCreateProgram();
616 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
617 ctx.glGetUniformiv (-1, unif, &params[0]);
618 ctx.expectError(GL_INVALID_VALUE);
619 ctx.endSection();
621 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
622 ctx.glGetUniformiv (shader, unif, &params[0]);
623 ctx.expectError(GL_INVALID_OPERATION);
624 ctx.endSection();
626 ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
627 ctx.glGetUniformiv (programEmpty, unif, &params[0]);
628 ctx.expectError(GL_INVALID_OPERATION);
629 ctx.endSection();
631 ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable location for the specified program object.");
632 ctx.glGetUniformiv (program.getProgram(), -1, &params[0]);
633 ctx.expectError(GL_INVALID_OPERATION);
634 ctx.endSection();
636 ctx.glDeleteShader(shader);
637 ctx.glDeleteProgram(programEmpty);
640 void get_nuniformiv (NegativeTestContext& ctx)
642 TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a higher context version.");
644 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
645 GLint unif = ctx.glGetUniformLocation(program.getProgram(), "fUnif_ivec4");
651 ctx.glUseProgram(program.getProgram());
654 ctx.fail("Failed to retrieve uniform location");
656 shader = ctx.glCreateShader(GL_VERTEX_SHADER);
657 programEmpty = ctx.glCreateProgram();
659 ctx.glGetIntegerv(GL_MAX_COMBINED_UNIFORM_BLOCKS, &bufferSize);
661 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
662 ctx.glGetnUniformiv(-1, unif, bufferSize, &params[0]);
663 ctx.expectError(GL_INVALID_VALUE);
664 ctx.endSection();
666 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
667 ctx.glGetnUniformiv(shader, unif, bufferSize, &params[0]);
668 ctx.expectError(GL_INVALID_OPERATION);
669 ctx.endSection();
671 ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
672 ctx.glGetnUniformiv(programEmpty, unif, bufferSize, &params[0]);
673 ctx.expectError(GL_INVALID_OPERATION);
674 ctx.endSection();
676 ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable location for the specified program object.");
677 ctx.glGetnUniformiv(program.getProgram(), -1, bufferSize, &params[0]);
678 ctx.expectError(GL_INVALID_OPERATION);
679 ctx.endSection();
681 ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer size required to store the requested data is greater than bufSize.");
682 ctx.glGetnUniformiv(program.getProgram(), unif, - 1, &params[0]);
683 ctx.expectError(GL_INVALID_OPERATION);
684 ctx.endSection();
686 ctx.glDeleteShader(shader);
687 ctx.glDeleteProgram(programEmpty);
690 void get_uniformuiv (NegativeTestContext& ctx)
692 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
693 GLint unif = ctx.glGetUniformLocation(program.getProgram(), "fUnif_uvec4");
698 ctx.glUseProgram(program.getProgram());
701 ctx.fail("Failed to retrieve uniform location");
703 shader = ctx.glCreateShader(GL_VERTEX_SHADER);
704 programEmpty = ctx.glCreateProgram();
706 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
707 ctx.glGetUniformuiv (-1, unif, &params[0]);
708 ctx.expectError(GL_INVALID_VALUE);
709 ctx.endSection();
711 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
712 ctx.glGetUniformuiv (shader, unif, &params[0]);
713 ctx.expectError(GL_INVALID_OPERATION);
714 ctx.endSection();
716 ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
717 ctx.glGetUniformuiv (programEmpty, unif, &params[0]);
718 ctx.expectError(GL_INVALID_OPERATION);
719 ctx.endSection();
721 ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable location for the specified program object.");
722 ctx.glGetUniformuiv (program.getProgram(), -1, &params[0]);
723 ctx.expectError(GL_INVALID_OPERATION);
724 ctx.endSection();
726 ctx.glDeleteShader(shader);
727 ctx.glDeleteProgram(programEmpty);
730 void get_nuniformuiv (NegativeTestContext& ctx)
732 TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a higher context version.");
734 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
735 GLint unif = ctx.glGetUniformLocation(program.getProgram(), "fUnif_ivec4");
741 ctx.glUseProgram(program.getProgram());
744 ctx.fail("Failed to retrieve uniform location");
746 shader = ctx.glCreateShader(GL_VERTEX_SHADER);
747 programEmpty = ctx.glCreateProgram();
749 ctx.glGetIntegerv(GL_MAX_COMBINED_UNIFORM_BLOCKS, &bufferSize);
751 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
752 ctx.glGetnUniformuiv(-1, unif, bufferSize, &params[0]);
753 ctx.expectError(GL_INVALID_VALUE);
754 ctx.endSection();
756 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
757 ctx.glGetnUniformuiv(shader, unif, bufferSize, &params[0]);
758 ctx.expectError(GL_INVALID_OPERATION);
759 ctx.endSection();
761 ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
762 ctx.glGetnUniformuiv(programEmpty, unif, bufferSize, &params[0]);
763 ctx.expectError(GL_INVALID_OPERATION);
764 ctx.endSection();
766 ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable location for the specified program object.");
767 ctx.glGetnUniformuiv(program.getProgram(), -1, bufferSize, &params[0]);
768 ctx.expectError(GL_INVALID_OPERATION);
769 ctx.endSection();
771 ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer size required to store the requested data is greater than bufSize.");
772 ctx.glGetnUniformuiv(program.getProgram(), unif, -1, &params[0]);
773 ctx.expectError(GL_INVALID_OPERATION);
774 ctx.endSection();
776 ctx.glDeleteShader(shader);
777 ctx.glDeleteProgram(programEmpty);
780 void get_active_uniform (NegativeTestContext& ctx)
782 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
783 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
786 ctx.glGetProgramiv (program.getProgram(), GL_ACTIVE_UNIFORMS, &numActiveUniforms);
787 ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORMS = " << numActiveUniforms << " (expected 4)." << TestLog::EndMessage;
789 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
790 ctx.glGetActiveUniform(-1, 0, 0, 0, 0, 0, 0);
791 ctx.expectError(GL_INVALID_VALUE);
792 ctx.endSection();
794 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
795 ctx.glGetActiveUniform(shader, 0, 0, 0, 0, 0, 0);
796 ctx.expectError(GL_INVALID_OPERATION);
797 ctx.endSection();
799 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to the number of active uniform variables in program.");
800 ctx.glUseProgram(program.getProgram());
801 ctx.glGetActiveUniform(program.getProgram(), numActiveUniforms, 0, 0, 0, 0, 0);
802 ctx.expectError(GL_INVALID_VALUE);
803 ctx.endSection();
805 ctx.beginSection("GL_INVALID_VALUE is generated if bufSize is less than 0.");
806 ctx.glGetActiveUniform(program.getProgram(), 0, -1, 0, 0, 0, 0);
807 ctx.expectError(GL_INVALID_VALUE);
808 ctx.endSection();
810 ctx.glUseProgram(0);
811 ctx.glDeleteShader(shader);
814 void get_active_uniformsiv (NegativeTestContext& ctx)
816 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
817 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
822 ctx.glUseProgram(program.getProgram());
824 ctx.glGetProgramiv (program.getProgram(), GL_ACTIVE_UNIFORMS, &numActiveUniforms);
825 ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORMS = " << numActiveUniforms << " (expected 4)." << TestLog::EndMessage;
827 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
828 ctx.glGetActiveUniformsiv(-1, 1, &dummyUniformIndex, GL_UNIFORM_TYPE, &dummyParamDst);
829 ctx.expectError(GL_INVALID_VALUE);
830 ctx.endSection();
832 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
833 ctx.glGetActiveUniformsiv(shader, 1, &dummyUniformIndex, GL_UNIFORM_TYPE, &dummyParamDst);
834 ctx.expectError(GL_INVALID_OPERATION);
835 ctx.endSection();
837 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.");
846 ctx.glGetActiveUniformsiv(program.getProgram(), (GLsizei)invalidUniformIndices.size(), &invalidUniformIndices[0], GL_UNIFORM_TYPE, &dummyParamsDst[0]);
847 ctx.expectError(excess == 0 ? GL_NO_ERROR : GL_INVALID_VALUE);
849 ctx.endSection();
851 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted token.");
852 ctx.glGetActiveUniformsiv(program.getProgram(), 1, &dummyUniformIndex, -1, &dummyParamDst);
853 ctx.expectError(GL_INVALID_ENUM);
854 ctx.endSection();
856 ctx.glUseProgram(0);
857 ctx.glDeleteShader(shader);
860 void get_active_uniform_blockiv (NegativeTestContext& ctx)
862 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
863 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
867 ctx.glGetProgramiv(program.getProgram(), GL_ACTIVE_UNIFORM_BLOCKS, &numActiveBlocks);
868 ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORM_BLOCKS = " << numActiveBlocks << " (expected 1)." << TestLog::EndMessage;
869 ctx.expectError(GL_NO_ERROR);
871 ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of either a program or shader object.");
872 ctx.glGetActiveUniformBlockiv(-1, 0, GL_UNIFORM_BLOCK_BINDING, &params);
873 ctx.expectError(GL_INVALID_VALUE);
874 ctx.endSection();
876 ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object");
877 ctx.glGetActiveUniformBlockiv(shader, 0, GL_UNIFORM_BLOCK_BINDING, &params);
878 ctx.expectError(GL_INVALID_OPERATION);
879 ctx.endSection();
881 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.");
882 ctx.glUseProgram(program.getProgram());
883 ctx.expectError(GL_NO_ERROR);
884 ctx.glGetActiveUniformBlockiv(program.getProgram(), numActiveBlocks, GL_UNIFORM_BLOCK_BINDING, &params);
885 ctx.expectError(GL_INVALID_VALUE);
886 ctx.endSection();
888 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the accepted tokens.");
889 ctx.glGetActiveUniformBlockiv(program.getProgram(), 0, -1, &params);
890 ctx.expectError(GL_INVALID_ENUM);
891 ctx.endSection();
893 ctx.glUseProgram(0);
896 void get_active_uniform_block_name (NegativeTestContext& ctx)
898 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
899 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
906 ctx.glGetProgramiv(program.getProgram(), GL_ACTIVE_UNIFORM_BLOCKS, &numActiveBlocks);
907 ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORM_BLOCKS = " << numActiveBlocks << " (expected 1)." << TestLog::EndMessage;
908 ctx.expectError(GL_NO_ERROR);
910 ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object.");
911 ctx.glGetActiveUniformBlockName(shader, numActiveBlocks, GL_UNIFORM_BLOCK_BINDING, &length, &uniformBlockName[0]);
912 ctx.expectError(GL_INVALID_OPERATION);
913 ctx.endSection();
915 ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of either a program or shader object.");
916 ctx.glGetActiveUniformBlockName(-1, numActiveBlocks, GL_UNIFORM_BLOCK_BINDING, &length, &uniformBlockName[0]);
917 ctx.expectError(GL_INVALID_VALUE);
918 ctx.endSection();
920 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.");
921 ctx.glUseProgram(program.getProgram());
922 ctx.expectError(GL_NO_ERROR);
923 ctx.glGetActiveUniformBlockName(program.getProgram(), numActiveBlocks, (int)sizeof(uniformBlockName), &length, &uniformBlockName[0]);
924 ctx.expectError(GL_INVALID_VALUE);
925 ctx.endSection();
927 ctx.glUseProgram(0);
930 void get_active_attrib (NegativeTestContext& ctx)
932 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
933 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
942 ctx.glGetProgramiv (program.getProgram(), GL_ACTIVE_ATTRIBUTES, &numActiveAttributes);
943 ctx.getLog() << TestLog::Message << "// GL_ACTIVE_ATTRIBUTES = " << numActiveAttributes << " (expected 1)." << TestLog::EndMessage;
945 ctx.glUseProgram(program.getProgram());
947 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
948 ctx.glGetActiveAttrib(-1, 0, 32, &length, &size, &type, &name[0]);
949 ctx.expectError(GL_INVALID_VALUE);
950 ctx.endSection();
952 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
953 ctx.glGetActiveAttrib(shader, 0, 32, &length, &size, &type, &name[0]);
954 ctx.expectError(GL_INVALID_OPERATION);
955 ctx.endSection();
957 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_ACTIVE_ATTRIBUTES.");
958 ctx.glGetActiveAttrib(program.getProgram(), numActiveAttributes, (int)sizeof(name), &length, &size, &type, &name[0]);
959 ctx.expectError(GL_INVALID_VALUE);
960 ctx.endSection();
962 ctx.beginSection("GL_INVALID_VALUE is generated if bufSize is less than 0.");
963 ctx.glGetActiveAttrib(program.getProgram(), 0, -1, &length, &size, &type, &name[0]);
964 ctx.expectError(GL_INVALID_VALUE);
965 ctx.endSection();
967 ctx.glUseProgram(0);
968 ctx.glDeleteShader(shader);
971 void get_uniform_indices (NegativeTestContext& ctx)
973 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
974 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx)));
980 ctx.glGetProgramiv(program.getProgram(), GL_ACTIVE_UNIFORM_BLOCKS, &numActiveBlocks);
981 ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORM_BLOCKS = " << numActiveBlocks << TestLog::EndMessage;
982 ctx.expectError(GL_NO_ERROR);
984 ctx.beginSection("GL_INVALID_OPERATION is generated if program is a name of shader object.");
985 ctx.glGetUniformIndices(shader, 1, &uniformName, &uniformIndices);
986 ctx.expectError(GL_INVALID_OPERATION);
987 ctx.endSection();
989 ctx.beginSection("GL_INVALID_VALUE is generated if program is not name of program or shader object.");
990 ctx.glGetUniformIndices(invalid, 1, &uniformName, &uniformIndices);
991 ctx.expectError(GL_INVALID_VALUE);
992 ctx.endSection();
994 ctx.glUseProgram(0);
995 ctx.glDeleteShader(shader);
998 void get_vertex_attribfv (NegativeTestContext& ctx)
1003 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
1004 ctx.glGetVertexAttribfv(0, -1, &params);
1005 ctx.expectError(GL_INVALID_ENUM);
1006 ctx.endSection();
1008 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
1009 ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);
1010 ctx.glGetVertexAttribfv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &params);
1011 ctx.expectError(GL_INVALID_VALUE);
1012 ctx.endSection();
1015 void get_vertex_attribiv (NegativeTestContext& ctx)
1020 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
1021 ctx.glGetVertexAttribiv(0, -1, &params);
1022 ctx.expectError(GL_INVALID_ENUM);
1023 ctx.endSection();
1025 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
1026 ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);
1027 ctx.glGetVertexAttribiv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &params);
1028 ctx.expectError(GL_INVALID_VALUE);
1029 ctx.endSection();
1032 void get_vertex_attribi_iv (NegativeTestContext& ctx)
1037 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
1038 ctx.glGetVertexAttribIiv(0, -1, &params);
1039 ctx.expectError(GL_INVALID_ENUM);
1040 ctx.endSection();
1042 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
1043 ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);
1044 ctx.glGetVertexAttribIiv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &params);
1045 ctx.expectError(GL_INVALID_VALUE);
1046 ctx.endSection();
1049 void get_vertex_attribi_uiv (NegativeTestContext& ctx)
1054 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
1055 ctx.glGetVertexAttribIuiv(0, -1, &params);
1056 ctx.expectError(GL_INVALID_ENUM);
1057 ctx.endSection();
1059 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
1060 ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);
1061 ctx.glGetVertexAttribIuiv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &params);
1062 ctx.expectError(GL_INVALID_VALUE);
1063 ctx.endSection();
1066 void get_vertex_attrib_pointerv (NegativeTestContext& ctx)
1071 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
1072 ctx.glGetVertexAttribPointerv(0, -1, &ptr[0]);
1073 ctx.expectError(GL_INVALID_ENUM);
1074 ctx.endSection();
1076 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
1077 ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);
1078 ctx.glGetVertexAttribPointerv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_POINTER, &ptr[0]);
1079 ctx.expectError(GL_INVALID_VALUE);
1080 ctx.endSection();
1083 void get_frag_data_location (NegativeTestContext& ctx)
1085 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
1086 GLuint program = ctx.glCreateProgram();
1088 ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object.");
1089 ctx.glGetFragDataLocation(shader, "gl_FragColor");
1090 ctx.expectError(GL_INVALID_OPERATION);
1091 ctx.endSection();
1093 ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been linked.");
1094 ctx.glGetFragDataLocation(program, "gl_FragColor");
1095 ctx.expectError(GL_INVALID_OPERATION);
1096 ctx.endSection();
1098 ctx.glDeleteProgram(program);
1099 ctx.glDeleteShader(shader);
1104 void get_buffer_parameteriv (NegativeTestContext& ctx)
1108 ctx.glGenBuffers(1, &buf);
1109 ctx.glBindBuffer(GL_ARRAY_BUFFER, buf);
1111 ctx.beginSection("GL_INVALID_ENUM is generated if target or value is not an accepted value.");
1112 ctx.glGetBufferParameteriv(-1, GL_BUFFER_SIZE, &params);
1113 ctx.expectError(GL_INVALID_ENUM);
1114 ctx.glGetBufferParameteriv(GL_ARRAY_BUFFER, -1, &params);
1115 ctx.expectError(GL_INVALID_ENUM);
1116 ctx.glGetBufferParameteriv(-1, -1, &params);
1117 ctx.expectError(GL_INVALID_ENUM);
1118 ctx.endSection();
1120 ctx.beginSection("GL_INVALID_OPERATION is generated if the reserved buffer object name 0 is bound to target.");
1121 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
1122 ctx.glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &params);
1123 ctx.expectError(GL_INVALID_OPERATION);
1124 ctx.endSection();
1126 ctx.glDeleteBuffers(1, &buf);
1129 void get_buffer_parameteri64v (NegativeTestContext& ctx)
1133 ctx.glGenBuffers(1, &buf);
1134 ctx.glBindBuffer(GL_ARRAY_BUFFER, buf);
1136 ctx.beginSection("GL_INVALID_ENUM is generated if target or value is not an accepted value.");
1137 ctx.glGetBufferParameteri64v(-1, GL_BUFFER_SIZE, &params);
1138 ctx.expectError(GL_INVALID_ENUM);
1139 ctx.glGetBufferParameteri64v(GL_ARRAY_BUFFER , -1, &params);
1140 ctx.expectError(GL_INVALID_ENUM);
1141 ctx.glGetBufferParameteri64v(-1, -1, &params);
1142 ctx.expectError(GL_INVALID_ENUM);
1143 ctx.endSection();
1145 ctx.beginSection("GL_INVALID_OPERATION is generated if the reserved buffer object name 0 is bound to target.");
1146 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
1147 ctx.glGetBufferParameteri64v(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &params);
1148 ctx.expectError(GL_INVALID_OPERATION);
1149 ctx.endSection();
1151 ctx.glDeleteBuffers(1, &buf);
1154 void get_buffer_pointerv (NegativeTestContext& ctx)
1158 ctx.glGenBuffers(1, &buf);
1159 ctx.glBindBuffer(GL_ARRAY_BUFFER, buf);
1161 ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value.");
1162 ctx.glGetBufferPointerv(GL_ARRAY_BUFFER, -1, &params);
1163 ctx.expectError(GL_INVALID_ENUM);
1164 ctx.glGetBufferPointerv(-1, GL_BUFFER_MAP_POINTER, &params);
1165 ctx.expectError(GL_INVALID_ENUM);
1166 ctx.endSection();
1168 ctx.beginSection("GL_INVALID_OPERATION is generated if the reserved buffer object name 0 is bound to target.");
1169 ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
1170 ctx.glGetBufferPointerv(GL_ARRAY_BUFFER, GL_BUFFER_MAP_POINTER, &params);
1171 ctx.expectError(GL_INVALID_OPERATION);
1172 ctx.endSection();
1174 ctx.glDeleteBuffers(1, &buf);
1177 void get_framebuffer_attachment_parameteriv (NegativeTestContext& ctx)
1183 ctx.glGenFramebuffers (1, &fbo);
1184 ctx.glGenRenderbuffers (2, rbo);
1186 ctx.glBindFramebuffer (GL_FRAMEBUFFER, fbo);
1187 ctx.glBindRenderbuffer (GL_RENDERBUFFER, rbo[0]);
1188 ctx.glRenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, 16, 16);
1189 ctx.glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rbo[0]);
1190 ctx.glBindRenderbuffer (GL_RENDERBUFFER, rbo[1]);
1191 ctx.glRenderbufferStorage (GL_RENDERBUFFER, GL_STENCIL_INDEX8, 16, 16);
1192 ctx.glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo[1]);
1193 ctx.glCheckFramebufferStatus (GL_FRAMEBUFFER);
1194 ctx.expectError (GL_NO_ERROR);
1196 ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
1197 ctx.glGetFramebufferAttachmentParameteriv(-1, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &params[0]); // TYPE is GL_RENDERBUFFER
1198 ctx.expectError(GL_INVALID_ENUM);
1199 ctx.endSection();
1201 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not valid for the value of GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE.");
1202 ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, &params[0]); // TYPE is GL_RENDERBUFFER
1203 ctx.expectError(GL_INVALID_ENUM);
1204 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1205 ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_BACK, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &params[0]); // TYPE is GL_FRAMEBUFFER_DEFAULT
1206 ctx.expectError(GL_INVALID_ENUM);
1207 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1208 ctx.endSection();
1210 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.");
1211 ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &params[0]);
1212 ctx.expectError(GL_INVALID_OPERATION);
1213 ctx.endSection();
1215 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.");
1216 ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &params[0]); // TYPE is GL_NONE
1217 ctx.expectError(GL_NO_ERROR);
1218 ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE, &params[0]); // TYPE is GL_NONE
1219 ctx.expectError(GL_INVALID_OPERATION);
1220 ctx.endSection();
1222 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.");
1223 ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_BACK, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &params[0]); // A FBO is bound so GL_BACK is invalid
1224 ctx.expectError(GL_INVALID_OPERATION, GL_INVALID_ENUM);
1225 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1226 ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &params[0]); // Default framebuffer is bound so GL_COLOR_ATTACHMENT0 is invalid
1227 ctx.expectError(GL_INVALID_OPERATION, GL_INVALID_ENUM);
1228 ctx.endSection();
1230 ctx.glDeleteFramebuffers(1, &fbo);
1233 void get_renderbuffer_parameteriv (NegativeTestContext& ctx)
1237 ctx.glGenRenderbuffers(1, &rbo);
1238 ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo);
1240 ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER.");
1241 ctx.glGetRenderbufferParameteriv(-1, GL_RENDERBUFFER_WIDTH, &params[0]);
1242 ctx.expectError(GL_INVALID_ENUM);
1243 ctx.endSection();
1245 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the accepted tokens.");
1246 ctx.glGetRenderbufferParameteriv(GL_RENDERBUFFER, -1, &params[0]);
1247 ctx.expectError(GL_INVALID_ENUM);
1248 ctx.endSection();
1250 ctx.beginSection("GL_INVALID_OPERATION is generated if the renderbuffer currently bound to target is zero.");
1251 ctx.glBindRenderbuffer(GL_RENDERBUFFER, 0);
1252 ctx.expectError(GL_NO_ERROR);
1253 ctx.glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &params[0]);
1254 ctx.expectError(GL_INVALID_OPERATION);
1255 ctx.endSection();
1257 ctx.glDeleteRenderbuffers(1, &rbo);
1258 ctx.glBindRenderbuffer(GL_RENDERBUFFER, 0);
1261 void get_internalformativ (NegativeTestContext& ctx)
1267 ctx.beginSection("GL_INVALID_VALUE is generated if bufSize is negative.");
1268 ctx.glGetInternalformativ (GL_RENDERBUFFER, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, -1, &params[0]);
1269 ctx.expectError (GL_INVALID_VALUE);
1270 ctx.endSection();
1272 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not GL_SAMPLES or GL_NUM_SAMPLE_COUNTS.");
1273 ctx.glGetInternalformativ (GL_RENDERBUFFER, GL_RGBA8, -1, 16, &params[0]);
1274 ctx.expectError (GL_INVALID_ENUM);
1275 ctx.endSection();
1277 ctx.beginSection("GL_INVALID_ENUM is generated if internalformat is not color-, depth-, or stencil-renderable.");
1279 if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_render_snorm"))
1281 ctx.glGetInternalformativ (GL_RENDERBUFFER, GL_RG8_SNORM, GL_NUM_SAMPLE_COUNTS, 16, &params[0]);
1282 ctx.expectError (GL_INVALID_ENUM);
1285 ctx.glGetInternalformativ (GL_RENDERBUFFER, GL_COMPRESSED_RGB8_ETC2, GL_NUM_SAMPLE_COUNTS, 16, &params[0]);
1286 ctx.expectError (GL_INVALID_ENUM);
1287 ctx.endSection();
1289 ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER.");
1290 ctx.glGetInternalformativ (-1, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 16, &params[0]);
1291 ctx.expectError (GL_INVALID_ENUM);
1292 ctx.glGetInternalformativ (GL_FRAMEBUFFER, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 16, &params[0]);
1293 ctx.expectError (GL_INVALID_ENUM);
1295 if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_sparse_texture"))
1297 ctx.glGetInternalformativ (GL_TEXTURE_2D, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 16, &params[0]);
1298 ctx.expectError (GL_INVALID_ENUM);
1301 ctx.endSection();
1306 void get_queryiv (NegativeTestContext& ctx)
1310 ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value.");
1311 ctx.glGetQueryiv (GL_ANY_SAMPLES_PASSED, -1, &params);
1312 ctx.expectError (GL_INVALID_ENUM);
1313 ctx.glGetQueryiv (-1, GL_CURRENT_QUERY, &params);
1314 ctx.expectError (GL_INVALID_ENUM);
1315 ctx.glGetQueryiv (-1, -1, &params);
1316 ctx.expectError (GL_INVALID_ENUM);
1317 ctx.endSection();
1320 void get_query_objectuiv (NegativeTestContext& ctx)
1324 ctx.glGenQueries (1, &id);
1326 ctx.beginSection("GL_INVALID_OPERATION is generated if id is not the name of a query object.");
1327 ctx.glGetQueryObjectuiv (-1, GL_QUERY_RESULT_AVAILABLE, &params);
1328 ctx.expectError (GL_INVALID_OPERATION);
1329 ctx.getLog() << TestLog::Message << "// Note: " << id << " is not a query object yet, since it hasn't been used by glBeginQuery" << TestLog::EndMessage;
1330 ctx.glGetQueryObjectuiv (id, GL_QUERY_RESULT_AVAILABLE, &params);
1331 ctx.expectError (GL_INVALID_OPERATION);
1332 ctx.endSection();
1334 ctx.glBeginQuery (GL_ANY_SAMPLES_PASSED, id);
1335 ctx.glEndQuery (GL_ANY_SAMPLES_PASSED);
1337 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
1338 ctx.glGetQueryObjectuiv (id, -1, &params);
1339 ctx.expectError (GL_INVALID_ENUM);
1340 ctx.endSection();
1342 ctx.beginSection("GL_INVALID_OPERATION is generated if id is the name of a currently active query object.");
1343 ctx.glBeginQuery (GL_ANY_SAMPLES_PASSED, id);
1344 ctx.expectError (GL_NO_ERROR);
1345 ctx.glGetQueryObjectuiv (id, GL_QUERY_RESULT_AVAILABLE, &params);
1346 ctx.expectError (GL_INVALID_OPERATION);
1347 ctx.glEndQuery (GL_ANY_SAMPLES_PASSED);
1348 ctx.expectError (GL_NO_ERROR);
1349 ctx.endSection();
1351 ctx.glDeleteQueries (1, &id);
1356 void get_synciv (NegativeTestContext& ctx)
1364 ctx.beginSection("GL_INVALID_VALUE is generated if sync is not the name of a sync object.");
1365 ctx.glGetSynciv(0, GL_OBJECT_TYPE, 32, &length, &values[0]);
1366 ctx.expectError(GL_INVALID_VALUE);
1367 ctx.endSection();
1369 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the accepted tokens.");
1370 sync = ctx.glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
1371 ctx.expectError(GL_NO_ERROR);
1372 ctx.glGetSynciv(sync, -1, 32, &length, &values[0]);
1373 ctx.expectError(GL_INVALID_ENUM);
1374 ctx.endSection();
1376 ctx.glDeleteSync(sync);
1378 ctx.beginSection("GL_INVALID_VALUE is generated if bufSize is negative.");
1379 sync = ctx.glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
1380 ctx.expectError(GL_NO_ERROR);
1381 ctx.glGetSynciv(sync, GL_OBJECT_TYPE, -1, &length, &values[0]);
1382 ctx.expectError(GL_INVALID_VALUE);
1383 ctx.endSection();
1385 ctx.glDeleteSync(sync);
1390 void is_enabled (NegativeTestContext& ctx)
1392 ctx.beginSection("GL_INVALID_ENUM is generated if cap is not an accepted value.");
1393 ctx.glIsEnabled(-1);
1394 ctx.expectError(GL_INVALID_ENUM);
1395 ctx.glIsEnabled(GL_TRIANGLES);
1396 ctx.expectError(GL_INVALID_ENUM);
1397 ctx.endSection();
1400 void is_enabledi (NegativeTestContext& ctx)
1402 TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a higher context version.");
1404 ctx.beginSection("GL_INVALID_ENUM is generated if cap is not an accepted value.");
1405 ctx.glIsEnabledi(-1, 1);
1406 ctx.expectError(GL_INVALID_ENUM);
1407 ctx.glIsEnabledi(GL_TRIANGLES, 1);
1408 ctx.expectError(GL_INVALID_ENUM);
1409 ctx.endSection();
1411 ctx.beginSection("GL_INVALID_VALUE is generated if index is outside the valid range for the indexed state cap.");
1412 ctx.glIsEnabledi(GL_BLEND, -1);
1413 ctx.expectError(GL_INVALID_VALUE);
1414 ctx.endSection();
1419 void hint (NegativeTestContext& ctx)
1421 ctx.beginSection("GL_INVALID_ENUM is generated if either target or mode is not an accepted value.");
1422 ctx.glHint(GL_GENERATE_MIPMAP_HINT, -1);
1423 ctx.expectError(GL_INVALID_ENUM);
1424 ctx.glHint(-1, GL_FASTEST);
1425 ctx.expectError(GL_INVALID_ENUM);
1426 ctx.glHint(-1, -1);
1427 ctx.expectError(GL_INVALID_ENUM);
1428 ctx.endSection();