1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 3.1 Module
3 * -------------------------------------------------
5 * Copyright 2014 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief Negative Shader API tests.
22 *//*--------------------------------------------------------------------*/
24 #include "es31fNegativeShaderApiTests.hpp"
26 #include "deUniquePtr.hpp"
28 #include "glwDefs.hpp"
29 #include "glwEnums.hpp"
31 #include "gluShaderProgram.hpp"
32 #include "gluCallLogWrapper.hpp"
34 #include "gluContextInfo.hpp"
35 #include "gluRenderContext.hpp"
44 namespace NegativeTestShared
47 using glu::CallLogWrapper;
50 static const char* vertexShaderSource = "#version 300 es\n"
53 " gl_Position = vec4(0.0);\n"
56 static const char* fragmentShaderSource = "#version 300 es\n"
57 "layout(location = 0) out mediump vec4 fragColor;"
60 " fragColor = vec4(0.0);\n"
63 static const char* uniformTestVertSource = "#version 300 es\n"
64 "uniform mediump vec4 vec4_v;\n"
65 "uniform mediump mat4 mat4_v;\n"
68 " gl_Position = mat4_v * vec4_v;\n"
71 static const char* uniformTestFragSource = "#version 300 es\n"
72 "uniform mediump ivec4 ivec4_f;\n"
73 "uniform mediump uvec4 uvec4_f;\n"
74 "uniform sampler2D sampler_f;\n"
75 "layout(location = 0) out mediump vec4 fragColor;"
78 " fragColor.xy = (vec4(uvec4_f) + vec4(ivec4_f)).xy;\n"
79 " fragColor.zw = texture(sampler_f, vec2(0.0, 0.0)).zw;\n"
82 static const char* uniformBlockVertSource = "#version 300 es\n"
83 "layout(shared) uniform Block { lowp float var; };\n"
86 " gl_Position = vec4(var);\n"
90 // Shader control commands
91 void create_shader (NegativeTestContext& ctx)
93 ctx.beginSection("GL_INVALID_ENUM is generated if shaderType is not an accepted value.");
94 ctx.glCreateShader(-1);
95 ctx.expectError(GL_INVALID_ENUM);
99 void shader_source (NegativeTestContext& ctx)
101 // make notAShader not a shader id
102 const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
103 ctx.glDeleteShader(notAShader);
105 ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
106 ctx.glShaderSource(notAShader, 0, 0, 0);
107 ctx.expectError(GL_INVALID_VALUE);
110 ctx.beginSection("GL_INVALID_VALUE is generated if count is less than 0.");
111 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
112 ctx.glShaderSource(shader, -1, 0, 0);
113 ctx.expectError(GL_INVALID_VALUE);
116 ctx.beginSection("GL_INVALID_OPERATION is generated if shader is not a shader object.");
117 GLuint program = ctx.glCreateProgram();
118 ctx.glShaderSource(program, 0, 0, 0);
119 ctx.expectError(GL_INVALID_OPERATION);
122 ctx.glDeleteProgram(program);
123 ctx.glDeleteShader(shader);
126 void compile_shader (NegativeTestContext& ctx)
128 const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
129 ctx.glDeleteShader(notAShader);
131 ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
132 ctx.glCompileShader(notAShader);
133 ctx.expectError(GL_INVALID_VALUE);
136 ctx.beginSection("GL_INVALID_OPERATION is generated if shader is not a shader object.");
137 GLuint program = ctx.glCreateProgram();
138 ctx.glCompileShader(program);
139 ctx.expectError(GL_INVALID_OPERATION);
142 ctx.glDeleteProgram(program);
145 void delete_shader (NegativeTestContext& ctx)
147 const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
148 ctx.glDeleteShader(notAShader);
150 ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
151 ctx.glDeleteShader(notAShader);
152 ctx.expectError(GL_INVALID_VALUE);
156 void shader_binary (NegativeTestContext& ctx)
158 std::vector<deInt32> binaryFormats;
159 deBool shaderBinarySupported = !binaryFormats.empty();
161 GLuint shaderPair[2];
162 GLuint nonProgram[2];
163 GLuint shaderProgram[2];
166 deInt32 numFormats = 0x1234;
167 ctx.glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &numFormats);
170 ctx.getLog() << TestLog::Message << "// No supported extensions available." << TestLog::EndMessage;
173 binaryFormats.resize(numFormats);
174 ctx.glGetIntegerv(GL_SHADER_BINARY_FORMATS, &binaryFormats[0]);
178 if (!shaderBinarySupported)
179 ctx.getLog() << TestLog::Message << "// Shader binaries not supported." << TestLog::EndMessage;
181 ctx.getLog() << TestLog::Message << "// Shader binaries supported" << TestLog::EndMessage;
183 shaders[0] = ctx.glCreateShader(GL_VERTEX_SHADER);
184 shaders[1] = ctx.glCreateShader(GL_VERTEX_SHADER);
185 shaderPair[0] = ctx.glCreateShader(GL_VERTEX_SHADER);
186 shaderPair[1] = ctx.glCreateShader(GL_FRAGMENT_SHADER);
189 shaderProgram[0] = ctx.glCreateShader(GL_VERTEX_SHADER);
190 shaderProgram[1] = ctx.glCreateProgram();
192 ctx.beginSection("GL_INVALID_ENUM is generated if binaryFormat is not an accepted value.");
193 ctx.glShaderBinary(1, &shaders[0], -1, 0, 0);
194 ctx.expectError(GL_INVALID_ENUM);
197 if (shaderBinarySupported)
199 ctx.beginSection("GL_INVALID_VALUE is generated if the data pointed to by binary does not match the format specified by binaryFormat.");
200 const GLbyte data = 0x005F;
201 ctx.glShaderBinary(1, &shaders[0], binaryFormats[0], &data, 1);
202 ctx.expectError(GL_INVALID_VALUE);
205 ctx.beginSection("GL_INVALID_OPERATION is generated if more than one of the handles in shaders refers to the same type of shader, or GL_INVALID_VALUE due to invalid data pointer.");
206 ctx.glShaderBinary(2, &shaders[0], binaryFormats[0], 0, 0);
207 ctx.expectError(GL_INVALID_OPERATION, GL_INVALID_VALUE);
210 ctx.beginSection("GL_INVALID_VALUE is generated if count or length is negative.");
211 ctx.glShaderBinary(2, &shaderPair[0], binaryFormats[0], 0, -1);
212 ctx.expectError(GL_INVALID_VALUE);
213 ctx.glShaderBinary(-1, &shaderPair[0], binaryFormats[0], 0, 0);
214 ctx.expectError(GL_INVALID_VALUE);
217 ctx.beginSection("GL_INVALID_VALUE is generated if shaders contains anything other than shader or program objects.");
218 ctx.glShaderBinary(2, &nonProgram[0], binaryFormats[0], 0, 0);
219 ctx.expectError(GL_INVALID_VALUE);
222 ctx.beginSection("GL_INVALID_OPERATION is generated if shaders refers to a program object.");
223 ctx.glShaderBinary(2, &shaderProgram[0], binaryFormats[0], 0, 0);
224 ctx.expectError(GL_INVALID_OPERATION);
228 ctx.glDeleteShader(shaders[0]);
229 ctx.glDeleteShader(shaders[1]);
232 void attach_shader (NegativeTestContext& ctx)
234 GLuint shader1 = ctx.glCreateShader(GL_VERTEX_SHADER);
235 GLuint shader2 = ctx.glCreateShader(GL_VERTEX_SHADER);
236 GLuint program = ctx.glCreateProgram();
238 const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
239 const GLuint notAProgram = ctx.glCreateProgram();
241 ctx.glDeleteShader(notAShader);
242 ctx.glDeleteProgram(notAProgram);
244 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
245 ctx.glAttachShader(shader1, shader1);
246 ctx.expectError(GL_INVALID_OPERATION);
249 ctx.beginSection("GL_INVALID_OPERATION is generated if shader is not a shader object.");
250 ctx.glAttachShader(program, program);
251 ctx.expectError(GL_INVALID_OPERATION);
252 ctx.glAttachShader(shader1, program);
253 ctx.expectError(GL_INVALID_OPERATION);
256 ctx.beginSection("GL_INVALID_VALUE is generated if either program or shader is not a value generated by OpenGL.");
257 ctx.glAttachShader(program, notAShader);
258 ctx.expectError(GL_INVALID_VALUE);
259 ctx.glAttachShader(notAProgram, shader1);
260 ctx.expectError(GL_INVALID_VALUE);
261 ctx.glAttachShader(notAProgram, notAShader);
262 ctx.expectError(GL_INVALID_VALUE);
265 ctx.beginSection("GL_INVALID_OPERATION is generated if shader is already attached to program.");
266 ctx.glAttachShader(program, shader1);
267 ctx.expectError(GL_NO_ERROR);
268 ctx.glAttachShader(program, shader1);
269 ctx.expectError(GL_INVALID_OPERATION);
272 ctx.beginSection("GL_INVALID_OPERATION is generated if a shader of the same type as shader is already attached to program.");
273 ctx.glAttachShader(program, shader2);
274 ctx.expectError(GL_INVALID_OPERATION);
277 ctx.glDeleteProgram(program);
278 ctx.glDeleteShader(shader1);
279 ctx.glDeleteShader(shader2);
282 void detach_shader (NegativeTestContext& ctx)
284 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
285 GLuint program = ctx.glCreateProgram();
287 const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
288 const GLuint notAProgram = ctx.glCreateProgram();
290 ctx.glDeleteShader(notAShader);
291 ctx.glDeleteProgram(notAProgram);
293 ctx.beginSection("GL_INVALID_VALUE is generated if either program or shader is not a value generated by OpenGL.");
294 ctx.glDetachShader(notAProgram, shader);
295 ctx.expectError(GL_INVALID_VALUE);
296 ctx.glDetachShader(program, notAShader);
297 ctx.expectError(GL_INVALID_VALUE);
298 ctx.glDetachShader(notAProgram, notAShader);
299 ctx.expectError(GL_INVALID_VALUE);
302 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
303 ctx.glDetachShader(shader, shader);
304 ctx.expectError(GL_INVALID_OPERATION);
307 ctx.beginSection("GL_INVALID_OPERATION is generated if shader is not a shader object.");
308 ctx.glDetachShader(program, program);
309 ctx.expectError(GL_INVALID_OPERATION);
310 ctx.glDetachShader(shader, program);
311 ctx.expectError(GL_INVALID_OPERATION);
314 ctx.beginSection("GL_INVALID_OPERATION is generated if shader is not attached to program.");
315 ctx.glDetachShader(program, shader);
316 ctx.expectError(GL_INVALID_OPERATION);
319 ctx.glDeleteProgram(program);
320 ctx.glDeleteShader(shader);
323 void link_program (NegativeTestContext& ctx)
325 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
327 const GLuint notAProgram = ctx.glCreateProgram();
328 ctx.glDeleteProgram(notAProgram);
330 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
331 ctx.glLinkProgram(notAProgram);
332 ctx.expectError(GL_INVALID_VALUE);
335 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
336 ctx.glLinkProgram(shader);
337 ctx.expectError(GL_INVALID_OPERATION);
340 ctx.glDeleteShader(shader);
342 ctx.beginSection("GL_INVALID_OPERATION is generated if program is the currently active program object and transform feedback mode is active.");
343 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
344 deUint32 buf = 0x1234;
345 deUint32 tfID = 0x1234;
346 const char* tfVarying = "gl_Position";
348 ctx.glGenTransformFeedbacks (1, &tfID);
349 ctx.glGenBuffers (1, &buf);
351 ctx.glUseProgram (program.getProgram());
352 ctx.glTransformFeedbackVaryings (program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
353 ctx.glLinkProgram (program.getProgram());
354 ctx.glBindTransformFeedback (GL_TRANSFORM_FEEDBACK, tfID);
355 ctx.glBindBuffer (GL_TRANSFORM_FEEDBACK_BUFFER, buf);
356 ctx.glBufferData (GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
357 ctx.glBindBufferBase (GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
358 ctx.glBeginTransformFeedback (GL_TRIANGLES);
359 ctx.expectError (GL_NO_ERROR);
361 ctx.glLinkProgram (program.getProgram());
362 ctx.expectError (GL_INVALID_OPERATION);
364 ctx.glEndTransformFeedback ();
365 ctx.glDeleteTransformFeedbacks (1, &tfID);
366 ctx.glDeleteBuffers (1, &buf);
367 ctx.expectError (GL_NO_ERROR);
371 void use_program (NegativeTestContext& ctx)
373 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
375 const GLuint notAProgram = ctx.glCreateProgram();
376 ctx.glDeleteProgram(notAProgram);
378 ctx.beginSection("GL_INVALID_VALUE is generated if program is neither 0 nor a value generated by OpenGL.");
379 ctx.glUseProgram(notAProgram);
380 ctx.expectError(GL_INVALID_VALUE);
383 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
384 ctx.glUseProgram(shader);
385 ctx.expectError(GL_INVALID_OPERATION);
388 ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback mode is active and not paused.");
389 glu::ShaderProgram program1(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
390 glu::ShaderProgram program2(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
391 deUint32 buf = 0x1234;
392 deUint32 tfID = 0x1234;
393 const char* tfVarying = "gl_Position";
395 ctx.glGenTransformFeedbacks (1, &tfID);
396 ctx.glGenBuffers (1, &buf);
398 ctx.glUseProgram (program1.getProgram());
399 ctx.glTransformFeedbackVaryings (program1.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
400 ctx.glLinkProgram (program1.getProgram());
401 ctx.glBindTransformFeedback (GL_TRANSFORM_FEEDBACK, tfID);
402 ctx.glBindBuffer (GL_TRANSFORM_FEEDBACK_BUFFER, buf);
403 ctx.glBufferData (GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
404 ctx.glBindBufferBase (GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
405 ctx.glBeginTransformFeedback (GL_TRIANGLES);
406 ctx.expectError (GL_NO_ERROR);
408 ctx.glUseProgram (program2.getProgram());
409 ctx.expectError (GL_INVALID_OPERATION);
411 ctx.glPauseTransformFeedback ();
412 ctx.glUseProgram (program2.getProgram());
413 ctx.expectError (GL_NO_ERROR);
415 ctx.glEndTransformFeedback ();
416 ctx.glDeleteTransformFeedbacks (1, &tfID);
417 ctx.glDeleteBuffers (1, &buf);
418 ctx.expectError (GL_NO_ERROR);
422 ctx.glDeleteShader(shader);
425 void delete_program (NegativeTestContext& ctx)
427 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
429 const GLuint notAProgram = ctx.glCreateProgram();
430 ctx.glDeleteProgram(notAProgram);
432 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
433 ctx.glDeleteProgram(notAProgram);
434 ctx.expectError(GL_INVALID_VALUE);
437 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not zero and is the name of a shader object.");
438 ctx.glDeleteProgram(shader);
439 ctx.expectError(GL_INVALID_OPERATION);
442 ctx.glDeleteShader(shader);
445 void validate_program (NegativeTestContext& ctx)
447 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
449 const GLuint notAProgram = ctx.glCreateProgram();
450 ctx.glDeleteProgram(notAProgram);
452 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
453 ctx.glValidateProgram(notAProgram);
454 ctx.expectError(GL_INVALID_VALUE);
457 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
458 ctx.glValidateProgram(shader);
459 ctx.expectError(GL_INVALID_OPERATION);
462 ctx.glDeleteShader(shader);
465 void get_program_binary (NegativeTestContext& ctx)
467 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
468 glu::ShaderProgram programInvalid (ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, ""));
469 GLenum binaryFormat = -1;
470 GLsizei binaryLength = -1;
471 GLint binaryPtr = -1;
473 GLint linkStatus = -1;
475 ctx.beginSection("GL_INVALID_OPERATION is generated if bufSize is less than the size of GL_PROGRAM_BINARY_LENGTH for program.");
476 ctx.glGetProgramiv (program.getProgram(), GL_PROGRAM_BINARY_LENGTH, &bufSize);
477 ctx.expectError (GL_NO_ERROR);
478 ctx.glGetProgramiv (program.getProgram(), GL_LINK_STATUS, &linkStatus);
479 ctx.getLog() << TestLog::Message << "// GL_PROGRAM_BINARY_LENGTH = " << bufSize << TestLog::EndMessage;
480 ctx.getLog() << TestLog::Message << "// GL_LINK_STATUS = " << linkStatus << TestLog::EndMessage;
481 ctx.expectError (GL_NO_ERROR);
483 ctx.glGetProgramBinary (program.getProgram(), 0, &binaryLength, &binaryFormat, &binaryPtr);
484 ctx.expectError (GL_INVALID_OPERATION);
487 ctx.glGetProgramBinary (program.getProgram(), bufSize-1, &binaryLength, &binaryFormat, &binaryPtr);
488 ctx.expectError (GL_INVALID_OPERATION);
492 ctx.beginSection("GL_INVALID_OPERATION is generated if GL_LINK_STATUS for the program object is false.");
493 ctx.glGetProgramiv (programInvalid.getProgram(), GL_PROGRAM_BINARY_LENGTH, &bufSize);
494 ctx.expectError (GL_NO_ERROR);
495 ctx.glGetProgramiv (programInvalid.getProgram(), GL_LINK_STATUS, &linkStatus);
496 ctx.getLog() << TestLog::Message << "// GL_PROGRAM_BINARY_LENGTH = " << bufSize << TestLog::EndMessage;
497 ctx.getLog() << TestLog::Message << "// GL_LINK_STATUS = " << linkStatus << TestLog::EndMessage;
498 ctx.expectError (GL_NO_ERROR);
500 ctx.glGetProgramBinary (programInvalid.getProgram(), bufSize, &binaryLength, &binaryFormat, &binaryPtr);
501 ctx.expectError (GL_INVALID_OPERATION);
505 void program_binary (NegativeTestContext& ctx)
507 glu::ShaderProgram srcProgram (ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
508 GLuint dstProgram = ctx.glCreateProgram();
509 GLuint dummyShader = ctx.glCreateShader(GL_VERTEX_SHADER);
510 GLenum binaryFormat = -1;
511 GLsizei binaryLength = -1;
512 std::vector<deUint8> binaryBuf;
514 GLint linkStatus = -1;
516 ctx.glGetProgramiv (srcProgram.getProgram(), GL_PROGRAM_BINARY_LENGTH, &bufSize);
517 ctx.glGetProgramiv (srcProgram.getProgram(), GL_LINK_STATUS, &linkStatus);
518 ctx.getLog() << TestLog::Message << "// GL_PROGRAM_BINARY_LENGTH = " << bufSize << TestLog::EndMessage;
519 ctx.getLog() << TestLog::Message << "// GL_LINK_STATUS = " << linkStatus << TestLog::EndMessage;
521 TCU_CHECK(bufSize >= 0);
524 binaryBuf.resize(bufSize);
525 ctx.glGetProgramBinary (srcProgram.getProgram(), bufSize, &binaryLength, &binaryFormat, &binaryBuf[0]);
526 ctx.expectError (GL_NO_ERROR);
528 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not the name of an existing program object.");
529 ctx.glProgramBinary (dummyShader, binaryFormat, &binaryBuf[0], binaryLength);
530 ctx.expectError (GL_INVALID_OPERATION);
533 ctx.beginSection("GL_INVALID_ENUM is generated if binaryFormat is not a value recognized by the implementation.");
534 ctx.glProgramBinary (dstProgram, -1, &binaryBuf[0], binaryLength);
535 ctx.expectError (GL_INVALID_ENUM);
539 ctx.glDeleteShader(dummyShader);
540 ctx.glDeleteProgram(dstProgram);
543 void program_parameteri (NegativeTestContext& ctx)
545 GLuint program = ctx.glCreateProgram();
546 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
548 const GLuint notAProgram = ctx.glCreateProgram();
549 ctx.glDeleteProgram(notAProgram);
551 ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of an existing program object.");
552 ctx.glProgramParameteri(notAProgram, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
553 ctx.expectError(GL_INVALID_VALUE);
556 ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object.");
557 ctx.glProgramParameteri(shader, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
558 ctx.expectError(GL_INVALID_OPERATION);
561 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not GL_PROGRAM_BINARY_RETRIEVABLE_HINT or PROGRAM_SEPARABLE.");
562 ctx.glProgramParameteri(program, -1, GL_TRUE);
563 ctx.expectError(GL_INVALID_ENUM);
566 ctx.beginSection("GL_INVALID_VALUE is generated if value is not GL_FALSE or GL_TRUE.");
567 ctx.glProgramParameteri(program, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, 2);
568 ctx.expectError(GL_INVALID_VALUE);
571 ctx.glDeleteProgram(program);
572 ctx.glDeleteShader(shader);
575 void gen_samplers (NegativeTestContext& ctx)
577 ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
579 ctx.glGenSamplers (-1, &sampler);
580 ctx.expectError (GL_INVALID_VALUE);
584 void bind_sampler (NegativeTestContext& ctx)
586 int maxTexImageUnits = 0x1234;
588 ctx.glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTexImageUnits);
589 ctx.glGenSamplers (1, &sampler);
591 ctx.beginSection("GL_INVALID_VALUE is generated if unit is greater than or equal to the value of GL_MAX_COMBIED_TEXTURE_IMAGE_UNITS.");
592 ctx.glBindSampler (maxTexImageUnits, sampler);
593 ctx.expectError (GL_INVALID_VALUE);
596 ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not zero or a name previously returned from a call to ctx.glGenSamplers.");
597 ctx.glBindSampler (1, -1);
598 ctx.expectError (GL_INVALID_OPERATION);
601 ctx.beginSection("GL_INVALID_OPERATION is generated if sampler has been deleted by a call to ctx.glDeleteSamplers.");
602 ctx.glDeleteSamplers(1, &sampler);
603 ctx.glBindSampler (1, sampler);
604 ctx.expectError (GL_INVALID_OPERATION);
608 void delete_samplers (NegativeTestContext& ctx)
610 ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
611 ctx.glDeleteSamplers(-1, 0);
612 ctx.expectError (GL_INVALID_VALUE);
616 void get_sampler_parameteriv (NegativeTestContext& ctx)
620 ctx.glGenSamplers (1, &sampler);
622 ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object returned from a previous call to ctx.glGenSamplers.");
623 ctx.glGetSamplerParameteriv (-1, GL_TEXTURE_MAG_FILTER, ¶ms);
624 ctx.expectError (GL_INVALID_OPERATION);
627 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
628 ctx.glGetSamplerParameteriv (sampler, -1, ¶ms);
629 ctx.expectError (GL_INVALID_ENUM);
632 ctx.glDeleteSamplers(1, &sampler);
635 void get_sampler_parameterfv (NegativeTestContext& ctx)
639 ctx.glGenSamplers (1, &sampler);
641 ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object returned from a previous call to ctx.glGenSamplers.");
642 ctx.glGetSamplerParameterfv (-1, GL_TEXTURE_MAG_FILTER, ¶ms);
643 ctx.expectError (GL_INVALID_OPERATION);
646 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
647 ctx.glGetSamplerParameterfv (sampler, -1, ¶ms);
648 ctx.expectError (GL_INVALID_ENUM);
651 ctx.glDeleteSamplers(1, &sampler);
654 void get_sampler_parameterIiv (NegativeTestContext& ctx)
656 if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
657 throw tcu::NotSupportedError("glGetSamplerParameterIiv is not supported.", DE_NULL, __FILE__, __LINE__);
659 GLuint sampler = 0x1234;
660 GLint borderColor = 0x1234;
662 ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object returned from a previous call to ctx.glGenSamplers.");
663 ctx.glGetSamplerParameterIiv(sampler, GL_TEXTURE_BORDER_COLOR, &borderColor);
664 ctx.expectError(GL_INVALID_OPERATION);
667 ctx.glGenSamplers(1, &sampler);
669 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
670 ctx.glGetSamplerParameterIiv(sampler, -1, &borderColor);
671 ctx.expectError(GL_INVALID_ENUM);
674 ctx.glDeleteSamplers(1, &sampler);
677 void get_sampler_parameterIuiv (NegativeTestContext& ctx)
679 if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
680 throw tcu::NotSupportedError("glGetSamplerParameterIuiv is not supported.", DE_NULL, __FILE__, __LINE__);
682 GLuint sampler = 0x1234;
683 GLuint borderColor = 0x1234;
685 ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object returned from a previous call to ctx.glGenSamplers.");
686 ctx.glGetSamplerParameterIuiv(sampler, GL_TEXTURE_BORDER_COLOR, &borderColor);
687 ctx.expectError(GL_INVALID_OPERATION);
690 ctx.glGenSamplers(1, &sampler);
692 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
693 ctx.glGetSamplerParameterIuiv(sampler, -1, &borderColor);
694 ctx.expectError(GL_INVALID_ENUM);
697 ctx.glDeleteSamplers(1, &sampler);
700 void sampler_parameteri (NegativeTestContext& ctx)
704 ctx.glGenSamplers(1, &sampler);
706 ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object previously returned from a call to ctx.glGenSamplers.");
707 ctx.glSamplerParameteri(-1, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
708 ctx.expectError(GL_INVALID_OPERATION);
711 ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined constant value (based on the value of pname) and does not.");
712 ctx.glSamplerParameteri(sampler, GL_TEXTURE_WRAP_S, -1);
713 ctx.expectError(GL_INVALID_ENUM);
716 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
718 ctx.beginSection("GL_INVALID_ENUM is generated if glSamplerParameteri is called for a non-scalar parameter.");
719 ctx.glSamplerParameteri(sampler, GL_TEXTURE_BORDER_COLOR, 0);
720 ctx.expectError(GL_INVALID_ENUM);
724 ctx.glDeleteSamplers(1, &sampler);
727 void sampler_parameteriv (NegativeTestContext& ctx)
731 ctx.glGenSamplers (1, &sampler);
733 ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object previously returned from a call to ctx.glGenSamplers.");
734 params = GL_CLAMP_TO_EDGE;
735 ctx.glSamplerParameteriv (-1, GL_TEXTURE_WRAP_S, ¶ms);
736 ctx.expectError (GL_INVALID_OPERATION);
739 ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined constant value (based on the value of pname) and does not.");
741 ctx.glSamplerParameteriv (sampler, GL_TEXTURE_WRAP_S, ¶ms);
742 ctx.expectError (GL_INVALID_ENUM);
745 ctx.glDeleteSamplers(1, &sampler);
748 void sampler_parameterf (NegativeTestContext& ctx)
752 ctx.glGenSamplers(1, &sampler);
754 ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object previously returned from a call to ctx.glGenSamplers.");
755 ctx.glSamplerParameterf(-1, GL_TEXTURE_MIN_LOD, -1000.0f);
756 ctx.expectError(GL_INVALID_OPERATION);
759 ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined constant value (based on the value of pname) and does not.");
760 ctx.glSamplerParameterf(sampler, GL_TEXTURE_WRAP_S, -1.0f);
761 ctx.expectError(GL_INVALID_ENUM);
764 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
766 ctx.beginSection("GL_INVALID_ENUM is generated if glSamplerParameterf is called for a non-scalar parameter.");
767 ctx.glSamplerParameteri(sampler, GL_TEXTURE_BORDER_COLOR, 0);
768 ctx.expectError(GL_INVALID_ENUM);
772 ctx.glDeleteSamplers(1, &sampler);
775 void sampler_parameterfv (NegativeTestContext& ctx)
779 ctx.glGenSamplers (1, &sampler);
781 ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object previously returned from a call to ctx.glGenSamplers.");
783 ctx.glSamplerParameterfv (-1, GL_TEXTURE_WRAP_S, ¶ms);
784 ctx.expectError (GL_INVALID_OPERATION);
787 ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined constant value (based on the value of pname) and does not.");
789 ctx.glSamplerParameterfv (sampler, GL_TEXTURE_WRAP_S, ¶ms);
790 ctx.expectError (GL_INVALID_ENUM);
793 ctx.glDeleteSamplers(1, &sampler);
796 void sampler_parameterIiv (NegativeTestContext& ctx)
798 if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
799 throw tcu::NotSupportedError("glSamplerParameterIiv is not supported.", DE_NULL, __FILE__, __LINE__);
802 GLint color[] = {0, 0, 0, 0};
804 ctx.glGenSamplers(1, &sampler);
806 ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object previously returned from a call to ctx.glGenSamplers.");
807 ctx.glSamplerParameterIiv(-1, GL_TEXTURE_BORDER_COLOR, color);
808 ctx.expectError(GL_INVALID_OPERATION);
811 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted sampler state name.");
812 ctx.glSamplerParameterIiv(sampler, -1, color);
813 ctx.expectError(GL_INVALID_ENUM);
817 void sampler_parameterIuiv (NegativeTestContext& ctx)
819 if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
820 throw tcu::NotSupportedError("glSamplerParameterIuiv is not supported.", DE_NULL, __FILE__, __LINE__);
823 GLuint color[] = {0, 0, 0, 0};
825 ctx.glGenSamplers(1, &sampler);
827 ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object previously returned from a call to ctx.glGenSamplers.");
828 ctx.glSamplerParameterIuiv(-1, GL_TEXTURE_BORDER_COLOR, color);
829 ctx.expectError(GL_INVALID_OPERATION);
832 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted sampler state name.");
833 ctx.glSamplerParameterIuiv(sampler, -1, color);
834 ctx.expectError(GL_INVALID_ENUM);
838 // Shader data commands
840 void get_attrib_location (NegativeTestContext& ctx)
842 GLuint programEmpty = ctx.glCreateProgram();
843 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
845 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
847 const GLuint notAProgram = ctx.glCreateProgram();
848 ctx.glDeleteProgram(notAProgram);
850 ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
851 ctx.glBindAttribLocation (programEmpty, 0, "test");
852 ctx.glGetAttribLocation (programEmpty, "test");
853 ctx.expectError (GL_INVALID_OPERATION);
856 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a program or shader object.");
857 ctx.glUseProgram (program.getProgram());
858 ctx.glBindAttribLocation (program.getProgram(), 0, "test");
859 ctx.expectError (GL_NO_ERROR);
860 ctx.glGetAttribLocation (program.getProgram(), "test");
861 ctx.expectError (GL_NO_ERROR);
862 ctx.glGetAttribLocation (notAProgram, "test");
863 ctx.expectError (GL_INVALID_VALUE);
866 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
867 ctx.glGetAttribLocation (shader, "test");
868 ctx.expectError (GL_INVALID_OPERATION);
871 ctx.glUseProgram (0);
872 ctx.glDeleteShader (shader);
873 ctx.glDeleteProgram (programEmpty);
876 void get_uniform_location (NegativeTestContext& ctx)
878 GLuint programEmpty = ctx.glCreateProgram();
879 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
881 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
883 const GLuint notAProgram = ctx.glCreateProgram();
884 ctx.glDeleteProgram(notAProgram);
886 ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
887 ctx.glGetUniformLocation(programEmpty, "test");
888 ctx.expectError(GL_INVALID_OPERATION);
891 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
892 ctx.glUseProgram(program.getProgram());
893 ctx.glGetUniformLocation(notAProgram, "test");
894 ctx.expectError(GL_INVALID_VALUE);
897 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
898 ctx.glGetAttribLocation(shader, "test");
899 ctx.expectError(GL_INVALID_OPERATION);
903 ctx.glDeleteProgram(programEmpty);
904 ctx.glDeleteShader(shader);
907 void bind_attrib_location (NegativeTestContext& ctx)
909 GLuint program = ctx.glCreateProgram();
910 GLuint maxIndex = ctx.getInteger(GL_MAX_VERTEX_ATTRIBS);
911 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
913 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
914 ctx.glBindAttribLocation(program, maxIndex, "test");
915 ctx.expectError(GL_INVALID_VALUE);
918 ctx.beginSection("GL_INVALID_OPERATION is generated if name starts with the reserved prefix \"gl_\".");
919 ctx.glBindAttribLocation(program, maxIndex-1, "gl_test");
920 ctx.expectError(GL_INVALID_OPERATION);
923 ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
924 ctx.glBindAttribLocation(-1, maxIndex-1, "test");
925 ctx.expectError(GL_INVALID_VALUE);
928 ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
929 ctx.glBindAttribLocation(shader, maxIndex-1, "test");
930 ctx.expectError(GL_INVALID_OPERATION);
933 ctx.glDeleteProgram(program);
934 ctx.glDeleteShader(shader);
937 void uniform_block_binding (NegativeTestContext& ctx)
939 GLint maxUniformBufferBindings = -1;
940 GLint numActiveUniforms = -1;
941 GLint numActiveBlocks = -1;
943 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformBlockVertSource, uniformTestFragSource));
945 shader = ctx.glCreateShader(GL_VERTEX_SHADER);
946 ctx.glUseProgram(program.getProgram());
948 ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUniformBufferBindings);
949 ctx.glGetProgramiv(program.getProgram(), GL_ACTIVE_UNIFORMS, &numActiveUniforms);
950 ctx.glGetProgramiv(program.getProgram(), GL_ACTIVE_UNIFORM_BLOCKS, &numActiveBlocks);
951 ctx.getLog() << TestLog::Message << "// GL_MAX_UNIFORM_BUFFER_BINDINGS = " << maxUniformBufferBindings << TestLog::EndMessage;
952 ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORMS = " << numActiveUniforms << TestLog::EndMessage;
953 ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORM_BLOCKS = " << numActiveBlocks << TestLog::EndMessage;
954 ctx.expectError (GL_NO_ERROR);
956 ctx.beginSection("GL_INVALID_VALUE is generated if uniformBlockIndex is not an active uniform block index of program.");
957 ctx.glUniformBlockBinding(program.getProgram(), -1, 0);
958 ctx.expectError(GL_INVALID_VALUE);
959 ctx.glUniformBlockBinding(program.getProgram(), 5, 0);
960 ctx.expectError(GL_INVALID_VALUE);
963 ctx.beginSection("GL_INVALID_VALUE is generated if uniformBlockBinding is greater than or equal to the value of GL_MAX_UNIFORM_BUFFER_BINDINGS.");
964 ctx.glUniformBlockBinding(program.getProgram(), maxUniformBufferBindings, 0);
965 ctx.expectError(GL_INVALID_VALUE);
968 ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of a program object generated by the GL.");
969 ctx.glUniformBlockBinding(-1, 0, 0);
970 ctx.expectError(GL_INVALID_VALUE);
973 ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object.");
974 ctx.glUniformBlockBinding(shader, 0, 0);
975 ctx.expectError(GL_INVALID_OPERATION);
978 ctx.glDeleteShader(shader);
983 void uniformf_invalid_program (NegativeTestContext& ctx)
985 ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
987 ctx.glUniform1f(-1, 0.0f);
988 ctx.expectError(GL_INVALID_OPERATION);
989 ctx.glUniform2f(-1, 0.0f, 0.0f);
990 ctx.expectError(GL_INVALID_OPERATION);
991 ctx.glUniform3f(-1, 0.0f, 0.0f, 0.0f);
992 ctx.expectError(GL_INVALID_OPERATION);
993 ctx.glUniform4f(-1, 0.0f, 0.0f, 0.0f, 0.0f);
994 ctx.expectError(GL_INVALID_OPERATION);
998 void uniformf_incompatible_type (NegativeTestContext& ctx)
1000 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1002 ctx.glUseProgram(program.getProgram());
1003 GLint vec4_v = ctx.glGetUniformLocation(program.getProgram(), "vec4_v"); // vec4
1004 GLint ivec4_f = ctx.glGetUniformLocation(program.getProgram(), "ivec4_f"); // ivec4
1005 GLint uvec4_f = ctx.glGetUniformLocation(program.getProgram(), "uvec4_f"); // uvec4
1006 GLint sampler_f = ctx.glGetUniformLocation(program.getProgram(), "sampler_f"); // sampler2D
1007 ctx.expectError(GL_NO_ERROR);
1009 if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1011 ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1012 ctx.fail("Failed to retrieve uniform location");
1015 ctx.beginSection("GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the ctx.glUniform command.");
1016 ctx.glUseProgram(program.getProgram());
1017 ctx.glUniform1f(vec4_v, 0.0f);
1018 ctx.expectError(GL_INVALID_OPERATION);
1019 ctx.glUniform2f(vec4_v, 0.0f, 0.0f);
1020 ctx.expectError(GL_INVALID_OPERATION);
1021 ctx.glUniform3f(vec4_v, 0.0f, 0.0f, 0.0f);
1022 ctx.expectError(GL_INVALID_OPERATION);
1023 ctx.glUniform4f(vec4_v, 0.0f, 0.0f, 0.0f, 0.0f);
1024 ctx.expectError(GL_NO_ERROR);
1027 ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}f is used to load a uniform variable of type int, ivec2, ivec3, ivec4, unsigned int, uvec2, uvec3, uvec4.");
1028 ctx.glUseProgram(program.getProgram());
1029 ctx.glUniform4f(ivec4_f, 0.0f, 0.0f, 0.0f, 0.0f);
1030 ctx.expectError(GL_INVALID_OPERATION);
1031 ctx.glUniform4f(uvec4_f, 0.0f, 0.0f, 0.0f, 0.0f);
1032 ctx.expectError(GL_INVALID_OPERATION);
1035 ctx.beginSection("GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than ctx.glUniform1i and ctx.glUniform1iv.");
1036 ctx.glUseProgram(program.getProgram());
1037 ctx.glUniform1f(sampler_f, 0.0f);
1038 ctx.expectError(GL_INVALID_OPERATION);
1041 ctx.glUseProgram(0);
1044 void uniformf_invalid_location (NegativeTestContext& ctx)
1046 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1048 ctx.glUseProgram(program.getProgram());
1049 ctx.expectError(GL_NO_ERROR);
1051 ctx.beginSection("GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
1052 ctx.glUseProgram(program.getProgram());
1053 ctx.glUniform1f(-2, 0.0f);
1054 ctx.expectError(GL_INVALID_OPERATION);
1055 ctx.glUniform2f(-2, 0.0f, 0.0f);
1056 ctx.expectError(GL_INVALID_OPERATION);
1057 ctx.glUniform3f(-2, 0.0f, 0.0f, 0.0f);
1058 ctx.expectError(GL_INVALID_OPERATION);
1059 ctx.glUniform4f(-2, 0.0f, 0.0f, 0.0f, 0.0f);
1060 ctx.expectError(GL_INVALID_OPERATION);
1062 ctx.glUseProgram(program.getProgram());
1063 ctx.glUniform1f(-1, 0.0f);
1064 ctx.expectError(GL_NO_ERROR);
1065 ctx.glUniform2f(-1, 0.0f, 0.0f);
1066 ctx.expectError(GL_NO_ERROR);
1067 ctx.glUniform3f(-1, 0.0f, 0.0f, 0.0f);
1068 ctx.expectError(GL_NO_ERROR);
1069 ctx.glUniform4f(-1, 0.0f, 0.0f, 0.0f, 0.0f);
1070 ctx.expectError(GL_NO_ERROR);
1073 ctx.glUseProgram(0);
1078 void uniformfv_invalid_program (NegativeTestContext& ctx)
1080 std::vector<GLfloat> data(4);
1082 ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
1083 ctx.glUseProgram(0);
1084 ctx.glUniform1fv(-1, 1, &data[0]);
1085 ctx.expectError(GL_INVALID_OPERATION);
1086 ctx.glUniform2fv(-1, 1, &data[0]);
1087 ctx.expectError(GL_INVALID_OPERATION);
1088 ctx.glUniform3fv(-1, 1, &data[0]);
1089 ctx.expectError(GL_INVALID_OPERATION);
1090 ctx.glUniform4fv(-1, 1, &data[0]);
1091 ctx.expectError(GL_INVALID_OPERATION);
1095 void uniformfv_incompatible_type (NegativeTestContext& ctx)
1097 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1099 ctx.glUseProgram(program.getProgram());
1100 GLint vec4_v = ctx.glGetUniformLocation(program.getProgram(), "vec4_v"); // vec4
1101 GLint ivec4_f = ctx.glGetUniformLocation(program.getProgram(), "ivec4_f"); // ivec4
1102 GLint uvec4_f = ctx.glGetUniformLocation(program.getProgram(), "uvec4_f"); // uvec4
1103 GLint sampler_f = ctx.glGetUniformLocation(program.getProgram(), "sampler_f"); // sampler2D
1104 ctx.expectError(GL_NO_ERROR);
1106 if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1108 ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1109 ctx.fail("Failed to retrieve uniform location");
1112 std::vector<GLfloat> data(4);
1114 ctx.beginSection("GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the ctx.glUniform command.");
1115 ctx.glUseProgram(program.getProgram());
1116 ctx.glUniform1fv(vec4_v, 1, &data[0]);
1117 ctx.expectError(GL_INVALID_OPERATION);
1118 ctx.glUniform2fv(vec4_v, 1, &data[0]);
1119 ctx.expectError(GL_INVALID_OPERATION);
1120 ctx.glUniform3fv(vec4_v, 1, &data[0]);
1121 ctx.expectError(GL_INVALID_OPERATION);
1122 ctx.glUniform4fv(vec4_v, 1, &data[0]);
1123 ctx.expectError(GL_NO_ERROR);
1126 ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}fv is used to load a uniform variable of type int, ivec2, ivec3, ivec4, unsigned int, uvec2, uvec3, uvec4.");
1127 ctx.glUseProgram(program.getProgram());
1128 ctx.glUniform4fv(ivec4_f, 1, &data[0]);
1129 ctx.expectError(GL_INVALID_OPERATION);
1130 ctx.glUniform4fv(uvec4_f, 1, &data[0]);
1131 ctx.expectError(GL_INVALID_OPERATION);
1134 ctx.beginSection("GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than ctx.glUniform1i and ctx.glUniform1iv.");
1135 ctx.glUseProgram(program.getProgram());
1136 ctx.glUniform1fv(sampler_f, 1, &data[0]);
1137 ctx.expectError(GL_INVALID_OPERATION);
1140 ctx.glUseProgram(0);
1143 void uniformfv_invalid_location (NegativeTestContext& ctx)
1145 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1147 ctx.glUseProgram(program.getProgram());
1148 ctx.expectError(GL_NO_ERROR);
1150 std::vector<GLfloat> data(4);
1152 ctx.beginSection("GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
1153 ctx.glUseProgram(program.getProgram());
1154 ctx.glUniform1fv(-2, 1, &data[0]);
1155 ctx.expectError(GL_INVALID_OPERATION);
1156 ctx.glUniform2fv(-2, 1, &data[0]);
1157 ctx.expectError(GL_INVALID_OPERATION);
1158 ctx.glUniform3fv(-2, 1, &data[0]);
1159 ctx.expectError(GL_INVALID_OPERATION);
1160 ctx.glUniform4fv(-2, 1, &data[0]);
1161 ctx.expectError(GL_INVALID_OPERATION);
1163 ctx.glUseProgram(program.getProgram());
1164 ctx.glUniform1fv(-1, 1, &data[0]);
1165 ctx.expectError(GL_NO_ERROR);
1166 ctx.glUniform2fv(-1, 1, &data[0]);
1167 ctx.expectError(GL_NO_ERROR);
1168 ctx.glUniform3fv(-1, 1, &data[0]);
1169 ctx.expectError(GL_NO_ERROR);
1170 ctx.glUniform4fv(-1, 1, &data[0]);
1171 ctx.expectError(GL_NO_ERROR);
1174 ctx.glUseProgram(0);
1177 void uniformfv_invalid_count (NegativeTestContext& ctx)
1179 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1181 ctx.glUseProgram (program.getProgram());
1182 GLint vec4_v = ctx.glGetUniformLocation(program.getProgram(), "vec4_v"); // vec4
1183 ctx.expectError(GL_NO_ERROR);
1187 ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1188 ctx.fail("Failed to retrieve uniform location");
1191 std::vector<GLfloat> data(8);
1193 ctx.beginSection("GL_INVALID_OPERATION is generated if count is greater than 1 and the indicated uniform variable is not an array variable.");
1194 ctx.glUseProgram(program.getProgram());
1195 ctx.glUniform1fv(vec4_v, 2, &data[0]);
1196 ctx.expectError(GL_INVALID_OPERATION);
1197 ctx.glUniform2fv(vec4_v, 2, &data[0]);
1198 ctx.expectError(GL_INVALID_OPERATION);
1199 ctx.glUniform3fv(vec4_v, 2, &data[0]);
1200 ctx.expectError(GL_INVALID_OPERATION);
1201 ctx.glUniform4fv(vec4_v, 2, &data[0]);
1202 ctx.expectError(GL_INVALID_OPERATION);
1205 ctx.glUseProgram(0);
1210 void uniformi_invalid_program (NegativeTestContext& ctx)
1212 ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
1213 ctx.glUseProgram(0);
1214 ctx.glUniform1i(-1, 0);
1215 ctx.expectError(GL_INVALID_OPERATION);
1216 ctx.glUniform2i(-1, 0, 0);
1217 ctx.expectError(GL_INVALID_OPERATION);
1218 ctx.glUniform3i(-1, 0, 0, 0);
1219 ctx.expectError(GL_INVALID_OPERATION);
1220 ctx.glUniform4i(-1, 0, 0, 0, 0);
1221 ctx.expectError(GL_INVALID_OPERATION);
1225 void uniformi_incompatible_type (NegativeTestContext& ctx)
1227 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1229 ctx.glUseProgram(program.getProgram());
1230 GLint vec4_v = ctx.glGetUniformLocation(program.getProgram(), "vec4_v"); // vec4
1231 GLint ivec4_f = ctx.glGetUniformLocation(program.getProgram(), "ivec4_f"); // ivec4
1232 GLint uvec4_f = ctx.glGetUniformLocation(program.getProgram(), "uvec4_f"); // uvec4
1233 GLint sampler_f = ctx.glGetUniformLocation(program.getProgram(), "sampler_f"); // sampler2D
1234 ctx.expectError(GL_NO_ERROR);
1236 if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1238 ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1239 ctx.fail("Failed to retrieve uniform location");
1242 ctx.beginSection("GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the ctx.glUniform command.");
1243 ctx.glUseProgram(program.getProgram());
1244 ctx.glUniform1i(ivec4_f, 0);
1245 ctx.expectError(GL_INVALID_OPERATION);
1246 ctx.glUniform2i(ivec4_f, 0, 0);
1247 ctx.expectError(GL_INVALID_OPERATION);
1248 ctx.glUniform3i(ivec4_f, 0, 0, 0);
1249 ctx.expectError(GL_INVALID_OPERATION);
1250 ctx.glUniform4i(ivec4_f, 0, 0, 0, 0);
1251 ctx.expectError(GL_NO_ERROR);
1254 ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}i is used to load a uniform variable of type unsigned int, uvec2, uvec3, uvec4, or an array of these.");
1255 ctx.glUseProgram(program.getProgram());
1256 ctx.glUniform1i(uvec4_f, 0);
1257 ctx.expectError(GL_INVALID_OPERATION);
1258 ctx.glUniform2i(uvec4_f, 0, 0);
1259 ctx.expectError(GL_INVALID_OPERATION);
1260 ctx.glUniform3i(uvec4_f, 0, 0, 0);
1261 ctx.expectError(GL_INVALID_OPERATION);
1262 ctx.glUniform4i(uvec4_f, 0, 0, 0, 0);
1263 ctx.expectError(GL_INVALID_OPERATION);
1266 ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}i is used to load a uniform variable of type float, vec2, vec3, or vec4.");
1267 ctx.glUseProgram(program.getProgram());
1268 ctx.glUniform1i(vec4_v, 0);
1269 ctx.expectError(GL_INVALID_OPERATION);
1270 ctx.glUniform2i(vec4_v, 0, 0);
1271 ctx.expectError(GL_INVALID_OPERATION);
1272 ctx.glUniform3i(vec4_v, 0, 0, 0);
1273 ctx.expectError(GL_INVALID_OPERATION);
1274 ctx.glUniform4i(vec4_v, 0, 0, 0, 0);
1275 ctx.expectError(GL_INVALID_OPERATION);
1278 ctx.glUseProgram(0);
1281 void uniformi_invalid_location (NegativeTestContext& ctx)
1283 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1285 ctx.glUseProgram(program.getProgram());
1286 ctx.expectError(GL_NO_ERROR);
1288 ctx.beginSection("GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
1289 ctx.glUseProgram(program.getProgram());
1290 ctx.glUniform1i(-2, 0);
1291 ctx.expectError(GL_INVALID_OPERATION);
1292 ctx.glUniform2i(-2, 0, 0);
1293 ctx.expectError(GL_INVALID_OPERATION);
1294 ctx.glUniform3i(-2, 0, 0, 0);
1295 ctx.expectError(GL_INVALID_OPERATION);
1296 ctx.glUniform4i(-2, 0, 0, 0, 0);
1297 ctx.expectError(GL_INVALID_OPERATION);
1299 ctx.glUseProgram(program.getProgram());
1300 ctx.glUniform1i(-1, 0);
1301 ctx.expectError(GL_NO_ERROR);
1302 ctx.glUniform2i(-1, 0, 0);
1303 ctx.expectError(GL_NO_ERROR);
1304 ctx.glUniform3i(-1, 0, 0, 0);
1305 ctx.expectError(GL_NO_ERROR);
1306 ctx.glUniform4i(-1, 0, 0, 0, 0);
1307 ctx.expectError(GL_NO_ERROR);
1310 ctx.glUseProgram(0);
1315 void uniformiv_invalid_program (NegativeTestContext& ctx)
1317 std::vector<GLint> data(4);
1319 ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
1320 ctx.glUseProgram(0);
1321 ctx.glUniform1iv(-1, 1, &data[0]);
1322 ctx.expectError(GL_INVALID_OPERATION);
1323 ctx.glUniform2iv(-1, 1, &data[0]);
1324 ctx.expectError(GL_INVALID_OPERATION);
1325 ctx.glUniform3iv(-1, 1, &data[0]);
1326 ctx.expectError(GL_INVALID_OPERATION);
1327 ctx.glUniform4iv(-1, 1, &data[0]);
1328 ctx.expectError(GL_INVALID_OPERATION);
1332 void uniformiv_incompatible_type (NegativeTestContext& ctx)
1334 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1336 ctx.glUseProgram(program.getProgram());
1337 GLint vec4_v = ctx.glGetUniformLocation(program.getProgram(), "vec4_v"); // vec4
1338 GLint ivec4_f = ctx.glGetUniformLocation(program.getProgram(), "ivec4_f"); // ivec4
1339 GLint uvec4_f = ctx.glGetUniformLocation(program.getProgram(), "uvec4_f"); // uvec4
1340 GLint sampler_f = ctx.glGetUniformLocation(program.getProgram(), "sampler_f"); // sampler2D
1341 ctx.expectError(GL_NO_ERROR);
1343 if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1345 ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1346 ctx.fail("Failed to retrieve uniform location");
1349 std::vector<GLint> data(4);
1351 ctx.beginSection("GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the ctx.glUniform command.");
1352 ctx.glUseProgram(program.getProgram());
1353 ctx.glUniform1iv(ivec4_f, 1, &data[0]);
1354 ctx.expectError(GL_INVALID_OPERATION);
1355 ctx.glUniform2iv(ivec4_f, 1, &data[0]);
1356 ctx.expectError(GL_INVALID_OPERATION);
1357 ctx.glUniform3iv(ivec4_f, 1, &data[0]);
1358 ctx.expectError(GL_INVALID_OPERATION);
1359 ctx.glUniform4iv(ivec4_f, 1, &data[0]);
1360 ctx.expectError(GL_NO_ERROR);
1363 ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}iv is used to load a uniform variable of type float, vec2, vec3, or vec4.");
1364 ctx.glUseProgram(program.getProgram());
1365 ctx.glUniform1iv(vec4_v, 1, &data[0]);
1366 ctx.expectError(GL_INVALID_OPERATION);
1367 ctx.glUniform2iv(vec4_v, 1, &data[0]);
1368 ctx.expectError(GL_INVALID_OPERATION);
1369 ctx.glUniform3iv(vec4_v, 1, &data[0]);
1370 ctx.expectError(GL_INVALID_OPERATION);
1371 ctx.glUniform4iv(vec4_v, 1, &data[0]);
1372 ctx.expectError(GL_INVALID_OPERATION);
1375 ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}iv is used to load a uniform variable of type unsigned int, uvec2, uvec3 or uvec4.");
1376 ctx.glUseProgram(program.getProgram());
1377 ctx.glUniform1iv(uvec4_f, 1, &data[0]);
1378 ctx.expectError(GL_INVALID_OPERATION);
1379 ctx.glUniform2iv(uvec4_f, 1, &data[0]);
1380 ctx.expectError(GL_INVALID_OPERATION);
1381 ctx.glUniform3iv(uvec4_f, 1, &data[0]);
1382 ctx.expectError(GL_INVALID_OPERATION);
1383 ctx.glUniform4iv(uvec4_f, 1, &data[0]);
1384 ctx.expectError(GL_INVALID_OPERATION);
1387 ctx.glUseProgram(0);
1390 void uniformiv_invalid_location (NegativeTestContext& ctx)
1392 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1394 ctx.glUseProgram(program.getProgram());
1395 ctx.expectError(GL_NO_ERROR);
1397 std::vector<GLint> data(4);
1399 ctx.beginSection("GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
1400 ctx.glUseProgram(program.getProgram());
1401 ctx.glUniform1iv(-2, 1, &data[0]);
1402 ctx.expectError(GL_INVALID_OPERATION);
1403 ctx.glUniform2iv(-2, 1, &data[0]);
1404 ctx.expectError(GL_INVALID_OPERATION);
1405 ctx.glUniform3iv(-2, 1, &data[0]);
1406 ctx.expectError(GL_INVALID_OPERATION);
1407 ctx.glUniform4iv(-2, 1, &data[0]);
1408 ctx.expectError(GL_INVALID_OPERATION);
1410 ctx.glUseProgram(program.getProgram());
1411 ctx.glUniform1iv(-1, 1, &data[0]);
1412 ctx.expectError(GL_NO_ERROR);
1413 ctx.glUniform2iv(-1, 1, &data[0]);
1414 ctx.expectError(GL_NO_ERROR);
1415 ctx.glUniform3iv(-1, 1, &data[0]);
1416 ctx.expectError(GL_NO_ERROR);
1417 ctx.glUniform4iv(-1, 1, &data[0]);
1418 ctx.expectError(GL_NO_ERROR);
1421 ctx.glUseProgram(0);
1424 void uniformiv_invalid_count (NegativeTestContext& ctx)
1426 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1428 ctx.glUseProgram (program.getProgram());
1429 GLint ivec4_f = ctx.glGetUniformLocation(program.getProgram(), "ivec4_f"); // ivec4
1430 ctx.expectError(GL_NO_ERROR);
1434 ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1435 ctx.fail("Failed to retrieve uniform location");
1438 std::vector<GLint> data(8);
1440 ctx.beginSection("GL_INVALID_OPERATION is generated if count is greater than 1 and the indicated uniform variable is not an array variable.");
1441 ctx.glUseProgram(program.getProgram());
1442 ctx.glUniform1iv(ivec4_f, 2, &data[0]);
1443 ctx.expectError(GL_INVALID_OPERATION);
1444 ctx.glUniform2iv(ivec4_f, 2, &data[0]);
1445 ctx.expectError(GL_INVALID_OPERATION);
1446 ctx.glUniform3iv(ivec4_f, 2, &data[0]);
1447 ctx.expectError(GL_INVALID_OPERATION);
1448 ctx.glUniform4iv(ivec4_f, 2, &data[0]);
1449 ctx.expectError(GL_INVALID_OPERATION);
1452 ctx.glUseProgram(0);
1455 // ctx.glUniform{1234}ui
1457 void uniformui_invalid_program (NegativeTestContext& ctx)
1459 ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
1460 ctx.glUseProgram(0);
1461 ctx.glUniform1ui(-1, 0);
1462 ctx.expectError(GL_INVALID_OPERATION);
1463 ctx.glUniform2ui(-1, 0, 0);
1464 ctx.expectError(GL_INVALID_OPERATION);
1465 ctx.glUniform3ui(-1, 0, 0, 0);
1466 ctx.expectError(GL_INVALID_OPERATION);
1467 ctx.glUniform4ui(-1, 0, 0, 0, 0);
1468 ctx.expectError(GL_INVALID_OPERATION);
1472 void uniformui_incompatible_type (NegativeTestContext& ctx)
1474 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1476 ctx.glUseProgram(program.getProgram());
1477 GLint vec4_v = ctx.glGetUniformLocation(program.getProgram(), "vec4_v"); // vec4
1478 GLint ivec4_f = ctx.glGetUniformLocation(program.getProgram(), "ivec4_f"); // ivec4
1479 GLint uvec4_f = ctx.glGetUniformLocation(program.getProgram(), "uvec4_f"); // uvec4
1480 GLint sampler_f = ctx.glGetUniformLocation(program.getProgram(), "sampler_f"); // sampler2D
1481 ctx.expectError(GL_NO_ERROR);
1483 if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1485 ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1486 ctx.fail("Failed to retrieve uniform location");
1489 ctx.beginSection("GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the ctx.glUniform command.");
1490 ctx.glUseProgram(program.getProgram());
1491 ctx.glUniform1ui(uvec4_f, 0);
1492 ctx.expectError(GL_INVALID_OPERATION);
1493 ctx.glUniform2ui(uvec4_f, 0, 0);
1494 ctx.expectError(GL_INVALID_OPERATION);
1495 ctx.glUniform3ui(uvec4_f, 0, 0, 0);
1496 ctx.expectError(GL_INVALID_OPERATION);
1497 ctx.glUniform4ui(uvec4_f, 0, 0, 0, 0);
1498 ctx.expectError(GL_NO_ERROR);
1501 ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}i is used to load a uniform variable of type int, ivec2, ivec3, ivec4, or an array of these.");
1502 ctx.glUseProgram(program.getProgram());
1503 ctx.glUniform1ui(ivec4_f, 0);
1504 ctx.expectError(GL_INVALID_OPERATION);
1505 ctx.glUniform2ui(ivec4_f, 0, 0);
1506 ctx.expectError(GL_INVALID_OPERATION);
1507 ctx.glUniform3ui(ivec4_f, 0, 0, 0);
1508 ctx.expectError(GL_INVALID_OPERATION);
1509 ctx.glUniform4ui(ivec4_f, 0, 0, 0, 0);
1510 ctx.expectError(GL_INVALID_OPERATION);
1513 ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}i is used to load a uniform variable of type float, vec2, vec3, or vec4.");
1514 ctx.glUseProgram(program.getProgram());
1515 ctx.glUniform1ui(vec4_v, 0);
1516 ctx.expectError(GL_INVALID_OPERATION);
1517 ctx.glUniform2ui(vec4_v, 0, 0);
1518 ctx.expectError(GL_INVALID_OPERATION);
1519 ctx.glUniform3ui(vec4_v, 0, 0, 0);
1520 ctx.expectError(GL_INVALID_OPERATION);
1521 ctx.glUniform4ui(vec4_v, 0, 0, 0, 0);
1522 ctx.expectError(GL_INVALID_OPERATION);
1525 ctx.beginSection("GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than ctx.glUniform1i and ctx.glUniform1iv.");
1526 ctx.glUseProgram(program.getProgram());
1527 ctx.glUniform1ui(sampler_f, 0);
1528 ctx.expectError(GL_INVALID_OPERATION);
1531 ctx.glUseProgram(0);
1534 void uniformui_invalid_location (NegativeTestContext& ctx)
1536 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1538 ctx.glUseProgram(program.getProgram());
1539 ctx.expectError(GL_NO_ERROR);
1541 ctx.beginSection("GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
1542 ctx.glUseProgram(program.getProgram());
1543 ctx.glUniform1i(-2, 0);
1544 ctx.expectError(GL_INVALID_OPERATION);
1545 ctx.glUniform2i(-2, 0, 0);
1546 ctx.expectError(GL_INVALID_OPERATION);
1547 ctx.glUniform3i(-2, 0, 0, 0);
1548 ctx.expectError(GL_INVALID_OPERATION);
1549 ctx.glUniform4i(-2, 0, 0, 0, 0);
1550 ctx.expectError(GL_INVALID_OPERATION);
1552 ctx.glUseProgram(program.getProgram());
1553 ctx.glUniform1i(-1, 0);
1554 ctx.expectError(GL_NO_ERROR);
1555 ctx.glUniform2i(-1, 0, 0);
1556 ctx.expectError(GL_NO_ERROR);
1557 ctx.glUniform3i(-1, 0, 0, 0);
1558 ctx.expectError(GL_NO_ERROR);
1559 ctx.glUniform4i(-1, 0, 0, 0, 0);
1560 ctx.expectError(GL_NO_ERROR);
1563 ctx.glUseProgram(0);
1566 // ctx.glUniform{1234}uiv
1568 void uniformuiv_invalid_program (NegativeTestContext& ctx)
1570 std::vector<GLuint> data(4);
1572 ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
1573 ctx.glUseProgram(0);
1574 ctx.glUniform1uiv(-1, 1, &data[0]);
1575 ctx.expectError(GL_INVALID_OPERATION);
1576 ctx.glUniform2uiv(-1, 1, &data[0]);
1577 ctx.expectError(GL_INVALID_OPERATION);
1578 ctx.glUniform3uiv(-1, 1, &data[0]);
1579 ctx.expectError(GL_INVALID_OPERATION);
1580 ctx.glUniform4uiv(-1, 1, &data[0]);
1581 ctx.expectError(GL_INVALID_OPERATION);
1585 void uniformuiv_incompatible_type (NegativeTestContext& ctx)
1587 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1589 ctx.glUseProgram(program.getProgram());
1590 GLint vec4_v = ctx.glGetUniformLocation(program.getProgram(), "vec4_v"); // vec4
1591 GLint ivec4_f = ctx.glGetUniformLocation(program.getProgram(), "ivec4_f"); // ivec4
1592 GLint uvec4_f = ctx.glGetUniformLocation(program.getProgram(), "uvec4_f"); // uvec4
1593 GLint sampler_f = ctx.glGetUniformLocation(program.getProgram(), "sampler_f"); // sampler2D
1594 ctx.expectError(GL_NO_ERROR);
1596 if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1598 ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1599 ctx.fail("Failed to retrieve uniform location");
1602 std::vector<GLuint> data(4);
1604 ctx.beginSection("GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the ctx.glUniform command.");
1605 ctx.glUseProgram(program.getProgram());
1606 ctx.glUniform1uiv(uvec4_f, 1, &data[0]);
1607 ctx.expectError(GL_INVALID_OPERATION);
1608 ctx.glUniform2uiv(uvec4_f, 1, &data[0]);
1609 ctx.expectError(GL_INVALID_OPERATION);
1610 ctx.glUniform3uiv(uvec4_f, 1, &data[0]);
1611 ctx.expectError(GL_INVALID_OPERATION);
1612 ctx.glUniform4uiv(uvec4_f, 1, &data[0]);
1613 ctx.expectError(GL_NO_ERROR);
1616 ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}uiv is used to load a uniform variable of type float, vec2, vec3, or vec4.");
1617 ctx.glUseProgram(program.getProgram());
1618 ctx.glUniform1uiv(vec4_v, 1, &data[0]);
1619 ctx.expectError(GL_INVALID_OPERATION);
1620 ctx.glUniform2uiv(vec4_v, 1, &data[0]);
1621 ctx.expectError(GL_INVALID_OPERATION);
1622 ctx.glUniform3uiv(vec4_v, 1, &data[0]);
1623 ctx.expectError(GL_INVALID_OPERATION);
1624 ctx.glUniform4uiv(vec4_v, 1, &data[0]);
1625 ctx.expectError(GL_INVALID_OPERATION);
1628 ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}uiv is used to load a uniform variable of type int, ivec2, ivec3 or ivec4.");
1629 ctx.glUseProgram(program.getProgram());
1630 ctx.glUniform1uiv(ivec4_f, 1, &data[0]);
1631 ctx.expectError(GL_INVALID_OPERATION);
1632 ctx.glUniform2uiv(ivec4_f, 1, &data[0]);
1633 ctx.expectError(GL_INVALID_OPERATION);
1634 ctx.glUniform3uiv(ivec4_f, 1, &data[0]);
1635 ctx.expectError(GL_INVALID_OPERATION);
1636 ctx.glUniform4uiv(ivec4_f, 1, &data[0]);
1637 ctx.expectError(GL_INVALID_OPERATION);
1640 ctx.beginSection("GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than ctx.glUniform1i and ctx.glUniform1iv.");
1641 ctx.glUseProgram(program.getProgram());
1642 ctx.glUniform1uiv(sampler_f, 1, &data[0]);
1643 ctx.expectError(GL_INVALID_OPERATION);
1646 ctx.glUseProgram(0);
1649 void uniformuiv_invalid_location (NegativeTestContext& ctx)
1651 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1653 ctx.glUseProgram(program.getProgram());
1654 ctx.expectError(GL_NO_ERROR);
1656 std::vector<GLuint> data(4);
1658 ctx.beginSection("GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
1659 ctx.glUseProgram(program.getProgram());
1660 ctx.glUniform1uiv(-2, 1, &data[0]);
1661 ctx.expectError(GL_INVALID_OPERATION);
1662 ctx.glUniform2uiv(-2, 1, &data[0]);
1663 ctx.expectError(GL_INVALID_OPERATION);
1664 ctx.glUniform3uiv(-2, 1, &data[0]);
1665 ctx.expectError(GL_INVALID_OPERATION);
1666 ctx.glUniform4uiv(-2, 1, &data[0]);
1667 ctx.expectError(GL_INVALID_OPERATION);
1669 ctx.glUseProgram(program.getProgram());
1670 ctx.glUniform1uiv(-1, 1, &data[0]);
1671 ctx.expectError(GL_NO_ERROR);
1672 ctx.glUniform2uiv(-1, 1, &data[0]);
1673 ctx.expectError(GL_NO_ERROR);
1674 ctx.glUniform3uiv(-1, 1, &data[0]);
1675 ctx.expectError(GL_NO_ERROR);
1676 ctx.glUniform4uiv(-1, 1, &data[0]);
1677 ctx.expectError(GL_NO_ERROR);
1680 ctx.glUseProgram(0);
1683 void uniformuiv_invalid_count (NegativeTestContext& ctx)
1685 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1687 ctx.glUseProgram (program.getProgram());
1688 int uvec4_f = ctx.glGetUniformLocation(program.getProgram(), "uvec4_f"); // uvec4
1689 ctx.expectError(GL_NO_ERROR);
1693 ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1694 ctx.fail("Failed to retrieve uniform location");
1697 std::vector<GLuint> data(8);
1699 ctx.beginSection("GL_INVALID_OPERATION is generated if count is greater than 1 and the indicated uniform variable is not an array variable.");
1700 ctx.glUseProgram(program.getProgram());
1701 ctx.glUniform1uiv(uvec4_f, 2, &data[0]);
1702 ctx.expectError(GL_INVALID_OPERATION);
1703 ctx.glUniform2uiv(uvec4_f, 2, &data[0]);
1704 ctx.expectError(GL_INVALID_OPERATION);
1705 ctx.glUniform3uiv(uvec4_f, 2, &data[0]);
1706 ctx.expectError(GL_INVALID_OPERATION);
1707 ctx.glUniform4uiv(uvec4_f, 2, &data[0]);
1708 ctx.expectError(GL_INVALID_OPERATION);
1711 ctx.glUseProgram(0);
1715 // ctx.glUniformMatrix*fv
1717 void uniform_matrixfv_invalid_program (NegativeTestContext& ctx)
1719 std::vector<GLfloat> data(16);
1721 ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
1722 ctx.glUseProgram(0);
1723 ctx.glUniformMatrix2fv(-1, 1, GL_FALSE, &data[0]);
1724 ctx.expectError(GL_INVALID_OPERATION);
1725 ctx.glUniformMatrix3fv(-1, 1, GL_FALSE, &data[0]);
1726 ctx.expectError(GL_INVALID_OPERATION);
1727 ctx.glUniformMatrix4fv(-1, 1, GL_FALSE, &data[0]);
1728 ctx.expectError(GL_INVALID_OPERATION);
1730 ctx.glUniformMatrix2x3fv(-1, 1, GL_FALSE, &data[0]);
1731 ctx.expectError(GL_INVALID_OPERATION);
1732 ctx.glUniformMatrix3x2fv(-1, 1, GL_FALSE, &data[0]);
1733 ctx.expectError(GL_INVALID_OPERATION);
1734 ctx.glUniformMatrix2x4fv(-1, 1, GL_FALSE, &data[0]);
1735 ctx.expectError(GL_INVALID_OPERATION);
1736 ctx.glUniformMatrix4x2fv(-1, 1, GL_FALSE, &data[0]);
1737 ctx.expectError(GL_INVALID_OPERATION);
1738 ctx.glUniformMatrix3x4fv(-1, 1, GL_FALSE, &data[0]);
1739 ctx.expectError(GL_INVALID_OPERATION);
1740 ctx.glUniformMatrix4x3fv(-1, 1, GL_FALSE, &data[0]);
1741 ctx.expectError(GL_INVALID_OPERATION);
1745 void uniform_matrixfv_incompatible_type (NegativeTestContext& ctx)
1747 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1749 ctx.glUseProgram (program.getProgram());
1750 GLint mat4_v = ctx.glGetUniformLocation(program.getProgram(), "mat4_v"); // mat4
1751 GLint sampler_f = ctx.glGetUniformLocation(program.getProgram(), "sampler_f"); // sampler2D
1752 ctx.expectError(GL_NO_ERROR);
1754 if (mat4_v == -1 || sampler_f == -1)
1756 ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1757 ctx.fail("Failed to retrieve uniform location");
1760 std::vector<GLfloat> data(16);
1762 ctx.beginSection("GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the ctx.glUniform command.");
1763 ctx.glUseProgram(program.getProgram());
1764 ctx.glUniformMatrix2fv(mat4_v, 1, GL_FALSE, &data[0]);
1765 ctx.expectError(GL_INVALID_OPERATION);
1766 ctx.glUniformMatrix3fv(mat4_v, 1, GL_FALSE, &data[0]);
1767 ctx.expectError(GL_INVALID_OPERATION);
1768 ctx.glUniformMatrix4fv(mat4_v, 1, GL_FALSE, &data[0]);
1769 ctx.expectError(GL_NO_ERROR);
1771 ctx.glUniformMatrix2x3fv(mat4_v, 1, GL_FALSE, &data[0]);
1772 ctx.expectError(GL_INVALID_OPERATION);
1773 ctx.glUniformMatrix3x2fv(mat4_v, 1, GL_FALSE, &data[0]);
1774 ctx.expectError(GL_INVALID_OPERATION);
1775 ctx.glUniformMatrix2x4fv(mat4_v, 1, GL_FALSE, &data[0]);
1776 ctx.expectError(GL_INVALID_OPERATION);
1777 ctx.glUniformMatrix4x2fv(mat4_v, 1, GL_FALSE, &data[0]);
1778 ctx.expectError(GL_INVALID_OPERATION);
1779 ctx.glUniformMatrix3x4fv(mat4_v, 1, GL_FALSE, &data[0]);
1780 ctx.expectError(GL_INVALID_OPERATION);
1781 ctx.glUniformMatrix4x3fv(mat4_v, 1, GL_FALSE, &data[0]);
1782 ctx.expectError(GL_INVALID_OPERATION);
1785 ctx.beginSection("GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than ctx.glUniform1i and ctx.glUniform1iv.");
1786 ctx.glUseProgram(program.getProgram());
1787 ctx.glUniformMatrix2fv(sampler_f, 1, GL_FALSE, &data[0]);
1788 ctx.expectError(GL_INVALID_OPERATION);
1789 ctx.glUniformMatrix3fv(sampler_f, 1, GL_FALSE, &data[0]);
1790 ctx.expectError(GL_INVALID_OPERATION);
1791 ctx.glUniformMatrix4fv(sampler_f, 1, GL_FALSE, &data[0]);
1792 ctx.expectError(GL_INVALID_OPERATION);
1794 ctx.glUniformMatrix2x3fv(sampler_f, 1, GL_FALSE, &data[0]);
1795 ctx.expectError(GL_INVALID_OPERATION);
1796 ctx.glUniformMatrix3x2fv(sampler_f, 1, GL_FALSE, &data[0]);
1797 ctx.expectError(GL_INVALID_OPERATION);
1798 ctx.glUniformMatrix2x4fv(sampler_f, 1, GL_FALSE, &data[0]);
1799 ctx.expectError(GL_INVALID_OPERATION);
1800 ctx.glUniformMatrix4x2fv(sampler_f, 1, GL_FALSE, &data[0]);
1801 ctx.expectError(GL_INVALID_OPERATION);
1802 ctx.glUniformMatrix3x4fv(sampler_f, 1, GL_FALSE, &data[0]);
1803 ctx.expectError(GL_INVALID_OPERATION);
1804 ctx.glUniformMatrix4x3fv(sampler_f, 1, GL_FALSE, &data[0]);
1805 ctx.expectError(GL_INVALID_OPERATION);
1808 ctx.glUseProgram(0);
1811 void uniform_matrixfv_invalid_location (NegativeTestContext& ctx)
1813 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1815 ctx.glUseProgram(program.getProgram());
1816 ctx.expectError(GL_NO_ERROR);
1818 std::vector<GLfloat> data(16);
1820 ctx.beginSection("GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
1821 ctx.glUseProgram(program.getProgram());
1822 ctx.glUniformMatrix2fv(-2, 1, GL_FALSE, &data[0]);
1823 ctx.expectError(GL_INVALID_OPERATION);
1824 ctx.glUniformMatrix3fv(-2, 1, GL_FALSE, &data[0]);
1825 ctx.expectError(GL_INVALID_OPERATION);
1826 ctx.glUniformMatrix4fv(-2, 1, GL_FALSE, &data[0]);
1827 ctx.expectError(GL_INVALID_OPERATION);
1829 ctx.glUniformMatrix2x3fv(-2, 1, GL_FALSE, &data[0]);
1830 ctx.expectError(GL_INVALID_OPERATION);
1831 ctx.glUniformMatrix3x2fv(-2, 1, GL_FALSE, &data[0]);
1832 ctx.expectError(GL_INVALID_OPERATION);
1833 ctx.glUniformMatrix2x4fv(-2, 1, GL_FALSE, &data[0]);
1834 ctx.expectError(GL_INVALID_OPERATION);
1835 ctx.glUniformMatrix4x2fv(-2, 1, GL_FALSE, &data[0]);
1836 ctx.expectError(GL_INVALID_OPERATION);
1837 ctx.glUniformMatrix3x4fv(-2, 1, GL_FALSE, &data[0]);
1838 ctx.expectError(GL_INVALID_OPERATION);
1839 ctx.glUniformMatrix4x3fv(-2, 1, GL_FALSE, &data[0]);
1840 ctx.expectError(GL_INVALID_OPERATION);
1842 ctx.glUseProgram(program.getProgram());
1843 ctx.glUniformMatrix2fv(-1, 1, GL_FALSE, &data[0]);
1844 ctx.expectError(GL_NO_ERROR);
1845 ctx.glUniformMatrix3fv(-1, 1, GL_FALSE, &data[0]);
1846 ctx.expectError(GL_NO_ERROR);
1847 ctx.glUniformMatrix4fv(-1, 1, GL_FALSE, &data[0]);
1848 ctx.expectError(GL_NO_ERROR);
1850 ctx.glUniformMatrix2x3fv(-1, 1, GL_FALSE, &data[0]);
1851 ctx.expectError(GL_NO_ERROR);
1852 ctx.glUniformMatrix3x2fv(-1, 1, GL_FALSE, &data[0]);
1853 ctx.expectError(GL_NO_ERROR);
1854 ctx.glUniformMatrix2x4fv(-1, 1, GL_FALSE, &data[0]);
1855 ctx.expectError(GL_NO_ERROR);
1856 ctx.glUniformMatrix4x2fv(-1, 1, GL_FALSE, &data[0]);
1857 ctx.expectError(GL_NO_ERROR);
1858 ctx.glUniformMatrix3x4fv(-1, 1, GL_FALSE, &data[0]);
1859 ctx.expectError(GL_NO_ERROR);
1860 ctx.glUniformMatrix4x3fv(-1, 1, GL_FALSE, &data[0]);
1861 ctx.expectError(GL_NO_ERROR);
1864 ctx.glUseProgram(0);
1867 void uniform_matrixfv_invalid_count (NegativeTestContext& ctx)
1869 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1871 ctx.glUseProgram (program.getProgram());
1872 GLint mat4_v = ctx.glGetUniformLocation(program.getProgram(), "mat4_v"); // mat4
1873 ctx.expectError(GL_NO_ERROR);
1877 ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1878 ctx.fail("Failed to retrieve uniform location");
1881 std::vector<GLfloat> data(32);
1883 ctx.beginSection("GL_INVALID_OPERATION is generated if count is greater than 1 and the indicated uniform variable is not an array variable.");
1884 ctx.glUseProgram(program.getProgram());
1885 ctx.glUniformMatrix2fv(mat4_v, 2, GL_FALSE, &data[0]);
1886 ctx.expectError(GL_INVALID_OPERATION);
1887 ctx.glUniformMatrix3fv(mat4_v, 2, GL_FALSE, &data[0]);
1888 ctx.expectError(GL_INVALID_OPERATION);
1889 ctx.glUniformMatrix4fv(mat4_v, 2, GL_FALSE, &data[0]);
1890 ctx.expectError(GL_INVALID_OPERATION);
1892 ctx.glUniformMatrix2x3fv(mat4_v, 1, GL_FALSE, &data[0]);
1893 ctx.expectError(GL_INVALID_OPERATION);
1894 ctx.glUniformMatrix3x2fv(mat4_v, 1, GL_FALSE, &data[0]);
1895 ctx.expectError(GL_INVALID_OPERATION);
1896 ctx.glUniformMatrix2x4fv(mat4_v, 1, GL_FALSE, &data[0]);
1897 ctx.expectError(GL_INVALID_OPERATION);
1898 ctx.glUniformMatrix4x2fv(mat4_v, 1, GL_FALSE, &data[0]);
1899 ctx.expectError(GL_INVALID_OPERATION);
1900 ctx.glUniformMatrix3x4fv(mat4_v, 1, GL_FALSE, &data[0]);
1901 ctx.expectError(GL_INVALID_OPERATION);
1902 ctx.glUniformMatrix4x3fv(mat4_v, 1, GL_FALSE, &data[0]);
1903 ctx.expectError(GL_INVALID_OPERATION);
1906 ctx.glUseProgram(0);
1909 // Transform feedback
1910 void gen_transform_feedbacks (NegativeTestContext& ctx)
1912 ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
1914 ctx.glGenTransformFeedbacks(-1, &id);
1915 ctx.expectError(GL_INVALID_VALUE);
1919 void bind_transform_feedback (NegativeTestContext& ctx)
1922 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
1923 deUint32 buf = 0x1234;
1924 const char* tfVarying = "gl_Position";
1926 ctx.glGenBuffers (1, &buf);
1927 ctx.glGenTransformFeedbacks (2, tfID);
1929 ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_TRANSFORM_FEEDBACK.");
1930 ctx.glBindTransformFeedback(-1, tfID[0]);
1931 ctx.expectError(GL_INVALID_ENUM);
1934 ctx.beginSection("GL_INVALID_OPERATION is generated if the transform feedback operation is active on the currently bound transform feedback object, and is not paused.");
1935 ctx.glUseProgram (program.getProgram());
1936 ctx.glTransformFeedbackVaryings (program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
1937 ctx.glLinkProgram (program.getProgram());
1938 ctx.glBindTransformFeedback (GL_TRANSFORM_FEEDBACK, tfID[0]);
1939 ctx.glBindBuffer (GL_TRANSFORM_FEEDBACK_BUFFER, buf);
1940 ctx.glBufferData (GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
1941 ctx.glBindBufferBase (GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
1942 ctx.glBeginTransformFeedback (GL_TRIANGLES);
1943 ctx.expectError (GL_NO_ERROR);
1945 ctx.glBindTransformFeedback (GL_TRANSFORM_FEEDBACK, tfID[1]);
1946 ctx.expectError (GL_INVALID_OPERATION);
1948 ctx.glEndTransformFeedback ();
1949 ctx.expectError (GL_NO_ERROR);
1952 ctx.glUseProgram (0);
1953 ctx.glDeleteBuffers (1, &buf);
1954 ctx.glDeleteTransformFeedbacks (2, tfID);
1955 ctx.expectError (GL_NO_ERROR);
1957 ctx.beginSection("GL_INVALID_OPERATION is generated if id has been deleted with glDeleteTransformFeedback().");
1958 ctx.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, tfID[0]);
1959 ctx.expectError(GL_INVALID_OPERATION);
1962 ctx.beginSection("GL_INVALID_OPERATION is generated if id is not 0 or a value returned from glGenTransformFeedbacks().");
1963 ctx.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, -1);
1964 ctx.expectError(GL_INVALID_OPERATION);
1968 void delete_transform_feedbacks (NegativeTestContext& ctx)
1972 deUint32 buf = 0x1234;
1973 const char* tfVarying = "gl_Position";
1974 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
1976 ctx.glGenBuffers(1, &buf);
1977 ctx.glGenTransformFeedbacks(1, &id);
1978 ctx.glGenTransformFeedbacks(2, tfID);
1980 ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
1981 ctx.glDeleteTransformFeedbacks(-1, &id);
1982 ctx.expectError(GL_INVALID_VALUE);
1985 ctx.beginSection("GL_INVALID_OPERATION is generated if the transform feedback operation for any object named by ids is currently active.");
1986 ctx.glUseProgram(program.getProgram());
1987 ctx.glTransformFeedbackVaryings(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
1988 ctx.glLinkProgram(program.getProgram());
1989 ctx.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, tfID[0]);
1990 ctx.glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
1991 ctx.glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
1992 ctx.glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
1993 ctx.glBeginTransformFeedback(GL_TRIANGLES);
1994 ctx.expectError(GL_NO_ERROR);
1996 ctx.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, tfID[1]);
1997 ctx.expectError(GL_INVALID_OPERATION);
1999 ctx.glDeleteTransformFeedbacks(2, tfID);
2000 ctx.expectError(GL_INVALID_OPERATION);
2002 ctx.glEndTransformFeedback();
2003 ctx.expectError(GL_NO_ERROR);
2007 ctx.glDeleteTransformFeedbacks(1, &id);
2008 ctx.glDeleteTransformFeedbacks(2, tfID);
2009 ctx.glDeleteBuffers(1, &buf);
2013 void begin_transform_feedback (NegativeTestContext& ctx)
2016 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
2017 deUint32 buf = 0x1234;
2018 const char* tfVarying = "gl_Position";
2020 ctx.glGenBuffers (1, &buf);
2021 ctx.glGenTransformFeedbacks (2, tfID);
2023 ctx.glUseProgram (program.getProgram());
2024 ctx.glTransformFeedbackVaryings (program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2025 ctx.glLinkProgram (program.getProgram());
2026 ctx.glBindTransformFeedback (GL_TRANSFORM_FEEDBACK, tfID[0]);
2027 ctx.glBindBuffer (GL_TRANSFORM_FEEDBACK_BUFFER, buf);
2028 ctx.glBufferData (GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
2029 ctx.glBindBufferBase (GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
2030 ctx.expectError (GL_NO_ERROR);
2032 ctx.beginSection("GL_INVALID_ENUM is generated if primitiveMode is not one of GL_POINTS, GL_LINES, or GL_TRIANGLES.");
2033 ctx.glBeginTransformFeedback (-1);
2034 ctx.expectError (GL_INVALID_ENUM);
2037 ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback is already active.");
2038 ctx.glBeginTransformFeedback (GL_TRIANGLES);
2039 ctx.expectError (GL_NO_ERROR);
2040 ctx.glBeginTransformFeedback (GL_POINTS);
2041 ctx.expectError (GL_INVALID_OPERATION);
2044 ctx.beginSection("GL_INVALID_OPERATION is generated if any binding point used in transform feedback mode does not have a buffer object bound.");
2045 ctx.glBindBufferBase (GL_TRANSFORM_FEEDBACK_BUFFER, 0, 0);
2046 ctx.glBeginTransformFeedback (GL_TRIANGLES);
2047 ctx.expectError (GL_INVALID_OPERATION);
2048 ctx.glBindBufferBase (GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
2051 ctx.beginSection("GL_INVALID_OPERATION is generated if no binding points would be used because no program object is active.");
2052 ctx.glUseProgram (0);
2053 ctx.glBeginTransformFeedback (GL_TRIANGLES);
2054 ctx.expectError (GL_INVALID_OPERATION);
2055 ctx.glUseProgram (program.getProgram());
2058 ctx.beginSection("GL_INVALID_OPERATION is generated if no binding points would be used because the active program object has specified no varying variables to record.");
2059 ctx.glTransformFeedbackVaryings (program.getProgram(), 0, 0, GL_INTERLEAVED_ATTRIBS);
2060 ctx.glBeginTransformFeedback (GL_TRIANGLES);
2061 ctx.expectError (GL_INVALID_OPERATION);
2064 ctx.glEndTransformFeedback ();
2065 ctx.glDeleteBuffers (1, &buf);
2066 ctx.glDeleteTransformFeedbacks (2, tfID);
2067 ctx.expectError (GL_NO_ERROR);
2070 void pause_transform_feedback (NegativeTestContext& ctx)
2073 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
2074 deUint32 buf = 0x1234;
2075 const char* tfVarying = "gl_Position";
2077 ctx.glGenBuffers (1, &buf);
2078 ctx.glGenTransformFeedbacks (2, tfID);
2080 ctx.glUseProgram (program.getProgram());
2081 ctx.glTransformFeedbackVaryings (program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2082 ctx.glLinkProgram (program.getProgram());
2083 ctx.glBindTransformFeedback (GL_TRANSFORM_FEEDBACK, tfID[0]);
2084 ctx.glBindBuffer (GL_TRANSFORM_FEEDBACK_BUFFER, buf);
2085 ctx.glBufferData (GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
2086 ctx.glBindBufferBase (GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
2087 ctx.expectError (GL_NO_ERROR);
2089 ctx.beginSection("GL_INVALID_OPERATION is generated if the currently bound transform feedback object is not active or is paused.");
2090 ctx.glPauseTransformFeedback ();
2091 ctx.expectError (GL_INVALID_OPERATION);
2092 ctx.glBeginTransformFeedback (GL_TRIANGLES);
2093 ctx.glPauseTransformFeedback ();
2094 ctx.expectError (GL_NO_ERROR);
2095 ctx.glPauseTransformFeedback ();
2096 ctx.expectError (GL_INVALID_OPERATION);
2099 ctx.glEndTransformFeedback ();
2100 ctx.glDeleteBuffers (1, &buf);
2101 ctx.glDeleteTransformFeedbacks (2, tfID);
2102 ctx.expectError (GL_NO_ERROR);
2105 void resume_transform_feedback (NegativeTestContext& ctx)
2108 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
2109 deUint32 buf = 0x1234;
2110 const char* tfVarying = "gl_Position";
2112 ctx.glGenBuffers (1, &buf);
2113 ctx.glGenTransformFeedbacks (2, tfID);
2115 ctx.glUseProgram (program.getProgram());
2116 ctx.glTransformFeedbackVaryings (program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2117 ctx.glLinkProgram (program.getProgram());
2118 ctx.glBindTransformFeedback (GL_TRANSFORM_FEEDBACK, tfID[0]);
2119 ctx.glBindBuffer (GL_TRANSFORM_FEEDBACK_BUFFER, buf);
2120 ctx.glBufferData (GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
2121 ctx.glBindBufferBase (GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
2122 ctx.expectError (GL_NO_ERROR);
2124 ctx.beginSection("GL_INVALID_OPERATION is generated if the currently bound transform feedback object is not active or is not paused.");
2125 ctx.glResumeTransformFeedback ();
2126 ctx.expectError (GL_INVALID_OPERATION);
2127 ctx.glBeginTransformFeedback (GL_TRIANGLES);
2128 ctx.glResumeTransformFeedback ();
2129 ctx.expectError (GL_INVALID_OPERATION);
2130 ctx.glPauseTransformFeedback ();
2131 ctx.glResumeTransformFeedback ();
2132 ctx.expectError (GL_NO_ERROR);
2135 ctx.glEndTransformFeedback ();
2136 ctx.glDeleteBuffers (1, &buf);
2137 ctx.glDeleteTransformFeedbacks (2, tfID);
2138 ctx.expectError (GL_NO_ERROR);
2141 void end_transform_feedback (NegativeTestContext& ctx)
2144 glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
2145 deUint32 buf = 0x1234;
2146 const char* tfVarying = "gl_Position";
2148 ctx.glGenBuffers (1, &buf);
2149 ctx.glGenTransformFeedbacks (1, &tfID);
2151 ctx.glUseProgram (program.getProgram());
2152 ctx.glTransformFeedbackVaryings (program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2153 ctx.glLinkProgram (program.getProgram());
2154 ctx.glBindTransformFeedback (GL_TRANSFORM_FEEDBACK, tfID);
2155 ctx.glBindBuffer (GL_TRANSFORM_FEEDBACK_BUFFER, buf);
2156 ctx.glBufferData (GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
2157 ctx.glBindBufferBase (GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
2158 ctx.expectError (GL_NO_ERROR);
2160 ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback is not active.");
2161 ctx.glEndTransformFeedback ();
2162 ctx.expectError (GL_INVALID_OPERATION);
2163 ctx.glBeginTransformFeedback (GL_TRIANGLES);
2164 ctx.glEndTransformFeedback ();
2165 ctx.expectError (GL_NO_ERROR);
2168 ctx.glDeleteBuffers (1, &buf);
2169 ctx.glDeleteTransformFeedbacks (1, &tfID);
2170 ctx.expectError (GL_NO_ERROR);
2173 void get_transform_feedback_varying (NegativeTestContext& ctx)
2176 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
2177 glu::ShaderProgram programInvalid (ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, ""));
2178 const char* tfVarying = "gl_Position";
2179 int maxTransformFeedbackVaryings = 0;
2186 const GLuint notAProgram = ctx.glCreateProgram();
2187 ctx.glDeleteProgram(notAProgram);
2189 ctx.glGenTransformFeedbacks (1, &tfID);
2191 ctx.glTransformFeedbackVaryings (program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2192 ctx.expectError (GL_NO_ERROR);
2193 ctx.glLinkProgram (program.getProgram());
2194 ctx.expectError (GL_NO_ERROR);
2196 ctx.glBindTransformFeedback (GL_TRANSFORM_FEEDBACK, tfID);
2197 ctx.expectError (GL_NO_ERROR);
2199 ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of a program object.");
2200 ctx.glGetTransformFeedbackVarying (notAProgram, 0, 32, &length, &size, &type, &name[0]);
2201 ctx.expectError (GL_INVALID_VALUE);
2204 ctx.beginSection("GL_INVALID_VALUE is generated if index is greater or equal to the value of GL_TRANSFORM_FEEDBACK_VARYINGS.");
2205 ctx.glGetProgramiv (program.getProgram(), GL_TRANSFORM_FEEDBACK_VARYINGS, &maxTransformFeedbackVaryings);
2206 ctx.glGetTransformFeedbackVarying (program.getProgram(), maxTransformFeedbackVaryings, 32, &length, &size, &type, &name[0]);
2207 ctx.expectError (GL_INVALID_VALUE);
2210 ctx.beginSection("GL_INVALID_OPERATION or GL_INVALID_VALUE is generated program has not been linked.");
2211 ctx.glGetTransformFeedbackVarying (programInvalid.getProgram(), 0, 32, &length, &size, &type, &name[0]);
2212 ctx.expectError (GL_INVALID_OPERATION, GL_INVALID_VALUE);
2215 ctx.glDeleteTransformFeedbacks (1, &tfID);
2216 ctx.expectError (GL_NO_ERROR);
2219 void transform_feedback_varyings (NegativeTestContext& ctx)
2222 GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
2223 glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
2224 const char* tfVarying = "gl_Position";
2225 GLint maxTransformFeedbackSeparateAttribs = 0;
2227 const GLuint notAProgram = ctx.glCreateProgram();
2228 ctx.glDeleteProgram(notAProgram);
2230 ctx.glGenTransformFeedbacks (1, &tfID);
2231 ctx.expectError (GL_NO_ERROR);
2233 ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of a program object.");
2234 ctx.glTransformFeedbackVaryings (notAProgram, 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2235 ctx.expectError (GL_INVALID_VALUE);
2238 ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object.");
2239 ctx.glTransformFeedbackVaryings(shader, 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2240 ctx.expectError(GL_INVALID_OPERATION);
2241 ctx.glDeleteShader(shader);
2244 ctx.beginSection("GL_INVALID_VALUE is generated if count is negative.");
2245 ctx.glTransformFeedbackVaryings(program.getProgram(), -1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2246 ctx.expectError(GL_INVALID_VALUE);
2249 ctx.beginSection("GL_INVALID_ENUM is generated if bufferMode is not SEPARATE_ATTRIBS or INTERLEAVED_ATTRIBS.");
2250 ctx.glTransformFeedbackVaryings(program.getProgram(), 1, &tfVarying, 0);
2251 ctx.expectError(GL_INVALID_ENUM);
2254 ctx.beginSection("GL_INVALID_VALUE is generated if bufferMode is GL_SEPARATE_ATTRIBS and count is greater than GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS.");
2255 ctx.glGetIntegerv (GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, &maxTransformFeedbackSeparateAttribs);
2256 ctx.glTransformFeedbackVaryings (program.getProgram(), maxTransformFeedbackSeparateAttribs+1, &tfVarying, GL_SEPARATE_ATTRIBS);
2257 ctx.expectError (GL_INVALID_VALUE);
2260 ctx.glDeleteTransformFeedbacks (1, &tfID);
2261 ctx.expectError (GL_NO_ERROR);
2265 void link_compute_shader (NegativeTestContext& ctx)
2267 const char* computeShaderSource = "#version 320 es\n"
2268 "void main (void)\n"
2272 const GLenum shaderTypes[] = {
2276 GL_TESS_CONTROL_SHADER,
2277 GL_TESS_EVALUATION_SHADER
2280 ctx.beginSection("Compute Shader linked with shader of other kind.");
2281 for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(shaderTypes); ndx++)
2283 GLint linkStatus = -1;
2284 GLuint program = ctx.glCreateProgram();
2285 GLuint computeShader = ctx.glCreateShader(GL_COMPUTE_SHADER);
2286 GLuint otherShader = ctx.glCreateShader(shaderTypes[ndx]);
2287 const char* otherShaderSource = (shaderTypes[ndx] != GL_GEOMETRY_SHADER) ?
2288 computeShaderSource :
2290 "layout(max_vertices = 3) out;\n"
2291 "void main(void){}\n\0";
2293 ctx.glShaderSource(computeShader, 1, &computeShaderSource, DE_NULL);
2294 ctx.glShaderSource(otherShader, 1, &otherShaderSource, DE_NULL);
2295 ctx.glCompileShader(computeShader);
2296 ctx.glCompileShader(otherShader);
2297 ctx.glAttachShader(program, computeShader);
2298 ctx.glAttachShader(program, otherShader);
2299 ctx.glLinkProgram(program);
2300 ctx.glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
2301 ctx.glDeleteShader(otherShader);
2302 ctx.glDeleteShader(computeShader);
2303 ctx.glDeleteProgram(program);
2304 if (linkStatus != GL_FALSE)
2305 ctx.fail("Program should not have linked");
2310 const char* computeShaderSource310 = "#version 310 es\n"
2311 "void main (void)\n"
2314 GLint linkStatus = -1;
2315 GLuint program = ctx.glCreateProgram();
2316 GLuint computeShader = ctx.glCreateShader(GL_COMPUTE_SHADER);
2317 GLuint computeShader310 = ctx.glCreateShader(GL_FRAGMENT_SHADER);
2319 ctx.glShaderSource(computeShader, 1, &computeShaderSource, DE_NULL);
2320 ctx.glShaderSource(computeShader310, 1, &computeShaderSource310, DE_NULL);
2321 ctx.beginSection("Compute Shader should not be linked with shaders of different version.");
2322 ctx.glCompileShader(computeShader);
2323 ctx.glCompileShader(computeShader310);
2324 ctx.glAttachShader(program, computeShader);
2325 ctx.glAttachShader(program, computeShader310);
2326 ctx.glLinkProgram(program);
2327 ctx.glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
2328 ctx.glDeleteShader(computeShader310);
2329 ctx.glDeleteShader(computeShader);
2330 ctx.glDeleteProgram(program);
2331 if (linkStatus != GL_FALSE)
2332 ctx.fail("Program should not have linked");
2337 void compile_compute_shader_helper (NegativeTestContext& ctx, const char** computeShaderSource, GLint* compileStatus)
2339 GLuint shader = ctx.glCreateShader(GL_COMPUTE_SHADER);
2341 *compileStatus = -1;
2342 ctx.glShaderSource(shader, 1, computeShaderSource, DE_NULL);
2343 ctx.glCompileShader(shader);
2344 ctx.glGetShaderiv(shader, GL_COMPILE_STATUS, compileStatus);
2345 ctx.glDeleteShader(shader);
2348 void compile_compute_shader (NegativeTestContext& ctx)
2350 GLint compileStatus;
2351 ctx.beginSection("Compile Computer Shader");
2354 const char* computeShaderSource = "#version 300 es\n"
2355 "void main (void)\n"
2359 compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2360 if (compileStatus != GL_FALSE)
2361 ctx.fail("Compute Shader should not have compiled with #version 300 es.");
2364 const char* computeShaderSource = "#version 310 es\n"
2365 "buffer SSBO { vec4 data }"
2366 "void main (void)\n"
2370 compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2371 if (compileStatus != GL_FALSE)
2372 ctx.fail("Compute Shader should not have compiled: incorrect SSBO syntax.");
2375 const char* computeShaderSource = "#version 310 es\n"
2376 "buffer SSBO { vec4 data;};"
2377 "uniform mat4 data;"
2378 "void main (void)\n"
2382 compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2383 if (compileStatus != GL_FALSE)
2384 ctx.fail("Compute Shader should not have compiled: buffer variable redefinition.");
2387 const char* computeShaderSource = "#version 310 es\n"
2388 "buffer SSBO { vec4 data[]; vec4 moreData;};"
2389 "void main (void)\n"
2393 compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2394 if (compileStatus != GL_FALSE)
2395 ctx.fail("Compute Shader should not have compiled: unspecified length buffer member not at the end.");
2398 const char* computeShaderSource = "#version 310 es\n"
2400 "void main (void)\n"
2404 compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2405 if (compileStatus != GL_FALSE)
2406 ctx.fail("Compute Shader should not have compiled: input qualifier used.");
2409 const char* computeShaderSource = "#version 310 es\n"
2410 "shared uint data = 0;";
2412 compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2413 if (compileStatus != GL_FALSE)
2414 ctx.fail("Compute Shader should not have compiled: shared-qualified variable initialized.");
2419 std::vector<FunctionContainer> getNegativeShaderApiTestFunctions ()
2421 FunctionContainer funcs[] =
2423 {create_shader, "create_shader", "Invalid glCreateShader() usage" },
2424 {shader_source, "shader_source", "Invalid glShaderSource() usage" },
2425 {compile_shader, "compile_shader", "Invalid glCompileShader() usage" },
2426 {delete_shader, "delete_shader", "Invalid glDeleteShader() usage" },
2427 {shader_binary, "shader_binary", "Invalid glShaderBinary() usage" },
2428 {attach_shader, "attach_shader", "Invalid glAttachShader() usage" },
2429 {detach_shader, "detach_shader", "Invalid glDetachShader() usage" },
2430 {link_program, "link_program", "Invalid glLinkProgram() usage" },
2431 {use_program, "use_program", "Invalid glUseProgram() usage" },
2432 {delete_program, "delete_program", "Invalid glDeleteProgram() usage" },
2433 {validate_program, "validate_program", "Invalid glValidateProgram() usage" },
2434 {get_program_binary, "get_program_binary", "Invalid glGetProgramBinary() usage" },
2435 {program_binary, "program_binary", "Invalid glProgramBinary() usage" },
2436 {program_parameteri, "program_parameteri", "Invalid glProgramParameteri() usage" },
2437 {gen_samplers, "gen_samplers", "Invalid glGenSamplers() usage" },
2438 {bind_sampler, "bind_sampler", "Invalid glBindSampler() usage" },
2439 {delete_samplers, "delete_samplers", "Invalid glDeleteSamplers() usage" },
2440 {get_sampler_parameteriv, "get_sampler_parameteriv", "Invalid glGetSamplerParameteriv() usage" },
2441 {get_sampler_parameterfv, "get_sampler_parameterfv", "Invalid glGetSamplerParameterfv() usage" },
2442 {get_sampler_parameterIiv, "get_sampler_parameterIiv", "Invalid glGetSamplerParameterIiv() usage" },
2443 {get_sampler_parameterIuiv, "get_sampler_parameterIuiv", "Invalid glGetSamplerParameterIuiv() usage" },
2444 {sampler_parameteri, "sampler_parameteri", "Invalid glSamplerParameteri() usage" },
2445 {sampler_parameteriv, "sampler_parameteriv", "Invalid glSamplerParameteriv() usage" },
2446 {sampler_parameterf, "sampler_parameterf", "Invalid glSamplerParameterf() usage" },
2447 {sampler_parameterfv, "sampler_parameterfv", "Invalid glSamplerParameterfv() usage" },
2448 {sampler_parameterIiv, "sampler_parameterIiv", "Invalid glSamplerParameterIiv() usage" },
2449 {sampler_parameterIuiv, "sampler_parameterIuiv", "Invalid glSamplerParameterIuiv() usage" },
2450 {get_attrib_location, "get_attrib_location", "Invalid glGetAttribLocation() usage" },
2451 {get_uniform_location, "get_uniform_location", "Invalid glGetUniformLocation() usage" },
2452 {bind_attrib_location, "bind_attrib_location", "Invalid glBindAttribLocation() usage" },
2453 {uniform_block_binding, "uniform_block_binding", "Invalid glUniformBlockBinding() usage" },
2454 {uniformf_invalid_program, "uniformf_invalid_program", "Invalid glUniform{1234}f() usage" },
2455 {uniformf_incompatible_type, "uniformf_incompatible_type", "Invalid glUniform{1234}f() usage" },
2456 {uniformf_invalid_location, "uniformf_invalid_location", "Invalid glUniform{1234}f() usage" },
2457 {uniformfv_invalid_program, "uniformfv_invalid_program", "Invalid glUniform{1234}fv() usage" },
2458 {uniformfv_incompatible_type, "uniformfv_incompatible_type", "Invalid glUniform{1234}fv() usage" },
2459 {uniformfv_invalid_location, "uniformfv_invalid_location", "Invalid glUniform{1234}fv() usage" },
2460 {uniformfv_invalid_count, "uniformfv_invalid_count", "Invalid glUniform{1234}fv() usage" },
2461 {uniformi_invalid_program, "uniformi_invalid_program", "Invalid glUniform{1234}i() usage" },
2462 {uniformi_incompatible_type, "uniformi_incompatible_type", "Invalid glUniform{1234}i() usage" },
2463 {uniformi_invalid_location, "uniformi_invalid_location", "Invalid glUniform{1234}i() usage" },
2464 {uniformiv_invalid_program, "uniformiv_invalid_program", "Invalid glUniform{1234}iv() usage" },
2465 {uniformiv_incompatible_type, "uniformiv_incompatible_type", "Invalid glUniform{1234}iv() usage" },
2466 {uniformiv_invalid_location, "uniformiv_invalid_location", "Invalid glUniform{1234}iv() usage" },
2467 {uniformiv_invalid_count, "uniformiv_invalid_count", "Invalid glUniform{1234}iv() usage" },
2468 {uniformui_invalid_program, "uniformui_invalid_program", "Invalid glUniform{234}ui() usage" },
2469 {uniformui_incompatible_type, "uniformui_incompatible_type", "Invalid glUniform{1234}ui() usage" },
2470 {uniformui_invalid_location, "uniformui_invalid_location", "Invalid glUniform{1234}ui() usage" },
2471 {uniformuiv_invalid_program, "uniformuiv_invalid_program", "Invalid glUniform{234}uiv() usage" },
2472 {uniformuiv_incompatible_type, "uniformuiv_incompatible_type", "Invalid glUniform{1234}uiv() usage" },
2473 {uniformuiv_invalid_location, "uniformuiv_invalid_location", "Invalid glUniform{1234}uiv() usage" },
2474 {uniformuiv_invalid_count, "uniformuiv_invalid_count", "Invalid glUniform{1234}uiv() usage" },
2475 {uniform_matrixfv_invalid_program, "uniform_matrixfv_invalid_program", "Invalid glUniformMatrix{234}fv() usage" },
2476 {uniform_matrixfv_incompatible_type, "uniform_matrixfv_incompatible_type", "Invalid glUniformMatrix{234}fv() usage" },
2477 {uniform_matrixfv_invalid_location, "uniform_matrixfv_invalid_location", "Invalid glUniformMatrix{234}fv() usage" },
2478 {uniform_matrixfv_invalid_count, "uniform_matrixfv_invalid_count", "Invalid glUniformMatrix{234}fv() usage" },
2479 {gen_transform_feedbacks, "gen_transform_feedbacks", "Invalid glGenTransformFeedbacks() usage" },
2480 {bind_transform_feedback, "bind_transform_feedback", "Invalid glBindTransformFeedback() usage" },
2481 {delete_transform_feedbacks, "delete_transform_feedbacks", "Invalid glDeleteTransformFeedbacks() usage" },
2482 {begin_transform_feedback, "begin_transform_feedback", "Invalid glBeginTransformFeedback() usage" },
2483 {pause_transform_feedback, "pause_transform_feedback", "Invalid glPauseTransformFeedback() usage" },
2484 {resume_transform_feedback, "resume_transform_feedback", "Invalid glResumeTransformFeedback() usage" },
2485 {end_transform_feedback, "end_transform_feedback", "Invalid glEndTransformFeedback() usage" },
2486 {get_transform_feedback_varying, "get_transform_feedback_varying", "Invalid glGetTransformFeedbackVarying() usage"},
2487 {transform_feedback_varyings, "transform_feedback_varyings", "Invalid glTransformFeedbackVaryings() usage" },
2488 {compile_compute_shader, "compile_compute_shader", "Invalid Compute Shader compilation" },
2489 {link_compute_shader, "link_compute_shader", "Invalid Compute Shader linkage" },
2492 return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs));
2495 } // NegativeTestShared