1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 3.0 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 "es3fNegativeShaderApiTests.hpp"
25 #include "es3fApiCase.hpp"
26 #include "gluShaderProgram.hpp"
27 #include "gluContextInfo.hpp"
28 #include "deUniquePtr.hpp"
30 #include "glwDefs.hpp"
31 #include "glwEnums.hpp"
33 using namespace glw; // GL types
44 static const char* vertexShaderSource = "#version 300 es\n"
47 " gl_Position = vec4(0.0);\n"
50 static const char* fragmentShaderSource = "#version 300 es\n"
51 "layout(location = 0) out mediump vec4 fragColor;"
54 " fragColor = vec4(0.0);\n"
57 static const char* uniformTestVertSource = "#version 300 es\n"
58 "uniform mediump vec4 vec4_v;\n"
59 "uniform mediump mat4 mat4_v;\n"
62 " gl_Position = mat4_v * vec4_v;\n"
65 static const char* uniformTestFragSource = "#version 300 es\n"
66 "uniform mediump ivec4 ivec4_f;\n"
67 "uniform mediump uvec4 uvec4_f;\n"
68 "uniform sampler2D sampler_f;\n"
69 "layout(location = 0) out mediump vec4 fragColor;"
72 " fragColor.xy = (vec4(uvec4_f) + vec4(ivec4_f)).xy;\n"
73 " fragColor.zw = texture(sampler_f, vec2(0.0, 0.0)).zw;\n"
76 static const char* uniformBlockVertSource = "#version 300 es\n"
77 "layout(shared) uniform Block { lowp float var; };\n"
80 " gl_Position = vec4(var);\n"
83 NegativeShaderApiTests::NegativeShaderApiTests (Context& context)
84 : TestCaseGroup(context, "shader", "Negative Shader API Cases")
88 NegativeShaderApiTests::~NegativeShaderApiTests (void)
92 void NegativeShaderApiTests::init (void)
94 // Shader control commands
96 ES3F_ADD_API_CASE(create_shader, "Invalid glCreateShader() usage",
98 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if shaderType is not an accepted value.");
100 expectError(GL_INVALID_ENUM);
101 m_log << TestLog::EndSection;
103 ES3F_ADD_API_CASE(shader_source, "Invalid glShaderSource() usage",
105 // \note Shader compilation must be supported.
107 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
108 glShaderSource(1, 0, 0, 0);
109 expectError(GL_INVALID_VALUE);
110 m_log << TestLog::EndSection;
112 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if count is less than 0.");
113 GLuint shader = glCreateShader(GL_VERTEX_SHADER);
114 glShaderSource(shader, -1, 0, 0);
115 expectError(GL_INVALID_VALUE);
116 m_log << TestLog::EndSection;
118 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if shader is not a shader object.");
119 GLuint program = glCreateProgram();
120 glShaderSource(program, 0, 0, 0);
121 expectError(GL_INVALID_OPERATION);
122 m_log << TestLog::EndSection;
124 glDeleteProgram(program);
125 glDeleteShader(shader);
127 ES3F_ADD_API_CASE(compile_shader, "Invalid glCompileShader() usage",
129 // \note Shader compilation must be supported.
131 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
133 expectError(GL_INVALID_VALUE);
134 m_log << TestLog::EndSection;
136 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if shader is not a shader object.");
137 GLuint program = glCreateProgram();
138 glCompileShader(program);
139 expectError(GL_INVALID_OPERATION);
140 m_log << TestLog::EndSection;
142 glDeleteProgram(program);
144 ES3F_ADD_API_CASE(delete_shader, "Invalid glDeleteShader() usage",
146 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
148 expectError(GL_INVALID_VALUE);
149 m_log << TestLog::EndSection;
151 ES3F_ADD_API_CASE(shader_binary, "Invalid glShaderBinary() usage",
153 std::vector<deInt32> binaryFormats;
154 getSupportedExtensions(GL_NUM_SHADER_BINARY_FORMATS, GL_SHADER_BINARY_FORMATS, binaryFormats);
155 deBool shaderBinarySupported = !binaryFormats.empty();
156 if (!shaderBinarySupported)
157 m_log << TestLog::Message << "// Shader binaries not supported." << TestLog::EndMessage;
159 m_log << TestLog::Message << "// Shader binaries supported" << TestLog::EndMessage;
162 shaders[0] = glCreateShader(GL_VERTEX_SHADER);
163 shaders[1] = glCreateShader(GL_VERTEX_SHADER);
165 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if binaryFormat is not an accepted value.");
166 glShaderBinary(1, &shaders[0], -1, 0, 0);
167 expectError(GL_INVALID_ENUM);
168 m_log << TestLog::EndSection;
170 if (shaderBinarySupported)
172 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if the data pointed to by binary does not match the format specified by binaryFormat.");
173 const GLbyte data = 0x005F;
174 glShaderBinary(1, &shaders[0], binaryFormats[0], &data, 1);
175 expectError(GL_INVALID_VALUE);
176 m_log << TestLog::EndSection;
178 m_log << TestLog::Section("", "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.");
179 glShaderBinary(2, &shaders[0], binaryFormats[0], 0, 0);
180 expectError(GL_INVALID_OPERATION, GL_INVALID_VALUE);
181 m_log << TestLog::EndSection;
184 glDeleteShader(shaders[0]);
185 glDeleteShader(shaders[1]);
187 ES3F_ADD_API_CASE(attach_shader, "Invalid glAttachShader() usage",
189 GLuint shader1 = glCreateShader(GL_VERTEX_SHADER);
190 GLuint shader2 = glCreateShader(GL_VERTEX_SHADER);
191 GLuint program = glCreateProgram();
193 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if program is not a program object.");
194 glAttachShader(shader1, shader1);
195 expectError(GL_INVALID_OPERATION);
196 m_log << TestLog::EndSection;
198 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if shader is not a shader object.");
199 glAttachShader(program, program);
200 expectError(GL_INVALID_OPERATION);
201 glAttachShader(shader1, program);
202 expectError(GL_INVALID_OPERATION);
203 m_log << TestLog::EndSection;
205 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if either program or shader is not a value generated by OpenGL.");
206 glAttachShader(program, -1);
207 expectError(GL_INVALID_VALUE);
208 glAttachShader(-1, shader1);
209 expectError(GL_INVALID_VALUE);
210 glAttachShader(-1, -1);
211 expectError(GL_INVALID_VALUE);
212 m_log << TestLog::EndSection;
214 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if shader is already attached to program.");
215 glAttachShader(program, shader1);
216 expectError(GL_NO_ERROR);
217 glAttachShader(program, shader1);
218 expectError(GL_INVALID_OPERATION);
219 m_log << TestLog::EndSection;
221 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if a shader of the same type as shader is already attached to program.");
222 glAttachShader(program, shader2);
223 expectError(GL_INVALID_OPERATION);
224 m_log << TestLog::EndSection;
226 glDeleteProgram(program);
227 glDeleteShader(shader1);
228 glDeleteShader(shader2);
230 ES3F_ADD_API_CASE(detach_shader, "Invalid glDetachShader() usage",
232 GLuint shader = glCreateShader(GL_VERTEX_SHADER);
233 GLuint program = glCreateProgram();
235 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if either program or shader is not a value generated by OpenGL.");
236 glDetachShader(-1, shader);
237 expectError(GL_INVALID_VALUE);
238 glDetachShader(program, -1);
239 expectError(GL_INVALID_VALUE);
240 glDetachShader(-1, -1);
241 expectError(GL_INVALID_VALUE);
242 m_log << TestLog::EndSection;
244 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if program is not a program object.");
245 glDetachShader(shader, shader);
246 expectError(GL_INVALID_OPERATION);
247 m_log << TestLog::EndSection;
249 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if shader is not a shader object.");
250 glDetachShader(program, program);
251 expectError(GL_INVALID_OPERATION);
252 glDetachShader(shader, program);
253 expectError(GL_INVALID_OPERATION);
254 m_log << TestLog::EndSection;
256 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if shader is not attached to program.");
257 glDetachShader(program, shader);
258 expectError(GL_INVALID_OPERATION);
259 m_log << TestLog::EndSection;
261 glDeleteProgram(program);
262 glDeleteShader(shader);
264 ES3F_ADD_API_CASE(link_program, "Invalid glLinkProgram() usage",
266 GLuint shader = glCreateShader(GL_VERTEX_SHADER);
268 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
270 expectError(GL_INVALID_VALUE);
271 m_log << TestLog::EndSection;
273 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if program is not a program object.");
274 glLinkProgram(shader);
275 expectError(GL_INVALID_OPERATION);
276 m_log << TestLog::EndSection;
278 glDeleteShader(shader);
280 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if program is the currently active program object and transform feedback mode is active.");
281 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
284 const char* tfVarying = "gl_Position";
286 glGenTransformFeedbacks (1, &tfID);
287 glGenBuffers (1, &buf);
289 glUseProgram (program.getProgram());
290 glTransformFeedbackVaryings (program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
291 glLinkProgram (program.getProgram());
292 glBindTransformFeedback (GL_TRANSFORM_FEEDBACK, tfID);
293 glBindBuffer (GL_TRANSFORM_FEEDBACK_BUFFER, buf);
294 glBufferData (GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
295 glBindBufferBase (GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
296 glBeginTransformFeedback (GL_TRIANGLES);
297 expectError (GL_NO_ERROR);
299 glLinkProgram (program.getProgram());
300 expectError (GL_INVALID_OPERATION);
302 glEndTransformFeedback ();
303 glDeleteTransformFeedbacks (1, &tfID);
304 glDeleteBuffers (1, &buf);
305 expectError (GL_NO_ERROR);
306 m_log << TestLog::EndSection;
308 ES3F_ADD_API_CASE(use_program, "Invalid glUseProgram() usage",
310 GLuint shader = glCreateShader(GL_VERTEX_SHADER);
312 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if program is neither 0 nor a value generated by OpenGL.");
314 expectError(GL_INVALID_VALUE);
315 m_log << TestLog::EndSection;
317 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if program is not a program object.");
318 glUseProgram(shader);
319 expectError(GL_INVALID_OPERATION);
320 m_log << TestLog::EndSection;
322 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if transform feedback mode is active and not paused.");
323 glu::ShaderProgram program1(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
324 glu::ShaderProgram program2(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
327 const char* tfVarying = "gl_Position";
329 glGenTransformFeedbacks (1, &tfID);
330 glGenBuffers (1, &buf);
332 glUseProgram (program1.getProgram());
333 glTransformFeedbackVaryings (program1.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
334 glLinkProgram (program1.getProgram());
335 glBindTransformFeedback (GL_TRANSFORM_FEEDBACK, tfID);
336 glBindBuffer (GL_TRANSFORM_FEEDBACK_BUFFER, buf);
337 glBufferData (GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
338 glBindBufferBase (GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
339 glBeginTransformFeedback (GL_TRIANGLES);
340 expectError (GL_NO_ERROR);
342 glUseProgram (program2.getProgram());
343 expectError (GL_INVALID_OPERATION);
345 glPauseTransformFeedback ();
346 glUseProgram (program2.getProgram());
347 expectError (GL_NO_ERROR);
349 glEndTransformFeedback ();
350 glDeleteTransformFeedbacks (1, &tfID);
351 glDeleteBuffers (1, &buf);
352 expectError (GL_NO_ERROR);
353 m_log << TestLog::EndSection;
356 glDeleteShader(shader);
358 ES3F_ADD_API_CASE(delete_program, "Invalid glDeleteProgram() usage",
360 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
362 expectError(GL_INVALID_VALUE);
363 m_log << TestLog::EndSection;
365 ES3F_ADD_API_CASE(validate_program, "Invalid glValidateProgram() usage",
367 GLuint shader = glCreateShader(GL_VERTEX_SHADER);
369 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
370 glValidateProgram(-1);
371 expectError(GL_INVALID_VALUE);
372 m_log << TestLog::EndSection;
374 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if program is not a program object.");
375 glValidateProgram(shader);
376 expectError(GL_INVALID_OPERATION);
377 m_log << TestLog::EndSection;
379 glDeleteShader(shader);
381 ES3F_ADD_API_CASE(get_program_binary, "Invalid glGetProgramBinary() usage",
383 glu::ShaderProgram program (m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
384 glu::ShaderProgram programInvalid (m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, ""));
385 GLenum binaryFormat = -1;
386 GLsizei binaryLength = -1;
387 GLint binaryPtr = -1;
389 GLint linkStatus = -1;
391 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if bufSize is less than the size of GL_PROGRAM_BINARY_LENGTH for program.");
392 glGetProgramiv (program.getProgram(), GL_PROGRAM_BINARY_LENGTH, &bufSize);
393 expectError (GL_NO_ERROR);
394 glGetProgramiv (program.getProgram(), GL_LINK_STATUS, &linkStatus);
395 m_log << TestLog::Message << "// GL_PROGRAM_BINARY_LENGTH = " << bufSize << TestLog::EndMessage;
396 m_log << TestLog::Message << "// GL_LINK_STATUS = " << linkStatus << TestLog::EndMessage;
397 expectError (GL_NO_ERROR);
399 glGetProgramBinary (program.getProgram(), 0, &binaryLength, &binaryFormat, &binaryPtr);
400 expectError (GL_INVALID_OPERATION);
403 glGetProgramBinary (program.getProgram(), bufSize-1, &binaryLength, &binaryFormat, &binaryPtr);
404 expectError (GL_INVALID_OPERATION);
406 m_log << TestLog::EndSection;
408 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if GL_LINK_STATUS for the program object is false.");
409 glGetProgramiv (programInvalid.getProgram(), GL_PROGRAM_BINARY_LENGTH, &bufSize);
410 expectError (GL_NO_ERROR);
411 glGetProgramiv (programInvalid.getProgram(), GL_LINK_STATUS, &linkStatus);
412 m_log << TestLog::Message << "// GL_PROGRAM_BINARY_LENGTH = " << bufSize << TestLog::EndMessage;
413 m_log << TestLog::Message << "// GL_LINK_STATUS = " << linkStatus << TestLog::EndMessage;
414 expectError (GL_NO_ERROR);
416 glGetProgramBinary (programInvalid.getProgram(), bufSize, &binaryLength, &binaryFormat, &binaryPtr);
417 expectError (GL_INVALID_OPERATION);
418 m_log << TestLog::EndSection;
420 ES3F_ADD_API_CASE(program_binary, "Invalid glProgramBinary() usage",
422 glu::ShaderProgram srcProgram (m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
423 GLuint dstProgram = glCreateProgram();
424 GLuint dummyShader = glCreateShader(GL_VERTEX_SHADER);
425 GLenum binaryFormat = -1;
426 GLsizei binaryLength = -1;
427 std::vector<deUint8> binaryBuf;
429 GLint linkStatus = -1;
431 glGetProgramiv (srcProgram.getProgram(), GL_PROGRAM_BINARY_LENGTH, &bufSize);
432 glGetProgramiv (srcProgram.getProgram(), GL_LINK_STATUS, &linkStatus);
433 m_log << TestLog::Message << "// GL_PROGRAM_BINARY_LENGTH = " << bufSize << TestLog::EndMessage;
434 m_log << TestLog::Message << "// GL_LINK_STATUS = " << linkStatus << TestLog::EndMessage;
436 TCU_CHECK(bufSize >= 0);
440 binaryBuf.resize(bufSize);
441 glGetProgramBinary (srcProgram.getProgram(), bufSize, &binaryLength, &binaryFormat, &binaryBuf[0]);
442 expectError (GL_NO_ERROR);
444 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if program is not the name of an existing program object.");
445 glProgramBinary (dummyShader, binaryFormat, &binaryBuf[0], binaryLength);
446 expectError (GL_INVALID_OPERATION);
447 m_log << TestLog::EndSection;
449 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if binaryFormat is not a value recognized by the implementation.");
450 glProgramBinary (dstProgram, -1, &binaryBuf[0], binaryLength);
451 expectError (GL_INVALID_ENUM);
452 m_log << TestLog::EndSection;
455 glDeleteShader(dummyShader);
456 glDeleteProgram(dstProgram);
458 ES3F_ADD_API_CASE(program_parameteri, "Invalid glProgramParameteri() usage",
460 GLuint program = glCreateProgram();
462 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if program is not the name of an existing program object.");
463 glProgramParameteri (0, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
464 expectError (GL_INVALID_VALUE);
465 m_log << TestLog::EndSection;
467 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if pname is not GL_PROGRAM_BINARY_RETRIEVABLE_HINT.");
468 glProgramParameteri (program, -1, GL_TRUE);
469 expectError (GL_INVALID_ENUM);
470 m_log << TestLog::EndSection;
472 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if value is not GL_FALSE or GL_TRUE.");
473 glProgramParameteri (program, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, 2);
474 expectError (GL_INVALID_VALUE);
475 m_log << TestLog::EndSection;
477 glDeleteProgram(program);
479 ES3F_ADD_API_CASE(gen_samplers, "Invalid glGenSamplers() usage",
481 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if n is negative.");
483 glGenSamplers (-1, &sampler);
484 expectError (GL_INVALID_VALUE);
485 m_log << TestLog::EndSection;
487 ES3F_ADD_API_CASE(bind_sampler, "Invalid glBindSampler() usage",
489 int maxTexImageUnits;
491 glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTexImageUnits);
492 glGenSamplers (1, &sampler);
494 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if unit is greater than or equal to the value of GL_MAX_COMBIED_TEXTURE_IMAGE_UNITS.");
495 glBindSampler (maxTexImageUnits, sampler);
496 expectError (GL_INVALID_VALUE);
497 m_log << TestLog::EndSection;
499 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if sampler is not zero or a name previously returned from a call to glGenSamplers.");
500 glBindSampler (1, -1);
501 expectError (GL_INVALID_OPERATION);
502 m_log << TestLog::EndSection;
504 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if sampler has been deleted by a call to glDeleteSamplers.");
505 glDeleteSamplers(1, &sampler);
506 glBindSampler (1, sampler);
507 expectError (GL_INVALID_OPERATION);
508 m_log << TestLog::EndSection;
510 ES3F_ADD_API_CASE(delete_samplers, "Invalid glDeleteSamplers() usage",
512 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if n is negative.");
513 glDeleteSamplers(-1, 0);
514 expectError (GL_INVALID_VALUE);
515 m_log << TestLog::EndSection;
517 ES3F_ADD_API_CASE(get_sampler_parameteriv, "Invalid glGetSamplerParameteriv() usage",
521 glGenSamplers (1, &sampler);
523 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object returned from a previous call to glGenSamplers.");
524 glGetSamplerParameteriv (-1, GL_TEXTURE_MAG_FILTER, ¶ms);
525 expectError (GL_INVALID_OPERATION);
526 m_log << TestLog::EndSection;
528 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if pname is not an accepted value.");
529 glGetSamplerParameteriv (sampler, -1, ¶ms);
530 expectError (GL_INVALID_ENUM);
531 m_log << TestLog::EndSection;
533 glDeleteSamplers(1, &sampler);
535 ES3F_ADD_API_CASE(get_sampler_parameterfv, "Invalid glGetSamplerParameterfv() usage",
539 glGenSamplers (1, &sampler);
541 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object returned from a previous call to glGenSamplers.");
542 glGetSamplerParameterfv (-1, GL_TEXTURE_MAG_FILTER, ¶ms);
543 expectError (GL_INVALID_OPERATION);
544 m_log << TestLog::EndSection;
546 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if pname is not an accepted value.");
547 glGetSamplerParameterfv (sampler, -1, ¶ms);
548 expectError (GL_INVALID_ENUM);
549 m_log << TestLog::EndSection;
551 glDeleteSamplers(1, &sampler);
553 ES3F_ADD_API_CASE(sampler_parameteri, "Invalid glSamplerParameteri() usage",
556 glGenSamplers (1, &sampler);
558 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object previously returned from a call to glGenSamplers.");
559 glSamplerParameteri (-1, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
560 expectError (GL_INVALID_OPERATION);
561 m_log << TestLog::EndSection;
563 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if params should have a defined constant value (based on the value of pname) and does not.");
564 glSamplerParameteri (sampler, GL_TEXTURE_WRAP_S, -1);
565 expectError (GL_INVALID_ENUM);
566 m_log << TestLog::EndSection;
568 glDeleteSamplers(1, &sampler);
570 ES3F_ADD_API_CASE(sampler_parameteriv, "Invalid glSamplerParameteriv() usage",
574 glGenSamplers (1, &sampler);
576 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object previously returned from a call to glGenSamplers.");
577 params = GL_CLAMP_TO_EDGE;
578 glSamplerParameteriv (-1, GL_TEXTURE_WRAP_S, ¶ms);
579 expectError (GL_INVALID_OPERATION);
580 m_log << TestLog::EndSection;
582 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if params should have a defined constant value (based on the value of pname) and does not.");
584 glSamplerParameteriv (sampler, GL_TEXTURE_WRAP_S, ¶ms);
585 expectError (GL_INVALID_ENUM);
586 m_log << TestLog::EndSection;
588 glDeleteSamplers(1, &sampler);
590 ES3F_ADD_API_CASE(sampler_parameterf, "Invalid glSamplerParameterf() usage",
593 glGenSamplers (1, &sampler);
595 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object previously returned from a call to glGenSamplers.");
596 glSamplerParameterf (-1, GL_TEXTURE_MIN_LOD, -1000.0f);
597 expectError (GL_INVALID_OPERATION);
598 m_log << TestLog::EndSection;
600 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if params should have a defined constant value (based on the value of pname) and does not.");
601 glSamplerParameterf (sampler, GL_TEXTURE_WRAP_S, -1.0f);
602 expectError (GL_INVALID_ENUM);
603 m_log << TestLog::EndSection;
605 glDeleteSamplers(1, &sampler);
607 ES3F_ADD_API_CASE(sampler_parameterfv, "Invalid glSamplerParameterfv() usage",
611 glGenSamplers (1, &sampler);
613 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object previously returned from a call to glGenSamplers.");
615 glSamplerParameterfv (-1, GL_TEXTURE_WRAP_S, ¶ms);
616 expectError (GL_INVALID_OPERATION);
617 m_log << TestLog::EndSection;
619 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if params should have a defined constant value (based on the value of pname) and does not.");
621 glSamplerParameterfv (sampler, GL_TEXTURE_WRAP_S, ¶ms);
622 expectError (GL_INVALID_ENUM);
623 m_log << TestLog::EndSection;
625 glDeleteSamplers(1, &sampler);
628 // Shader data commands
630 ES3F_ADD_API_CASE(get_attrib_location, "Invalid glGetAttribLocation() usage",
632 GLuint programEmpty = glCreateProgram();
633 GLuint shader = glCreateShader(GL_VERTEX_SHADER);
635 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
637 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if program has not been successfully linked.");
638 glBindAttribLocation (programEmpty, 0, "test");
639 glGetAttribLocation (programEmpty, "test");
640 expectError (GL_INVALID_OPERATION);
641 m_log << TestLog::EndSection;
643 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if program is not a program or shader object.");
644 glUseProgram (program.getProgram());
645 glBindAttribLocation (program.getProgram(), 0, "test");
646 expectError (GL_NO_ERROR);
647 glGetAttribLocation (program.getProgram(), "test");
648 expectError (GL_NO_ERROR);
649 glGetAttribLocation (-2, "test");
650 expectError (GL_INVALID_VALUE);
651 m_log << TestLog::EndSection;
653 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if program is not a program object.");
654 glGetAttribLocation (shader, "test");
655 expectError (GL_INVALID_OPERATION);
656 m_log << TestLog::EndSection;
659 glDeleteShader (shader);
660 glDeleteProgram (programEmpty);
662 ES3F_ADD_API_CASE(get_uniform_location, "Invalid glGetUniformLocation() usage",
664 GLuint programEmpty = glCreateProgram();
665 GLuint shader = glCreateShader(GL_VERTEX_SHADER);
667 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
669 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if program has not been successfully linked.");
670 glGetUniformLocation(programEmpty, "test");
671 expectError(GL_INVALID_OPERATION);
672 m_log << TestLog::EndSection;
674 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
675 glUseProgram(program.getProgram());
676 glGetUniformLocation(-2, "test");
677 expectError(GL_INVALID_VALUE);
678 m_log << TestLog::EndSection;
680 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if program is not a program object.");
681 glGetAttribLocation(shader, "test");
682 expectError(GL_INVALID_OPERATION);
683 m_log << TestLog::EndSection;
686 glDeleteProgram(programEmpty);
687 glDeleteShader(shader);
689 ES3F_ADD_API_CASE(bind_attrib_location, "Invalid glBindAttribLocation() usage",
691 GLuint program = glCreateProgram();
692 GLuint maxIndex = m_context.getContextInfo().getInt(GL_MAX_VERTEX_ATTRIBS);
693 GLuint shader = glCreateShader(GL_VERTEX_SHADER);
695 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
696 glBindAttribLocation(program, maxIndex, "test");
697 expectError(GL_INVALID_VALUE);
698 m_log << TestLog::EndSection;
700 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if name starts with the reserved prefix \"gl_\".");
701 glBindAttribLocation(program, maxIndex-1, "gl_test");
702 expectError(GL_INVALID_OPERATION);
703 m_log << TestLog::EndSection;
705 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
706 glBindAttribLocation(-1, maxIndex-1, "test");
707 expectError(GL_INVALID_VALUE);
708 m_log << TestLog::EndSection;
710 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if program is not a program object.");
711 glBindAttribLocation(shader, maxIndex-1, "test");
712 expectError(GL_INVALID_OPERATION);
713 m_log << TestLog::EndSection;
715 glDeleteProgram(program);
716 glDeleteShader(shader);
718 ES3F_ADD_API_CASE(uniform_block_binding, "Invalid glUniformBlockBinding() usage",
720 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(uniformBlockVertSource, uniformTestFragSource));
722 glUseProgram (program.getProgram());
724 GLint maxUniformBufferBindings;
725 GLint numActiveUniforms = -1;
726 GLint numActiveBlocks = -1;
727 glGetIntegerv (GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUniformBufferBindings);
728 glGetProgramiv (program.getProgram(), GL_ACTIVE_UNIFORMS, &numActiveUniforms);
729 glGetProgramiv (program.getProgram(), GL_ACTIVE_UNIFORM_BLOCKS, &numActiveBlocks);
730 m_log << TestLog::Message << "// GL_MAX_UNIFORM_BUFFER_BINDINGS = " << maxUniformBufferBindings << TestLog::EndMessage;
731 m_log << TestLog::Message << "// GL_ACTIVE_UNIFORMS = " << numActiveUniforms << TestLog::EndMessage;
732 m_log << TestLog::Message << "// GL_ACTIVE_UNIFORM_BLOCKS = " << numActiveBlocks << TestLog::EndMessage;
733 expectError (GL_NO_ERROR);
735 m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if uniformBlockIndex is not an active uniform block index of program.");
736 glUniformBlockBinding(program.getProgram(), -1, 0);
737 expectError(GL_INVALID_VALUE);
738 glUniformBlockBinding(program.getProgram(), 5, 0);
739 expectError(GL_INVALID_VALUE);
740 m_log << tcu::TestLog::EndSection;
742 m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if uniformBlockBinding is greater than or equal to the value of GL_MAX_UNIFORM_BUFFER_BINDINGS.");
743 glUniformBlockBinding(program.getProgram(), maxUniformBufferBindings, 0);
744 expectError(GL_INVALID_VALUE);
745 m_log << tcu::TestLog::EndSection;
747 m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if program is not the name of a program object generated by the GL.");
748 glUniformBlockBinding(-1, 0, 0);
749 expectError(GL_INVALID_VALUE);
750 m_log << tcu::TestLog::EndSection;
755 ES3F_ADD_API_CASE(uniformf_invalid_program, "Invalid glUniform{1234}f() usage",
757 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if there is no current program object.");
759 glUniform1f(-1, 0.0f);
760 expectError(GL_INVALID_OPERATION);
761 glUniform2f(-1, 0.0f, 0.0f);
762 expectError(GL_INVALID_OPERATION);
763 glUniform3f(-1, 0.0f, 0.0f, 0.0f);
764 expectError(GL_INVALID_OPERATION);
765 glUniform4f(-1, 0.0f, 0.0f, 0.0f, 0.0f);
766 expectError(GL_INVALID_OPERATION);
767 m_log << tcu::TestLog::EndSection;
769 ES3F_ADD_API_CASE(uniformf_incompatible_type, "Invalid glUniform{1234}f() usage",
771 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
773 glUseProgram(program.getProgram());
774 GLint vec4_v = glGetUniformLocation(program.getProgram(), "vec4_v"); // vec4
775 GLint ivec4_f = glGetUniformLocation(program.getProgram(), "ivec4_f"); // ivec4
776 GLint uvec4_f = glGetUniformLocation(program.getProgram(), "uvec4_f"); // uvec4
777 GLint sampler_f = glGetUniformLocation(program.getProgram(), "sampler_f"); // sampler2D
778 expectError(GL_NO_ERROR);
780 if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
782 m_log << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
783 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Failed to retrieve uniform location");
786 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the glUniform command.");
787 glUseProgram(program.getProgram());
788 glUniform1f(vec4_v, 0.0f);
789 expectError(GL_INVALID_OPERATION);
790 glUniform2f(vec4_v, 0.0f, 0.0f);
791 expectError(GL_INVALID_OPERATION);
792 glUniform3f(vec4_v, 0.0f, 0.0f, 0.0f);
793 expectError(GL_INVALID_OPERATION);
794 glUniform4f(vec4_v, 0.0f, 0.0f, 0.0f, 0.0f);
795 expectError(GL_NO_ERROR);
796 m_log << tcu::TestLog::EndSection;
798 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if glUniform{1234}f is used to load a uniform variable of type int, ivec2, ivec3, ivec4, unsigned int, uvec2, uvec3, uvec4.");
799 glUseProgram(program.getProgram());
800 glUniform4f(ivec4_f, 0.0f, 0.0f, 0.0f, 0.0f);
801 expectError(GL_INVALID_OPERATION);
802 glUniform4f(uvec4_f, 0.0f, 0.0f, 0.0f, 0.0f);
803 expectError(GL_INVALID_OPERATION);
804 m_log << tcu::TestLog::EndSection;
806 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than glUniform1i and glUniform1iv.");
807 glUseProgram(program.getProgram());
808 glUniform1f(sampler_f, 0.0f);
809 expectError(GL_INVALID_OPERATION);
810 m_log << tcu::TestLog::EndSection;
814 ES3F_ADD_API_CASE(uniformf_invalid_location, "Invalid glUniform{1234}f() usage",
816 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
818 glUseProgram(program.getProgram());
819 expectError(GL_NO_ERROR);
821 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
822 glUseProgram(program.getProgram());
823 glUniform1f(-2, 0.0f);
824 expectError(GL_INVALID_OPERATION);
825 glUniform2f(-2, 0.0f, 0.0f);
826 expectError(GL_INVALID_OPERATION);
827 glUniform3f(-2, 0.0f, 0.0f, 0.0f);
828 expectError(GL_INVALID_OPERATION);
829 glUniform4f(-2, 0.0f, 0.0f, 0.0f, 0.0f);
830 expectError(GL_INVALID_OPERATION);
832 glUseProgram(program.getProgram());
833 glUniform1f(-1, 0.0f);
834 expectError(GL_NO_ERROR);
835 glUniform2f(-1, 0.0f, 0.0f);
836 expectError(GL_NO_ERROR);
837 glUniform3f(-1, 0.0f, 0.0f, 0.0f);
838 expectError(GL_NO_ERROR);
839 glUniform4f(-1, 0.0f, 0.0f, 0.0f, 0.0f);
840 expectError(GL_NO_ERROR);
841 m_log << tcu::TestLog::EndSection;
848 ES3F_ADD_API_CASE(uniformfv_invalid_program, "Invalid glUniform{1234}fv() usage",
850 std::vector<GLfloat> data(4);
852 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if there is no current program object.");
854 glUniform1fv(-1, 1, &data[0]);
855 expectError(GL_INVALID_OPERATION);
856 glUniform2fv(-1, 1, &data[0]);
857 expectError(GL_INVALID_OPERATION);
858 glUniform3fv(-1, 1, &data[0]);
859 expectError(GL_INVALID_OPERATION);
860 glUniform4fv(-1, 1, &data[0]);
861 expectError(GL_INVALID_OPERATION);
862 m_log << tcu::TestLog::EndSection;
864 ES3F_ADD_API_CASE(uniformfv_incompatible_type, "Invalid glUniform{1234}fv() usage",
866 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
868 glUseProgram(program.getProgram());
869 GLint vec4_v = glGetUniformLocation(program.getProgram(), "vec4_v"); // vec4
870 GLint ivec4_f = glGetUniformLocation(program.getProgram(), "ivec4_f"); // ivec4
871 GLint uvec4_f = glGetUniformLocation(program.getProgram(), "uvec4_f"); // uvec4
872 GLint sampler_f = glGetUniformLocation(program.getProgram(), "sampler_f"); // sampler2D
873 expectError(GL_NO_ERROR);
875 if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
877 m_log << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
878 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Failed to retrieve uniform location");
881 std::vector<GLfloat> data(4);
883 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the glUniform command.");
884 glUseProgram(program.getProgram());
885 glUniform1fv(vec4_v, 1, &data[0]);
886 expectError(GL_INVALID_OPERATION);
887 glUniform2fv(vec4_v, 1, &data[0]);
888 expectError(GL_INVALID_OPERATION);
889 glUniform3fv(vec4_v, 1, &data[0]);
890 expectError(GL_INVALID_OPERATION);
891 glUniform4fv(vec4_v, 1, &data[0]);
892 expectError(GL_NO_ERROR);
893 m_log << tcu::TestLog::EndSection;
895 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if glUniform{1234}fv is used to load a uniform variable of type int, ivec2, ivec3, ivec4, unsigned int, uvec2, uvec3, uvec4.");
896 glUseProgram(program.getProgram());
897 glUniform4fv(ivec4_f, 1, &data[0]);
898 expectError(GL_INVALID_OPERATION);
899 glUniform4fv(uvec4_f, 1, &data[0]);
900 expectError(GL_INVALID_OPERATION);
901 m_log << tcu::TestLog::EndSection;
903 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than glUniform1i and glUniform1iv.");
904 glUseProgram(program.getProgram());
905 glUniform1fv(sampler_f, 1, &data[0]);
906 expectError(GL_INVALID_OPERATION);
907 m_log << tcu::TestLog::EndSection;
911 ES3F_ADD_API_CASE(uniformfv_invalid_location, "Invalid glUniform{1234}fv() usage",
913 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
915 glUseProgram(program.getProgram());
916 expectError(GL_NO_ERROR);
918 std::vector<GLfloat> data(4);
920 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
921 glUseProgram(program.getProgram());
922 glUniform1fv(-2, 1, &data[0]);
923 expectError(GL_INVALID_OPERATION);
924 glUniform2fv(-2, 1, &data[0]);
925 expectError(GL_INVALID_OPERATION);
926 glUniform3fv(-2, 1, &data[0]);
927 expectError(GL_INVALID_OPERATION);
928 glUniform4fv(-2, 1, &data[0]);
929 expectError(GL_INVALID_OPERATION);
931 glUseProgram(program.getProgram());
932 glUniform1fv(-1, 1, &data[0]);
933 expectError(GL_NO_ERROR);
934 glUniform2fv(-1, 1, &data[0]);
935 expectError(GL_NO_ERROR);
936 glUniform3fv(-1, 1, &data[0]);
937 expectError(GL_NO_ERROR);
938 glUniform4fv(-1, 1, &data[0]);
939 expectError(GL_NO_ERROR);
940 m_log << tcu::TestLog::EndSection;
944 ES3F_ADD_API_CASE(uniformfv_invalid_count, "Invalid glUniform{1234}fv() usage",
946 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
948 glUseProgram (program.getProgram());
949 GLint vec4_v = glGetUniformLocation(program.getProgram(), "vec4_v"); // vec4
950 expectError(GL_NO_ERROR);
954 m_log << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
955 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Failed to retrieve uniform location");
958 std::vector<GLfloat> data(8);
960 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if count is greater than 1 and the indicated uniform variable is not an array variable.");
961 glUseProgram(program.getProgram());
962 glUniform1fv(vec4_v, 2, &data[0]);
963 expectError(GL_INVALID_OPERATION);
964 glUniform2fv(vec4_v, 2, &data[0]);
965 expectError(GL_INVALID_OPERATION);
966 glUniform3fv(vec4_v, 2, &data[0]);
967 expectError(GL_INVALID_OPERATION);
968 glUniform4fv(vec4_v, 2, &data[0]);
969 expectError(GL_INVALID_OPERATION);
970 m_log << tcu::TestLog::EndSection;
977 ES3F_ADD_API_CASE(uniformi_invalid_program, "Invalid glUniform{1234}i() usage",
979 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if there is no current program object.");
982 expectError(GL_INVALID_OPERATION);
983 glUniform2i(-1, 0, 0);
984 expectError(GL_INVALID_OPERATION);
985 glUniform3i(-1, 0, 0, 0);
986 expectError(GL_INVALID_OPERATION);
987 glUniform4i(-1, 0, 0, 0, 0);
988 expectError(GL_INVALID_OPERATION);
989 m_log << tcu::TestLog::EndSection;
991 ES3F_ADD_API_CASE(uniformi_incompatible_type, "Invalid glUniform{1234}i() usage",
993 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
995 glUseProgram(program.getProgram());
996 GLint vec4_v = glGetUniformLocation(program.getProgram(), "vec4_v"); // vec4
997 GLint ivec4_f = glGetUniformLocation(program.getProgram(), "ivec4_f"); // ivec4
998 GLint uvec4_f = glGetUniformLocation(program.getProgram(), "uvec4_f"); // uvec4
999 GLint sampler_f = glGetUniformLocation(program.getProgram(), "sampler_f"); // sampler2D
1000 expectError(GL_NO_ERROR);
1002 if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1004 m_log << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1005 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Failed to retrieve uniform location");
1008 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the glUniform command.");
1009 glUseProgram(program.getProgram());
1010 glUniform1i(ivec4_f, 0);
1011 expectError(GL_INVALID_OPERATION);
1012 glUniform2i(ivec4_f, 0, 0);
1013 expectError(GL_INVALID_OPERATION);
1014 glUniform3i(ivec4_f, 0, 0, 0);
1015 expectError(GL_INVALID_OPERATION);
1016 glUniform4i(ivec4_f, 0, 0, 0, 0);
1017 expectError(GL_NO_ERROR);
1018 m_log << tcu::TestLog::EndSection;
1020 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if glUniform{1234}i is used to load a uniform variable of type unsigned int, uvec2, uvec3, uvec4, or an array of these.");
1021 glUseProgram(program.getProgram());
1022 glUniform1i(uvec4_f, 0);
1023 expectError(GL_INVALID_OPERATION);
1024 glUniform2i(uvec4_f, 0, 0);
1025 expectError(GL_INVALID_OPERATION);
1026 glUniform3i(uvec4_f, 0, 0, 0);
1027 expectError(GL_INVALID_OPERATION);
1028 glUniform4i(uvec4_f, 0, 0, 0, 0);
1029 expectError(GL_INVALID_OPERATION);
1030 m_log << tcu::TestLog::EndSection;
1032 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if glUniform{1234}i is used to load a uniform variable of type float, vec2, vec3, or vec4.");
1033 glUseProgram(program.getProgram());
1034 glUniform1i(vec4_v, 0);
1035 expectError(GL_INVALID_OPERATION);
1036 glUniform2i(vec4_v, 0, 0);
1037 expectError(GL_INVALID_OPERATION);
1038 glUniform3i(vec4_v, 0, 0, 0);
1039 expectError(GL_INVALID_OPERATION);
1040 glUniform4i(vec4_v, 0, 0, 0, 0);
1041 expectError(GL_INVALID_OPERATION);
1042 m_log << tcu::TestLog::EndSection;
1046 ES3F_ADD_API_CASE(uniformi_invalid_location, "Invalid glUniform{1234}i() usage",
1048 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1050 glUseProgram(program.getProgram());
1051 expectError(GL_NO_ERROR);
1053 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
1054 glUseProgram(program.getProgram());
1056 expectError(GL_INVALID_OPERATION);
1057 glUniform2i(-2, 0, 0);
1058 expectError(GL_INVALID_OPERATION);
1059 glUniform3i(-2, 0, 0, 0);
1060 expectError(GL_INVALID_OPERATION);
1061 glUniform4i(-2, 0, 0, 0, 0);
1062 expectError(GL_INVALID_OPERATION);
1064 glUseProgram(program.getProgram());
1066 expectError(GL_NO_ERROR);
1067 glUniform2i(-1, 0, 0);
1068 expectError(GL_NO_ERROR);
1069 glUniform3i(-1, 0, 0, 0);
1070 expectError(GL_NO_ERROR);
1071 glUniform4i(-1, 0, 0, 0, 0);
1072 expectError(GL_NO_ERROR);
1073 m_log << tcu::TestLog::EndSection;
1080 ES3F_ADD_API_CASE(uniformiv_invalid_program, "Invalid glUniform{1234}iv() usage",
1082 std::vector<GLint> data(4);
1084 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if there is no current program object.");
1086 glUniform1iv(-1, 1, &data[0]);
1087 expectError(GL_INVALID_OPERATION);
1088 glUniform2iv(-1, 1, &data[0]);
1089 expectError(GL_INVALID_OPERATION);
1090 glUniform3iv(-1, 1, &data[0]);
1091 expectError(GL_INVALID_OPERATION);
1092 glUniform4iv(-1, 1, &data[0]);
1093 expectError(GL_INVALID_OPERATION);
1094 m_log << tcu::TestLog::EndSection;
1096 ES3F_ADD_API_CASE(uniformiv_incompatible_type, "Invalid glUniform{1234}iv() usage",
1098 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1100 glUseProgram(program.getProgram());
1101 GLint vec4_v = glGetUniformLocation(program.getProgram(), "vec4_v"); // vec4
1102 GLint ivec4_f = glGetUniformLocation(program.getProgram(), "ivec4_f"); // ivec4
1103 GLint uvec4_f = glGetUniformLocation(program.getProgram(), "uvec4_f"); // uvec4
1104 GLint sampler_f = glGetUniformLocation(program.getProgram(), "sampler_f"); // sampler2D
1105 expectError(GL_NO_ERROR);
1107 if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1109 m_log << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1110 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Failed to retrieve uniform location");
1113 std::vector<GLint> data(4);
1115 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the glUniform command.");
1116 glUseProgram(program.getProgram());
1117 glUniform1iv(ivec4_f, 1, &data[0]);
1118 expectError(GL_INVALID_OPERATION);
1119 glUniform2iv(ivec4_f, 1, &data[0]);
1120 expectError(GL_INVALID_OPERATION);
1121 glUniform3iv(ivec4_f, 1, &data[0]);
1122 expectError(GL_INVALID_OPERATION);
1123 glUniform4iv(ivec4_f, 1, &data[0]);
1124 expectError(GL_NO_ERROR);
1125 m_log << tcu::TestLog::EndSection;
1127 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if glUniform{1234}iv is used to load a uniform variable of type float, vec2, vec3, or vec4.");
1128 glUseProgram(program.getProgram());
1129 glUniform1iv(vec4_v, 1, &data[0]);
1130 expectError(GL_INVALID_OPERATION);
1131 glUniform2iv(vec4_v, 1, &data[0]);
1132 expectError(GL_INVALID_OPERATION);
1133 glUniform3iv(vec4_v, 1, &data[0]);
1134 expectError(GL_INVALID_OPERATION);
1135 glUniform4iv(vec4_v, 1, &data[0]);
1136 expectError(GL_INVALID_OPERATION);
1137 m_log << tcu::TestLog::EndSection;
1139 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if glUniform{1234}iv is used to load a uniform variable of type unsigned int, uvec2, uvec3 or uvec4.");
1140 glUseProgram(program.getProgram());
1141 glUniform1iv(uvec4_f, 1, &data[0]);
1142 expectError(GL_INVALID_OPERATION);
1143 glUniform2iv(uvec4_f, 1, &data[0]);
1144 expectError(GL_INVALID_OPERATION);
1145 glUniform3iv(uvec4_f, 1, &data[0]);
1146 expectError(GL_INVALID_OPERATION);
1147 glUniform4iv(uvec4_f, 1, &data[0]);
1148 expectError(GL_INVALID_OPERATION);
1149 m_log << tcu::TestLog::EndSection;
1153 ES3F_ADD_API_CASE(uniformiv_invalid_location, "Invalid glUniform{1234}iv() usage",
1155 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1157 glUseProgram(program.getProgram());
1158 expectError(GL_NO_ERROR);
1160 std::vector<GLint> data(4);
1162 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
1163 glUseProgram(program.getProgram());
1164 glUniform1iv(-2, 1, &data[0]);
1165 expectError(GL_INVALID_OPERATION);
1166 glUniform2iv(-2, 1, &data[0]);
1167 expectError(GL_INVALID_OPERATION);
1168 glUniform3iv(-2, 1, &data[0]);
1169 expectError(GL_INVALID_OPERATION);
1170 glUniform4iv(-2, 1, &data[0]);
1171 expectError(GL_INVALID_OPERATION);
1173 glUseProgram(program.getProgram());
1174 glUniform1iv(-1, 1, &data[0]);
1175 expectError(GL_NO_ERROR);
1176 glUniform2iv(-1, 1, &data[0]);
1177 expectError(GL_NO_ERROR);
1178 glUniform3iv(-1, 1, &data[0]);
1179 expectError(GL_NO_ERROR);
1180 glUniform4iv(-1, 1, &data[0]);
1181 expectError(GL_NO_ERROR);
1182 m_log << tcu::TestLog::EndSection;
1186 ES3F_ADD_API_CASE(uniformiv_invalid_count, "Invalid glUniform{1234}iv() usage",
1188 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1190 glUseProgram (program.getProgram());
1191 GLint ivec4_f = glGetUniformLocation(program.getProgram(), "ivec4_f"); // ivec4
1192 expectError(GL_NO_ERROR);
1196 m_log << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1197 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Failed to retrieve uniform location");
1200 std::vector<GLint> data(8);
1202 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if count is greater than 1 and the indicated uniform variable is not an array variable.");
1203 glUseProgram(program.getProgram());
1204 glUniform1iv(ivec4_f, 2, &data[0]);
1205 expectError(GL_INVALID_OPERATION);
1206 glUniform2iv(ivec4_f, 2, &data[0]);
1207 expectError(GL_INVALID_OPERATION);
1208 glUniform3iv(ivec4_f, 2, &data[0]);
1209 expectError(GL_INVALID_OPERATION);
1210 glUniform4iv(ivec4_f, 2, &data[0]);
1211 expectError(GL_INVALID_OPERATION);
1212 m_log << tcu::TestLog::EndSection;
1217 // glUniform{1234}ui
1219 ES3F_ADD_API_CASE(uniformui_invalid_program, "Invalid glUniform{234}ui() usage",
1221 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if there is no current program object.");
1223 glUniform1ui(-1, 0);
1224 expectError(GL_INVALID_OPERATION);
1225 glUniform2ui(-1, 0, 0);
1226 expectError(GL_INVALID_OPERATION);
1227 glUniform3ui(-1, 0, 0, 0);
1228 expectError(GL_INVALID_OPERATION);
1229 glUniform4ui(-1, 0, 0, 0, 0);
1230 expectError(GL_INVALID_OPERATION);
1231 m_log << tcu::TestLog::EndSection;
1233 ES3F_ADD_API_CASE(uniformui_incompatible_type, "Invalid glUniform{1234}ui() usage",
1235 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1237 glUseProgram(program.getProgram());
1238 GLint vec4_v = glGetUniformLocation(program.getProgram(), "vec4_v"); // vec4
1239 GLint ivec4_f = glGetUniformLocation(program.getProgram(), "ivec4_f"); // ivec4
1240 GLint uvec4_f = glGetUniformLocation(program.getProgram(), "uvec4_f"); // uvec4
1241 GLint sampler_f = glGetUniformLocation(program.getProgram(), "sampler_f"); // sampler2D
1242 expectError(GL_NO_ERROR);
1244 if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1246 m_log << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1247 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Failed to retrieve uniform location");
1250 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the glUniform command.");
1251 glUseProgram(program.getProgram());
1252 glUniform1ui(uvec4_f, 0);
1253 expectError(GL_INVALID_OPERATION);
1254 glUniform2ui(uvec4_f, 0, 0);
1255 expectError(GL_INVALID_OPERATION);
1256 glUniform3ui(uvec4_f, 0, 0, 0);
1257 expectError(GL_INVALID_OPERATION);
1258 glUniform4ui(uvec4_f, 0, 0, 0, 0);
1259 expectError(GL_NO_ERROR);
1260 m_log << tcu::TestLog::EndSection;
1262 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if glUniform{1234}i is used to load a uniform variable of type int, ivec2, ivec3, ivec4, or an array of these.");
1263 glUseProgram(program.getProgram());
1264 glUniform1ui(ivec4_f, 0);
1265 expectError(GL_INVALID_OPERATION);
1266 glUniform2ui(ivec4_f, 0, 0);
1267 expectError(GL_INVALID_OPERATION);
1268 glUniform3ui(ivec4_f, 0, 0, 0);
1269 expectError(GL_INVALID_OPERATION);
1270 glUniform4ui(ivec4_f, 0, 0, 0, 0);
1271 expectError(GL_INVALID_OPERATION);
1272 m_log << tcu::TestLog::EndSection;
1274 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if glUniform{1234}i is used to load a uniform variable of type float, vec2, vec3, or vec4.");
1275 glUseProgram(program.getProgram());
1276 glUniform1ui(vec4_v, 0);
1277 expectError(GL_INVALID_OPERATION);
1278 glUniform2ui(vec4_v, 0, 0);
1279 expectError(GL_INVALID_OPERATION);
1280 glUniform3ui(vec4_v, 0, 0, 0);
1281 expectError(GL_INVALID_OPERATION);
1282 glUniform4ui(vec4_v, 0, 0, 0, 0);
1283 expectError(GL_INVALID_OPERATION);
1284 m_log << tcu::TestLog::EndSection;
1286 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than glUniform1i and glUniform1iv.");
1287 glUseProgram(program.getProgram());
1288 glUniform1ui(sampler_f, 0);
1289 expectError(GL_INVALID_OPERATION);
1290 m_log << tcu::TestLog::EndSection;
1294 ES3F_ADD_API_CASE(uniformui_invalid_location, "Invalid glUniform{1234}ui() usage",
1296 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1298 glUseProgram(program.getProgram());
1299 expectError(GL_NO_ERROR);
1301 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
1302 glUseProgram(program.getProgram());
1304 expectError(GL_INVALID_OPERATION);
1305 glUniform2i(-2, 0, 0);
1306 expectError(GL_INVALID_OPERATION);
1307 glUniform3i(-2, 0, 0, 0);
1308 expectError(GL_INVALID_OPERATION);
1309 glUniform4i(-2, 0, 0, 0, 0);
1310 expectError(GL_INVALID_OPERATION);
1312 glUseProgram(program.getProgram());
1314 expectError(GL_NO_ERROR);
1315 glUniform2i(-1, 0, 0);
1316 expectError(GL_NO_ERROR);
1317 glUniform3i(-1, 0, 0, 0);
1318 expectError(GL_NO_ERROR);
1319 glUniform4i(-1, 0, 0, 0, 0);
1320 expectError(GL_NO_ERROR);
1321 m_log << tcu::TestLog::EndSection;
1326 // glUniform{1234}uiv
1328 ES3F_ADD_API_CASE(uniformuiv_invalid_program, "Invalid glUniform{234}uiv() usage",
1330 std::vector<GLuint> data(4);
1332 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if there is no current program object.");
1334 glUniform1uiv(-1, 1, &data[0]);
1335 expectError(GL_INVALID_OPERATION);
1336 glUniform2uiv(-1, 1, &data[0]);
1337 expectError(GL_INVALID_OPERATION);
1338 glUniform3uiv(-1, 1, &data[0]);
1339 expectError(GL_INVALID_OPERATION);
1340 glUniform4uiv(-1, 1, &data[0]);
1341 expectError(GL_INVALID_OPERATION);
1342 m_log << tcu::TestLog::EndSection;
1344 ES3F_ADD_API_CASE(uniformuiv_incompatible_type, "Invalid glUniform{1234}uiv() usage",
1346 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1348 glUseProgram(program.getProgram());
1349 GLint vec4_v = glGetUniformLocation(program.getProgram(), "vec4_v"); // vec4
1350 GLint ivec4_f = glGetUniformLocation(program.getProgram(), "ivec4_f"); // ivec4
1351 GLint uvec4_f = glGetUniformLocation(program.getProgram(), "uvec4_f"); // uvec4
1352 GLint sampler_f = glGetUniformLocation(program.getProgram(), "sampler_f"); // sampler2D
1353 expectError(GL_NO_ERROR);
1355 if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1357 m_log << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1358 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Failed to retrieve uniform location");
1361 std::vector<GLuint> data(4);
1363 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the glUniform command.");
1364 glUseProgram(program.getProgram());
1365 glUniform1uiv(uvec4_f, 1, &data[0]);
1366 expectError(GL_INVALID_OPERATION);
1367 glUniform2uiv(uvec4_f, 1, &data[0]);
1368 expectError(GL_INVALID_OPERATION);
1369 glUniform3uiv(uvec4_f, 1, &data[0]);
1370 expectError(GL_INVALID_OPERATION);
1371 glUniform4uiv(uvec4_f, 1, &data[0]);
1372 expectError(GL_NO_ERROR);
1373 m_log << tcu::TestLog::EndSection;
1375 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if glUniform{1234}uiv is used to load a uniform variable of type float, vec2, vec3, or vec4.");
1376 glUseProgram(program.getProgram());
1377 glUniform1uiv(vec4_v, 1, &data[0]);
1378 expectError(GL_INVALID_OPERATION);
1379 glUniform2uiv(vec4_v, 1, &data[0]);
1380 expectError(GL_INVALID_OPERATION);
1381 glUniform3uiv(vec4_v, 1, &data[0]);
1382 expectError(GL_INVALID_OPERATION);
1383 glUniform4uiv(vec4_v, 1, &data[0]);
1384 expectError(GL_INVALID_OPERATION);
1385 m_log << tcu::TestLog::EndSection;
1387 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if glUniform{1234}uiv is used to load a uniform variable of type int, ivec2, ivec3 or ivec4.");
1388 glUseProgram(program.getProgram());
1389 glUniform1uiv(ivec4_f, 1, &data[0]);
1390 expectError(GL_INVALID_OPERATION);
1391 glUniform2uiv(ivec4_f, 1, &data[0]);
1392 expectError(GL_INVALID_OPERATION);
1393 glUniform3uiv(ivec4_f, 1, &data[0]);
1394 expectError(GL_INVALID_OPERATION);
1395 glUniform4uiv(ivec4_f, 1, &data[0]);
1396 expectError(GL_INVALID_OPERATION);
1397 m_log << tcu::TestLog::EndSection;
1399 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than glUniform1i and glUniform1iv.");
1400 glUseProgram(program.getProgram());
1401 glUniform1uiv(sampler_f, 1, &data[0]);
1402 expectError(GL_INVALID_OPERATION);
1403 m_log << tcu::TestLog::EndSection;
1407 ES3F_ADD_API_CASE(uniformuiv_invalid_location, "Invalid glUniform{1234}uiv() usage",
1409 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1411 glUseProgram(program.getProgram());
1412 expectError(GL_NO_ERROR);
1414 std::vector<GLuint> data(4);
1416 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
1417 glUseProgram(program.getProgram());
1418 glUniform1uiv(-2, 1, &data[0]);
1419 expectError(GL_INVALID_OPERATION);
1420 glUniform2uiv(-2, 1, &data[0]);
1421 expectError(GL_INVALID_OPERATION);
1422 glUniform3uiv(-2, 1, &data[0]);
1423 expectError(GL_INVALID_OPERATION);
1424 glUniform4uiv(-2, 1, &data[0]);
1425 expectError(GL_INVALID_OPERATION);
1427 glUseProgram(program.getProgram());
1428 glUniform1uiv(-1, 1, &data[0]);
1429 expectError(GL_NO_ERROR);
1430 glUniform2uiv(-1, 1, &data[0]);
1431 expectError(GL_NO_ERROR);
1432 glUniform3uiv(-1, 1, &data[0]);
1433 expectError(GL_NO_ERROR);
1434 glUniform4uiv(-1, 1, &data[0]);
1435 expectError(GL_NO_ERROR);
1436 m_log << tcu::TestLog::EndSection;
1440 ES3F_ADD_API_CASE(uniformuiv_invalid_count, "Invalid glUniform{1234}uiv() usage",
1442 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1444 glUseProgram (program.getProgram());
1445 int uvec4_f = glGetUniformLocation(program.getProgram(), "uvec4_f"); // uvec4
1446 expectError(GL_NO_ERROR);
1450 m_log << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1451 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Failed to retrieve uniform location");
1454 std::vector<GLuint> data(8);
1456 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if count is greater than 1 and the indicated uniform variable is not an array variable.");
1457 glUseProgram(program.getProgram());
1458 glUniform1uiv(uvec4_f, 2, &data[0]);
1459 expectError(GL_INVALID_OPERATION);
1460 glUniform2uiv(uvec4_f, 2, &data[0]);
1461 expectError(GL_INVALID_OPERATION);
1462 glUniform3uiv(uvec4_f, 2, &data[0]);
1463 expectError(GL_INVALID_OPERATION);
1464 glUniform4uiv(uvec4_f, 2, &data[0]);
1465 expectError(GL_INVALID_OPERATION);
1466 m_log << tcu::TestLog::EndSection;
1472 // glUniformMatrix*fv
1474 ES3F_ADD_API_CASE(uniform_matrixfv_invalid_program, "Invalid glUniformMatrix{234}fv() usage",
1476 std::vector<GLfloat> data(16);
1478 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if there is no current program object.");
1480 glUniformMatrix2fv(-1, 1, GL_FALSE, &data[0]);
1481 expectError(GL_INVALID_OPERATION);
1482 glUniformMatrix3fv(-1, 1, GL_FALSE, &data[0]);
1483 expectError(GL_INVALID_OPERATION);
1484 glUniformMatrix4fv(-1, 1, GL_FALSE, &data[0]);
1485 expectError(GL_INVALID_OPERATION);
1487 glUniformMatrix2x3fv(-1, 1, GL_FALSE, &data[0]);
1488 expectError(GL_INVALID_OPERATION);
1489 glUniformMatrix3x2fv(-1, 1, GL_FALSE, &data[0]);
1490 expectError(GL_INVALID_OPERATION);
1491 glUniformMatrix2x4fv(-1, 1, GL_FALSE, &data[0]);
1492 expectError(GL_INVALID_OPERATION);
1493 glUniformMatrix4x2fv(-1, 1, GL_FALSE, &data[0]);
1494 expectError(GL_INVALID_OPERATION);
1495 glUniformMatrix3x4fv(-1, 1, GL_FALSE, &data[0]);
1496 expectError(GL_INVALID_OPERATION);
1497 glUniformMatrix4x3fv(-1, 1, GL_FALSE, &data[0]);
1498 expectError(GL_INVALID_OPERATION);
1499 m_log << tcu::TestLog::EndSection;
1501 ES3F_ADD_API_CASE(uniform_matrixfv_incompatible_type, "Invalid glUniformMatrix{234}fv() usage",
1503 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1505 glUseProgram (program.getProgram());
1506 GLint mat4_v = glGetUniformLocation(program.getProgram(), "mat4_v"); // mat4
1507 GLint sampler_f = glGetUniformLocation(program.getProgram(), "sampler_f"); // sampler2D
1508 expectError(GL_NO_ERROR);
1510 if (mat4_v == -1 || sampler_f == -1)
1512 m_log << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1513 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Failed to retrieve uniform location");
1516 std::vector<GLfloat> data(16);
1518 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the glUniform command.");
1519 glUseProgram(program.getProgram());
1520 glUniformMatrix2fv(mat4_v, 1, GL_FALSE, &data[0]);
1521 expectError(GL_INVALID_OPERATION);
1522 glUniformMatrix3fv(mat4_v, 1, GL_FALSE, &data[0]);
1523 expectError(GL_INVALID_OPERATION);
1524 glUniformMatrix4fv(mat4_v, 1, GL_FALSE, &data[0]);
1525 expectError(GL_NO_ERROR);
1527 glUniformMatrix2x3fv(mat4_v, 1, GL_FALSE, &data[0]);
1528 expectError(GL_INVALID_OPERATION);
1529 glUniformMatrix3x2fv(mat4_v, 1, GL_FALSE, &data[0]);
1530 expectError(GL_INVALID_OPERATION);
1531 glUniformMatrix2x4fv(mat4_v, 1, GL_FALSE, &data[0]);
1532 expectError(GL_INVALID_OPERATION);
1533 glUniformMatrix4x2fv(mat4_v, 1, GL_FALSE, &data[0]);
1534 expectError(GL_INVALID_OPERATION);
1535 glUniformMatrix3x4fv(mat4_v, 1, GL_FALSE, &data[0]);
1536 expectError(GL_INVALID_OPERATION);
1537 glUniformMatrix4x3fv(mat4_v, 1, GL_FALSE, &data[0]);
1538 expectError(GL_INVALID_OPERATION);
1539 m_log << tcu::TestLog::EndSection;
1541 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than glUniform1i and glUniform1iv.");
1542 glUseProgram(program.getProgram());
1543 glUniformMatrix2fv(sampler_f, 1, GL_FALSE, &data[0]);
1544 expectError(GL_INVALID_OPERATION);
1545 glUniformMatrix3fv(sampler_f, 1, GL_FALSE, &data[0]);
1546 expectError(GL_INVALID_OPERATION);
1547 glUniformMatrix4fv(sampler_f, 1, GL_FALSE, &data[0]);
1548 expectError(GL_INVALID_OPERATION);
1550 glUniformMatrix2x3fv(sampler_f, 1, GL_FALSE, &data[0]);
1551 expectError(GL_INVALID_OPERATION);
1552 glUniformMatrix3x2fv(sampler_f, 1, GL_FALSE, &data[0]);
1553 expectError(GL_INVALID_OPERATION);
1554 glUniformMatrix2x4fv(sampler_f, 1, GL_FALSE, &data[0]);
1555 expectError(GL_INVALID_OPERATION);
1556 glUniformMatrix4x2fv(sampler_f, 1, GL_FALSE, &data[0]);
1557 expectError(GL_INVALID_OPERATION);
1558 glUniformMatrix3x4fv(sampler_f, 1, GL_FALSE, &data[0]);
1559 expectError(GL_INVALID_OPERATION);
1560 glUniformMatrix4x3fv(sampler_f, 1, GL_FALSE, &data[0]);
1561 expectError(GL_INVALID_OPERATION);
1562 m_log << tcu::TestLog::EndSection;
1566 ES3F_ADD_API_CASE(uniform_matrixfv_invalid_location, "Invalid glUniformMatrix{234}fv() usage",
1568 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1570 glUseProgram(program.getProgram());
1571 expectError(GL_NO_ERROR);
1573 std::vector<GLfloat> data(16);
1575 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
1576 glUseProgram(program.getProgram());
1577 glUniformMatrix2fv(-2, 1, GL_FALSE, &data[0]);
1578 expectError(GL_INVALID_OPERATION);
1579 glUniformMatrix3fv(-2, 1, GL_FALSE, &data[0]);
1580 expectError(GL_INVALID_OPERATION);
1581 glUniformMatrix4fv(-2, 1, GL_FALSE, &data[0]);
1582 expectError(GL_INVALID_OPERATION);
1584 glUniformMatrix2x3fv(-2, 1, GL_FALSE, &data[0]);
1585 expectError(GL_INVALID_OPERATION);
1586 glUniformMatrix3x2fv(-2, 1, GL_FALSE, &data[0]);
1587 expectError(GL_INVALID_OPERATION);
1588 glUniformMatrix2x4fv(-2, 1, GL_FALSE, &data[0]);
1589 expectError(GL_INVALID_OPERATION);
1590 glUniformMatrix4x2fv(-2, 1, GL_FALSE, &data[0]);
1591 expectError(GL_INVALID_OPERATION);
1592 glUniformMatrix3x4fv(-2, 1, GL_FALSE, &data[0]);
1593 expectError(GL_INVALID_OPERATION);
1594 glUniformMatrix4x3fv(-2, 1, GL_FALSE, &data[0]);
1595 expectError(GL_INVALID_OPERATION);
1597 glUseProgram(program.getProgram());
1598 glUniformMatrix2fv(-1, 1, GL_FALSE, &data[0]);
1599 expectError(GL_NO_ERROR);
1600 glUniformMatrix3fv(-1, 1, GL_FALSE, &data[0]);
1601 expectError(GL_NO_ERROR);
1602 glUniformMatrix4fv(-1, 1, GL_FALSE, &data[0]);
1603 expectError(GL_NO_ERROR);
1605 glUniformMatrix2x3fv(-1, 1, GL_FALSE, &data[0]);
1606 expectError(GL_NO_ERROR);
1607 glUniformMatrix3x2fv(-1, 1, GL_FALSE, &data[0]);
1608 expectError(GL_NO_ERROR);
1609 glUniformMatrix2x4fv(-1, 1, GL_FALSE, &data[0]);
1610 expectError(GL_NO_ERROR);
1611 glUniformMatrix4x2fv(-1, 1, GL_FALSE, &data[0]);
1612 expectError(GL_NO_ERROR);
1613 glUniformMatrix3x4fv(-1, 1, GL_FALSE, &data[0]);
1614 expectError(GL_NO_ERROR);
1615 glUniformMatrix4x3fv(-1, 1, GL_FALSE, &data[0]);
1616 expectError(GL_NO_ERROR);
1617 m_log << tcu::TestLog::EndSection;
1621 ES3F_ADD_API_CASE(uniform_matrixfv_invalid_count, "Invalid glUniformMatrix{234}fv() usage",
1623 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1625 glUseProgram (program.getProgram());
1626 GLint mat4_v = glGetUniformLocation(program.getProgram(), "mat4_v"); // mat4
1627 expectError(GL_NO_ERROR);
1631 m_log << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1632 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Failed to retrieve uniform location");
1635 std::vector<GLfloat> data(32);
1637 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if count is greater than 1 and the indicated uniform variable is not an array variable.");
1638 glUseProgram(program.getProgram());
1639 glUniformMatrix2fv(mat4_v, 2, GL_FALSE, &data[0]);
1640 expectError(GL_INVALID_OPERATION);
1641 glUniformMatrix3fv(mat4_v, 2, GL_FALSE, &data[0]);
1642 expectError(GL_INVALID_OPERATION);
1643 glUniformMatrix4fv(mat4_v, 2, GL_FALSE, &data[0]);
1644 expectError(GL_INVALID_OPERATION);
1646 glUniformMatrix2x3fv(mat4_v, 1, GL_FALSE, &data[0]);
1647 expectError(GL_INVALID_OPERATION);
1648 glUniformMatrix3x2fv(mat4_v, 1, GL_FALSE, &data[0]);
1649 expectError(GL_INVALID_OPERATION);
1650 glUniformMatrix2x4fv(mat4_v, 1, GL_FALSE, &data[0]);
1651 expectError(GL_INVALID_OPERATION);
1652 glUniformMatrix4x2fv(mat4_v, 1, GL_FALSE, &data[0]);
1653 expectError(GL_INVALID_OPERATION);
1654 glUniformMatrix3x4fv(mat4_v, 1, GL_FALSE, &data[0]);
1655 expectError(GL_INVALID_OPERATION);
1656 glUniformMatrix4x3fv(mat4_v, 1, GL_FALSE, &data[0]);
1657 expectError(GL_INVALID_OPERATION);
1658 m_log << tcu::TestLog::EndSection;
1663 // Transform feedback
1665 ES3F_ADD_API_CASE(gen_transform_feedbacks, "Invalid glGenTransformFeedbacks() usage",
1667 m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if n is negative.");
1669 glGenTransformFeedbacks(-1, &id);
1670 expectError(GL_INVALID_VALUE);
1671 m_log << tcu::TestLog::EndSection;
1673 ES3F_ADD_API_CASE(bind_transform_feedback, "Invalid glBindTransformFeedback() usage",
1676 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
1678 const char* tfVarying = "gl_Position";
1680 glGenBuffers (1, &buf);
1681 glGenTransformFeedbacks (2, tfID);
1683 m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if target is not GL_TRANSFORM_FEEDBACK.");
1684 glBindTransformFeedback(-1, tfID[0]);
1685 expectError(GL_INVALID_ENUM);
1686 m_log << tcu::TestLog::EndSection;
1688 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if the transform feedback operation is active on the currently bound transform feedback object, and is not paused.");
1689 glUseProgram (program.getProgram());
1690 glTransformFeedbackVaryings (program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
1691 glLinkProgram (program.getProgram());
1692 glBindTransformFeedback (GL_TRANSFORM_FEEDBACK, tfID[0]);
1693 glBindBuffer (GL_TRANSFORM_FEEDBACK_BUFFER, buf);
1694 glBufferData (GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
1695 glBindBufferBase (GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
1696 glBeginTransformFeedback (GL_TRIANGLES);
1697 expectError (GL_NO_ERROR);
1699 glBindTransformFeedback (GL_TRANSFORM_FEEDBACK, tfID[1]);
1700 expectError (GL_INVALID_OPERATION);
1702 glEndTransformFeedback ();
1703 expectError (GL_NO_ERROR);
1704 m_log << tcu::TestLog::EndSection;
1707 glDeleteBuffers (1, &buf);
1708 glDeleteTransformFeedbacks (2, tfID);
1709 expectError (GL_NO_ERROR);
1711 ES3F_ADD_API_CASE(delete_transform_feedbacks, "Invalid glDeleteTransformFeedbacks() usage",
1714 glGenTransformFeedbacks(1, &id);
1716 m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if n is negative.");
1717 glDeleteTransformFeedbacks(-1, &id);
1718 expectError(GL_INVALID_VALUE);
1719 m_log << tcu::TestLog::EndSection;
1721 glDeleteTransformFeedbacks(1, &id);
1723 ES3F_ADD_API_CASE(begin_transform_feedback, "Invalid glBeginTransformFeedback() usage",
1726 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
1728 const char* tfVarying = "gl_Position";
1730 glGenBuffers (1, &buf);
1731 glGenTransformFeedbacks (2, tfID);
1733 glUseProgram (program.getProgram());
1734 glTransformFeedbackVaryings (program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
1735 glLinkProgram (program.getProgram());
1736 glBindTransformFeedback (GL_TRANSFORM_FEEDBACK, tfID[0]);
1737 glBindBuffer (GL_TRANSFORM_FEEDBACK_BUFFER, buf);
1738 glBufferData (GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
1739 glBindBufferBase (GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
1740 expectError (GL_NO_ERROR);
1742 m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if primitiveMode is not one of GL_POINTS, GL_LINES, or GL_TRIANGLES.");
1743 glBeginTransformFeedback (-1);
1744 expectError (GL_INVALID_ENUM);
1745 m_log << tcu::TestLog::EndSection;
1747 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if transform feedback is already active.");
1748 glBeginTransformFeedback (GL_TRIANGLES);
1749 expectError (GL_NO_ERROR);
1750 glBeginTransformFeedback (GL_POINTS);
1751 expectError (GL_INVALID_OPERATION);
1752 m_log << tcu::TestLog::EndSection;
1754 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if any binding point used in transform feedback mode does not have a buffer object bound.");
1755 glBindBufferBase (GL_TRANSFORM_FEEDBACK_BUFFER, 0, 0);
1756 glBeginTransformFeedback (GL_TRIANGLES);
1757 expectError (GL_INVALID_OPERATION);
1758 glBindBufferBase (GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
1759 m_log << tcu::TestLog::EndSection;
1761 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if no binding points would be used because no program object is active.");
1763 glBeginTransformFeedback (GL_TRIANGLES);
1764 expectError (GL_INVALID_OPERATION);
1765 glUseProgram (program.getProgram());
1766 m_log << tcu::TestLog::EndSection;
1768 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if no binding points would be used because the active program object has specified no varying variables to record.");
1769 glTransformFeedbackVaryings (program.getProgram(), 0, 0, GL_INTERLEAVED_ATTRIBS);
1770 glBeginTransformFeedback (GL_TRIANGLES);
1771 expectError (GL_INVALID_OPERATION);
1772 m_log << tcu::TestLog::EndSection;
1774 glEndTransformFeedback ();
1775 glDeleteBuffers (1, &buf);
1776 glDeleteTransformFeedbacks (2, tfID);
1777 expectError (GL_NO_ERROR);
1779 ES3F_ADD_API_CASE(pause_transform_feedback, "Invalid glPauseTransformFeedback() usage",
1782 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
1784 const char* tfVarying = "gl_Position";
1786 glGenBuffers (1, &buf);
1787 glGenTransformFeedbacks (2, tfID);
1789 glUseProgram (program.getProgram());
1790 glTransformFeedbackVaryings (program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
1791 glLinkProgram (program.getProgram());
1792 glBindTransformFeedback (GL_TRANSFORM_FEEDBACK, tfID[0]);
1793 glBindBuffer (GL_TRANSFORM_FEEDBACK_BUFFER, buf);
1794 glBufferData (GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
1795 glBindBufferBase (GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
1796 expectError (GL_NO_ERROR);
1798 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if the currently bound transform feedback object is not active or is paused.");
1799 glPauseTransformFeedback ();
1800 expectError (GL_INVALID_OPERATION);
1801 glBeginTransformFeedback (GL_TRIANGLES);
1802 glPauseTransformFeedback ();
1803 expectError (GL_NO_ERROR);
1804 glPauseTransformFeedback ();
1805 expectError (GL_INVALID_OPERATION);
1806 m_log << tcu::TestLog::EndSection;
1808 glEndTransformFeedback ();
1809 glDeleteBuffers (1, &buf);
1810 glDeleteTransformFeedbacks (2, tfID);
1811 expectError (GL_NO_ERROR);
1813 ES3F_ADD_API_CASE(resume_transform_feedback, "Invalid glResumeTransformFeedback() usage",
1816 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
1818 const char* tfVarying = "gl_Position";
1820 glGenBuffers (1, &buf);
1821 glGenTransformFeedbacks (2, tfID);
1823 glUseProgram (program.getProgram());
1824 glTransformFeedbackVaryings (program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
1825 glLinkProgram (program.getProgram());
1826 glBindTransformFeedback (GL_TRANSFORM_FEEDBACK, tfID[0]);
1827 glBindBuffer (GL_TRANSFORM_FEEDBACK_BUFFER, buf);
1828 glBufferData (GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
1829 glBindBufferBase (GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
1830 expectError (GL_NO_ERROR);
1832 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if the currently bound transform feedback object is not active or is not paused.");
1833 glResumeTransformFeedback ();
1834 expectError (GL_INVALID_OPERATION);
1835 glBeginTransformFeedback (GL_TRIANGLES);
1836 glResumeTransformFeedback ();
1837 expectError (GL_INVALID_OPERATION);
1838 glPauseTransformFeedback ();
1839 glResumeTransformFeedback ();
1840 expectError (GL_NO_ERROR);
1841 m_log << tcu::TestLog::EndSection;
1843 glEndTransformFeedback ();
1844 glDeleteBuffers (1, &buf);
1845 glDeleteTransformFeedbacks (2, tfID);
1846 expectError (GL_NO_ERROR);
1848 ES3F_ADD_API_CASE(end_transform_feedback, "Invalid glEndTransformFeedback() usage",
1851 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
1853 const char* tfVarying = "gl_Position";
1855 glGenBuffers (1, &buf);
1856 glGenTransformFeedbacks (1, &tfID);
1858 glUseProgram (program.getProgram());
1859 glTransformFeedbackVaryings (program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
1860 glLinkProgram (program.getProgram());
1861 glBindTransformFeedback (GL_TRANSFORM_FEEDBACK, tfID);
1862 glBindBuffer (GL_TRANSFORM_FEEDBACK_BUFFER, buf);
1863 glBufferData (GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
1864 glBindBufferBase (GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
1865 expectError (GL_NO_ERROR);
1867 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if transform feedback is not active.");
1868 glEndTransformFeedback ();
1869 expectError (GL_INVALID_OPERATION);
1870 glBeginTransformFeedback (GL_TRIANGLES);
1871 glEndTransformFeedback ();
1872 expectError (GL_NO_ERROR);
1873 m_log << tcu::TestLog::EndSection;
1875 glDeleteBuffers (1, &buf);
1876 glDeleteTransformFeedbacks (1, &tfID);
1877 expectError (GL_NO_ERROR);
1879 ES3F_ADD_API_CASE(get_transform_feedback_varying, "Invalid glGetTransformFeedbackVarying() usage",
1882 glu::ShaderProgram program (m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
1883 glu::ShaderProgram programInvalid (m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, ""));
1884 const char* tfVarying = "gl_Position";
1885 int maxTransformFeedbackVaryings = 0;
1892 glGenTransformFeedbacks (1, &tfID);
1894 glTransformFeedbackVaryings (program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
1895 expectError (GL_NO_ERROR);
1896 glLinkProgram (program.getProgram());
1897 expectError (GL_NO_ERROR);
1899 glBindTransformFeedback (GL_TRANSFORM_FEEDBACK, tfID);
1900 expectError (GL_NO_ERROR);
1902 m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if program is not the name of a program object.");
1903 glGetTransformFeedbackVarying (-1, 0, 32, &length, &size, &type, &name[0]);
1904 expectError (GL_INVALID_VALUE);
1905 m_log << tcu::TestLog::EndSection;
1907 m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if index is greater or equal to the value of GL_TRANSFORM_FEEDBACK_VARYINGS.");
1908 glGetProgramiv (program.getProgram(), GL_TRANSFORM_FEEDBACK_VARYINGS, &maxTransformFeedbackVaryings);
1909 glGetTransformFeedbackVarying (program.getProgram(), maxTransformFeedbackVaryings, 32, &length, &size, &type, &name[0]);
1910 expectError (GL_INVALID_VALUE);
1911 m_log << tcu::TestLog::EndSection;
1913 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION or GL_INVALID_VALUE is generated program has not been linked.");
1914 glGetTransformFeedbackVarying (programInvalid.getProgram(), 0, 32, &length, &size, &type, &name[0]);
1915 expectError (GL_INVALID_OPERATION, GL_INVALID_VALUE);
1916 m_log << tcu::TestLog::EndSection;
1918 glDeleteTransformFeedbacks (1, &tfID);
1919 expectError (GL_NO_ERROR);
1921 ES3F_ADD_API_CASE(transform_feedback_varyings, "Invalid glTransformFeedbackVaryings() usage",
1924 glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
1925 const char* tfVarying = "gl_Position";
1926 GLint maxTransformFeedbackSeparateAttribs = 0;
1928 glGenTransformFeedbacks (1, &tfID);
1929 expectError (GL_NO_ERROR);
1931 m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if program is not the name of a program object.");
1932 glTransformFeedbackVaryings (0, 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
1933 expectError (GL_INVALID_VALUE);
1934 m_log << tcu::TestLog::EndSection;
1936 m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if bufferMode is GL_SEPARATE_ATTRIBS and count is greater than GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS.");
1937 glGetIntegerv (GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, &maxTransformFeedbackSeparateAttribs);
1938 glTransformFeedbackVaryings (program.getProgram(), maxTransformFeedbackSeparateAttribs+1, &tfVarying, GL_SEPARATE_ATTRIBS);
1939 expectError (GL_INVALID_VALUE);
1940 m_log << tcu::TestLog::EndSection;
1942 glDeleteTransformFeedbacks (1, &tfID);
1943 expectError (GL_NO_ERROR);