1 /*-------------------------------------------------------------------------
2  * drawElements Quality Program OpenGL ES 3.1 Module
3  * -------------------------------------------------
4  *
5  * Copyright 2014 The Android Open Source Project
6  *
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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  *//*!
20  * \file
21  * \brief Negative Shader API tests.
22  *//*--------------------------------------------------------------------*/
23 
24 #include "es31fNegativeShaderApiTests.hpp"
25 
26 #include "deUniquePtr.hpp"
27 
28 #include "glwDefs.hpp"
29 #include "glwEnums.hpp"
30 
31 #include "gluShaderProgram.hpp"
32 #include "gluCallLogWrapper.hpp"
33 
34 #include "gluContextInfo.hpp"
35 #include "gluRenderContext.hpp"
36 
37 
38 namespace deqp
39 {
40 namespace gles31
41 {
42 namespace Functional
43 {
44 namespace NegativeTestShared
45 {
46 using tcu::TestLog;
47 using glu::CallLogWrapper;
48 using namespace glw;
49 
50 static const char* vertexShaderSource		=	"#version 300 es\n"
51 												"void main (void)\n"
52 												"{\n"
53 												"	gl_Position = vec4(0.0);\n"
54 												"}\n\0";
55 
56 static const char* fragmentShaderSource		=	"#version 300 es\n"
57 												"layout(location = 0) out mediump vec4 fragColor;"
58 												"void main (void)\n"
59 												"{\n"
60 												"	fragColor = vec4(0.0);\n"
61 												"}\n\0";
62 
63 static const char* uniformTestVertSource	=	"#version 300 es\n"
64 												"uniform mediump vec4 vec4_v;\n"
65 												"uniform mediump mat4 mat4_v;\n"
66 												"void main (void)\n"
67 												"{\n"
68 												"	gl_Position = mat4_v * vec4_v;\n"
69 												"}\n\0";
70 
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;"
76 												"void main (void)\n"
77 												"{\n"
78 												"	fragColor.xy = (vec4(uvec4_f) + vec4(ivec4_f)).xy;\n"
79 												"	fragColor.zw = texture(sampler_f, vec2(0.0, 0.0)).zw;\n"
80 												"}\n\0";
81 
82 static const char* uniformBlockVertSource	=	"#version 300 es\n"
83 												"layout(shared) uniform Block { lowp float var; };\n"
84 												"void main (void)\n"
85 												"{\n"
86 												"	gl_Position = vec4(var);\n"
87 												"}\n\0";
88 
89 
90 // Shader control commands
create_shader(NegativeTestContext & ctx)91 void create_shader (NegativeTestContext& ctx)
92 {
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);
96 	ctx.endSection();
97 }
98 
shader_source(NegativeTestContext & ctx)99 void shader_source (NegativeTestContext& ctx)
100 {
101 	// make notAShader not a shader id
102 	const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
103 	ctx.glDeleteShader(notAShader);
104 
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);
108 	ctx.endSection();
109 
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);
114 	ctx.endSection();
115 
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);
120 	ctx.endSection();
121 
122 	ctx.glDeleteProgram(program);
123 	ctx.glDeleteShader(shader);
124 }
125 
compile_shader(NegativeTestContext & ctx)126 void compile_shader (NegativeTestContext& ctx)
127 {
128 	const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
129 	ctx.glDeleteShader(notAShader);
130 
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);
134 	ctx.endSection();
135 
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);
140 	ctx.endSection();
141 
142 	ctx.glDeleteProgram(program);
143 }
144 
delete_shader(NegativeTestContext & ctx)145 void delete_shader (NegativeTestContext& ctx)
146 {
147 	const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
148 	ctx.glDeleteShader(notAShader);
149 
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);
153 	ctx.endSection();
154 }
155 
shader_binary(NegativeTestContext & ctx)156 void shader_binary (NegativeTestContext& ctx)
157 {
158 	std::vector<deInt32> binaryFormats;
159 	deBool shaderBinarySupported = !binaryFormats.empty();
160 	GLuint shaders[2];
161 	GLuint shaderPair[2];
162 	GLuint nonProgram[2];
163 	GLuint shaderProgram[2];
164 
165 	{
166 		deInt32 numFormats = 0x1234;
167 		ctx.glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &numFormats);
168 
169 		if (numFormats == 0)
170 			ctx.getLog() << TestLog::Message << "// No supported extensions available." << TestLog::EndMessage;
171 		else
172 		{
173 			binaryFormats.resize(numFormats);
174 			ctx.glGetIntegerv(GL_SHADER_BINARY_FORMATS, &binaryFormats[0]);
175 		}
176 	}
177 
178 	if (!shaderBinarySupported)
179 		ctx.getLog() << TestLog::Message << "// Shader binaries not supported." << TestLog::EndMessage;
180 	else
181 		ctx.getLog() << TestLog::Message << "// Shader binaries supported" << TestLog::EndMessage;
182 
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);
187 	nonProgram[0]		= -1;
188 	nonProgram[1]		= -1;
189 	shaderProgram[0]	= ctx.glCreateShader(GL_VERTEX_SHADER);
190 	shaderProgram[1]	= ctx.glCreateProgram();
191 
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);
195 	ctx.endSection();
196 
197 	if (shaderBinarySupported)
198 	{
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);
203 		ctx.endSection();
204 
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);
208 		ctx.endSection();
209 
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);
215 		ctx.endSection();
216 
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);
220 		ctx.endSection();
221 
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);
225 		ctx.endSection();
226 	}
227 
228 	ctx.glDeleteShader(shaders[0]);
229 	ctx.glDeleteShader(shaders[1]);
230 }
231 
attach_shader(NegativeTestContext & ctx)232 void attach_shader (NegativeTestContext& ctx)
233 {
234 	GLuint shader1 = ctx.glCreateShader(GL_VERTEX_SHADER);
235 	GLuint shader2 = ctx.glCreateShader(GL_VERTEX_SHADER);
236 	GLuint program = ctx.glCreateProgram();
237 
238 	const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
239 	const GLuint notAProgram = ctx.glCreateProgram();
240 
241 	ctx.glDeleteShader(notAShader);
242 	ctx.glDeleteProgram(notAProgram);
243 
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);
247 	ctx.endSection();
248 
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);
254 	ctx.endSection();
255 
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);
263 	ctx.endSection();
264 
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);
270 	ctx.endSection();
271 
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);
275 	ctx.endSection();
276 
277 	ctx.glDeleteProgram(program);
278 	ctx.glDeleteShader(shader1);
279 	ctx.glDeleteShader(shader2);
280 }
281 
detach_shader(NegativeTestContext & ctx)282 void detach_shader (NegativeTestContext& ctx)
283 {
284 	GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
285 	GLuint program = ctx.glCreateProgram();
286 
287 	const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
288 	const GLuint notAProgram = ctx.glCreateProgram();
289 
290 	ctx.glDeleteShader(notAShader);
291 	ctx.glDeleteProgram(notAProgram);
292 
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);
300 	ctx.endSection();
301 
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);
305 	ctx.endSection();
306 
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);
312 	ctx.endSection();
313 
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);
317 	ctx.endSection();
318 
319 	ctx.glDeleteProgram(program);
320 	ctx.glDeleteShader(shader);
321 }
322 
link_program(NegativeTestContext & ctx)323 void link_program (NegativeTestContext& ctx)
324 {
325 	GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
326 
327 	const GLuint notAProgram = ctx.glCreateProgram();
328 	ctx.glDeleteProgram(notAProgram);
329 
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);
333 	ctx.endSection();
334 
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);
338 	ctx.endSection();
339 
340 	ctx.glDeleteShader(shader);
341 
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";
347 
348 	ctx.glGenTransformFeedbacks		(1, &tfID);
349 	ctx.glGenBuffers				(1, &buf);
350 
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);
360 
361 	ctx.glLinkProgram				(program.getProgram());
362 	ctx.expectError				(GL_INVALID_OPERATION);
363 
364 	ctx.glEndTransformFeedback		();
365 	ctx.glDeleteTransformFeedbacks	(1, &tfID);
366 	ctx.glDeleteBuffers				(1, &buf);
367 	ctx.expectError				(GL_NO_ERROR);
368 	ctx.endSection();
369 }
370 
use_program(NegativeTestContext & ctx)371 void use_program (NegativeTestContext& ctx)
372 {
373 	GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
374 
375 	const GLuint notAProgram = ctx.glCreateProgram();
376 	ctx.glDeleteProgram(notAProgram);
377 
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);
381 	ctx.endSection();
382 
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);
386 	ctx.endSection();
387 
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";
394 
395 	ctx.glGenTransformFeedbacks		(1, &tfID);
396 	ctx.glGenBuffers				(1, &buf);
397 
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);
407 
408 	ctx.glUseProgram				(program2.getProgram());
409 	ctx.expectError				(GL_INVALID_OPERATION);
410 
411 	ctx.glPauseTransformFeedback	();
412 	ctx.glUseProgram				(program2.getProgram());
413 	ctx.expectError				(GL_NO_ERROR);
414 
415 	ctx.glEndTransformFeedback		();
416 	ctx.glDeleteTransformFeedbacks	(1, &tfID);
417 	ctx.glDeleteBuffers				(1, &buf);
418 	ctx.expectError				(GL_NO_ERROR);
419 	ctx.endSection();
420 
421 	ctx.glUseProgram(0);
422 	ctx.glDeleteShader(shader);
423 }
424 
delete_program(NegativeTestContext & ctx)425 void delete_program (NegativeTestContext& ctx)
426 {
427 	GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
428 
429 	const GLuint notAProgram = ctx.glCreateProgram();
430 	ctx.glDeleteProgram(notAProgram);
431 
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);
435 	ctx.endSection();
436 
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);
440 	ctx.endSection();
441 
442 	ctx.glDeleteShader(shader);
443 }
444 
validate_program(NegativeTestContext & ctx)445 void validate_program (NegativeTestContext& ctx)
446 {
447 	GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
448 
449 	const GLuint notAProgram = ctx.glCreateProgram();
450 	ctx.glDeleteProgram(notAProgram);
451 
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);
455 	ctx.endSection();
456 
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);
460 	ctx.endSection();
461 
462 	ctx.glDeleteShader(shader);
463 }
464 
get_program_binary(NegativeTestContext & ctx)465 void get_program_binary (NegativeTestContext& ctx)
466 {
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;
472 	GLint							bufSize			= -1;
473 	GLint							linkStatus		= -1;
474 
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);
482 
483 	ctx.glGetProgramBinary	(program.getProgram(), 0, &binaryLength, &binaryFormat, &binaryPtr);
484 	ctx.expectError		(GL_INVALID_OPERATION);
485 	if (bufSize > 0)
486 	{
487 		ctx.glGetProgramBinary	(program.getProgram(), bufSize-1, &binaryLength, &binaryFormat, &binaryPtr);
488 		ctx.expectError		(GL_INVALID_OPERATION);
489 	}
490 	ctx.endSection();
491 
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);
499 
500 	ctx.glGetProgramBinary	(programInvalid.getProgram(), bufSize, &binaryLength, &binaryFormat, &binaryPtr);
501 	ctx.expectError		(GL_INVALID_OPERATION);
502 	ctx.endSection();
503 }
504 
program_binary(NegativeTestContext & ctx)505 void program_binary (NegativeTestContext& ctx)
506 {
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;
513 	GLint					bufSize			= -1;
514 	GLint					linkStatus		= -1;
515 
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;
520 	TCU_CHECK(bufSize > 0);
521 	binaryBuf.resize(bufSize);
522 	ctx.glGetProgramBinary	(srcProgram.getProgram(), bufSize, &binaryLength, &binaryFormat, &binaryBuf[0]);
523 	ctx.expectError		(GL_NO_ERROR);
524 
525 	ctx.beginSection("GL_INVALID_OPERATION is generated if program is not the name of an existing program object.");
526 	ctx.glProgramBinary		(dummyShader, binaryFormat, &binaryBuf[0], binaryLength);
527 	ctx.expectError		(GL_INVALID_OPERATION);
528 	ctx.endSection();
529 
530 	ctx.beginSection("GL_INVALID_ENUM is generated if binaryFormat is not a value recognized by the implementation.");
531 	ctx.glProgramBinary		(dstProgram, -1, &binaryBuf[0], binaryLength);
532 	ctx.expectError		(GL_INVALID_ENUM);
533 	ctx.endSection();
534 
535 	ctx.glDeleteShader(dummyShader);
536 	ctx.glDeleteProgram(dstProgram);
537 }
538 
program_parameteri(NegativeTestContext & ctx)539 void program_parameteri (NegativeTestContext& ctx)
540 {
541 	GLuint program	= ctx.glCreateProgram();
542 	GLuint shader	= ctx.glCreateShader(GL_VERTEX_SHADER);
543 
544 	const GLuint notAProgram = ctx.glCreateProgram();
545 	ctx.glDeleteProgram(notAProgram);
546 
547 	ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of an existing program object.");
548 	ctx.glProgramParameteri(notAProgram, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
549 	ctx.expectError(GL_INVALID_VALUE);
550 	ctx.endSection();
551 
552 	ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object.");
553 	ctx.glProgramParameteri(shader, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
554 	ctx.expectError(GL_INVALID_OPERATION);
555 	ctx.endSection();
556 
557 	ctx.beginSection("GL_INVALID_ENUM is generated if pname is not GL_PROGRAM_BINARY_RETRIEVABLE_HINT or PROGRAM_SEPARABLE.");
558 	ctx.glProgramParameteri(program, -1, GL_TRUE);
559 	ctx.expectError(GL_INVALID_ENUM);
560 	ctx.endSection();
561 
562 	ctx.beginSection("GL_INVALID_VALUE is generated if value is not GL_FALSE or GL_TRUE.");
563 	ctx.glProgramParameteri(program, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, 2);
564 	ctx.expectError(GL_INVALID_VALUE);
565 	ctx.endSection();
566 
567 	ctx.glDeleteProgram(program);
568 	ctx.glDeleteShader(shader);
569 }
570 
gen_samplers(NegativeTestContext & ctx)571 void gen_samplers (NegativeTestContext& ctx)
572 {
573 	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
574 	GLuint sampler = 0;
575 	ctx.glGenSamplers	(-1, &sampler);
576 	ctx.expectError	(GL_INVALID_VALUE);
577 	ctx.endSection();
578 }
579 
bind_sampler(NegativeTestContext & ctx)580 void bind_sampler (NegativeTestContext& ctx)
581 {
582 	int				maxTexImageUnits = 0x1234;
583 	GLuint			sampler = 0;
584 	ctx.glGetIntegerv	(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTexImageUnits);
585 	ctx.glGenSamplers	(1, &sampler);
586 
587 	ctx.beginSection("GL_INVALID_VALUE is generated if unit is greater than or equal to the value of GL_MAX_COMBIED_TEXTURE_IMAGE_UNITS.");
588 	ctx.glBindSampler	(maxTexImageUnits, sampler);
589 	ctx.expectError	(GL_INVALID_VALUE);
590 	ctx.endSection();
591 
592 	ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not zero or a name previously returned from a call to ctx.glGenSamplers.");
593 	ctx.glBindSampler	(1, -1);
594 	ctx.expectError	(GL_INVALID_OPERATION);
595 	ctx.endSection();
596 
597 	ctx.beginSection("GL_INVALID_OPERATION is generated if sampler has been deleted by a call to ctx.glDeleteSamplers.");
598 	ctx.glDeleteSamplers(1, &sampler);
599 	ctx.glBindSampler	(1, sampler);
600 	ctx.expectError	(GL_INVALID_OPERATION);
601 	ctx.endSection();
602 }
603 
delete_samplers(NegativeTestContext & ctx)604 void delete_samplers (NegativeTestContext& ctx)
605 {
606 	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
607 	ctx.glDeleteSamplers(-1, 0);
608 	ctx.expectError	(GL_INVALID_VALUE);
609 	ctx.endSection();
610 }
611 
get_sampler_parameteriv(NegativeTestContext & ctx)612 void get_sampler_parameteriv (NegativeTestContext& ctx)
613 {
614 	int				params = 0x1234;
615 	GLuint			sampler = 0;
616 	ctx.glGenSamplers	(1, &sampler);
617 
618 	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.");
619 	ctx.glGetSamplerParameteriv	(-1, GL_TEXTURE_MAG_FILTER, &params);
620 	ctx.expectError			(GL_INVALID_OPERATION);
621 	ctx.endSection();
622 
623 	ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
624 	ctx.glGetSamplerParameteriv	(sampler, -1, &params);
625 	ctx.expectError			(GL_INVALID_ENUM);
626 	ctx.endSection();
627 
628 	ctx.glDeleteSamplers(1, &sampler);
629 }
630 
get_sampler_parameterfv(NegativeTestContext & ctx)631 void get_sampler_parameterfv (NegativeTestContext& ctx)
632 {
633 	float				params	= 0.0f;
634 	GLuint				sampler = 0;
635 	ctx.glGenSamplers	(1, &sampler);
636 
637 	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.");
638 	ctx.glGetSamplerParameterfv	(-1, GL_TEXTURE_MAG_FILTER, &params);
639 	ctx.expectError			(GL_INVALID_OPERATION);
640 	ctx.endSection();
641 
642 	ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
643 	ctx.glGetSamplerParameterfv	(sampler, -1, &params);
644 	ctx.expectError			(GL_INVALID_ENUM);
645 	ctx.endSection();
646 
647 	ctx.glDeleteSamplers(1, &sampler);
648 }
649 
get_sampler_parameterIiv(NegativeTestContext & ctx)650 void get_sampler_parameterIiv (NegativeTestContext& ctx)
651 {
652 	if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
653 		throw tcu::NotSupportedError("glGetSamplerParameterIiv is not supported.", DE_NULL, __FILE__, __LINE__);
654 
655 	GLuint	sampler		= 0x1234;
656 	GLint	borderColor	= 0x1234;
657 
658 	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.");
659 	ctx.glGetSamplerParameterIiv(sampler, GL_TEXTURE_BORDER_COLOR, &borderColor);
660 	ctx.expectError(GL_INVALID_OPERATION);
661 	ctx.endSection();
662 
663 	ctx.glGenSamplers(1, &sampler);
664 
665 	ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
666 	ctx.glGetSamplerParameterIiv(sampler, -1, &borderColor);
667 	ctx.expectError(GL_INVALID_ENUM);
668 	ctx.endSection();
669 
670 	ctx.glDeleteSamplers(1, &sampler);
671 }
672 
get_sampler_parameterIuiv(NegativeTestContext & ctx)673 void get_sampler_parameterIuiv (NegativeTestContext& ctx)
674 {
675 	if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
676 		throw tcu::NotSupportedError("glGetSamplerParameterIuiv is not supported.", DE_NULL, __FILE__, __LINE__);
677 
678 	GLuint	sampler		= 0x1234;
679 	GLuint	borderColor	= 0x1234;
680 
681 	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.");
682 	ctx.glGetSamplerParameterIuiv(sampler, GL_TEXTURE_BORDER_COLOR, &borderColor);
683 	ctx.expectError(GL_INVALID_OPERATION);
684 	ctx.endSection();
685 
686 	ctx.glGenSamplers(1, &sampler);
687 
688 	ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
689 	ctx.glGetSamplerParameterIuiv(sampler, -1, &borderColor);
690 	ctx.expectError(GL_INVALID_ENUM);
691 	ctx.endSection();
692 
693 	ctx.glDeleteSamplers(1, &sampler);
694 }
695 
sampler_parameteri(NegativeTestContext & ctx)696 void sampler_parameteri (NegativeTestContext& ctx)
697 {
698 	GLuint sampler = 0;
699 
700 	ctx.glGenSamplers(1, &sampler);
701 
702 	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.");
703 	ctx.glSamplerParameteri(-1, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
704 	ctx.expectError(GL_INVALID_OPERATION);
705 	ctx.endSection();
706 
707 	ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined constant value (based on the value of pname) and does not.");
708 	ctx.glSamplerParameteri(sampler, GL_TEXTURE_WRAP_S, -1);
709 	ctx.expectError(GL_INVALID_ENUM);
710 	ctx.endSection();
711 
712 	if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
713 	{
714 		ctx.beginSection("GL_INVALID_ENUM is generated if glSamplerParameteri is called for a non-scalar parameter.");
715 		ctx.glSamplerParameteri(sampler, GL_TEXTURE_BORDER_COLOR, 0);
716 		ctx.expectError(GL_INVALID_ENUM);
717 		ctx.endSection();
718 	}
719 
720 	ctx.glDeleteSamplers(1, &sampler);
721 }
722 
sampler_parameteriv(NegativeTestContext & ctx)723 void sampler_parameteriv (NegativeTestContext& ctx)
724 {
725 	int				params = 0x1234;
726 	GLuint			sampler = 0;
727 	ctx.glGenSamplers	(1, &sampler);
728 
729 	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.");
730 	params = GL_CLAMP_TO_EDGE;
731 	ctx.glSamplerParameteriv	(-1, GL_TEXTURE_WRAP_S, &params);
732 	ctx.expectError			(GL_INVALID_OPERATION);
733 	ctx.endSection();
734 
735 	ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined constant value (based on the value of pname) and does not.");
736 	params = -1;
737 	ctx.glSamplerParameteriv	(sampler, GL_TEXTURE_WRAP_S, &params);
738 	ctx.expectError			(GL_INVALID_ENUM);
739 	ctx.endSection();
740 
741 	ctx.glDeleteSamplers(1, &sampler);
742 }
743 
sampler_parameterf(NegativeTestContext & ctx)744 void sampler_parameterf (NegativeTestContext& ctx)
745 {
746 	GLuint sampler = 0;
747 
748 	ctx.glGenSamplers(1, &sampler);
749 
750 	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.");
751 	ctx.glSamplerParameterf(-1, GL_TEXTURE_MIN_LOD, -1000.0f);
752 	ctx.expectError(GL_INVALID_OPERATION);
753 	ctx.endSection();
754 
755 	ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined constant value (based on the value of pname) and does not.");
756 	ctx.glSamplerParameterf(sampler, GL_TEXTURE_WRAP_S, -1.0f);
757 	ctx.expectError(GL_INVALID_ENUM);
758 	ctx.endSection();
759 
760 	if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
761 	{
762 		ctx.beginSection("GL_INVALID_ENUM is generated if glSamplerParameterf is called for a non-scalar parameter.");
763 		ctx.glSamplerParameteri(sampler, GL_TEXTURE_BORDER_COLOR, 0);
764 		ctx.expectError(GL_INVALID_ENUM);
765 		ctx.endSection();
766 	}
767 
768 	ctx.glDeleteSamplers(1, &sampler);
769 }
770 
sampler_parameterfv(NegativeTestContext & ctx)771 void sampler_parameterfv (NegativeTestContext& ctx)
772 {
773 	float			params;
774 	GLuint			sampler = 0;
775 	ctx.glGenSamplers	(1, &sampler);
776 
777 	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.");
778 	params = -1000.0f;
779 	ctx.glSamplerParameterfv	(-1, GL_TEXTURE_WRAP_S, &params);
780 	ctx.expectError			(GL_INVALID_OPERATION);
781 	ctx.endSection();
782 
783 	ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined constant value (based on the value of pname) and does not.");
784 	params = -1.0f;
785 	ctx.glSamplerParameterfv	(sampler, GL_TEXTURE_WRAP_S, &params);
786 	ctx.expectError			(GL_INVALID_ENUM);
787 	ctx.endSection();
788 
789 	ctx.glDeleteSamplers(1, &sampler);
790 }
791 
sampler_parameterIiv(NegativeTestContext & ctx)792 void sampler_parameterIiv (NegativeTestContext& ctx)
793 {
794 	if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
795 		throw tcu::NotSupportedError("glSamplerParameterIiv is not supported.", DE_NULL, __FILE__, __LINE__);
796 
797 	GLuint	sampler;
798 	GLint	color[]	= {0, 0, 0, 0};
799 
800 	ctx.glGenSamplers(1, &sampler);
801 
802 	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.");
803 	ctx.glSamplerParameterIiv(-1, GL_TEXTURE_BORDER_COLOR, color);
804 	ctx.expectError(GL_INVALID_OPERATION);
805 	ctx.endSection();
806 
807 	ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted sampler state name.");
808 	ctx.glSamplerParameterIiv(sampler, -1, color);
809 	ctx.expectError(GL_INVALID_ENUM);
810 	ctx.endSection();
811 }
812 
sampler_parameterIuiv(NegativeTestContext & ctx)813 void sampler_parameterIuiv (NegativeTestContext& ctx)
814 {
815 	if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
816 		throw tcu::NotSupportedError("glSamplerParameterIuiv is not supported.", DE_NULL, __FILE__, __LINE__);
817 
818 	GLuint	sampler;
819 	GLuint	color[]	= {0, 0, 0, 0};
820 
821 	ctx.glGenSamplers(1, &sampler);
822 
823 	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.");
824 	ctx.glSamplerParameterIuiv(-1, GL_TEXTURE_BORDER_COLOR, color);
825 	ctx.expectError(GL_INVALID_OPERATION);
826 	ctx.endSection();
827 
828 	ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted sampler state name.");
829 	ctx.glSamplerParameterIuiv(sampler, -1, color);
830 	ctx.expectError(GL_INVALID_ENUM);
831 	ctx.endSection();
832 }
833 
834 // Shader data commands
835 
get_attrib_location(NegativeTestContext & ctx)836 void get_attrib_location (NegativeTestContext& ctx)
837 {
838 	GLuint programEmpty		= ctx.glCreateProgram();
839 	GLuint shader			= ctx.glCreateShader(GL_VERTEX_SHADER);
840 
841 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
842 
843 	const GLuint notAProgram = ctx.glCreateProgram();
844 	ctx.glDeleteProgram(notAProgram);
845 
846 	ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
847 	ctx.glBindAttribLocation		(programEmpty, 0, "test");
848 	ctx.glGetAttribLocation			(programEmpty, "test");
849 	ctx.expectError				(GL_INVALID_OPERATION);
850 	ctx.endSection();
851 
852 	ctx.beginSection("GL_INVALID_VALUE is generated if program is not a program or shader object.");
853 	ctx.glUseProgram				(program.getProgram());
854 	ctx.glBindAttribLocation		(program.getProgram(), 0, "test");
855 	ctx.expectError				(GL_NO_ERROR);
856 	ctx.glGetAttribLocation			(program.getProgram(), "test");
857 	ctx.expectError				(GL_NO_ERROR);
858 	ctx.glGetAttribLocation			(notAProgram, "test");
859 	ctx.expectError				(GL_INVALID_VALUE);
860 	ctx.endSection();
861 
862 	ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
863 	ctx.glGetAttribLocation			(shader, "test");
864 	ctx.expectError				(GL_INVALID_OPERATION);
865 	ctx.endSection();
866 
867 	ctx.glUseProgram				(0);
868 	ctx.glDeleteShader				(shader);
869 	ctx.glDeleteProgram				(programEmpty);
870 }
871 
get_uniform_location(NegativeTestContext & ctx)872 void get_uniform_location (NegativeTestContext& ctx)
873 {
874 	GLuint programEmpty = ctx.glCreateProgram();
875 	GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
876 
877 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
878 
879 	const GLuint notAProgram = ctx.glCreateProgram();
880 	ctx.glDeleteProgram(notAProgram);
881 
882 	ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
883 	ctx.glGetUniformLocation(programEmpty, "test");
884 	ctx.expectError(GL_INVALID_OPERATION);
885 	ctx.endSection();
886 
887 	ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
888 	ctx.glUseProgram(program.getProgram());
889 	ctx.glGetUniformLocation(notAProgram, "test");
890 	ctx.expectError(GL_INVALID_VALUE);
891 	ctx.endSection();
892 
893 	ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
894 	ctx.glGetAttribLocation(shader, "test");
895 	ctx.expectError(GL_INVALID_OPERATION);
896 	ctx.endSection();
897 
898 	ctx.glUseProgram(0);
899 	ctx.glDeleteProgram(programEmpty);
900 	ctx.glDeleteShader(shader);
901 }
902 
bind_attrib_location(NegativeTestContext & ctx)903 void bind_attrib_location (NegativeTestContext& ctx)
904 {
905 	GLuint program = ctx.glCreateProgram();
906 	GLuint maxIndex = ctx.getInteger(GL_MAX_VERTEX_ATTRIBS);
907 	GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
908 
909 	ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
910 	ctx.glBindAttribLocation(program, maxIndex, "test");
911 	ctx.expectError(GL_INVALID_VALUE);
912 	ctx.endSection();
913 
914 	ctx.beginSection("GL_INVALID_OPERATION is generated if name starts with the reserved prefix \"gl_\".");
915 	ctx.glBindAttribLocation(program, maxIndex-1, "gl_test");
916 	ctx.expectError(GL_INVALID_OPERATION);
917 	ctx.endSection();
918 
919 	ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
920 	ctx.glBindAttribLocation(-1, maxIndex-1, "test");
921 	ctx.expectError(GL_INVALID_VALUE);
922 	ctx.endSection();
923 
924 	ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
925 	ctx.glBindAttribLocation(shader, maxIndex-1, "test");
926 	ctx.expectError(GL_INVALID_OPERATION);
927 	ctx.endSection();
928 
929 	ctx.glDeleteProgram(program);
930 	ctx.glDeleteShader(shader);
931 }
932 
uniform_block_binding(NegativeTestContext & ctx)933 void uniform_block_binding (NegativeTestContext& ctx)
934 {
935 	GLint				maxUniformBufferBindings	= -1;
936 	GLint				numActiveUniforms			= -1;
937 	GLint				numActiveBlocks				= -1;
938 	GLuint				shader 						= -1;
939 	glu::ShaderProgram	program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformBlockVertSource, uniformTestFragSource));
940 
941 	shader = ctx.glCreateShader(GL_VERTEX_SHADER);
942 	ctx.glUseProgram(program.getProgram());
943 
944 	ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUniformBufferBindings);
945 	ctx.glGetProgramiv(program.getProgram(), GL_ACTIVE_UNIFORMS, &numActiveUniforms);
946 	ctx.glGetProgramiv(program.getProgram(), GL_ACTIVE_UNIFORM_BLOCKS, &numActiveBlocks);
947 	ctx.getLog() << TestLog::Message << "// GL_MAX_UNIFORM_BUFFER_BINDINGS = " << maxUniformBufferBindings << TestLog::EndMessage;
948 	ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORMS = "				<< numActiveUniforms		<< TestLog::EndMessage;
949 	ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORM_BLOCKS = "		<< numActiveBlocks			<< TestLog::EndMessage;
950 	ctx.expectError	(GL_NO_ERROR);
951 
952 	ctx.beginSection("GL_INVALID_VALUE is generated if uniformBlockIndex is not an active uniform block index of program.");
953 	ctx.glUniformBlockBinding(program.getProgram(), -1, 0);
954 	ctx.expectError(GL_INVALID_VALUE);
955 	ctx.glUniformBlockBinding(program.getProgram(), 5, 0);
956 	ctx.expectError(GL_INVALID_VALUE);
957 	ctx.endSection();
958 
959 	ctx.beginSection("GL_INVALID_VALUE is generated if uniformBlockBinding is greater than or equal to the value of GL_MAX_UNIFORM_BUFFER_BINDINGS.");
960 	ctx.glUniformBlockBinding(program.getProgram(), maxUniformBufferBindings, 0);
961 	ctx.expectError(GL_INVALID_VALUE);
962 	ctx.endSection();
963 
964 	ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of a program object generated by the GL.");
965 	ctx.glUniformBlockBinding(-1, 0, 0);
966 	ctx.expectError(GL_INVALID_VALUE);
967 	ctx.endSection();
968 
969 	ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object.");
970 	ctx.glUniformBlockBinding(shader, 0, 0);
971 	ctx.expectError(GL_INVALID_OPERATION);
972 	ctx.endSection();
973 
974 	ctx.glDeleteShader(shader);
975 }
976 
977 // ctx.glUniform*f
978 
uniformf_invalid_program(NegativeTestContext & ctx)979 void uniformf_invalid_program (NegativeTestContext& ctx)
980 {
981 	ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
982 	ctx.glUseProgram(0);
983 	ctx.glUniform1f(-1, 0.0f);
984 	ctx.expectError(GL_INVALID_OPERATION);
985 	ctx.glUniform2f(-1, 0.0f, 0.0f);
986 	ctx.expectError(GL_INVALID_OPERATION);
987 	ctx.glUniform3f(-1, 0.0f, 0.0f, 0.0f);
988 	ctx.expectError(GL_INVALID_OPERATION);
989 	ctx.glUniform4f(-1, 0.0f, 0.0f, 0.0f, 0.0f);
990 	ctx.expectError(GL_INVALID_OPERATION);
991 	ctx.endSection();
992 }
993 
uniformf_incompatible_type(NegativeTestContext & ctx)994 void uniformf_incompatible_type (NegativeTestContext& ctx)
995 {
996 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
997 
998 	ctx.glUseProgram(program.getProgram());
999 	GLint vec4_v	= ctx.glGetUniformLocation(program.getProgram(), "vec4_v");	// vec4
1000 	GLint ivec4_f	= ctx.glGetUniformLocation(program.getProgram(), "ivec4_f");	// ivec4
1001 	GLint uvec4_f	= ctx.glGetUniformLocation(program.getProgram(), "uvec4_f");	// uvec4
1002 	GLint sampler_f	= ctx.glGetUniformLocation(program.getProgram(), "sampler_f");	// sampler2D
1003 	ctx.expectError(GL_NO_ERROR);
1004 
1005 	if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1006 	{
1007 		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1008 		ctx.fail("Failed to retrieve uniform location");
1009 	}
1010 
1011 	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.");
1012 	ctx.glUseProgram(program.getProgram());
1013 	ctx.glUniform1f(vec4_v, 0.0f);
1014 	ctx.expectError(GL_INVALID_OPERATION);
1015 	ctx.glUniform2f(vec4_v, 0.0f, 0.0f);
1016 	ctx.expectError(GL_INVALID_OPERATION);
1017 	ctx.glUniform3f(vec4_v, 0.0f, 0.0f, 0.0f);
1018 	ctx.expectError(GL_INVALID_OPERATION);
1019 	ctx.glUniform4f(vec4_v, 0.0f, 0.0f, 0.0f, 0.0f);
1020 	ctx.expectError(GL_NO_ERROR);
1021 	ctx.endSection();
1022 
1023 	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.");
1024 	ctx.glUseProgram(program.getProgram());
1025 	ctx.glUniform4f(ivec4_f, 0.0f, 0.0f, 0.0f, 0.0f);
1026 	ctx.expectError(GL_INVALID_OPERATION);
1027 	ctx.glUniform4f(uvec4_f, 0.0f, 0.0f, 0.0f, 0.0f);
1028 	ctx.expectError(GL_INVALID_OPERATION);
1029 	ctx.endSection();
1030 
1031 	ctx.beginSection("GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than ctx.glUniform1i and ctx.glUniform1iv.");
1032 	ctx.glUseProgram(program.getProgram());
1033 	ctx.glUniform1f(sampler_f, 0.0f);
1034 	ctx.expectError(GL_INVALID_OPERATION);
1035 	ctx.endSection();
1036 
1037 	ctx.glUseProgram(0);
1038 }
1039 
uniformf_invalid_location(NegativeTestContext & ctx)1040 void uniformf_invalid_location (NegativeTestContext& ctx)
1041 {
1042 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1043 
1044 	ctx.glUseProgram(program.getProgram());
1045 	ctx.expectError(GL_NO_ERROR);
1046 
1047 	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.");
1048 	ctx.glUseProgram(program.getProgram());
1049 	ctx.glUniform1f(-2, 0.0f);
1050 	ctx.expectError(GL_INVALID_OPERATION);
1051 	ctx.glUniform2f(-2, 0.0f, 0.0f);
1052 	ctx.expectError(GL_INVALID_OPERATION);
1053 	ctx.glUniform3f(-2, 0.0f, 0.0f, 0.0f);
1054 	ctx.expectError(GL_INVALID_OPERATION);
1055 	ctx.glUniform4f(-2, 0.0f, 0.0f, 0.0f, 0.0f);
1056 	ctx.expectError(GL_INVALID_OPERATION);
1057 
1058 	ctx.glUseProgram(program.getProgram());
1059 	ctx.glUniform1f(-1, 0.0f);
1060 	ctx.expectError(GL_NO_ERROR);
1061 	ctx.glUniform2f(-1, 0.0f, 0.0f);
1062 	ctx.expectError(GL_NO_ERROR);
1063 	ctx.glUniform3f(-1, 0.0f, 0.0f, 0.0f);
1064 	ctx.expectError(GL_NO_ERROR);
1065 	ctx.glUniform4f(-1, 0.0f, 0.0f, 0.0f, 0.0f);
1066 	ctx.expectError(GL_NO_ERROR);
1067 	ctx.endSection();
1068 
1069 	ctx.glUseProgram(0);
1070 }
1071 
1072 // ctx.glUniform*fv
1073 
uniformfv_invalid_program(NegativeTestContext & ctx)1074 void uniformfv_invalid_program (NegativeTestContext& ctx)
1075 {
1076 	std::vector<GLfloat> data(4);
1077 
1078 	ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
1079 	ctx.glUseProgram(0);
1080 	ctx.glUniform1fv(-1, 1, &data[0]);
1081 	ctx.expectError(GL_INVALID_OPERATION);
1082 	ctx.glUniform2fv(-1, 1, &data[0]);
1083 	ctx.expectError(GL_INVALID_OPERATION);
1084 	ctx.glUniform3fv(-1, 1, &data[0]);
1085 	ctx.expectError(GL_INVALID_OPERATION);
1086 	ctx.glUniform4fv(-1, 1, &data[0]);
1087 	ctx.expectError(GL_INVALID_OPERATION);
1088 	ctx.endSection();
1089 }
1090 
uniformfv_incompatible_type(NegativeTestContext & ctx)1091 void uniformfv_incompatible_type (NegativeTestContext& ctx)
1092 {
1093 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1094 
1095 	ctx.glUseProgram(program.getProgram());
1096 	GLint vec4_v	= ctx.glGetUniformLocation(program.getProgram(), "vec4_v");	// vec4
1097 	GLint ivec4_f	= ctx.glGetUniformLocation(program.getProgram(), "ivec4_f");	// ivec4
1098 	GLint uvec4_f	= ctx.glGetUniformLocation(program.getProgram(), "uvec4_f");	// uvec4
1099 	GLint sampler_f	= ctx.glGetUniformLocation(program.getProgram(), "sampler_f");	// sampler2D
1100 	ctx.expectError(GL_NO_ERROR);
1101 
1102 	if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1103 	{
1104 		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1105 		ctx.fail("Failed to retrieve uniform location");
1106 	}
1107 
1108 	std::vector<GLfloat> data(4);
1109 
1110 	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.");
1111 	ctx.glUseProgram(program.getProgram());
1112 	ctx.glUniform1fv(vec4_v, 1, &data[0]);
1113 	ctx.expectError(GL_INVALID_OPERATION);
1114 	ctx.glUniform2fv(vec4_v, 1, &data[0]);
1115 	ctx.expectError(GL_INVALID_OPERATION);
1116 	ctx.glUniform3fv(vec4_v, 1, &data[0]);
1117 	ctx.expectError(GL_INVALID_OPERATION);
1118 	ctx.glUniform4fv(vec4_v, 1, &data[0]);
1119 	ctx.expectError(GL_NO_ERROR);
1120 	ctx.endSection();
1121 
1122 	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.");
1123 	ctx.glUseProgram(program.getProgram());
1124 	ctx.glUniform4fv(ivec4_f, 1, &data[0]);
1125 	ctx.expectError(GL_INVALID_OPERATION);
1126 	ctx.glUniform4fv(uvec4_f, 1, &data[0]);
1127 	ctx.expectError(GL_INVALID_OPERATION);
1128 	ctx.endSection();
1129 
1130 	ctx.beginSection("GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than ctx.glUniform1i and ctx.glUniform1iv.");
1131 	ctx.glUseProgram(program.getProgram());
1132 	ctx.glUniform1fv(sampler_f, 1, &data[0]);
1133 	ctx.expectError(GL_INVALID_OPERATION);
1134 	ctx.endSection();
1135 
1136 	ctx.glUseProgram(0);
1137 }
1138 
uniformfv_invalid_location(NegativeTestContext & ctx)1139 void uniformfv_invalid_location (NegativeTestContext& ctx)
1140 {
1141 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1142 
1143 	ctx.glUseProgram(program.getProgram());
1144 	ctx.expectError(GL_NO_ERROR);
1145 
1146 	std::vector<GLfloat> data(4);
1147 
1148 	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.");
1149 	ctx.glUseProgram(program.getProgram());
1150 	ctx.glUniform1fv(-2, 1, &data[0]);
1151 	ctx.expectError(GL_INVALID_OPERATION);
1152 	ctx.glUniform2fv(-2, 1, &data[0]);
1153 	ctx.expectError(GL_INVALID_OPERATION);
1154 	ctx.glUniform3fv(-2, 1, &data[0]);
1155 	ctx.expectError(GL_INVALID_OPERATION);
1156 	ctx.glUniform4fv(-2, 1, &data[0]);
1157 	ctx.expectError(GL_INVALID_OPERATION);
1158 
1159 	ctx.glUseProgram(program.getProgram());
1160 	ctx.glUniform1fv(-1, 1, &data[0]);
1161 	ctx.expectError(GL_NO_ERROR);
1162 	ctx.glUniform2fv(-1, 1, &data[0]);
1163 	ctx.expectError(GL_NO_ERROR);
1164 	ctx.glUniform3fv(-1, 1, &data[0]);
1165 	ctx.expectError(GL_NO_ERROR);
1166 	ctx.glUniform4fv(-1, 1, &data[0]);
1167 	ctx.expectError(GL_NO_ERROR);
1168 	ctx.endSection();
1169 
1170 	ctx.glUseProgram(0);
1171 }
1172 
uniformfv_invalid_count(NegativeTestContext & ctx)1173 void uniformfv_invalid_count (NegativeTestContext& ctx)
1174 {
1175 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1176 
1177 	ctx.glUseProgram	(program.getProgram());
1178 	GLint vec4_v			= ctx.glGetUniformLocation(program.getProgram(), "vec4_v");	// vec4
1179 	ctx.expectError(GL_NO_ERROR);
1180 
1181 	if (vec4_v == -1)
1182 	{
1183 		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1184 		ctx.fail("Failed to retrieve uniform location");
1185 	}
1186 
1187 	std::vector<GLfloat> data(8);
1188 
1189 	ctx.beginSection("GL_INVALID_OPERATION is generated if count is greater than 1 and the indicated uniform variable is not an array variable.");
1190 	ctx.glUseProgram(program.getProgram());
1191 	ctx.glUniform1fv(vec4_v, 2, &data[0]);
1192 	ctx.expectError(GL_INVALID_OPERATION);
1193 	ctx.glUniform2fv(vec4_v, 2, &data[0]);
1194 	ctx.expectError(GL_INVALID_OPERATION);
1195 	ctx.glUniform3fv(vec4_v, 2, &data[0]);
1196 	ctx.expectError(GL_INVALID_OPERATION);
1197 	ctx.glUniform4fv(vec4_v, 2, &data[0]);
1198 	ctx.expectError(GL_INVALID_OPERATION);
1199 	ctx.endSection();
1200 
1201 	ctx.glUseProgram(0);
1202 }
1203 
1204 // ctx.glUniform*i
1205 
uniformi_invalid_program(NegativeTestContext & ctx)1206 void uniformi_invalid_program (NegativeTestContext& ctx)
1207 {
1208 	ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
1209 	ctx.glUseProgram(0);
1210 	ctx.glUniform1i(-1, 0);
1211 	ctx.expectError(GL_INVALID_OPERATION);
1212 	ctx.glUniform2i(-1, 0, 0);
1213 	ctx.expectError(GL_INVALID_OPERATION);
1214 	ctx.glUniform3i(-1, 0, 0, 0);
1215 	ctx.expectError(GL_INVALID_OPERATION);
1216 	ctx.glUniform4i(-1, 0, 0, 0, 0);
1217 	ctx.expectError(GL_INVALID_OPERATION);
1218 	ctx.endSection();
1219 }
1220 
uniformi_incompatible_type(NegativeTestContext & ctx)1221 void uniformi_incompatible_type (NegativeTestContext& ctx)
1222 {
1223 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1224 
1225 	ctx.glUseProgram(program.getProgram());
1226 	GLint vec4_v	= ctx.glGetUniformLocation(program.getProgram(), "vec4_v");	// vec4
1227 	GLint ivec4_f	= ctx.glGetUniformLocation(program.getProgram(), "ivec4_f");	// ivec4
1228 	GLint uvec4_f	= ctx.glGetUniformLocation(program.getProgram(), "uvec4_f");	// uvec4
1229 	GLint sampler_f	= ctx.glGetUniformLocation(program.getProgram(), "sampler_f");	// sampler2D
1230 	ctx.expectError(GL_NO_ERROR);
1231 
1232 	if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1233 	{
1234 		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1235 		ctx.fail("Failed to retrieve uniform location");
1236 	}
1237 
1238 	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.");
1239 	ctx.glUseProgram(program.getProgram());
1240 	ctx.glUniform1i(ivec4_f, 0);
1241 	ctx.expectError(GL_INVALID_OPERATION);
1242 	ctx.glUniform2i(ivec4_f, 0, 0);
1243 	ctx.expectError(GL_INVALID_OPERATION);
1244 	ctx.glUniform3i(ivec4_f, 0, 0, 0);
1245 	ctx.expectError(GL_INVALID_OPERATION);
1246 	ctx.glUniform4i(ivec4_f, 0, 0, 0, 0);
1247 	ctx.expectError(GL_NO_ERROR);
1248 	ctx.endSection();
1249 
1250 	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.");
1251 	ctx.glUseProgram(program.getProgram());
1252 	ctx.glUniform1i(uvec4_f, 0);
1253 	ctx.expectError(GL_INVALID_OPERATION);
1254 	ctx.glUniform2i(uvec4_f, 0, 0);
1255 	ctx.expectError(GL_INVALID_OPERATION);
1256 	ctx.glUniform3i(uvec4_f, 0, 0, 0);
1257 	ctx.expectError(GL_INVALID_OPERATION);
1258 	ctx.glUniform4i(uvec4_f, 0, 0, 0, 0);
1259 	ctx.expectError(GL_INVALID_OPERATION);
1260 	ctx.endSection();
1261 
1262 	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.");
1263 	ctx.glUseProgram(program.getProgram());
1264 	ctx.glUniform1i(vec4_v, 0);
1265 	ctx.expectError(GL_INVALID_OPERATION);
1266 	ctx.glUniform2i(vec4_v, 0, 0);
1267 	ctx.expectError(GL_INVALID_OPERATION);
1268 	ctx.glUniform3i(vec4_v, 0, 0, 0);
1269 	ctx.expectError(GL_INVALID_OPERATION);
1270 	ctx.glUniform4i(vec4_v, 0, 0, 0, 0);
1271 	ctx.expectError(GL_INVALID_OPERATION);
1272 	ctx.endSection();
1273 
1274 	ctx.glUseProgram(0);
1275 }
1276 
uniformi_invalid_location(NegativeTestContext & ctx)1277 void uniformi_invalid_location (NegativeTestContext& ctx)
1278 {
1279 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1280 
1281 	ctx.glUseProgram(program.getProgram());
1282 	ctx.expectError(GL_NO_ERROR);
1283 
1284 	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.");
1285 	ctx.glUseProgram(program.getProgram());
1286 	ctx.glUniform1i(-2, 0);
1287 	ctx.expectError(GL_INVALID_OPERATION);
1288 	ctx.glUniform2i(-2, 0, 0);
1289 	ctx.expectError(GL_INVALID_OPERATION);
1290 	ctx.glUniform3i(-2, 0, 0, 0);
1291 	ctx.expectError(GL_INVALID_OPERATION);
1292 	ctx.glUniform4i(-2, 0, 0, 0, 0);
1293 	ctx.expectError(GL_INVALID_OPERATION);
1294 
1295 	ctx.glUseProgram(program.getProgram());
1296 	ctx.glUniform1i(-1, 0);
1297 	ctx.expectError(GL_NO_ERROR);
1298 	ctx.glUniform2i(-1, 0, 0);
1299 	ctx.expectError(GL_NO_ERROR);
1300 	ctx.glUniform3i(-1, 0, 0, 0);
1301 	ctx.expectError(GL_NO_ERROR);
1302 	ctx.glUniform4i(-1, 0, 0, 0, 0);
1303 	ctx.expectError(GL_NO_ERROR);
1304 	ctx.endSection();
1305 
1306 	ctx.glUseProgram(0);
1307 }
1308 
1309 // ctx.glUniform*iv
1310 
uniformiv_invalid_program(NegativeTestContext & ctx)1311 void uniformiv_invalid_program (NegativeTestContext& ctx)
1312 {
1313 	std::vector<GLint> data(4);
1314 
1315 	ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
1316 	ctx.glUseProgram(0);
1317 	ctx.glUniform1iv(-1, 1, &data[0]);
1318 	ctx.expectError(GL_INVALID_OPERATION);
1319 	ctx.glUniform2iv(-1, 1, &data[0]);
1320 	ctx.expectError(GL_INVALID_OPERATION);
1321 	ctx.glUniform3iv(-1, 1, &data[0]);
1322 	ctx.expectError(GL_INVALID_OPERATION);
1323 	ctx.glUniform4iv(-1, 1, &data[0]);
1324 	ctx.expectError(GL_INVALID_OPERATION);
1325 	ctx.endSection();
1326 }
1327 
uniformiv_incompatible_type(NegativeTestContext & ctx)1328 void uniformiv_incompatible_type (NegativeTestContext& ctx)
1329 {
1330 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1331 
1332 	ctx.glUseProgram(program.getProgram());
1333 	GLint vec4_v	= ctx.glGetUniformLocation(program.getProgram(), "vec4_v");	// vec4
1334 	GLint ivec4_f	= ctx.glGetUniformLocation(program.getProgram(), "ivec4_f");	// ivec4
1335 	GLint uvec4_f	= ctx.glGetUniformLocation(program.getProgram(), "uvec4_f");	// uvec4
1336 	GLint sampler_f	= ctx.glGetUniformLocation(program.getProgram(), "sampler_f");	// sampler2D
1337 	ctx.expectError(GL_NO_ERROR);
1338 
1339 	if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1340 	{
1341 		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1342 		ctx.fail("Failed to retrieve uniform location");
1343 	}
1344 
1345 	std::vector<GLint> data(4);
1346 
1347 	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.");
1348 	ctx.glUseProgram(program.getProgram());
1349 	ctx.glUniform1iv(ivec4_f, 1, &data[0]);
1350 	ctx.expectError(GL_INVALID_OPERATION);
1351 	ctx.glUniform2iv(ivec4_f, 1, &data[0]);
1352 	ctx.expectError(GL_INVALID_OPERATION);
1353 	ctx.glUniform3iv(ivec4_f, 1, &data[0]);
1354 	ctx.expectError(GL_INVALID_OPERATION);
1355 	ctx.glUniform4iv(ivec4_f, 1, &data[0]);
1356 	ctx.expectError(GL_NO_ERROR);
1357 	ctx.endSection();
1358 
1359 	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.");
1360 	ctx.glUseProgram(program.getProgram());
1361 	ctx.glUniform1iv(vec4_v, 1, &data[0]);
1362 	ctx.expectError(GL_INVALID_OPERATION);
1363 	ctx.glUniform2iv(vec4_v, 1, &data[0]);
1364 	ctx.expectError(GL_INVALID_OPERATION);
1365 	ctx.glUniform3iv(vec4_v, 1, &data[0]);
1366 	ctx.expectError(GL_INVALID_OPERATION);
1367 	ctx.glUniform4iv(vec4_v, 1, &data[0]);
1368 	ctx.expectError(GL_INVALID_OPERATION);
1369 	ctx.endSection();
1370 
1371 	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.");
1372 	ctx.glUseProgram(program.getProgram());
1373 	ctx.glUniform1iv(uvec4_f, 1, &data[0]);
1374 	ctx.expectError(GL_INVALID_OPERATION);
1375 	ctx.glUniform2iv(uvec4_f, 1, &data[0]);
1376 	ctx.expectError(GL_INVALID_OPERATION);
1377 	ctx.glUniform3iv(uvec4_f, 1, &data[0]);
1378 	ctx.expectError(GL_INVALID_OPERATION);
1379 	ctx.glUniform4iv(uvec4_f, 1, &data[0]);
1380 	ctx.expectError(GL_INVALID_OPERATION);
1381 	ctx.endSection();
1382 
1383 	ctx.glUseProgram(0);
1384 }
1385 
uniformiv_invalid_location(NegativeTestContext & ctx)1386 void uniformiv_invalid_location (NegativeTestContext& ctx)
1387 {
1388 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1389 
1390 	ctx.glUseProgram(program.getProgram());
1391 	ctx.expectError(GL_NO_ERROR);
1392 
1393 	std::vector<GLint> data(4);
1394 
1395 	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.");
1396 	ctx.glUseProgram(program.getProgram());
1397 	ctx.glUniform1iv(-2, 1, &data[0]);
1398 	ctx.expectError(GL_INVALID_OPERATION);
1399 	ctx.glUniform2iv(-2, 1, &data[0]);
1400 	ctx.expectError(GL_INVALID_OPERATION);
1401 	ctx.glUniform3iv(-2, 1, &data[0]);
1402 	ctx.expectError(GL_INVALID_OPERATION);
1403 	ctx.glUniform4iv(-2, 1, &data[0]);
1404 	ctx.expectError(GL_INVALID_OPERATION);
1405 
1406 	ctx.glUseProgram(program.getProgram());
1407 	ctx.glUniform1iv(-1, 1, &data[0]);
1408 	ctx.expectError(GL_NO_ERROR);
1409 	ctx.glUniform2iv(-1, 1, &data[0]);
1410 	ctx.expectError(GL_NO_ERROR);
1411 	ctx.glUniform3iv(-1, 1, &data[0]);
1412 	ctx.expectError(GL_NO_ERROR);
1413 	ctx.glUniform4iv(-1, 1, &data[0]);
1414 	ctx.expectError(GL_NO_ERROR);
1415 	ctx.endSection();
1416 
1417 	ctx.glUseProgram(0);
1418 }
1419 
uniformiv_invalid_count(NegativeTestContext & ctx)1420 void uniformiv_invalid_count (NegativeTestContext& ctx)
1421 {
1422 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1423 
1424 	ctx.glUseProgram			(program.getProgram());
1425 	GLint ivec4_f			= ctx.glGetUniformLocation(program.getProgram(), "ivec4_f"); // ivec4
1426 	ctx.expectError(GL_NO_ERROR);
1427 
1428 	if (ivec4_f == -1)
1429 	{
1430 		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1431 		ctx.fail("Failed to retrieve uniform location");
1432 	}
1433 
1434 	std::vector<GLint> data(8);
1435 
1436 	ctx.beginSection("GL_INVALID_OPERATION is generated if count is greater than 1 and the indicated uniform variable is not an array variable.");
1437 	ctx.glUseProgram(program.getProgram());
1438 	ctx.glUniform1iv(ivec4_f, 2, &data[0]);
1439 	ctx.expectError(GL_INVALID_OPERATION);
1440 	ctx.glUniform2iv(ivec4_f, 2, &data[0]);
1441 	ctx.expectError(GL_INVALID_OPERATION);
1442 	ctx.glUniform3iv(ivec4_f, 2, &data[0]);
1443 	ctx.expectError(GL_INVALID_OPERATION);
1444 	ctx.glUniform4iv(ivec4_f, 2, &data[0]);
1445 	ctx.expectError(GL_INVALID_OPERATION);
1446 	ctx.endSection();
1447 
1448 	ctx.glUseProgram(0);
1449 }
1450 
1451 // ctx.glUniform{1234}ui
1452 
uniformui_invalid_program(NegativeTestContext & ctx)1453 void uniformui_invalid_program (NegativeTestContext& ctx)
1454 {
1455 	ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
1456 	ctx.glUseProgram(0);
1457 	ctx.glUniform1ui(-1, 0);
1458 	ctx.expectError(GL_INVALID_OPERATION);
1459 	ctx.glUniform2ui(-1, 0, 0);
1460 	ctx.expectError(GL_INVALID_OPERATION);
1461 	ctx.glUniform3ui(-1, 0, 0, 0);
1462 	ctx.expectError(GL_INVALID_OPERATION);
1463 	ctx.glUniform4ui(-1, 0, 0, 0, 0);
1464 	ctx.expectError(GL_INVALID_OPERATION);
1465 	ctx.endSection();
1466 }
1467 
uniformui_incompatible_type(NegativeTestContext & ctx)1468 void uniformui_incompatible_type (NegativeTestContext& ctx)
1469 {
1470 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1471 
1472 	ctx.glUseProgram(program.getProgram());
1473 	GLint vec4_v	= ctx.glGetUniformLocation(program.getProgram(), "vec4_v");	// vec4
1474 	GLint ivec4_f	= ctx.glGetUniformLocation(program.getProgram(), "ivec4_f");	// ivec4
1475 	GLint uvec4_f	= ctx.glGetUniformLocation(program.getProgram(), "uvec4_f");	// uvec4
1476 	GLint sampler_f	= ctx.glGetUniformLocation(program.getProgram(), "sampler_f");	// sampler2D
1477 	ctx.expectError(GL_NO_ERROR);
1478 
1479 	if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1480 	{
1481 		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1482 		ctx.fail("Failed to retrieve uniform location");
1483 	}
1484 
1485 	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.");
1486 	ctx.glUseProgram(program.getProgram());
1487 	ctx.glUniform1ui(uvec4_f, 0);
1488 	ctx.expectError(GL_INVALID_OPERATION);
1489 	ctx.glUniform2ui(uvec4_f, 0, 0);
1490 	ctx.expectError(GL_INVALID_OPERATION);
1491 	ctx.glUniform3ui(uvec4_f, 0, 0, 0);
1492 	ctx.expectError(GL_INVALID_OPERATION);
1493 	ctx.glUniform4ui(uvec4_f, 0, 0, 0, 0);
1494 	ctx.expectError(GL_NO_ERROR);
1495 	ctx.endSection();
1496 
1497 	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.");
1498 	ctx.glUseProgram(program.getProgram());
1499 	ctx.glUniform1ui(ivec4_f, 0);
1500 	ctx.expectError(GL_INVALID_OPERATION);
1501 	ctx.glUniform2ui(ivec4_f, 0, 0);
1502 	ctx.expectError(GL_INVALID_OPERATION);
1503 	ctx.glUniform3ui(ivec4_f, 0, 0, 0);
1504 	ctx.expectError(GL_INVALID_OPERATION);
1505 	ctx.glUniform4ui(ivec4_f, 0, 0, 0, 0);
1506 	ctx.expectError(GL_INVALID_OPERATION);
1507 	ctx.endSection();
1508 
1509 	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.");
1510 	ctx.glUseProgram(program.getProgram());
1511 	ctx.glUniform1ui(vec4_v, 0);
1512 	ctx.expectError(GL_INVALID_OPERATION);
1513 	ctx.glUniform2ui(vec4_v, 0, 0);
1514 	ctx.expectError(GL_INVALID_OPERATION);
1515 	ctx.glUniform3ui(vec4_v, 0, 0, 0);
1516 	ctx.expectError(GL_INVALID_OPERATION);
1517 	ctx.glUniform4ui(vec4_v, 0, 0, 0, 0);
1518 	ctx.expectError(GL_INVALID_OPERATION);
1519 	ctx.endSection();
1520 
1521 	ctx.beginSection("GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than ctx.glUniform1i and ctx.glUniform1iv.");
1522 	ctx.glUseProgram(program.getProgram());
1523 	ctx.glUniform1ui(sampler_f, 0);
1524 	ctx.expectError(GL_INVALID_OPERATION);
1525 	ctx.endSection();
1526 
1527 	ctx.glUseProgram(0);
1528 }
1529 
uniformui_invalid_location(NegativeTestContext & ctx)1530 void uniformui_invalid_location (NegativeTestContext& ctx)
1531 {
1532 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1533 
1534 	ctx.glUseProgram(program.getProgram());
1535 	ctx.expectError(GL_NO_ERROR);
1536 
1537 	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.");
1538 	ctx.glUseProgram(program.getProgram());
1539 	ctx.glUniform1i(-2, 0);
1540 	ctx.expectError(GL_INVALID_OPERATION);
1541 	ctx.glUniform2i(-2, 0, 0);
1542 	ctx.expectError(GL_INVALID_OPERATION);
1543 	ctx.glUniform3i(-2, 0, 0, 0);
1544 	ctx.expectError(GL_INVALID_OPERATION);
1545 	ctx.glUniform4i(-2, 0, 0, 0, 0);
1546 	ctx.expectError(GL_INVALID_OPERATION);
1547 
1548 	ctx.glUseProgram(program.getProgram());
1549 	ctx.glUniform1i(-1, 0);
1550 	ctx.expectError(GL_NO_ERROR);
1551 	ctx.glUniform2i(-1, 0, 0);
1552 	ctx.expectError(GL_NO_ERROR);
1553 	ctx.glUniform3i(-1, 0, 0, 0);
1554 	ctx.expectError(GL_NO_ERROR);
1555 	ctx.glUniform4i(-1, 0, 0, 0, 0);
1556 	ctx.expectError(GL_NO_ERROR);
1557 	ctx.endSection();
1558 
1559 	ctx.glUseProgram(0);
1560 }
1561 
1562 // ctx.glUniform{1234}uiv
1563 
uniformuiv_invalid_program(NegativeTestContext & ctx)1564 void uniformuiv_invalid_program (NegativeTestContext& ctx)
1565 {
1566 	std::vector<GLuint> data(4);
1567 
1568 	ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
1569 	ctx.glUseProgram(0);
1570 	ctx.glUniform1uiv(-1, 1, &data[0]);
1571 	ctx.expectError(GL_INVALID_OPERATION);
1572 	ctx.glUniform2uiv(-1, 1, &data[0]);
1573 	ctx.expectError(GL_INVALID_OPERATION);
1574 	ctx.glUniform3uiv(-1, 1, &data[0]);
1575 	ctx.expectError(GL_INVALID_OPERATION);
1576 	ctx.glUniform4uiv(-1, 1, &data[0]);
1577 	ctx.expectError(GL_INVALID_OPERATION);
1578 	ctx.endSection();
1579 }
1580 
uniformuiv_incompatible_type(NegativeTestContext & ctx)1581 void uniformuiv_incompatible_type (NegativeTestContext& ctx)
1582 {
1583 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1584 
1585 	ctx.glUseProgram(program.getProgram());
1586 	GLint vec4_v	= ctx.glGetUniformLocation(program.getProgram(), "vec4_v");	// vec4
1587 	GLint ivec4_f	= ctx.glGetUniformLocation(program.getProgram(), "ivec4_f");	// ivec4
1588 	GLint uvec4_f	= ctx.glGetUniformLocation(program.getProgram(), "uvec4_f");	// uvec4
1589 	GLint sampler_f	= ctx.glGetUniformLocation(program.getProgram(), "sampler_f");	// sampler2D
1590 	ctx.expectError(GL_NO_ERROR);
1591 
1592 	if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1593 	{
1594 		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1595 		ctx.fail("Failed to retrieve uniform location");
1596 	}
1597 
1598 	std::vector<GLuint> data(4);
1599 
1600 	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.");
1601 	ctx.glUseProgram(program.getProgram());
1602 	ctx.glUniform1uiv(uvec4_f, 1, &data[0]);
1603 	ctx.expectError(GL_INVALID_OPERATION);
1604 	ctx.glUniform2uiv(uvec4_f, 1, &data[0]);
1605 	ctx.expectError(GL_INVALID_OPERATION);
1606 	ctx.glUniform3uiv(uvec4_f, 1, &data[0]);
1607 	ctx.expectError(GL_INVALID_OPERATION);
1608 	ctx.glUniform4uiv(uvec4_f, 1, &data[0]);
1609 	ctx.expectError(GL_NO_ERROR);
1610 	ctx.endSection();
1611 
1612 	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.");
1613 	ctx.glUseProgram(program.getProgram());
1614 	ctx.glUniform1uiv(vec4_v, 1, &data[0]);
1615 	ctx.expectError(GL_INVALID_OPERATION);
1616 	ctx.glUniform2uiv(vec4_v, 1, &data[0]);
1617 	ctx.expectError(GL_INVALID_OPERATION);
1618 	ctx.glUniform3uiv(vec4_v, 1, &data[0]);
1619 	ctx.expectError(GL_INVALID_OPERATION);
1620 	ctx.glUniform4uiv(vec4_v, 1, &data[0]);
1621 	ctx.expectError(GL_INVALID_OPERATION);
1622 	ctx.endSection();
1623 
1624 	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.");
1625 	ctx.glUseProgram(program.getProgram());
1626 	ctx.glUniform1uiv(ivec4_f, 1, &data[0]);
1627 	ctx.expectError(GL_INVALID_OPERATION);
1628 	ctx.glUniform2uiv(ivec4_f, 1, &data[0]);
1629 	ctx.expectError(GL_INVALID_OPERATION);
1630 	ctx.glUniform3uiv(ivec4_f, 1, &data[0]);
1631 	ctx.expectError(GL_INVALID_OPERATION);
1632 	ctx.glUniform4uiv(ivec4_f, 1, &data[0]);
1633 	ctx.expectError(GL_INVALID_OPERATION);
1634 	ctx.endSection();
1635 
1636 	ctx.beginSection("GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than ctx.glUniform1i and ctx.glUniform1iv.");
1637 	ctx.glUseProgram(program.getProgram());
1638 	ctx.glUniform1uiv(sampler_f, 1, &data[0]);
1639 	ctx.expectError(GL_INVALID_OPERATION);
1640 	ctx.endSection();
1641 
1642 	ctx.glUseProgram(0);
1643 }
1644 
uniformuiv_invalid_location(NegativeTestContext & ctx)1645 void uniformuiv_invalid_location (NegativeTestContext& ctx)
1646 {
1647 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1648 
1649 	ctx.glUseProgram(program.getProgram());
1650 	ctx.expectError(GL_NO_ERROR);
1651 
1652 	std::vector<GLuint> data(4);
1653 
1654 	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.");
1655 	ctx.glUseProgram(program.getProgram());
1656 	ctx.glUniform1uiv(-2, 1, &data[0]);
1657 	ctx.expectError(GL_INVALID_OPERATION);
1658 	ctx.glUniform2uiv(-2, 1, &data[0]);
1659 	ctx.expectError(GL_INVALID_OPERATION);
1660 	ctx.glUniform3uiv(-2, 1, &data[0]);
1661 	ctx.expectError(GL_INVALID_OPERATION);
1662 	ctx.glUniform4uiv(-2, 1, &data[0]);
1663 	ctx.expectError(GL_INVALID_OPERATION);
1664 
1665 	ctx.glUseProgram(program.getProgram());
1666 	ctx.glUniform1uiv(-1, 1, &data[0]);
1667 	ctx.expectError(GL_NO_ERROR);
1668 	ctx.glUniform2uiv(-1, 1, &data[0]);
1669 	ctx.expectError(GL_NO_ERROR);
1670 	ctx.glUniform3uiv(-1, 1, &data[0]);
1671 	ctx.expectError(GL_NO_ERROR);
1672 	ctx.glUniform4uiv(-1, 1, &data[0]);
1673 	ctx.expectError(GL_NO_ERROR);
1674 	ctx.endSection();
1675 
1676 	ctx.glUseProgram(0);
1677 }
1678 
uniformuiv_invalid_count(NegativeTestContext & ctx)1679 void uniformuiv_invalid_count (NegativeTestContext& ctx)
1680 {
1681 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1682 
1683 	ctx.glUseProgram			(program.getProgram());
1684 	int uvec4_f				= ctx.glGetUniformLocation(program.getProgram(), "uvec4_f"); // uvec4
1685 	ctx.expectError(GL_NO_ERROR);
1686 
1687 	if (uvec4_f == -1)
1688 	{
1689 		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1690 		ctx.fail("Failed to retrieve uniform location");
1691 	}
1692 
1693 	std::vector<GLuint> data(8);
1694 
1695 	ctx.beginSection("GL_INVALID_OPERATION is generated if count is greater than 1 and the indicated uniform variable is not an array variable.");
1696 	ctx.glUseProgram(program.getProgram());
1697 	ctx.glUniform1uiv(uvec4_f, 2, &data[0]);
1698 	ctx.expectError(GL_INVALID_OPERATION);
1699 	ctx.glUniform2uiv(uvec4_f, 2, &data[0]);
1700 	ctx.expectError(GL_INVALID_OPERATION);
1701 	ctx.glUniform3uiv(uvec4_f, 2, &data[0]);
1702 	ctx.expectError(GL_INVALID_OPERATION);
1703 	ctx.glUniform4uiv(uvec4_f, 2, &data[0]);
1704 	ctx.expectError(GL_INVALID_OPERATION);
1705 	ctx.endSection();
1706 
1707 	ctx.glUseProgram(0);
1708 }
1709 
1710 
1711 // ctx.glUniformMatrix*fv
1712 
uniform_matrixfv_invalid_program(NegativeTestContext & ctx)1713 void uniform_matrixfv_invalid_program (NegativeTestContext& ctx)
1714 {
1715 	std::vector<GLfloat> data(16);
1716 
1717 	ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
1718 	ctx.glUseProgram(0);
1719 	ctx.glUniformMatrix2fv(-1, 1, GL_FALSE, &data[0]);
1720 	ctx.expectError(GL_INVALID_OPERATION);
1721 	ctx.glUniformMatrix3fv(-1, 1, GL_FALSE, &data[0]);
1722 	ctx.expectError(GL_INVALID_OPERATION);
1723 	ctx.glUniformMatrix4fv(-1, 1, GL_FALSE, &data[0]);
1724 	ctx.expectError(GL_INVALID_OPERATION);
1725 
1726 	ctx.glUniformMatrix2x3fv(-1, 1, GL_FALSE, &data[0]);
1727 	ctx.expectError(GL_INVALID_OPERATION);
1728 	ctx.glUniformMatrix3x2fv(-1, 1, GL_FALSE, &data[0]);
1729 	ctx.expectError(GL_INVALID_OPERATION);
1730 	ctx.glUniformMatrix2x4fv(-1, 1, GL_FALSE, &data[0]);
1731 	ctx.expectError(GL_INVALID_OPERATION);
1732 	ctx.glUniformMatrix4x2fv(-1, 1, GL_FALSE, &data[0]);
1733 	ctx.expectError(GL_INVALID_OPERATION);
1734 	ctx.glUniformMatrix3x4fv(-1, 1, GL_FALSE, &data[0]);
1735 	ctx.expectError(GL_INVALID_OPERATION);
1736 	ctx.glUniformMatrix4x3fv(-1, 1, GL_FALSE, &data[0]);
1737 	ctx.expectError(GL_INVALID_OPERATION);
1738 	ctx.endSection();
1739 }
1740 
uniform_matrixfv_incompatible_type(NegativeTestContext & ctx)1741 void uniform_matrixfv_incompatible_type (NegativeTestContext& ctx)
1742 {
1743 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1744 
1745 	ctx.glUseProgram			(program.getProgram());
1746 	GLint mat4_v			= ctx.glGetUniformLocation(program.getProgram(), "mat4_v");	// mat4
1747 	GLint sampler_f			= ctx.glGetUniformLocation(program.getProgram(), "sampler_f");	// sampler2D
1748 	ctx.expectError(GL_NO_ERROR);
1749 
1750 	if (mat4_v == -1 || sampler_f == -1)
1751 	{
1752 		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1753 		ctx.fail("Failed to retrieve uniform location");
1754 	}
1755 
1756 	std::vector<GLfloat> data(16);
1757 
1758 	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.");
1759 	ctx.glUseProgram(program.getProgram());
1760 	ctx.glUniformMatrix2fv(mat4_v, 1, GL_FALSE, &data[0]);
1761 	ctx.expectError(GL_INVALID_OPERATION);
1762 	ctx.glUniformMatrix3fv(mat4_v, 1, GL_FALSE, &data[0]);
1763 	ctx.expectError(GL_INVALID_OPERATION);
1764 	ctx.glUniformMatrix4fv(mat4_v, 1, GL_FALSE, &data[0]);
1765 	ctx.expectError(GL_NO_ERROR);
1766 
1767 	ctx.glUniformMatrix2x3fv(mat4_v, 1, GL_FALSE, &data[0]);
1768 	ctx.expectError(GL_INVALID_OPERATION);
1769 	ctx.glUniformMatrix3x2fv(mat4_v, 1, GL_FALSE, &data[0]);
1770 	ctx.expectError(GL_INVALID_OPERATION);
1771 	ctx.glUniformMatrix2x4fv(mat4_v, 1, GL_FALSE, &data[0]);
1772 	ctx.expectError(GL_INVALID_OPERATION);
1773 	ctx.glUniformMatrix4x2fv(mat4_v, 1, GL_FALSE, &data[0]);
1774 	ctx.expectError(GL_INVALID_OPERATION);
1775 	ctx.glUniformMatrix3x4fv(mat4_v, 1, GL_FALSE, &data[0]);
1776 	ctx.expectError(GL_INVALID_OPERATION);
1777 	ctx.glUniformMatrix4x3fv(mat4_v, 1, GL_FALSE, &data[0]);
1778 	ctx.expectError(GL_INVALID_OPERATION);
1779 	ctx.endSection();
1780 
1781 	ctx.beginSection("GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than ctx.glUniform1i and ctx.glUniform1iv.");
1782 	ctx.glUseProgram(program.getProgram());
1783 	ctx.glUniformMatrix2fv(sampler_f, 1, GL_FALSE, &data[0]);
1784 	ctx.expectError(GL_INVALID_OPERATION);
1785 	ctx.glUniformMatrix3fv(sampler_f, 1, GL_FALSE, &data[0]);
1786 	ctx.expectError(GL_INVALID_OPERATION);
1787 	ctx.glUniformMatrix4fv(sampler_f, 1, GL_FALSE, &data[0]);
1788 	ctx.expectError(GL_INVALID_OPERATION);
1789 
1790 	ctx.glUniformMatrix2x3fv(sampler_f, 1, GL_FALSE, &data[0]);
1791 	ctx.expectError(GL_INVALID_OPERATION);
1792 	ctx.glUniformMatrix3x2fv(sampler_f, 1, GL_FALSE, &data[0]);
1793 	ctx.expectError(GL_INVALID_OPERATION);
1794 	ctx.glUniformMatrix2x4fv(sampler_f, 1, GL_FALSE, &data[0]);
1795 	ctx.expectError(GL_INVALID_OPERATION);
1796 	ctx.glUniformMatrix4x2fv(sampler_f, 1, GL_FALSE, &data[0]);
1797 	ctx.expectError(GL_INVALID_OPERATION);
1798 	ctx.glUniformMatrix3x4fv(sampler_f, 1, GL_FALSE, &data[0]);
1799 	ctx.expectError(GL_INVALID_OPERATION);
1800 	ctx.glUniformMatrix4x3fv(sampler_f, 1, GL_FALSE, &data[0]);
1801 	ctx.expectError(GL_INVALID_OPERATION);
1802 	ctx.endSection();
1803 
1804 	ctx.glUseProgram(0);
1805 }
1806 
uniform_matrixfv_invalid_location(NegativeTestContext & ctx)1807 void uniform_matrixfv_invalid_location (NegativeTestContext& ctx)
1808 {
1809 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1810 
1811 	ctx.glUseProgram(program.getProgram());
1812 	ctx.expectError(GL_NO_ERROR);
1813 
1814 	std::vector<GLfloat> data(16);
1815 
1816 	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.");
1817 	ctx.glUseProgram(program.getProgram());
1818 	ctx.glUniformMatrix2fv(-2, 1, GL_FALSE, &data[0]);
1819 	ctx.expectError(GL_INVALID_OPERATION);
1820 	ctx.glUniformMatrix3fv(-2, 1, GL_FALSE, &data[0]);
1821 	ctx.expectError(GL_INVALID_OPERATION);
1822 	ctx.glUniformMatrix4fv(-2, 1, GL_FALSE, &data[0]);
1823 	ctx.expectError(GL_INVALID_OPERATION);
1824 
1825 	ctx.glUniformMatrix2x3fv(-2, 1, GL_FALSE, &data[0]);
1826 	ctx.expectError(GL_INVALID_OPERATION);
1827 	ctx.glUniformMatrix3x2fv(-2, 1, GL_FALSE, &data[0]);
1828 	ctx.expectError(GL_INVALID_OPERATION);
1829 	ctx.glUniformMatrix2x4fv(-2, 1, GL_FALSE, &data[0]);
1830 	ctx.expectError(GL_INVALID_OPERATION);
1831 	ctx.glUniformMatrix4x2fv(-2, 1, GL_FALSE, &data[0]);
1832 	ctx.expectError(GL_INVALID_OPERATION);
1833 	ctx.glUniformMatrix3x4fv(-2, 1, GL_FALSE, &data[0]);
1834 	ctx.expectError(GL_INVALID_OPERATION);
1835 	ctx.glUniformMatrix4x3fv(-2, 1, GL_FALSE, &data[0]);
1836 	ctx.expectError(GL_INVALID_OPERATION);
1837 
1838 	ctx.glUseProgram(program.getProgram());
1839 	ctx.glUniformMatrix2fv(-1, 1, GL_FALSE, &data[0]);
1840 	ctx.expectError(GL_NO_ERROR);
1841 	ctx.glUniformMatrix3fv(-1, 1, GL_FALSE, &data[0]);
1842 	ctx.expectError(GL_NO_ERROR);
1843 	ctx.glUniformMatrix4fv(-1, 1, GL_FALSE, &data[0]);
1844 	ctx.expectError(GL_NO_ERROR);
1845 
1846 	ctx.glUniformMatrix2x3fv(-1, 1, GL_FALSE, &data[0]);
1847 	ctx.expectError(GL_NO_ERROR);
1848 	ctx.glUniformMatrix3x2fv(-1, 1, GL_FALSE, &data[0]);
1849 	ctx.expectError(GL_NO_ERROR);
1850 	ctx.glUniformMatrix2x4fv(-1, 1, GL_FALSE, &data[0]);
1851 	ctx.expectError(GL_NO_ERROR);
1852 	ctx.glUniformMatrix4x2fv(-1, 1, GL_FALSE, &data[0]);
1853 	ctx.expectError(GL_NO_ERROR);
1854 	ctx.glUniformMatrix3x4fv(-1, 1, GL_FALSE, &data[0]);
1855 	ctx.expectError(GL_NO_ERROR);
1856 	ctx.glUniformMatrix4x3fv(-1, 1, GL_FALSE, &data[0]);
1857 	ctx.expectError(GL_NO_ERROR);
1858 	ctx.endSection();
1859 
1860 	ctx.glUseProgram(0);
1861 }
1862 
uniform_matrixfv_invalid_count(NegativeTestContext & ctx)1863 void uniform_matrixfv_invalid_count (NegativeTestContext& ctx)
1864 {
1865 	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1866 
1867 	ctx.glUseProgram			(program.getProgram());
1868 	GLint mat4_v			= ctx.glGetUniformLocation(program.getProgram(), "mat4_v"); // mat4
1869 	ctx.expectError(GL_NO_ERROR);
1870 
1871 	if (mat4_v == -1)
1872 	{
1873 		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1874 		ctx.fail("Failed to retrieve uniform location");
1875 	}
1876 
1877 	std::vector<GLfloat> data(32);
1878 
1879 	ctx.beginSection("GL_INVALID_OPERATION is generated if count is greater than 1 and the indicated uniform variable is not an array variable.");
1880 	ctx.glUseProgram(program.getProgram());
1881 	ctx.glUniformMatrix2fv(mat4_v, 2, GL_FALSE, &data[0]);
1882 	ctx.expectError(GL_INVALID_OPERATION);
1883 	ctx.glUniformMatrix3fv(mat4_v, 2, GL_FALSE, &data[0]);
1884 	ctx.expectError(GL_INVALID_OPERATION);
1885 	ctx.glUniformMatrix4fv(mat4_v, 2, GL_FALSE, &data[0]);
1886 	ctx.expectError(GL_INVALID_OPERATION);
1887 
1888 	ctx.glUniformMatrix2x3fv(mat4_v, 1, GL_FALSE, &data[0]);
1889 	ctx.expectError(GL_INVALID_OPERATION);
1890 	ctx.glUniformMatrix3x2fv(mat4_v, 1, GL_FALSE, &data[0]);
1891 	ctx.expectError(GL_INVALID_OPERATION);
1892 	ctx.glUniformMatrix2x4fv(mat4_v, 1, GL_FALSE, &data[0]);
1893 	ctx.expectError(GL_INVALID_OPERATION);
1894 	ctx.glUniformMatrix4x2fv(mat4_v, 1, GL_FALSE, &data[0]);
1895 	ctx.expectError(GL_INVALID_OPERATION);
1896 	ctx.glUniformMatrix3x4fv(mat4_v, 1, GL_FALSE, &data[0]);
1897 	ctx.expectError(GL_INVALID_OPERATION);
1898 	ctx.glUniformMatrix4x3fv(mat4_v, 1, GL_FALSE, &data[0]);
1899 	ctx.expectError(GL_INVALID_OPERATION);
1900 	ctx.endSection();
1901 
1902 	ctx.glUseProgram(0);
1903 }
1904 
1905 // Transform feedback
gen_transform_feedbacks(NegativeTestContext & ctx)1906 void gen_transform_feedbacks (NegativeTestContext& ctx)
1907 {
1908 	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
1909 	GLuint id = 0;
1910 	ctx.glGenTransformFeedbacks(-1, &id);
1911 	ctx.expectError(GL_INVALID_VALUE);
1912 	ctx.endSection();
1913 }
1914 
bind_transform_feedback(NegativeTestContext & ctx)1915 void bind_transform_feedback (NegativeTestContext& ctx)
1916 {
1917 	GLuint						tfID[2];
1918 	glu::ShaderProgram			program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
1919 	deUint32					buf = 0x1234;
1920 	const char* tfVarying		= "gl_Position";
1921 
1922 	ctx.glGenBuffers				(1, &buf);
1923 	ctx.glGenTransformFeedbacks		(2, tfID);
1924 
1925 	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_TRANSFORM_FEEDBACK.");
1926 	ctx.glBindTransformFeedback(-1, tfID[0]);
1927 	ctx.expectError(GL_INVALID_ENUM);
1928 	ctx.endSection();
1929 
1930 	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.");
1931 	ctx.glUseProgram				(program.getProgram());
1932 	ctx.glTransformFeedbackVaryings	(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
1933 	ctx.glLinkProgram				(program.getProgram());
1934 	ctx.glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID[0]);
1935 	ctx.glBindBuffer				(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
1936 	ctx.glBufferData				(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
1937 	ctx.glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
1938 	ctx.glBeginTransformFeedback	(GL_TRIANGLES);
1939 	ctx.expectError				(GL_NO_ERROR);
1940 
1941 	ctx.glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID[1]);
1942 	ctx.expectError				(GL_INVALID_OPERATION);
1943 
1944 	ctx.glEndTransformFeedback		();
1945 	ctx.expectError				(GL_NO_ERROR);
1946 	ctx.endSection();
1947 
1948 	ctx.glUseProgram				(0);
1949 	ctx.glDeleteBuffers				(1, &buf);
1950 	ctx.glDeleteTransformFeedbacks	(2, tfID);
1951 	ctx.expectError				(GL_NO_ERROR);
1952 
1953 	ctx.beginSection("GL_INVALID_OPERATION is generated if id has been deleted with glDeleteTransformFeedback().");
1954 	ctx.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, tfID[0]);
1955 	ctx.expectError(GL_INVALID_OPERATION);
1956 	ctx.endSection();
1957 
1958 	ctx.beginSection("GL_INVALID_OPERATION is generated if id is not 0 or a value returned from glGenTransformFeedbacks().");
1959 	ctx.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, -1);
1960 	ctx.expectError(GL_INVALID_OPERATION);
1961 	ctx.endSection();
1962 }
1963 
delete_transform_feedbacks(NegativeTestContext & ctx)1964 void delete_transform_feedbacks (NegativeTestContext& ctx)
1965 {
1966 	GLuint 				id 			= 0;
1967 	GLuint 				tfID[2];
1968 	deUint32 			buf 		= 0x1234;
1969 	const char* 		tfVarying	= "gl_Position";
1970 	glu::ShaderProgram	program		(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
1971 
1972 	ctx.glGenBuffers(1, &buf);
1973 	ctx.glGenTransformFeedbacks(1, &id);
1974 	ctx.glGenTransformFeedbacks(2, tfID);
1975 
1976 	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
1977 	ctx.glDeleteTransformFeedbacks(-1, &id);
1978 	ctx.expectError(GL_INVALID_VALUE);
1979 	ctx.endSection();
1980 
1981 	ctx.beginSection("GL_INVALID_OPERATION is generated if the transform feedback operation for any object named by ids is currently active.");
1982 	ctx.glUseProgram(program.getProgram());
1983 	ctx.glTransformFeedbackVaryings(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
1984 	ctx.glLinkProgram(program.getProgram());
1985 	ctx.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, tfID[0]);
1986 	ctx.glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
1987 	ctx.glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
1988 	ctx.glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
1989 	ctx.glBeginTransformFeedback(GL_TRIANGLES);
1990 	ctx.expectError(GL_NO_ERROR);
1991 
1992 	ctx.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, tfID[1]);
1993 	ctx.expectError(GL_INVALID_OPERATION);
1994 
1995 	ctx.glDeleteTransformFeedbacks(2, tfID);
1996 	ctx.expectError(GL_INVALID_OPERATION);
1997 
1998 	ctx.glEndTransformFeedback();
1999 	ctx.expectError(GL_NO_ERROR);
2000 	ctx.endSection();
2001 
2002 
2003 	ctx.glDeleteTransformFeedbacks(1, &id);
2004 	ctx.glDeleteTransformFeedbacks(2, tfID);
2005 	ctx.glDeleteBuffers(1, &buf);
2006 
2007 }
2008 
begin_transform_feedback(NegativeTestContext & ctx)2009 void begin_transform_feedback (NegativeTestContext& ctx)
2010 {
2011 	GLuint						tfID[2];
2012 	glu::ShaderProgram			program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
2013 	deUint32					buf = 0x1234;
2014 	const char* tfVarying		= "gl_Position";
2015 
2016 	ctx.glGenBuffers				(1, &buf);
2017 	ctx.glGenTransformFeedbacks		(2, tfID);
2018 
2019 	ctx.glUseProgram				(program.getProgram());
2020 	ctx.glTransformFeedbackVaryings	(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2021 	ctx.glLinkProgram				(program.getProgram());
2022 	ctx.glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID[0]);
2023 	ctx.glBindBuffer				(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
2024 	ctx.glBufferData				(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
2025 	ctx.glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
2026 	ctx.expectError					(GL_NO_ERROR);
2027 
2028 	ctx.beginSection("GL_INVALID_ENUM is generated if primitiveMode is not one of GL_POINTS, GL_LINES, or GL_TRIANGLES.");
2029 	ctx.glBeginTransformFeedback	(-1);
2030 	ctx.expectError					(GL_INVALID_ENUM);
2031 	ctx.endSection();
2032 
2033 	ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback is already active.");
2034 	ctx.glBeginTransformFeedback	(GL_TRIANGLES);
2035 	ctx.expectError					(GL_NO_ERROR);
2036 	ctx.glBeginTransformFeedback	(GL_POINTS);
2037 	ctx.expectError					(GL_INVALID_OPERATION);
2038 	ctx.endSection();
2039 
2040 	ctx.beginSection("GL_INVALID_OPERATION is generated if any binding point used in transform feedback mode does not have a buffer object bound.");
2041 	ctx.glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, 0);
2042 	ctx.glBeginTransformFeedback	(GL_TRIANGLES);
2043 	ctx.expectError					(GL_INVALID_OPERATION);
2044 	ctx.glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
2045 	ctx.endSection();
2046 
2047 	ctx.beginSection("GL_INVALID_OPERATION is generated if no binding points would be used because no program object is active.");
2048 	ctx.glUseProgram				(0);
2049 	ctx.glBeginTransformFeedback	(GL_TRIANGLES);
2050 	ctx.expectError					(GL_INVALID_OPERATION);
2051 	ctx.glUseProgram				(program.getProgram());
2052 	ctx.endSection();
2053 
2054 	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.");
2055 	ctx.glTransformFeedbackVaryings	(program.getProgram(), 0, 0, GL_INTERLEAVED_ATTRIBS);
2056 	ctx.glBeginTransformFeedback	(GL_TRIANGLES);
2057 	ctx.expectError					(GL_INVALID_OPERATION);
2058 	ctx.endSection();
2059 
2060 	ctx.glEndTransformFeedback		();
2061 	ctx.glDeleteBuffers				(1, &buf);
2062 	ctx.glDeleteTransformFeedbacks	(2, tfID);
2063 	ctx.expectError					(GL_NO_ERROR);
2064 }
2065 
pause_transform_feedback(NegativeTestContext & ctx)2066 void pause_transform_feedback (NegativeTestContext& ctx)
2067 {
2068 	GLuint						tfID[2];
2069 	glu::ShaderProgram			program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
2070 	deUint32					buf = 0x1234;
2071 	const char* tfVarying		= "gl_Position";
2072 
2073 	ctx.glGenBuffers				(1, &buf);
2074 	ctx.glGenTransformFeedbacks		(2, tfID);
2075 
2076 	ctx.glUseProgram				(program.getProgram());
2077 	ctx.glTransformFeedbackVaryings	(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2078 	ctx.glLinkProgram				(program.getProgram());
2079 	ctx.glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID[0]);
2080 	ctx.glBindBuffer				(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
2081 	ctx.glBufferData				(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
2082 	ctx.glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
2083 	ctx.expectError					(GL_NO_ERROR);
2084 
2085 	ctx.beginSection("GL_INVALID_OPERATION is generated if the currently bound transform feedback object is not active or is paused.");
2086 	ctx.glPauseTransformFeedback	();
2087 	ctx.expectError					(GL_INVALID_OPERATION);
2088 	ctx.glBeginTransformFeedback	(GL_TRIANGLES);
2089 	ctx.glPauseTransformFeedback	();
2090 	ctx.expectError					(GL_NO_ERROR);
2091 	ctx.glPauseTransformFeedback	();
2092 	ctx.expectError					(GL_INVALID_OPERATION);
2093 	ctx.endSection();
2094 
2095 	ctx.glEndTransformFeedback		();
2096 	ctx.glDeleteBuffers				(1, &buf);
2097 	ctx.glDeleteTransformFeedbacks	(2, tfID);
2098 	ctx.expectError					(GL_NO_ERROR);
2099 }
2100 
resume_transform_feedback(NegativeTestContext & ctx)2101 void resume_transform_feedback (NegativeTestContext& ctx)
2102 {
2103 	GLuint						tfID[2];
2104 	glu::ShaderProgram			program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
2105 	deUint32					buf = 0x1234;
2106 	const char* tfVarying		= "gl_Position";
2107 
2108 	ctx.glGenBuffers				(1, &buf);
2109 	ctx.glGenTransformFeedbacks		(2, tfID);
2110 
2111 	ctx.glUseProgram				(program.getProgram());
2112 	ctx.glTransformFeedbackVaryings	(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2113 	ctx.glLinkProgram				(program.getProgram());
2114 	ctx.glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID[0]);
2115 	ctx.glBindBuffer				(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
2116 	ctx.glBufferData				(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
2117 	ctx.glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
2118 	ctx.expectError					(GL_NO_ERROR);
2119 
2120 	ctx.beginSection("GL_INVALID_OPERATION is generated if the currently bound transform feedback object is not active or is not paused.");
2121 	ctx.glResumeTransformFeedback	();
2122 	ctx.expectError					(GL_INVALID_OPERATION);
2123 	ctx.glBeginTransformFeedback	(GL_TRIANGLES);
2124 	ctx.glResumeTransformFeedback	();
2125 	ctx.expectError					(GL_INVALID_OPERATION);
2126 	ctx.glPauseTransformFeedback	();
2127 	ctx.glResumeTransformFeedback	();
2128 	ctx.expectError					(GL_NO_ERROR);
2129 	ctx.endSection();
2130 
2131 	ctx.glEndTransformFeedback		();
2132 	ctx.glDeleteBuffers				(1, &buf);
2133 	ctx.glDeleteTransformFeedbacks	(2, tfID);
2134 	ctx.expectError					(GL_NO_ERROR);
2135 }
2136 
end_transform_feedback(NegativeTestContext & ctx)2137 void end_transform_feedback (NegativeTestContext& ctx)
2138 {
2139 	GLuint						tfID = 0;
2140 	glu::ShaderProgram			program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
2141 	deUint32					buf = 0x1234;
2142 	const char* tfVarying		= "gl_Position";
2143 
2144 	ctx.glGenBuffers				(1, &buf);
2145 	ctx.glGenTransformFeedbacks		(1, &tfID);
2146 
2147 	ctx.glUseProgram				(program.getProgram());
2148 	ctx.glTransformFeedbackVaryings	(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2149 	ctx.glLinkProgram				(program.getProgram());
2150 	ctx.glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID);
2151 	ctx.glBindBuffer				(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
2152 	ctx.glBufferData				(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
2153 	ctx.glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
2154 	ctx.expectError					(GL_NO_ERROR);
2155 
2156 	ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback is not active.");
2157 	ctx.glEndTransformFeedback		();
2158 	ctx.expectError					(GL_INVALID_OPERATION);
2159 	ctx.glBeginTransformFeedback	(GL_TRIANGLES);
2160 	ctx.glEndTransformFeedback		();
2161 	ctx.expectError					(GL_NO_ERROR);
2162 	ctx.endSection();
2163 
2164 	ctx.glDeleteBuffers				(1, &buf);
2165 	ctx.glDeleteTransformFeedbacks	(1, &tfID);
2166 	ctx.expectError					(GL_NO_ERROR);
2167 }
2168 
get_transform_feedback_varying(NegativeTestContext & ctx)2169 void get_transform_feedback_varying (NegativeTestContext& ctx)
2170 {
2171 	GLuint					tfID = 0;
2172 	glu::ShaderProgram		program			(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
2173 	glu::ShaderProgram		programInvalid	(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, ""));
2174 	const char* tfVarying	= "gl_Position";
2175 	int						maxTransformFeedbackVaryings = 0;
2176 
2177 	GLsizei					length;
2178 	GLsizei					size;
2179 	GLenum					type;
2180 	char					name[32];
2181 
2182 	const GLuint notAProgram = ctx.glCreateProgram();
2183 	ctx.glDeleteProgram(notAProgram);
2184 
2185 	ctx.glGenTransformFeedbacks				(1, &tfID);
2186 
2187 	ctx.glTransformFeedbackVaryings			(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2188 	ctx.expectError						(GL_NO_ERROR);
2189 	ctx.glLinkProgram						(program.getProgram());
2190 	ctx.expectError						(GL_NO_ERROR);
2191 
2192 	ctx.glBindTransformFeedback				(GL_TRANSFORM_FEEDBACK, tfID);
2193 	ctx.expectError						(GL_NO_ERROR);
2194 
2195 	ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of a program object.");
2196 	ctx.glGetTransformFeedbackVarying		(notAProgram, 0, 32, &length, &size, &type, &name[0]);
2197 	ctx.expectError						(GL_INVALID_VALUE);
2198 	ctx.endSection();
2199 
2200 	ctx.beginSection("GL_INVALID_VALUE is generated if index is greater or equal to the value of GL_TRANSFORM_FEEDBACK_VARYINGS.");
2201 	ctx.glGetProgramiv						(program.getProgram(), GL_TRANSFORM_FEEDBACK_VARYINGS, &maxTransformFeedbackVaryings);
2202 	ctx.glGetTransformFeedbackVarying		(program.getProgram(), maxTransformFeedbackVaryings, 32, &length, &size, &type, &name[0]);
2203 	ctx.expectError						(GL_INVALID_VALUE);
2204 	ctx.endSection();
2205 
2206 	ctx.beginSection("GL_INVALID_OPERATION or GL_INVALID_VALUE is generated program has not been linked.");
2207 	ctx.glGetTransformFeedbackVarying		(programInvalid.getProgram(), 0, 32, &length, &size, &type, &name[0]);
2208 	ctx.expectError						(GL_INVALID_OPERATION, GL_INVALID_VALUE);
2209 	ctx.endSection();
2210 
2211 	ctx.glDeleteTransformFeedbacks			(1, &tfID);
2212 	ctx.expectError						(GL_NO_ERROR);
2213 }
2214 
transform_feedback_varyings(NegativeTestContext & ctx)2215 void transform_feedback_varyings (NegativeTestContext& ctx)
2216 {
2217 	GLuint										tfID = 0;
2218 	GLuint shader								= ctx.glCreateShader(GL_VERTEX_SHADER);
2219 	glu::ShaderProgram program					(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
2220 	const char* tfVarying						= "gl_Position";
2221 	GLint maxTransformFeedbackSeparateAttribs	= 0;
2222 
2223 	const GLuint notAProgram = ctx.glCreateProgram();
2224 	ctx.glDeleteProgram(notAProgram);
2225 
2226 	ctx.glGenTransformFeedbacks				(1, &tfID);
2227 	ctx.expectError						(GL_NO_ERROR);
2228 
2229 	ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of a program object.");
2230 	ctx.glTransformFeedbackVaryings			(notAProgram, 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2231 	ctx.expectError						(GL_INVALID_VALUE);
2232 	ctx.endSection();
2233 
2234 	ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object.");
2235 	ctx.glTransformFeedbackVaryings(shader, 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2236 	ctx.expectError(GL_INVALID_OPERATION);
2237 	ctx.glDeleteShader(shader);
2238 	ctx.endSection();
2239 
2240 	ctx.beginSection("GL_INVALID_VALUE is generated if count is negative.");
2241 	ctx.glTransformFeedbackVaryings(program.getProgram(), -1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2242 	ctx.expectError(GL_INVALID_VALUE);
2243 	ctx.endSection();
2244 
2245 	ctx.beginSection("GL_INVALID_ENUM is generated if bufferMode is not SEPARATE_ATTRIBS or INTERLEAVED_ATTRIBS.");
2246 	ctx.glTransformFeedbackVaryings(program.getProgram(), 1, &tfVarying, 0);
2247 	ctx.expectError(GL_INVALID_ENUM);
2248 	ctx.endSection();
2249 
2250 	ctx.beginSection("GL_INVALID_VALUE is generated if bufferMode is GL_SEPARATE_ATTRIBS and count is greater than GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS.");
2251 	ctx.glGetIntegerv						(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, &maxTransformFeedbackSeparateAttribs);
2252 	ctx.glTransformFeedbackVaryings			(program.getProgram(), maxTransformFeedbackSeparateAttribs+1, &tfVarying, GL_SEPARATE_ATTRIBS);
2253 	ctx.expectError						(GL_INVALID_VALUE);
2254 	ctx.endSection();
2255 
2256 	ctx.glDeleteTransformFeedbacks			(1, &tfID);
2257 	ctx.expectError						(GL_NO_ERROR);
2258 
2259 }
2260 
link_compute_shader(NegativeTestContext & ctx)2261 void link_compute_shader (NegativeTestContext& ctx)
2262 {
2263 	const char* computeShaderSource		=	"#version 320 es\n"
2264 											"void main (void)\n"
2265 											"{\n"
2266 											"}\n\0";
2267 	{
2268 		const GLenum shaderTypes[]			=	{
2269 													GL_VERTEX_SHADER,
2270 													GL_FRAGMENT_SHADER,
2271 													GL_GEOMETRY_SHADER,
2272 													GL_TESS_CONTROL_SHADER,
2273 													GL_TESS_EVALUATION_SHADER
2274 												};
2275 
2276 		ctx.beginSection("Compute Shader linked with shader of other kind.");
2277 		for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(shaderTypes); ndx++)
2278 		{
2279 			GLint linkStatus				=	-1;
2280 			GLuint program					=	ctx.glCreateProgram();
2281 			GLuint computeShader			=	ctx.glCreateShader(GL_COMPUTE_SHADER);
2282 			GLuint otherShader				=	ctx.glCreateShader(shaderTypes[ndx]);
2283 			const char* otherShaderSource	=	(shaderTypes[ndx] != GL_GEOMETRY_SHADER)	?
2284 												computeShaderSource							:
2285 												"#version 320 es\n"
2286 												"layout(max_vertices = 3) out;\n"
2287 												"void main(void){}\n\0";
2288 
2289 			ctx.glShaderSource(computeShader, 1, &computeShaderSource, DE_NULL);
2290 			ctx.glShaderSource(otherShader, 1, &otherShaderSource, DE_NULL);
2291 			ctx.glCompileShader(computeShader);
2292 			ctx.glCompileShader(otherShader);
2293 			ctx.glAttachShader(program, computeShader);
2294 			ctx.glAttachShader(program, otherShader);
2295 			ctx.glLinkProgram(program);
2296 			ctx.glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
2297 			ctx.glDeleteShader(otherShader);
2298 			ctx.glDeleteShader(computeShader);
2299 			ctx.glDeleteProgram(program);
2300 			if (linkStatus != GL_FALSE)
2301 				ctx.fail("Program should not have linked");
2302 		}
2303 		ctx.endSection();
2304 	}
2305 	{
2306 		const char* computeShaderSource310	=	"#version 310 es\n"
2307 												"void main (void)\n"
2308 												"{\n"
2309 												"}\n\0";
2310 		GLint linkStatus					=	-1;
2311 		GLuint program						=	ctx.glCreateProgram();
2312 		GLuint computeShader				=	ctx.glCreateShader(GL_COMPUTE_SHADER);
2313 		GLuint computeShader310				=	ctx.glCreateShader(GL_FRAGMENT_SHADER);
2314 
2315 		ctx.glShaderSource(computeShader, 1, &computeShaderSource, DE_NULL);
2316 		ctx.glShaderSource(computeShader310, 1, &computeShaderSource310, DE_NULL);
2317 		ctx.beginSection("Compute Shader should not be linked with shaders of different version.");
2318 		ctx.glCompileShader(computeShader);
2319 		ctx.glCompileShader(computeShader310);
2320 		ctx.glAttachShader(program, computeShader);
2321 		ctx.glAttachShader(program, computeShader310);
2322 		ctx.glLinkProgram(program);
2323 		ctx.glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
2324 		ctx.glDeleteShader(computeShader310);
2325 		ctx.glDeleteShader(computeShader);
2326 		ctx.glDeleteProgram(program);
2327 		if (linkStatus != GL_FALSE)
2328 			ctx.fail("Program should not have linked");
2329 		ctx.endSection();
2330 	}
2331 }
2332 
compile_compute_shader_helper(NegativeTestContext & ctx,const char ** computeShaderSource,GLint * compileStatus)2333 void compile_compute_shader_helper (NegativeTestContext& ctx, const char** computeShaderSource, GLint* compileStatus)
2334 {
2335 	GLuint shader = ctx.glCreateShader(GL_COMPUTE_SHADER);
2336 
2337 	*compileStatus = -1;
2338 	ctx.glShaderSource(shader, 1, computeShaderSource, DE_NULL);
2339 	ctx.glCompileShader(shader);
2340 	ctx.glGetShaderiv(shader, GL_COMPILE_STATUS, compileStatus);
2341 	ctx.glDeleteShader(shader);
2342 }
2343 
compile_compute_shader(NegativeTestContext & ctx)2344 void compile_compute_shader (NegativeTestContext& ctx)
2345 {
2346 	GLint compileStatus;
2347 	ctx.beginSection("Compile Computer Shader");
2348 
2349 	{
2350 		const char* computeShaderSource		=	"#version 300 es\n"
2351 												"void main (void)\n"
2352 												"{\n"
2353 												"}\n\0";
2354 
2355 		compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2356 		if (compileStatus != GL_FALSE)
2357 			ctx.fail("Compute Shader should not have compiled with #version 300 es.");
2358 	}
2359 	{
2360 		const char* computeShaderSource		=	"#version 310 es\n"
2361 												"buffer SSBO { vec4 data }"
2362 												"void main (void)\n"
2363 												"{\n"
2364 												"}\n\0";
2365 
2366 		compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2367 		if (compileStatus != GL_FALSE)
2368 			ctx.fail("Compute Shader should not have compiled: incorrect SSBO syntax.");
2369 	}
2370 	{
2371 		const char* computeShaderSource		=	"#version 310 es\n"
2372 												"buffer SSBO { vec4 data;};"
2373 												"uniform mat4 data;"
2374 												"void main (void)\n"
2375 												"{\n"
2376 												"}\n\0";
2377 
2378 		compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2379 		if (compileStatus != GL_FALSE)
2380 			ctx.fail("Compute Shader should not have compiled: buffer variable redefinition.");
2381 	}
2382 	{
2383 		const char* computeShaderSource		=	"#version 310 es\n"
2384 												"buffer SSBO { vec4 data[]; vec4 moreData;};"
2385 												"void main (void)\n"
2386 												"{\n"
2387 												"}\n\0";
2388 
2389 		compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2390 		if (compileStatus != GL_FALSE)
2391 			ctx.fail("Compute Shader should not have compiled: unspecified length buffer member not at the end.");
2392 	}
2393 	{
2394 		const char* computeShaderSource		=	"#version 310 es\n"
2395 												"in vec4 data;"
2396 												"void main (void)\n"
2397 												"{\n"
2398 												"}\n\0";
2399 
2400 		compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2401 		if (compileStatus != GL_FALSE)
2402 			ctx.fail("Compute Shader should not have compiled: input qualifier used.");
2403 	}
2404 	{
2405 		const char* computeShaderSource		=	"#version 310 es\n"
2406 												"shared uint data = 0;";
2407 
2408 		compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2409 		if (compileStatus != GL_FALSE)
2410 			ctx.fail("Compute Shader should not have compiled: shared-qualified variable initialized.");
2411 	}
2412 	ctx.endSection();
2413 }
2414 
getNegativeShaderApiTestFunctions()2415 std::vector<FunctionContainer> getNegativeShaderApiTestFunctions ()
2416 {
2417 	FunctionContainer funcs[] =
2418 	{
2419 		{create_shader,							"create_shader",						"Invalid glCreateShader() usage"			   },
2420 		{shader_source,							"shader_source",						"Invalid glShaderSource() usage"			   },
2421 		{compile_shader,						"compile_shader",						"Invalid glCompileShader() usage"			   },
2422 		{delete_shader,							"delete_shader",						"Invalid glDeleteShader() usage"			   },
2423 		{shader_binary,							"shader_binary",						"Invalid glShaderBinary() usage"			   },
2424 		{attach_shader,							"attach_shader",						"Invalid glAttachShader() usage"			   },
2425 		{detach_shader,							"detach_shader",						"Invalid glDetachShader() usage"			   },
2426 		{link_program,							"link_program",							"Invalid glLinkProgram() usage"				   },
2427 		{use_program,							"use_program",							"Invalid glUseProgram() usage"				   },
2428 		{delete_program,						"delete_program",						"Invalid glDeleteProgram() usage"			   },
2429 		{validate_program,						"validate_program",						"Invalid glValidateProgram() usage"			   },
2430 		{get_program_binary,					"get_program_binary",					"Invalid glGetProgramBinary() usage"		   },
2431 		{program_binary,						"program_binary",						"Invalid glProgramBinary() usage"			   },
2432 		{program_parameteri,					"program_parameteri",					"Invalid glProgramParameteri() usage"		   },
2433 		{gen_samplers,							"gen_samplers",							"Invalid glGenSamplers() usage"				   },
2434 		{bind_sampler,							"bind_sampler",							"Invalid glBindSampler() usage"				   },
2435 		{delete_samplers,						"delete_samplers",						"Invalid glDeleteSamplers() usage"			   },
2436 		{get_sampler_parameteriv,				"get_sampler_parameteriv",				"Invalid glGetSamplerParameteriv() usage"	   },
2437 		{get_sampler_parameterfv,				"get_sampler_parameterfv",				"Invalid glGetSamplerParameterfv() usage"	   },
2438 		{get_sampler_parameterIiv,				"get_sampler_parameterIiv",				"Invalid glGetSamplerParameterIiv() usage"	   },
2439 		{get_sampler_parameterIuiv,				"get_sampler_parameterIuiv",			"Invalid glGetSamplerParameterIuiv() usage"	   },
2440 		{sampler_parameteri,					"sampler_parameteri",					"Invalid glSamplerParameteri() usage"		   },
2441 		{sampler_parameteriv,					"sampler_parameteriv",					"Invalid glSamplerParameteriv() usage"		   },
2442 		{sampler_parameterf,					"sampler_parameterf",					"Invalid glSamplerParameterf() usage"		   },
2443 		{sampler_parameterfv,					"sampler_parameterfv",					"Invalid glSamplerParameterfv() usage"		   },
2444 		{sampler_parameterIiv,					"sampler_parameterIiv",					"Invalid glSamplerParameterIiv() usage"		   },
2445 		{sampler_parameterIuiv,					"sampler_parameterIuiv",				"Invalid glSamplerParameterIuiv() usage"		   },
2446 		{get_attrib_location,					"get_attrib_location",					"Invalid glGetAttribLocation() usage"		   },
2447 		{get_uniform_location,					"get_uniform_location",					"Invalid glGetUniformLocation() usage"		   },
2448 		{bind_attrib_location,					"bind_attrib_location",					"Invalid glBindAttribLocation() usage"		   },
2449 		{uniform_block_binding,					"uniform_block_binding",				"Invalid glUniformBlockBinding() usage"		   },
2450 		{uniformf_invalid_program,				"uniformf_invalid_program",				"Invalid glUniform{1234}f() usage"			   },
2451 		{uniformf_incompatible_type,			"uniformf_incompatible_type",			"Invalid glUniform{1234}f() usage"			   },
2452 		{uniformf_invalid_location,				"uniformf_invalid_location",			"Invalid glUniform{1234}f() usage"			   },
2453 		{uniformfv_invalid_program,				"uniformfv_invalid_program",			"Invalid glUniform{1234}fv() usage"			   },
2454 		{uniformfv_incompatible_type,			"uniformfv_incompatible_type",			"Invalid glUniform{1234}fv() usage"			   },
2455 		{uniformfv_invalid_location,			"uniformfv_invalid_location",			"Invalid glUniform{1234}fv() usage"			   },
2456 		{uniformfv_invalid_count,				"uniformfv_invalid_count",				"Invalid glUniform{1234}fv() usage"			   },
2457 		{uniformi_invalid_program,				"uniformi_invalid_program",				"Invalid glUniform{1234}i() usage"			   },
2458 		{uniformi_incompatible_type,			"uniformi_incompatible_type",			"Invalid glUniform{1234}i() usage"			   },
2459 		{uniformi_invalid_location,				"uniformi_invalid_location",			"Invalid glUniform{1234}i() usage"			   },
2460 		{uniformiv_invalid_program,				"uniformiv_invalid_program",			"Invalid glUniform{1234}iv() usage"			   },
2461 		{uniformiv_incompatible_type,			"uniformiv_incompatible_type",			"Invalid glUniform{1234}iv() usage"			   },
2462 		{uniformiv_invalid_location,			"uniformiv_invalid_location",			"Invalid glUniform{1234}iv() usage"			   },
2463 		{uniformiv_invalid_count,				"uniformiv_invalid_count",				"Invalid glUniform{1234}iv() usage"			   },
2464 		{uniformui_invalid_program,				"uniformui_invalid_program",			"Invalid glUniform{234}ui() usage"			   },
2465 		{uniformui_incompatible_type,			"uniformui_incompatible_type",			"Invalid glUniform{1234}ui() usage"			   },
2466 		{uniformui_invalid_location,			"uniformui_invalid_location",			"Invalid glUniform{1234}ui() usage"			   },
2467 		{uniformuiv_invalid_program,			"uniformuiv_invalid_program",			"Invalid glUniform{234}uiv() usage"			   },
2468 		{uniformuiv_incompatible_type,			"uniformuiv_incompatible_type",			"Invalid glUniform{1234}uiv() usage"		   },
2469 		{uniformuiv_invalid_location,			"uniformuiv_invalid_location",			"Invalid glUniform{1234}uiv() usage"		   },
2470 		{uniformuiv_invalid_count,				"uniformuiv_invalid_count",				"Invalid glUniform{1234}uiv() usage"		   },
2471 		{uniform_matrixfv_invalid_program,		"uniform_matrixfv_invalid_program",		"Invalid glUniformMatrix{234}fv() usage"	   },
2472 		{uniform_matrixfv_incompatible_type,	"uniform_matrixfv_incompatible_type",	"Invalid glUniformMatrix{234}fv() usage"	   },
2473 		{uniform_matrixfv_invalid_location,		"uniform_matrixfv_invalid_location",	"Invalid glUniformMatrix{234}fv() usage"	   },
2474 		{uniform_matrixfv_invalid_count,		"uniform_matrixfv_invalid_count",		"Invalid glUniformMatrix{234}fv() usage"	   },
2475 		{gen_transform_feedbacks,				"gen_transform_feedbacks",				"Invalid glGenTransformFeedbacks() usage"	   },
2476 		{bind_transform_feedback,				"bind_transform_feedback",				"Invalid glBindTransformFeedback() usage"	   },
2477 		{delete_transform_feedbacks,			"delete_transform_feedbacks",			"Invalid glDeleteTransformFeedbacks() usage"   },
2478 		{begin_transform_feedback,				"begin_transform_feedback",				"Invalid glBeginTransformFeedback() usage"	   },
2479 		{pause_transform_feedback,				"pause_transform_feedback",				"Invalid glPauseTransformFeedback() usage"	   },
2480 		{resume_transform_feedback,				"resume_transform_feedback",			"Invalid glResumeTransformFeedback() usage"	   },
2481 		{end_transform_feedback,				"end_transform_feedback",				"Invalid glEndTransformFeedback() usage"	   },
2482 		{get_transform_feedback_varying,		"get_transform_feedback_varying",		"Invalid glGetTransformFeedbackVarying() usage"},
2483 		{transform_feedback_varyings,			"transform_feedback_varyings",			"Invalid glTransformFeedbackVaryings() usage"  },
2484 		{compile_compute_shader,				"compile_compute_shader",				"Invalid Compute Shader compilation"		   },
2485 		{link_compute_shader,					"link_compute_shader",					"Invalid Compute Shader linkage"			   },
2486 	};
2487 
2488 	return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs));
2489 }
2490 
2491 } // NegativeTestShared
2492 } // Functional
2493 } // gles31
2494 } // deqp
2495