es31fNegativeBufferApiTests.cpp revision 271c2654cc44f23492888c7ef40c36c2fd810c77
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 Buffer API tests.
22 *//*--------------------------------------------------------------------*/
23
24#include "es31fNegativeBufferApiTests.hpp"
25
26#include "gluCallLogWrapper.hpp"
27#include "gluContextInfo.hpp"
28
29#include "glwDefs.hpp"
30#include "glwEnums.hpp"
31
32namespace deqp
33{
34namespace gles31
35{
36namespace Functional
37{
38namespace NegativeTestShared
39{
40
41using tcu::TestLog;
42using glu::CallLogWrapper;
43using namespace glw;
44
45// Buffers
46void bind_buffer (NegativeTestContext& ctx)
47{
48	ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the allowable values.");
49	ctx.glBindBuffer(-1, 0);
50	ctx.expectError(GL_INVALID_ENUM);
51	ctx.endSection();
52}
53
54void delete_buffers (NegativeTestContext& ctx)
55{
56	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
57	ctx.glDeleteBuffers(-1, 0);
58	ctx.expectError(GL_INVALID_VALUE);
59	ctx.endSection();
60}
61
62void gen_buffers (NegativeTestContext& ctx)
63{
64	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
65	ctx.glGenBuffers(-1, 0);
66	ctx.expectError(GL_INVALID_VALUE);
67	ctx.endSection();
68}
69
70void buffer_data (NegativeTestContext& ctx)
71{
72	GLuint buffer = 0x1234;
73	ctx.glGenBuffers(1, &buffer);
74	ctx.glBindBuffer(GL_ARRAY_BUFFER, buffer);
75
76	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER.");
77	ctx.glBufferData(-1, 0, NULL, GL_STREAM_DRAW);
78	ctx.expectError(GL_INVALID_ENUM);
79	ctx.endSection();
80
81	ctx.beginSection("GL_INVALID_ENUM is generated if usage is not GL_STREAM_DRAW, GL_STATIC_DRAW, or GL_DYNAMIC_DRAW.");
82	ctx.glBufferData(GL_ARRAY_BUFFER, 0, NULL, -1);
83	ctx.expectError(GL_INVALID_ENUM);
84	ctx.endSection();
85
86	ctx.beginSection("GL_INVALID_VALUE is generated if size is negative.");
87	ctx.glBufferData(GL_ARRAY_BUFFER, -1, NULL, GL_STREAM_DRAW);
88	ctx.expectError(GL_INVALID_VALUE);
89	ctx.endSection();
90
91	ctx.beginSection("GL_INVALID_OPERATION is generated if the reserved buffer object name 0 is bound to target.");
92	ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
93	ctx.glBufferData(GL_ARRAY_BUFFER, 0, NULL, GL_STREAM_DRAW);
94	ctx.expectError(GL_INVALID_OPERATION);
95	ctx.endSection();
96
97	ctx.glDeleteBuffers(1, &buffer);
98}
99
100void buffer_sub_data (NegativeTestContext& ctx)
101{
102	GLuint buffer = 0x1234;
103	ctx.glGenBuffers(1, &buffer);
104	ctx.glBindBuffer(GL_ARRAY_BUFFER, buffer);
105	ctx.glBufferData(GL_ARRAY_BUFFER, 10, 0, GL_STREAM_DRAW);
106
107	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER.");
108	ctx.glBufferSubData(-1, 1, 1, 0);
109	ctx.expectError(GL_INVALID_ENUM);
110	ctx.endSection();
111
112	ctx.beginSection("GL_INVALID_OPERATION is generated if the reserved buffer object name 0 is bound to target.");
113	ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
114	ctx.glBufferSubData(GL_ARRAY_BUFFER, 1, 1, 0);
115	ctx.expectError(GL_INVALID_OPERATION);
116	ctx.endSection();
117
118	ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer object being updated is mapped.");
119	ctx.glBindBuffer(GL_ARRAY_BUFFER, buffer);
120	ctx.glMapBufferRange(GL_ARRAY_BUFFER, 0, 5, GL_MAP_READ_BIT);
121	ctx.expectError(GL_NO_ERROR);
122	ctx.glBufferSubData(GL_ARRAY_BUFFER, 1, 1, 0);
123	ctx.expectError(GL_INVALID_OPERATION);
124	ctx.endSection();
125
126	ctx.glDeleteBuffers(1, &buffer);
127}
128
129void buffer_sub_data_size_offset (NegativeTestContext& ctx)
130{
131	GLuint buffer = 0x1234;
132	ctx.glGenBuffers(1, &buffer);
133	ctx.glBindBuffer(GL_ARRAY_BUFFER, buffer);
134	ctx.glBufferData(GL_ARRAY_BUFFER, 10, 0, GL_STREAM_DRAW);
135
136	ctx.beginSection("GL_INVALID_VALUE is generated if offset or size is negative, or if together they define a region of memory that extends beyond the buffer object's allocated data store.");
137	ctx.glBufferSubData(GL_ARRAY_BUFFER, -1, 1, 0);
138	ctx.expectError(GL_INVALID_VALUE);
139	ctx.glBufferSubData(GL_ARRAY_BUFFER, -1, -1, 0);
140	ctx.expectError(GL_INVALID_VALUE);
141	ctx.glBufferSubData(GL_ARRAY_BUFFER, 1, -1, 0);
142	ctx.expectError(GL_INVALID_VALUE);
143	ctx.glBufferSubData(GL_ARRAY_BUFFER, 15, 1, 0);
144	ctx.expectError(GL_INVALID_VALUE);
145	ctx.glBufferSubData(GL_ARRAY_BUFFER, 1, 15, 0);
146	ctx.expectError(GL_INVALID_VALUE);
147	ctx.glBufferSubData(GL_ARRAY_BUFFER, 8, 8, 0);
148	ctx.expectError(GL_INVALID_VALUE);
149	ctx.endSection();
150
151	ctx.glDeleteBuffers(1, &buffer);
152}
153
154void clear (NegativeTestContext& ctx)
155{
156	ctx.beginSection("GL_INVALID_VALUE is generated if any bit other than the three defined bits is set in mask.");
157	ctx.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
158	ctx.expectError(GL_NO_ERROR);
159	ctx.glClear(0x00000200);
160	ctx.expectError(GL_INVALID_VALUE);
161	ctx.glClear(0x00001000);
162	ctx.expectError(GL_INVALID_VALUE);
163	ctx.glClear(0x00000010);
164	ctx.expectError(GL_INVALID_VALUE);
165	ctx.endSection();
166}
167
168void read_pixels (NegativeTestContext& ctx)
169{
170	std::vector<GLubyte> ubyteData(4);
171
172	ctx.beginSection("GL_INVALID_OPERATION is generated if the combination of format and type is unsupported.");
173	ctx.glReadPixels(0, 0, 1, 1, GL_LUMINANCE_ALPHA, GL_UNSIGNED_SHORT_4_4_4_4, &ubyteData[0]);
174	ctx.expectError(GL_INVALID_OPERATION);
175	ctx.endSection();
176
177	ctx.beginSection("GL_INVALID_VALUE is generated if either width or height is negative.");
178	ctx.glReadPixels(0, 0, -1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &ubyteData[0]);
179	ctx.expectError(GL_INVALID_VALUE);
180	ctx.glReadPixels(0, 0, 1, -1, GL_RGBA, GL_UNSIGNED_BYTE, &ubyteData[0]);
181	ctx.expectError(GL_INVALID_VALUE);
182	ctx.glReadPixels(0, 0, -1, -1, GL_RGBA, GL_UNSIGNED_BYTE, &ubyteData[0]);
183	ctx.expectError(GL_INVALID_VALUE);
184	ctx.endSection();
185
186	ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
187	GLuint fbo = 0x1234;
188	ctx.glGenFramebuffers(1, &fbo);
189	ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
190	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
191	ctx.glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &ubyteData[0]);
192	ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
193	ctx.endSection();
194
195	ctx.glDeleteFramebuffers(1, &fbo);
196}
197
198void read_pixels_format_mismatch (NegativeTestContext& ctx)
199{
200	std::vector<GLubyte> ubyteData(4);
201	std::vector<GLushort> ushortData(4);
202
203	ctx.beginSection("Unsupported combinations of format and type will generate an INVALID_OPERATION error.");
204	ctx.glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_SHORT_5_6_5, &ushortData[0]);
205	ctx.expectError(GL_INVALID_OPERATION);
206	ctx.glReadPixels(0, 0, 1, 1, GL_ALPHA, GL_UNSIGNED_SHORT_5_6_5, &ushortData[0]);
207	ctx.expectError(GL_INVALID_OPERATION);
208	ctx.glReadPixels(0, 0, 1, 1, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, &ushortData[0]);
209	ctx.expectError(GL_INVALID_OPERATION);
210	ctx.glReadPixels(0, 0, 1, 1, GL_ALPHA, GL_UNSIGNED_SHORT_4_4_4_4, &ushortData[0]);
211	ctx.expectError(GL_INVALID_OPERATION);
212	ctx.glReadPixels(0, 0, 1, 1, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, &ushortData[0]);
213	ctx.expectError(GL_INVALID_OPERATION);
214	ctx.glReadPixels(0, 0, 1, 1, GL_ALPHA, GL_UNSIGNED_SHORT_5_5_5_1, &ushortData[0]);
215	ctx.expectError(GL_INVALID_OPERATION);
216	ctx.endSection();
217
218	ctx.beginSection("GL_RGBA/GL_UNSIGNED_BYTE is always accepted and the other acceptable pair can be discovered by querying GL_IMPLEMENTATION_COLOR_READ_FORMAT and GL_IMPLEMENTATION_COLOR_READ_TYPE.");
219	ctx.glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &ubyteData[0]);
220	ctx.expectError(GL_NO_ERROR);
221	GLint readFormat = 0x1234;
222	GLint readType = 0x1234;
223	ctx.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &readFormat);
224	ctx.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &readType);
225	ctx.glReadPixels(0, 0, 1, 1, readFormat, readType, &ubyteData[0]);
226	ctx.expectError(GL_NO_ERROR);
227	ctx.endSection();
228}
229
230void read_pixels_fbo_format_mismatch (NegativeTestContext& ctx)
231{
232	std::vector<GLubyte>	ubyteData(4);
233	std::vector<float>		floatData(4);
234	deUint32				fbo = 0x1234;
235	deUint32				texture = 0x1234;
236
237	ctx.glGenTextures			(1, &texture);
238	ctx.glBindTexture			(GL_TEXTURE_2D, texture);
239	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
240	ctx.glGenFramebuffers		(1, &fbo);
241	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, fbo);
242	ctx.glFramebufferTexture2D	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
243	ctx.expectError				(GL_NO_ERROR);
244
245	ctx.beginSection("GL_INVALID_OPERATION is generated if currently bound framebuffer format is incompatible with format and type.");
246
247	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
248	ctx.glFramebufferTexture2D	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
249	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
250	ctx.expectError				(GL_NO_ERROR);
251	ctx.glReadPixels			(0, 0, 1, 1, GL_RGBA, GL_FLOAT, &floatData[0]);
252	ctx.expectError				(GL_INVALID_OPERATION);
253
254	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32I, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, NULL);
255	ctx.glFramebufferTexture2D	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
256	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
257	ctx.expectError				(GL_NO_ERROR);
258	ctx.glReadPixels			(0, 0, 1, 1, GL_RGBA, GL_FLOAT, &floatData[0]);
259	ctx.expectError				(GL_INVALID_OPERATION);
260
261	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32UI, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, NULL);
262	ctx.glFramebufferTexture2D	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
263	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
264	ctx.expectError				(GL_NO_ERROR);
265	ctx.glReadPixels			(0, 0, 1, 1, GL_RGBA, GL_FLOAT, &floatData[0]);
266	ctx.expectError				(GL_INVALID_OPERATION);
267
268	ctx.endSection();
269
270	ctx.beginSection("GL_INVALID_OPERATION is generated if GL_READ_FRAMEBUFFER_BINDING is non-zero, the read framebuffer is complete, and the value of GL_SAMPLE_BUFFERS for the read framebuffer is greater than zero.");
271
272	int			binding			= -1;
273	int			sampleBuffers = 0x1234;
274	deUint32	rbo = 0x1234;
275
276	ctx.glGenRenderbuffers(1, &rbo);
277	ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo);
278	ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA8, 32, 32);
279	ctx.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo);
280
281	ctx.glGetIntegerv			(GL_READ_FRAMEBUFFER_BINDING, &binding);
282	ctx.getLog() << TestLog::Message << "// GL_READ_FRAMEBUFFER_BINDING: " << binding << TestLog::EndMessage;
283	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
284	ctx.glGetIntegerv			(GL_SAMPLE_BUFFERS, &sampleBuffers);
285	ctx.getLog() << TestLog::Message << "// GL_SAMPLE_BUFFERS: " << sampleBuffers << TestLog::EndMessage;
286	ctx.expectError				(GL_NO_ERROR);
287
288	if (binding == 0 || sampleBuffers <= 0)
289	{
290		ctx.getLog() << TestLog::Message << "// ERROR: expected GL_READ_FRAMEBUFFER_BINDING to be non-zero and GL_SAMPLE_BUFFERS to be greater than zero" << TestLog::EndMessage;
291		ctx.fail("Got invalid value");
292	}
293	else
294	{
295		ctx.glReadPixels	(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &ubyteData[0]);
296		ctx.expectError		(GL_INVALID_OPERATION);
297	}
298
299	ctx.endSection();
300
301	ctx.glBindRenderbuffer		(GL_RENDERBUFFER, 0);
302	ctx.glBindTexture			(GL_TEXTURE_2D, 0);
303	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, 0);
304	ctx.glDeleteFramebuffers	(1, &fbo);
305	ctx.glDeleteTextures		(1, &texture);
306	ctx.glDeleteRenderbuffers	(1, &rbo);
307}
308
309void bind_buffer_range (NegativeTestContext& ctx)
310{
311	deUint32 bufU = 0x1234;
312	ctx.glGenBuffers(1, &bufU);
313	ctx.glBindBuffer(GL_UNIFORM_BUFFER, bufU);
314	ctx.glBufferData(GL_UNIFORM_BUFFER, 16, NULL, GL_STREAM_DRAW);
315
316	deUint32 bufTF = 0x1234;
317	ctx.glGenBuffers(1, &bufTF);
318	ctx.glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, bufTF);
319	ctx.glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 16, NULL, GL_STREAM_DRAW);
320
321	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_TRANSFORM_FEEDBACK_BUFFER or GL_UNIFORM_BUFFER.");
322	ctx.glBindBufferRange(GL_ARRAY_BUFFER, 0, bufU, 0, 4);
323	ctx.expectError(GL_INVALID_ENUM);
324	ctx.endSection();
325
326	ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_TRANSFORM_FEEDBACK_BUFFER and index is greater than or equal to GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS.");
327	int maxTFSize = 0x1234;
328	ctx.glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, &maxTFSize);
329	ctx.glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, maxTFSize, bufTF, 0, 4);
330	ctx.expectError(GL_INVALID_VALUE);
331	ctx.endSection();
332
333	ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_UNIFORM_BUFFER and index is greater than or equal to GL_MAX_UNIFORM_BUFFER_BINDINGS.");
334	int maxUSize = 0x1234;
335	ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUSize);
336	ctx.glBindBufferRange(GL_UNIFORM_BUFFER, maxUSize, bufU, 0, 4);
337	ctx.expectError(GL_INVALID_VALUE);
338	ctx.endSection();
339
340	ctx.beginSection("GL_INVALID_VALUE is generated if size is less than or equal to zero.");
341	ctx.glBindBufferRange(GL_UNIFORM_BUFFER, 0, bufU, 0, -1);
342	ctx.expectError(GL_INVALID_VALUE);
343	ctx.glBindBufferRange(GL_UNIFORM_BUFFER, 0, bufU, 0, 0);
344	ctx.expectError(GL_INVALID_VALUE);
345	ctx.endSection();
346
347	ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_TRANSFORM_FEEDBACK_BUFFER and size or offset are not multiples of 4.");
348	ctx.glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, bufTF, 4, 5);
349	ctx.expectError(GL_INVALID_VALUE);
350	ctx.glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, bufTF, 5, 4);
351	ctx.expectError(GL_INVALID_VALUE);
352	ctx.glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, bufTF, 5, 7);
353	ctx.expectError(GL_INVALID_VALUE);
354	ctx.endSection();
355
356	ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_UNIFORM_BUFFER and offset is not a multiple of GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT.");
357	int alignment = 0x1234;
358	ctx.glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &alignment);
359	ctx.glBindBufferRange(GL_UNIFORM_BUFFER, 0, bufU, alignment+1, 4);
360	ctx.expectError(GL_INVALID_VALUE);
361	ctx.endSection();
362
363	ctx.glDeleteBuffers(1, &bufU);
364	ctx.glDeleteBuffers(1, &bufTF);
365}
366
367void bind_buffer_base (NegativeTestContext& ctx)
368{
369	deUint32 bufU = 0x1234;
370	ctx.glGenBuffers(1, &bufU);
371	ctx.glBindBuffer(GL_UNIFORM_BUFFER, bufU);
372	ctx.glBufferData(GL_UNIFORM_BUFFER, 16, NULL, GL_STREAM_DRAW);
373
374	deUint32 bufTF = 0x1234;
375	ctx.glGenBuffers(1, &bufTF);
376	ctx.glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, bufTF);
377	ctx.glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 16, NULL, GL_STREAM_DRAW);
378	ctx.expectError(GL_NO_ERROR);
379
380	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_TRANSFORM_FEEDBACK_BUFFER or GL_UNIFORM_BUFFER.");
381	ctx.glBindBufferBase(-1, 0, bufU);
382	ctx.expectError(GL_INVALID_ENUM);
383	ctx.glBindBufferBase(GL_ARRAY_BUFFER, 0, bufU);
384	ctx.expectError(GL_INVALID_ENUM);
385	ctx.endSection();
386
387	ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_UNIFORM_BUFFER and index is greater than or equal to GL_MAX_UNIFORM_BUFFER_BINDINGS.");
388	int maxUSize = 0x1234;
389	ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUSize);
390	ctx.glBindBufferBase(GL_UNIFORM_BUFFER, maxUSize, bufU);
391	ctx.expectError(GL_INVALID_VALUE);
392	ctx.endSection();
393
394	ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_TRANSFORM_FEEDBACK_BUFFER andindex is greater than or equal to GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS.");
395	int maxTFSize = 0x1234;
396	ctx.glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, &maxTFSize);
397	ctx.glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, maxTFSize, bufTF);
398	ctx.expectError(GL_INVALID_VALUE);
399	ctx.endSection();
400
401	ctx.glDeleteBuffers(1, &bufU);
402	ctx.glDeleteBuffers(1, &bufTF);
403}
404
405void clear_bufferiv (NegativeTestContext& ctx)
406{
407	std::vector<int>		data(32*32);
408	deUint32				fbo = 0x1234;
409	deUint32				texture = 0x1234;
410
411	ctx.glGenTextures			(1, &texture);
412	ctx.glBindTexture			(GL_TEXTURE_2D, texture);
413	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32I, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, NULL);
414	ctx.glGenFramebuffers		(1, &fbo);
415	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, fbo);
416	ctx.glFramebufferTexture2D	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
417	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
418	ctx.expectError				(GL_NO_ERROR);
419
420	ctx.beginSection("GL_INVALID_ENUM is generated if buffer is not an accepted value.");
421	ctx.glClearBufferiv(-1, 0, &data[0]);
422	ctx.expectError(GL_INVALID_ENUM);
423	ctx.glClearBufferiv(GL_FRAMEBUFFER, 0, &data[0]);
424	ctx.expectError(GL_INVALID_ENUM);
425	ctx.endSection();
426
427	ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_COLOR, GL_FRONT, GL_BACK, GL_LEFT, GL_RIGHT, or GL_FRONT_AND_BACK and drawBuffer is greater than or equal to GL_MAX_DRAW_BUFFERS.");
428	int maxDrawBuffers = 0x1234;
429	ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
430	ctx.glClearBufferiv(GL_COLOR, maxDrawBuffers, &data[0]);
431	ctx.expectError(GL_INVALID_VALUE);
432	ctx.endSection();
433
434	ctx.beginSection("GL_INVALID_ENUM is generated if buffer is GL_DEPTH or GL_DEPTH_STENCIL.");
435	ctx.glClearBufferiv(GL_DEPTH, 1, &data[0]);
436	ctx.expectError(GL_INVALID_ENUM);
437	ctx.glClearBufferiv(GL_DEPTH_STENCIL, 1, &data[0]);
438	ctx.expectError(GL_INVALID_ENUM);
439	ctx.endSection();
440
441	ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_STENCIL and drawBuffer is not zero.");
442	ctx.glClearBufferiv(GL_STENCIL, 1, &data[0]);
443	ctx.expectError(GL_INVALID_VALUE);
444	ctx.endSection();
445
446	ctx.glDeleteFramebuffers(1, &fbo);
447	ctx.glDeleteTextures(1, &texture);
448}
449
450void clear_bufferuiv (NegativeTestContext& ctx)
451{
452	std::vector<deUint32>	data(32*32);
453	deUint32				fbo = 0x1234;
454	deUint32				texture = 0x1234;
455
456	ctx.glGenTextures			(1, &texture);
457	ctx.glBindTexture			(GL_TEXTURE_2D, texture);
458	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32UI, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, NULL);
459	ctx.glGenFramebuffers		(1, &fbo);
460	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, fbo);
461	ctx.glFramebufferTexture2D	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
462	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
463	ctx.expectError				(GL_NO_ERROR);
464
465	ctx.beginSection("GL_INVALID_ENUM is generated if buffer is not an accepted value.");
466	ctx.glClearBufferuiv(-1, 0, &data[0]);
467	ctx.expectError(GL_INVALID_ENUM);
468	ctx.glClearBufferuiv(GL_FRAMEBUFFER, 0, &data[0]);
469	ctx.expectError(GL_INVALID_ENUM);
470	ctx.endSection();
471
472	ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_COLOR, GL_FRONT, GL_BACK, GL_LEFT, GL_RIGHT, or GL_FRONT_AND_BACK and drawBuffer is greater than or equal to GL_MAX_DRAW_BUFFERS.");
473	int maxDrawBuffers = 0x1234;
474	ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
475	ctx.glClearBufferuiv(GL_COLOR, maxDrawBuffers, &data[0]);
476	ctx.expectError(GL_INVALID_VALUE);
477	ctx.endSection();
478
479	ctx.beginSection("GL_INVALID_ENUM is generated if buffer is GL_DEPTH, GL_STENCIL or GL_DEPTH_STENCIL.");
480	ctx.glClearBufferuiv(GL_DEPTH, 1, &data[0]);
481	ctx.expectError(GL_INVALID_ENUM);
482	ctx.glClearBufferuiv(GL_STENCIL, 1, &data[0]);
483	ctx.expectError(GL_INVALID_ENUM);
484	ctx.glClearBufferuiv(GL_DEPTH_STENCIL, 1, &data[0]);
485	ctx.expectError(GL_INVALID_ENUM);
486	ctx.endSection();
487
488	ctx.glDeleteFramebuffers(1, &fbo);
489	ctx.glDeleteTextures(1, &texture);
490}
491
492void clear_bufferfv (NegativeTestContext& ctx)
493{
494	std::vector<float>		data(32*32);
495	deUint32				fbo = 0x1234;
496	deUint32				texture = 0x1234;
497
498	ctx.glGenTextures			(1, &texture);
499	ctx.glBindTexture			(GL_TEXTURE_2D, texture);
500	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32F, 32, 32, 0, GL_RGBA, GL_FLOAT, NULL);
501	ctx.glGenFramebuffers		(1, &fbo);
502	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, fbo);
503	ctx.glFramebufferTexture2D	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
504	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
505	ctx.expectError				(GL_NO_ERROR);
506
507	ctx.beginSection("GL_INVALID_ENUM is generated if buffer is not an accepted value.");
508	ctx.glClearBufferfv(-1, 0, &data[0]);
509	ctx.expectError(GL_INVALID_ENUM);
510	ctx.glClearBufferfv(GL_FRAMEBUFFER, 0, &data[0]);
511	ctx.expectError(GL_INVALID_ENUM);
512	ctx.endSection();
513
514	ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_COLOR, GL_FRONT, GL_BACK, GL_LEFT, GL_RIGHT, or GL_FRONT_AND_BACK and drawBuffer is greater than or equal to GL_MAX_DRAW_BUFFERS.");
515	int maxDrawBuffers = 0x1234;
516	ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
517	ctx.glClearBufferfv(GL_COLOR, maxDrawBuffers, &data[0]);
518	ctx.expectError(GL_INVALID_VALUE);
519	ctx.endSection();
520
521	ctx.beginSection("GL_INVALID_ENUM is generated if buffer is GL_STENCIL or GL_DEPTH_STENCIL.");
522	ctx.glClearBufferfv(GL_STENCIL, 1, &data[0]);
523	ctx.expectError(GL_INVALID_ENUM);
524	ctx.glClearBufferfv(GL_DEPTH_STENCIL, 1, &data[0]);
525	ctx.expectError(GL_INVALID_ENUM);
526	ctx.endSection();
527
528	ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_DEPTH and drawBuffer is not zero.");
529	ctx.glClearBufferfv(GL_DEPTH, 1, &data[0]);
530	ctx.expectError(GL_INVALID_VALUE);
531	ctx.endSection();
532
533	ctx.glDeleteFramebuffers(1, &fbo);
534	ctx.glDeleteTextures(1, &texture);
535}
536
537void clear_bufferfi (NegativeTestContext& ctx)
538{
539	ctx.beginSection("GL_INVALID_ENUM is generated if buffer is not an accepted value.");
540	ctx.glClearBufferfi(-1, 0, 1.0f, 1);
541	ctx.expectError(GL_INVALID_ENUM);
542	ctx.glClearBufferfi(GL_FRAMEBUFFER, 0, 1.0f, 1);
543	ctx.expectError(GL_INVALID_ENUM);
544	ctx.endSection();
545
546	ctx.beginSection("GL_INVALID_ENUM is generated if buffer is not GL_DEPTH_STENCIL.");
547	ctx.glClearBufferfi(GL_DEPTH, 0, 1.0f, 1);
548	ctx.expectError(GL_INVALID_ENUM);
549	ctx.glClearBufferfi(GL_STENCIL, 0, 1.0f, 1);
550	ctx.expectError(GL_INVALID_ENUM);
551	ctx.glClearBufferfi(GL_COLOR, 0, 1.0f, 1);
552	ctx.expectError(GL_INVALID_ENUM);
553	ctx.endSection();
554
555	ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_DEPTH_STENCIL and drawBuffer is not zero.");
556	ctx.glClearBufferfi(GL_DEPTH_STENCIL, 1, 1.0f, 1);
557	ctx.expectError(GL_INVALID_VALUE);
558	ctx.endSection();
559}
560
561void copy_buffer_sub_data (NegativeTestContext& ctx)
562{
563	deUint32				buf[2];
564	std::vector<float>		data(32*32);
565
566	ctx.glGenBuffers			(2, buf);
567	ctx.glBindBuffer			(GL_COPY_READ_BUFFER, buf[0]);
568	ctx.glBufferData			(GL_COPY_READ_BUFFER, 32, &data[0], GL_DYNAMIC_COPY);
569	ctx.glBindBuffer			(GL_COPY_WRITE_BUFFER, buf[1]);
570	ctx.glBufferData			(GL_COPY_WRITE_BUFFER, 32, &data[0], GL_DYNAMIC_COPY);
571	ctx.expectError				(GL_NO_ERROR);
572
573	ctx.beginSection("GL_INVALID_VALUE is generated if any of readoffset, writeoffset or size is negative.");
574	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, -4);
575	ctx.expectError				(GL_INVALID_VALUE);
576	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, -1, 0, 4);
577	ctx.expectError				(GL_INVALID_VALUE);
578	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, -1, 4);
579	ctx.expectError				(GL_INVALID_VALUE);
580	ctx.endSection();
581
582	ctx.beginSection("GL_INVALID_VALUE is generated if readoffset + size exceeds the size of the buffer object bound to readtarget.");
583	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 36);
584	ctx.expectError				(GL_INVALID_VALUE);
585	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 24, 0, 16);
586	ctx.expectError				(GL_INVALID_VALUE);
587	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 36, 0, 4);
588	ctx.expectError				(GL_INVALID_VALUE);
589	ctx.endSection();
590
591	ctx.beginSection("GL_INVALID_VALUE is generated if writeoffset + size exceeds the size of the buffer object bound to writetarget.");
592	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 36);
593	ctx.expectError				(GL_INVALID_VALUE);
594	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 24, 16);
595	ctx.expectError				(GL_INVALID_VALUE);
596	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 36, 4);
597	ctx.expectError				(GL_INVALID_VALUE);
598	ctx.endSection();
599
600	ctx.beginSection("GL_INVALID_VALUE is generated if the same buffer object is bound to both readtarget and writetarget and the ranges [readoffset, readoffset + size) and [writeoffset, writeoffset + size) overlap.");
601	ctx.glBindBuffer			(GL_COPY_WRITE_BUFFER, buf[0]);
602	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 16, 4);
603	ctx.expectError				(GL_NO_ERROR);
604	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 4);
605	ctx.expectError				(GL_INVALID_VALUE);
606	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 16, 18);
607	ctx.expectError				(GL_INVALID_VALUE);
608	ctx.glBindBuffer			(GL_COPY_WRITE_BUFFER, buf[1]);
609	ctx.endSection();
610
611	ctx.beginSection("GL_INVALID_OPERATION is generated if zero is bound to readtarget or writetarget.");
612	ctx.glBindBuffer			(GL_COPY_READ_BUFFER, 0);
613	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 16);
614	ctx.expectError				(GL_INVALID_OPERATION);
615
616	ctx.glBindBuffer			(GL_COPY_READ_BUFFER, buf[0]);
617	ctx.glBindBuffer			(GL_COPY_WRITE_BUFFER, 0);
618	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 16);
619	ctx.expectError				(GL_INVALID_OPERATION);
620
621	ctx.glBindBuffer			(GL_COPY_WRITE_BUFFER, buf[1]);
622	ctx.endSection();
623
624	ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer object bound to either readtarget or writetarget is mapped.");
625	ctx.glMapBufferRange		(GL_COPY_READ_BUFFER, 0, 4, GL_MAP_READ_BIT);
626	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 16);
627	ctx.expectError				(GL_INVALID_OPERATION);
628	ctx.glUnmapBuffer			(GL_COPY_READ_BUFFER);
629
630	ctx.glMapBufferRange		(GL_COPY_WRITE_BUFFER, 0, 4, GL_MAP_READ_BIT);
631	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 16);
632	ctx.expectError				(GL_INVALID_OPERATION);
633	ctx.glUnmapBuffer			(GL_COPY_WRITE_BUFFER);
634	ctx.endSection();
635
636	ctx.glDeleteBuffers(2, buf);
637}
638
639void draw_buffers (NegativeTestContext& ctx)
640{
641	deUint32				fbo = 0x1234;
642	deUint32				texture = 0x1234;
643	int						maxDrawBuffers = 0x1234;
644	ctx.glGetIntegerv		(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
645	std::vector<deUint32>	values(maxDrawBuffers+1);
646	values[0]				= GL_NONE;
647	values[1]				= GL_BACK;
648	values[2]				= GL_COLOR_ATTACHMENT0;
649	values[3]				= GL_DEPTH_ATTACHMENT;
650	std::vector<GLfloat>	data(32*32);
651
652	ctx.glGenTextures			(1, &texture);
653	ctx.glBindTexture			(GL_TEXTURE_2D, texture);
654	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
655	ctx.glGenFramebuffers		(1, &fbo);
656	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, fbo);
657	ctx.glFramebufferTexture2D	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
658	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
659	ctx.expectError				(GL_NO_ERROR);
660
661	ctx.beginSection("GL_INVALID_ENUM is generated if one of the values in bufs is not an accepted value.");
662	ctx.glDrawBuffers			(2, &values[2]);
663	ctx.expectError				(GL_INVALID_ENUM);
664	ctx.endSection();
665
666	ctx.beginSection("GL_INVALID_OPERATION is generated if the GL is bound to the default framebuffer and n is not 1.");
667	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, 0);
668	ctx.glDrawBuffers			(2, &values[0]);
669	ctx.expectError				(GL_INVALID_OPERATION);
670	ctx.endSection();
671
672	ctx.beginSection("GL_INVALID_OPERATION is generated if the GL is bound to the default framebuffer and the value in bufs is one of the GL_COLOR_ATTACHMENTn tokens.");
673	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, 0);
674	ctx.glDrawBuffers			(1, &values[2]);
675	ctx.expectError				(GL_INVALID_OPERATION);
676	ctx.endSection();
677
678	ctx.beginSection("GL_INVALID_OPERATION is generated if the GL is bound to a framebuffer object and the ith buffer listed in bufs is anything other than GL_NONE or GL_COLOR_ATTACHMENTSi.");
679	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, fbo);
680	ctx.glDrawBuffers			(1, &values[1]);
681	ctx.expectError				(GL_INVALID_OPERATION);
682	ctx.endSection();
683
684	ctx.beginSection("GL_INVALID_VALUE is generated if n is less than 0 or greater than GL_MAX_DRAW_BUFFERS.");
685	ctx.glDrawBuffers			(-1, &values[1]);
686	ctx.expectError				(GL_INVALID_VALUE);
687	ctx.glDrawBuffers			(maxDrawBuffers+1, &values[0]);
688	ctx.expectError				(GL_INVALID_VALUE);
689	ctx.endSection();
690
691	ctx.glDeleteTextures(1, &texture);
692	ctx.glDeleteFramebuffers(1, &fbo);
693}
694
695void flush_mapped_buffer_range (NegativeTestContext& ctx)
696{
697	deUint32				buf = 0x1234;
698	std::vector<GLfloat>	data(32);
699
700	ctx.glGenBuffers			(1, &buf);
701	ctx.glBindBuffer			(GL_ARRAY_BUFFER, buf);
702	ctx.glBufferData			(GL_ARRAY_BUFFER, 32, &data[0], GL_STATIC_READ);
703	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT);
704	ctx.expectError				(GL_NO_ERROR);
705
706	ctx.beginSection("GL_INVALID_VALUE is generated if offset or length is negative, or if offset + length exceeds the size of the mapping.");
707	ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, -1, 1);
708	ctx.expectError				(GL_INVALID_VALUE);
709	ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 0, -1);
710	ctx.expectError				(GL_INVALID_VALUE);
711	ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 12, 8);
712	ctx.expectError				(GL_INVALID_VALUE);
713	ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 24, 4);
714	ctx.expectError				(GL_INVALID_VALUE);
715	ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 0, 24);
716	ctx.expectError				(GL_INVALID_VALUE);
717	ctx.endSection();
718
719	ctx.beginSection("GL_INVALID_OPERATION is generated if zero is bound to target.");
720	ctx.glBindBuffer			(GL_ARRAY_BUFFER, 0);
721	ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 0, 8);
722	ctx.expectError				(GL_INVALID_OPERATION);
723	ctx.endSection();
724
725	ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer bound to target is not mapped, or is mapped without the GL_MAP_FLUSH_EXPLICIT flag.");
726	ctx.glBindBuffer			(GL_ARRAY_BUFFER, buf);
727	ctx.glUnmapBuffer			(GL_ARRAY_BUFFER);
728	ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 0, 8);
729	ctx.expectError				(GL_INVALID_OPERATION);
730	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_WRITE_BIT);
731	ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 0, 8);
732	ctx.expectError				(GL_INVALID_OPERATION);
733	ctx.endSection();
734
735	ctx.glUnmapBuffer			(GL_ARRAY_BUFFER);
736	ctx.glDeleteBuffers			(1, &buf);
737}
738
739void map_buffer_range (NegativeTestContext& ctx)
740{
741	deUint32				buf = 0x1234;
742	std::vector<GLfloat>	data(32);
743
744	ctx.glGenBuffers			(1, &buf);
745	ctx.glBindBuffer			(GL_ARRAY_BUFFER, buf);
746	ctx.glBufferData			(GL_ARRAY_BUFFER, 32, &data[0], GL_DYNAMIC_COPY);
747	ctx.expectError				(GL_NO_ERROR);
748
749	ctx.beginSection("GL_INVALID_VALUE is generated if either of offset or length is negative.");
750	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, -1, 1, GL_MAP_READ_BIT);
751	ctx.expectError				(GL_INVALID_VALUE);
752
753	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 1, -1, GL_MAP_READ_BIT);
754	ctx.expectError				(GL_INVALID_VALUE);
755	ctx.endSection();
756
757	ctx.beginSection("GL_INVALID_VALUE is generated if offset + length is greater than the value of GL_BUFFER_SIZE.");
758	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 33, GL_MAP_READ_BIT);
759	ctx.expectError				(GL_INVALID_VALUE);
760
761	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 32, 1, GL_MAP_READ_BIT);
762	ctx.expectError				(GL_INVALID_VALUE);
763
764	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 16, 17, GL_MAP_READ_BIT);
765	ctx.expectError				(GL_INVALID_VALUE);
766	ctx.endSection();
767
768	ctx.beginSection("GL_INVALID_VALUE is generated if access has any bits set other than those accepted.");
769	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_READ_BIT | 0x1000);
770	ctx.expectError				(GL_INVALID_VALUE);
771
772	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_WRITE_BIT | 0x1000);
773	ctx.expectError				(GL_INVALID_VALUE);
774	ctx.endSection();
775
776	ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer is already in a mapped state.");
777	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_WRITE_BIT);
778	ctx.expectError				(GL_NO_ERROR);
779	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 16, 8, GL_MAP_READ_BIT);
780	ctx.expectError				(GL_INVALID_OPERATION);
781	ctx.glUnmapBuffer			(GL_ARRAY_BUFFER);
782	ctx.endSection();
783
784	ctx.beginSection("GL_INVALID_OPERATION is generated if neither GL_MAP_READ_BIT or GL_MAP_WRITE_BIT is set.");
785	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_INVALIDATE_RANGE_BIT);
786	ctx.expectError				(GL_INVALID_OPERATION);
787	ctx.endSection();
788
789	ctx.beginSection("GL_INVALID_OPERATION is generated if ");
790	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_INVALIDATE_RANGE_BIT);
791	ctx.expectError				(GL_INVALID_OPERATION);
792	ctx.endSection();
793
794	ctx.beginSection("GL_INVALID_OPERATION is generated if GL_MAP_READ_BIT is set and any of GL_MAP_INVALIDATE_RANGE_BIT, GL_MAP_INVALIDATE_BUFFER_BIT, or GL_MAP_UNSYNCHRONIZED_BIT is set.");
795	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_READ_BIT | GL_MAP_INVALIDATE_RANGE_BIT);
796	ctx.expectError				(GL_INVALID_OPERATION);
797
798	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_READ_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
799	ctx.expectError				(GL_INVALID_OPERATION);
800
801	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_READ_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
802	ctx.expectError				(GL_INVALID_OPERATION);
803	ctx.endSection();
804
805	ctx.beginSection("GL_INVALID_OPERATION is generated if GL_MAP_FLUSH_EXPLICIT_BIT is set and GL_MAP_WRITE_BIT is not set.");
806	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_READ_BIT | GL_MAP_FLUSH_EXPLICIT_BIT);
807	ctx.expectError				(GL_INVALID_OPERATION);
808	ctx.endSection();
809
810	ctx.glDeleteBuffers			(1, &buf);
811}
812
813void read_buffer (NegativeTestContext& ctx)
814{
815	deUint32				fbo = 0x1234;
816	deUint32				texture = 0x1234;
817	int						maxColorAttachments = 0x1234;
818
819	ctx.glGetIntegerv			(GL_MAX_COLOR_ATTACHMENTS, &maxColorAttachments);
820	ctx.glGenTextures			(1, &texture);
821	ctx.glBindTexture			(GL_TEXTURE_2D, texture);
822	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
823	ctx.glGenFramebuffers		(1, &fbo);
824	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, fbo);
825	ctx.glFramebufferTexture2D	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
826	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
827	ctx.expectError				(GL_NO_ERROR);
828
829	ctx.beginSection("GL_INVALID_ENUM is generated if mode is not GL_BACK, GL_NONE, or GL_COLOR_ATTACHMENTi, where i is less than GL_MAX_COLOR_ATTACHMENTS.");
830	ctx.glReadBuffer			(-1);
831	ctx.expectError				(GL_INVALID_ENUM);
832	ctx.glReadBuffer			(GL_FRAMEBUFFER);
833	ctx.expectError				(GL_INVALID_ENUM);
834	ctx.glReadBuffer			(GL_COLOR_ATTACHMENT0 + maxColorAttachments);
835	ctx.expectError				(GL_INVALID_ENUM);
836	ctx.endSection();
837
838	ctx.beginSection("GL_INVALID_OPERATION is generated if the current framebuffer is the default framebuffer and mode is not GL_NONE or GL_BACK.");
839	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, 0);
840	ctx.glReadBuffer			(GL_COLOR_ATTACHMENT0);
841	ctx.expectError				(GL_INVALID_OPERATION);
842	ctx.endSection();
843
844	ctx.beginSection("GL_INVALID_OPERATION is generated if the current framebuffer is a named framebuffer and mode is not GL_NONE or GL_COLOR_ATTACHMENTi.");
845	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, fbo);
846	ctx.glReadBuffer			(GL_BACK);
847	ctx.expectError				(GL_INVALID_OPERATION);
848	ctx.endSection();
849
850	ctx.glDeleteTextures(1, &texture);
851	ctx.glDeleteFramebuffers(1, &fbo);
852}
853
854void unmap_buffer (NegativeTestContext& ctx)
855{
856	deUint32				buf = 0x1234;
857	std::vector<GLfloat>	data(32);
858
859	ctx.glGenBuffers			(1, &buf);
860	ctx.glBindBuffer			(GL_ARRAY_BUFFER, buf);
861	ctx.glBufferData			(GL_ARRAY_BUFFER, 32, &data[0], GL_DYNAMIC_COPY);
862	ctx.expectError				(GL_NO_ERROR);
863
864	ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer data store is already in an unmapped state.");
865	ctx.glUnmapBuffer			(GL_ARRAY_BUFFER);
866	ctx.expectError				(GL_INVALID_OPERATION);
867	ctx.endSection();
868
869	ctx.glDeleteBuffers			(1, &buf);
870}
871// Framebuffer Objects
872
873void bind_framebuffer (NegativeTestContext& ctx)
874{
875	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_FRAMEBUFFER.");
876	ctx.glBindFramebuffer(-1, 0);
877	ctx.expectError(GL_INVALID_ENUM);
878	ctx.glBindFramebuffer(GL_RENDERBUFFER, 0);
879	ctx.expectError(GL_INVALID_ENUM);
880	ctx.endSection();
881}
882
883void bind_renderbuffer (NegativeTestContext& ctx)
884{
885	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER.");
886	ctx.glBindRenderbuffer(-1, 0);
887	ctx.expectError(GL_INVALID_ENUM);
888	ctx.glBindRenderbuffer(GL_FRAMEBUFFER, 0);
889	ctx.expectError(GL_INVALID_ENUM);
890	ctx.endSection();
891}
892
893void check_framebuffer_status (NegativeTestContext& ctx)
894{
895	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_FRAMEBUFFER.");
896	ctx.glCheckFramebufferStatus(-1);
897	ctx.expectError(GL_INVALID_ENUM);
898	ctx.glCheckFramebufferStatus(GL_RENDERBUFFER);
899	ctx.expectError(GL_INVALID_ENUM);
900	ctx.endSection();
901}
902
903void gen_framebuffers (NegativeTestContext& ctx)
904{
905	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
906	ctx.glGenFramebuffers(-1, 0);
907	ctx.expectError(GL_INVALID_VALUE);
908	ctx.endSection();
909}
910
911void gen_renderbuffers (NegativeTestContext& ctx)
912{
913	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
914	ctx.glGenRenderbuffers(-1, 0);
915	ctx.expectError(GL_INVALID_VALUE);
916	ctx.endSection();
917}
918
919void delete_framebuffers (NegativeTestContext& ctx)
920{
921	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
922	ctx.glDeleteFramebuffers(-1, 0);
923	ctx.expectError(GL_INVALID_VALUE);
924	ctx.endSection();
925}
926
927void delete_renderbuffers (NegativeTestContext& ctx)
928{;
929	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
930	ctx.glDeleteRenderbuffers(-1, 0);
931	ctx.expectError(GL_INVALID_VALUE);
932	ctx.endSection();
933}
934
935void framebuffer_renderbuffer (NegativeTestContext& ctx)
936{
937	GLuint fbo = 0x1234;
938	GLuint rbo = 0x1234;
939	ctx.glGenFramebuffers(1, &fbo);
940	ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
941	ctx.glGenRenderbuffers(1, &rbo);
942
943	ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
944	ctx.glFramebufferRenderbuffer(-1, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0);
945	ctx.expectError(GL_INVALID_ENUM);
946	ctx.endSection();
947
948	ctx.beginSection("GL_INVALID_ENUM is generated if renderbuffertarget is not GL_RENDERBUFFER.");
949	ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo);
950	ctx.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, -1, rbo);
951	ctx.expectError(GL_INVALID_ENUM);
952	ctx.glBindRenderbuffer(GL_RENDERBUFFER, 0);
953	ctx.endSection();
954
955	ctx.beginSection("GL_INVALID_OPERATION is generated if renderbuffer is neither 0 nor the name of an existing renderbuffer object.");
956	ctx.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, -1);
957	ctx.expectError(GL_INVALID_OPERATION);
958	ctx.endSection();
959
960	ctx.beginSection("GL_INVALID_OPERATION is generated if zero is bound to target.");
961	ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
962	ctx.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0);
963	ctx.expectError(GL_INVALID_OPERATION);
964	ctx.endSection();
965
966	ctx.glDeleteRenderbuffers(1, &rbo);
967	ctx.glDeleteFramebuffers(1, &fbo);
968}
969
970void framebuffer_texture2d (NegativeTestContext& ctx)
971{
972	GLuint fbo = 0x1234;
973	GLuint tex2D = 0x1234;
974	GLuint texCube = 0x1234;
975	GLint maxTexSize = 0x1234;
976	GLint maxTexCubeSize = 0x1234;
977
978	ctx.glGenFramebuffers(1, &fbo);
979	ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
980	ctx.glGenTextures(1, &tex2D);
981	ctx.glBindTexture(GL_TEXTURE_2D, tex2D);
982	ctx.glGenTextures(1, &texCube);
983	ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, texCube);
984	ctx.glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTexSize);
985	ctx.glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &maxTexCubeSize);
986	ctx.expectError(GL_NO_ERROR);
987
988	ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
989	ctx.glFramebufferTexture2D(-1, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
990	ctx.expectError(GL_INVALID_ENUM);
991	ctx.endSection();
992
993	ctx.beginSection("GL_INVALID_ENUM is generated if textarget is not an accepted texture target.");
994	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, -1, tex2D, 0);
995	ctx.expectError(GL_INVALID_ENUM);
996	ctx.endSection();
997
998	ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0 or larger than log_2 of maximum texture size.");
999	int maxSize = 0x1234;
1000	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2D, -1);
1001	ctx.expectError(GL_INVALID_VALUE);
1002	maxSize = deLog2Floor32(maxTexSize) + 1;
1003	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2D, maxSize);
1004	ctx.expectError(GL_INVALID_VALUE);
1005	maxSize = deLog2Floor32(maxTexSize) + 1;
1006	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X, texCube, maxSize);
1007	ctx.expectError(GL_INVALID_VALUE);
1008	ctx.endSection();
1009
1010	ctx.beginSection("GL_INVALID_OPERATION is generated if texture is neither 0 nor the name of an existing texture object.");
1011	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, -1, 0);
1012	ctx.expectError(GL_INVALID_OPERATION);
1013	ctx.endSection();
1014
1015	ctx.beginSection("GL_INVALID_OPERATION is generated if textarget and texture are not compatible.");
1016	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X, tex2D, 0);
1017	ctx.expectError(GL_INVALID_OPERATION);
1018	ctx.glDeleteTextures(1, &tex2D);
1019
1020	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texCube, 0);
1021	ctx.expectError(GL_INVALID_OPERATION);
1022	ctx.glDeleteTextures(1, &texCube);
1023	ctx.endSection();
1024
1025	ctx.beginSection("GL_INVALID_OPERATION is generated if zero is bound to target.");
1026	ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1027	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
1028	ctx.expectError(GL_INVALID_OPERATION);
1029	ctx.endSection();
1030
1031	ctx.glDeleteFramebuffers(1, &fbo);
1032}
1033
1034void renderbuffer_storage (NegativeTestContext& ctx)
1035{
1036	deUint32					rbo = 0x1234;
1037	ctx.glGenRenderbuffers		(1, &rbo);
1038	ctx.glBindRenderbuffer		(GL_RENDERBUFFER, rbo);
1039
1040	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER.");
1041	ctx.glRenderbufferStorage	(-1, GL_RGBA4, 1, 1);
1042	ctx.expectError				(GL_INVALID_ENUM);
1043	ctx.glRenderbufferStorage	(GL_FRAMEBUFFER, GL_RGBA4, 1, 1);
1044	ctx.expectError				(GL_INVALID_ENUM);
1045	ctx.endSection();
1046
1047	ctx.beginSection("GL_INVALID_ENUM is generated if internalformat is not a color-renderable, depth-renderable, or stencil-renderable format.");
1048	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, -1, 1, 1);
1049	ctx.expectError				(GL_INVALID_ENUM);
1050
1051	if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_color_buffer_half_float")) // GL_EXT_color_buffer_half_float disables error
1052	{
1053		ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_RGB16F, 1, 1);
1054		ctx.expectError				(GL_INVALID_ENUM);
1055	}
1056
1057	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_RGBA8_SNORM, 1, 1);
1058	ctx.expectError				(GL_INVALID_ENUM);
1059	ctx.endSection();
1060
1061	ctx.beginSection("GL_INVALID_VALUE is generated if width or height is less than zero.");
1062	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_RGBA4, -1, 1);
1063	ctx.expectError				(GL_INVALID_VALUE);
1064	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_RGBA4, 1, -1);
1065	ctx.expectError				(GL_INVALID_VALUE);
1066	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_RGBA4, -1, -1);
1067	ctx.expectError				(GL_INVALID_VALUE);
1068	ctx.endSection();
1069
1070	ctx.beginSection("GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_RENDERBUFFER_SIZE.");
1071	GLint maxSize = 0x1234;
1072	ctx.glGetIntegerv			(GL_MAX_RENDERBUFFER_SIZE, &maxSize);
1073	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_RGBA4, 1, maxSize+1);
1074	ctx.expectError				(GL_INVALID_VALUE);
1075	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_RGBA4, maxSize+1, 1);
1076	ctx.expectError				(GL_INVALID_VALUE);
1077	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_RGBA4, maxSize+1, maxSize+1);
1078	ctx.expectError				(GL_INVALID_VALUE);
1079	ctx.endSection();
1080
1081	ctx.glDeleteRenderbuffers(1, &rbo);
1082}
1083
1084void blit_framebuffer (NegativeTestContext& ctx)
1085{
1086	deUint32					fbo[2];
1087	deUint32					rbo[2];
1088	deUint32					texture[2];
1089
1090	ctx.glGenFramebuffers		(2, fbo);
1091	ctx.glGenTextures			(2, texture);
1092	ctx.glGenRenderbuffers		(2, rbo);
1093
1094	ctx.glBindTexture			(GL_TEXTURE_2D, texture[0]);
1095	ctx.glBindRenderbuffer		(GL_RENDERBUFFER, rbo[0]);
1096	ctx.glBindFramebuffer		(GL_READ_FRAMEBUFFER, fbo[0]);
1097
1098	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1099	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 32, 32);
1100	ctx.glFramebufferTexture2D	(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[0], 0);
1101	ctx.glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo[0]);
1102	ctx.glCheckFramebufferStatus(GL_READ_FRAMEBUFFER);
1103
1104	ctx.glBindTexture			(GL_TEXTURE_2D, texture[1]);
1105	ctx.glBindRenderbuffer		(GL_RENDERBUFFER, rbo[1]);
1106	ctx.glBindFramebuffer		(GL_DRAW_FRAMEBUFFER, fbo[1]);
1107
1108	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1109	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 32, 32);
1110	ctx.glFramebufferTexture2D	(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[1], 0);
1111	ctx.glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo[1]);
1112	ctx.glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
1113	ctx.expectError				(GL_NO_ERROR);
1114
1115	ctx.beginSection("GL_INVALID_OPERATION is generated if mask contains any of the GL_DEPTH_BUFFER_BIT or GL_STENCIL_BUFFER_BIT and filter is not GL_NEAREST.");
1116	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_LINEAR);
1117	ctx.expectError				(GL_INVALID_OPERATION);
1118	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, GL_LINEAR);
1119	ctx.expectError				(GL_INVALID_OPERATION);
1120	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_LINEAR);
1121	ctx.expectError				(GL_INVALID_OPERATION);
1122	ctx.endSection();
1123
1124	ctx.beginSection("GL_INVALID_OPERATION is generated if mask contains GL_COLOR_BUFFER_BIT and read buffer format is incompatible with draw buffer format.");
1125	ctx.glBindTexture			(GL_TEXTURE_2D, texture[0]);
1126
1127	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32UI, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, NULL);
1128	ctx.glFramebufferTexture2D	(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[0], 0);
1129	ctx.getLog() << TestLog::Message << "// Read buffer: GL_RGBA32UI, draw buffer: GL_RGBA" << TestLog::EndMessage;
1130	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
1131	ctx.expectError				(GL_INVALID_OPERATION);
1132
1133	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32I, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, NULL);
1134	ctx.glFramebufferTexture2D	(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[0], 0);
1135	ctx.getLog() << TestLog::Message << "// Read buffer: GL_RGBA32I, draw buffer: GL_RGBA" << TestLog::EndMessage;
1136	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
1137	ctx.expectError				(GL_INVALID_OPERATION);
1138
1139	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1140	ctx.glFramebufferTexture2D	(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[0], 0);
1141	ctx.glBindTexture			(GL_TEXTURE_2D, texture[1]);
1142	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32I, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, NULL);
1143	ctx.glFramebufferTexture2D	(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[1], 0);
1144	ctx.getLog() << TestLog::Message << "// Read buffer: GL_RGBA8, draw buffer: GL_RGBA32I" << TestLog::EndMessage;
1145	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
1146	ctx.expectError				(GL_INVALID_OPERATION);
1147	ctx.endSection();
1148
1149	ctx.beginSection("GL_INVALID_OPERATION is generated if filter is GL_LINEAR and the read buffer contains integer data.");
1150	ctx.glBindTexture			(GL_TEXTURE_2D, texture[0]);
1151	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32UI, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, NULL);
1152	ctx.glFramebufferTexture2D	(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[0], 0);
1153	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1154	ctx.glFramebufferTexture2D	(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[1], 0);
1155	ctx.getLog() << TestLog::Message << "// Read buffer: GL_RGBA32I, draw buffer: GL_RGBA8" << TestLog::EndMessage;
1156	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_LINEAR);
1157	ctx.expectError				(GL_INVALID_OPERATION);
1158	ctx.endSection();
1159
1160	ctx.beginSection("GL_INVALID_OPERATION is generated if mask contains GL_DEPTH_BUFFER_BIT or GL_STENCIL_BUFFER_BIT and the source and destination depth and stencil formats do not match.");
1161	ctx.glBindRenderbuffer		(GL_RENDERBUFFER, rbo[0]);
1162	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_DEPTH32F_STENCIL8, 32, 32);
1163	ctx.glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo[0]);
1164	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
1165	ctx.expectError				(GL_INVALID_OPERATION);
1166	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, GL_STENCIL_BUFFER_BIT, GL_NEAREST);
1167	ctx.expectError				(GL_INVALID_OPERATION);
1168	ctx.endSection();
1169
1170	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, 0);
1171	ctx.glDeleteFramebuffers	(2, fbo);
1172	ctx.glDeleteTextures		(2, texture);
1173	ctx.glDeleteRenderbuffers	(2, rbo);
1174}
1175
1176void blit_framebuffer_multisample (NegativeTestContext& ctx)
1177{
1178	deUint32							fbo[2];
1179	deUint32							rbo[2];
1180
1181	ctx.glGenFramebuffers				(2, fbo);
1182	ctx.glGenRenderbuffers				(2, rbo);
1183
1184	ctx.glBindRenderbuffer				(GL_RENDERBUFFER, rbo[0]);
1185	ctx.glBindFramebuffer				(GL_READ_FRAMEBUFFER, fbo[0]);
1186	ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA8, 32, 32);
1187	ctx.glFramebufferRenderbuffer		(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[0]);
1188	ctx.glCheckFramebufferStatus		(GL_READ_FRAMEBUFFER);
1189
1190	ctx.glBindRenderbuffer				(GL_RENDERBUFFER, rbo[1]);
1191	ctx.glBindFramebuffer				(GL_DRAW_FRAMEBUFFER, fbo[1]);
1192
1193	ctx.expectError						(GL_NO_ERROR);
1194
1195	ctx.beginSection("GL_INVALID_OPERATION is generated if the value of GL_SAMPLE_BUFFERS for the draw buffer is greater than zero.");
1196	ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA8, 32, 32);
1197	ctx.glFramebufferRenderbuffer		(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
1198	ctx.glBlitFramebuffer				(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
1199	ctx.expectError						(GL_INVALID_OPERATION);
1200	ctx.endSection();
1201
1202	ctx.beginSection("GL_INVALID_OPERATION is generated if GL_SAMPLE_BUFFERS for the read buffer is greater than zero and the formats of draw and read buffers are not identical.");
1203	ctx.glRenderbufferStorage			(GL_RENDERBUFFER, GL_RGBA4, 32, 32);
1204	ctx.glFramebufferRenderbuffer		(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
1205	ctx.glBlitFramebuffer				(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
1206	ctx.expectError						(GL_INVALID_OPERATION);
1207	ctx.endSection();
1208
1209	ctx.beginSection("GL_INVALID_OPERATION is generated if GL_SAMPLE_BUFFERS for the read buffer is greater than zero and the source and destination rectangles are not defined with the same (X0, Y0) and (X1, Y1) bounds.");
1210	ctx.glRenderbufferStorage			(GL_RENDERBUFFER, GL_RGBA8, 32, 32);
1211	ctx.glFramebufferRenderbuffer		(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
1212	ctx.glBlitFramebuffer				(0, 0, 16, 16, 2, 2, 18, 18, GL_COLOR_BUFFER_BIT, GL_NEAREST);
1213	ctx.expectError						(GL_INVALID_OPERATION);
1214	ctx.endSection();
1215
1216	ctx.glBindFramebuffer				(GL_FRAMEBUFFER, 0);
1217	ctx.glDeleteRenderbuffers			(2, rbo);
1218	ctx.glDeleteFramebuffers			(2, fbo);
1219}
1220
1221void framebuffer_texture_layer (NegativeTestContext& ctx)
1222{
1223	deUint32						fbo = 0x1234;
1224	deUint32						tex3D;
1225	deUint32						tex2DArray;
1226	deUint32						tex2D;
1227
1228	ctx.glGenFramebuffers			(1, &fbo);
1229	ctx.glGenTextures				(1, &tex3D);
1230	ctx.glGenTextures				(1, &tex2DArray);
1231	ctx.glGenTextures				(1, &tex2D);
1232	ctx.glBindFramebuffer			(GL_FRAMEBUFFER, fbo);
1233
1234	ctx.glBindTexture				(GL_TEXTURE_3D, tex3D);
1235	ctx.glTexImage3D				(GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1236	ctx.glBindTexture				(GL_TEXTURE_2D_ARRAY, tex2DArray);
1237	ctx.glTexImage3D				(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1238	ctx.glBindTexture				(GL_TEXTURE_2D, tex2D);
1239	ctx.glTexImage2D				(GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1240
1241	ctx.expectError					(GL_NO_ERROR);
1242
1243	ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
1244	ctx.glFramebufferTextureLayer	(-1, GL_COLOR_ATTACHMENT0, tex3D, 0, 1);
1245	ctx.expectError					(GL_INVALID_ENUM);
1246	ctx.glFramebufferTextureLayer	(GL_RENDERBUFFER, GL_COLOR_ATTACHMENT0, tex3D, 0, 1);
1247	ctx.expectError					(GL_INVALID_ENUM);
1248	ctx.endSection();
1249
1250	ctx.beginSection("GL_INVALID_ENUM is generated if attachment is not one of the accepted tokens.");
1251	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, -1, tex3D, 0, 1);
1252	ctx.expectError					(GL_INVALID_ENUM);
1253	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_BACK, tex3D, 0, 1);
1254	ctx.expectError					(GL_INVALID_ENUM);
1255	ctx.endSection();
1256
1257	ctx.beginSection("GL_INVALID_OPERATION is generated if texture is non-zero and not the name of a 3D texture or 2D array texture.");
1258	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, -1, 0, 0);
1259	ctx.expectError					(GL_INVALID_OPERATION);
1260	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex2D, 0, 0);
1261	ctx.expectError					(GL_INVALID_OPERATION);
1262	ctx.endSection();
1263
1264	ctx.beginSection("GL_INVALID_VALUE is generated if texture is not zero and layer is negative.");
1265	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex3D, 0, -1);
1266	ctx.expectError					(GL_INVALID_VALUE);
1267	ctx.endSection();
1268
1269	ctx.beginSection("GL_INVALID_VALUE is generated if texture is not zero and layer is greater than GL_MAX_3D_TEXTURE_SIZE-1 for a 3D texture.");
1270	int							max3DTexSize = 0x1234;
1271	ctx.glGetIntegerv				(GL_MAX_3D_TEXTURE_SIZE, &max3DTexSize);
1272	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex3D, 0, max3DTexSize);
1273	ctx.expectError					(GL_INVALID_VALUE);
1274	ctx.endSection();
1275
1276	ctx.beginSection("GL_INVALID_VALUE is generated if texture is not zero and layer is greater than GL_MAX_ARRAY_TEXTURE_LAYERS-1 for a 2D array texture.");
1277	int							maxArrayTexLayers = 0x1234;
1278	ctx.glGetIntegerv				(GL_MAX_ARRAY_TEXTURE_LAYERS, &maxArrayTexLayers);
1279	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex2DArray, 0, maxArrayTexLayers);
1280	ctx.expectError					(GL_INVALID_VALUE);
1281	ctx.endSection();
1282
1283	ctx.beginSection("GL_INVALID_OPERATION is generated if zero is bound to target.");
1284	ctx.glBindFramebuffer			(GL_FRAMEBUFFER, 0);
1285	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex3D, 0, 1);
1286	ctx.expectError					(GL_INVALID_OPERATION);
1287	ctx.endSection();
1288
1289	ctx.glDeleteTextures		(1, &tex3D);
1290	ctx.glDeleteTextures		(1, &tex2DArray);
1291	ctx.glDeleteTextures		(1, &tex2D);
1292	ctx.glDeleteFramebuffers	(1, &fbo);
1293}
1294
1295void invalidate_framebuffer (NegativeTestContext& ctx)
1296{
1297	deUint32					fbo = 0x1234;
1298	deUint32					texture = 0x1234;
1299	deUint32					attachments[2];
1300	int							maxColorAttachments = 0x1234;
1301	ctx.glGetIntegerv				(GL_MAX_COLOR_ATTACHMENTS, &maxColorAttachments);
1302	attachments[0]				= GL_COLOR_ATTACHMENT0;
1303	attachments[1]				= GL_COLOR_ATTACHMENT0 + maxColorAttachments;
1304
1305	ctx.glGenFramebuffers			(1, &fbo);
1306	ctx.glGenTextures				(1, &texture);
1307	ctx.glBindFramebuffer			(GL_FRAMEBUFFER, fbo);
1308	ctx.glBindTexture				(GL_TEXTURE_2D, texture);
1309	ctx.glTexImage2D				(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1310	ctx.glFramebufferTexture2D		(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
1311	ctx.glCheckFramebufferStatus	(GL_FRAMEBUFFER);
1312	ctx.expectError					(GL_NO_ERROR);
1313
1314	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_FRAMEBUFFER, GL_READ_FRAMEBUFFER or GL_DRAW_FRAMEBUFFER.");
1315	ctx.glInvalidateFramebuffer		(-1, 1, &attachments[0]);
1316	ctx.expectError					(GL_INVALID_ENUM);
1317	ctx.glInvalidateFramebuffer		(GL_BACK, 1, &attachments[0]);
1318	ctx.expectError					(GL_INVALID_ENUM);
1319	ctx.endSection();
1320
1321	ctx.beginSection("GL_INVALID_OPERATION is generated if attachments contains GL_COLOR_ATTACHMENTm and m is greater than or equal to the value of GL_MAX_COLOR_ATTACHMENTS.");
1322	ctx.glInvalidateFramebuffer		(GL_FRAMEBUFFER, 1, &attachments[1]);
1323	ctx.expectError					(GL_INVALID_OPERATION);
1324	ctx.endSection();
1325
1326	ctx.glDeleteTextures		(1, &texture);
1327	ctx.glDeleteFramebuffers	(1, &fbo);
1328}
1329
1330void invalidate_sub_framebuffer (NegativeTestContext& ctx)
1331{
1332	deUint32					fbo = 0x1234;
1333	deUint32					texture = 0x1234;
1334	deUint32					attachments[2];
1335	int							maxColorAttachments = 0x1234;
1336	ctx.glGetIntegerv				(GL_MAX_COLOR_ATTACHMENTS, &maxColorAttachments);
1337	attachments[0]				= GL_COLOR_ATTACHMENT0;
1338	attachments[1]				= GL_COLOR_ATTACHMENT0 + maxColorAttachments;
1339
1340	ctx.glGenFramebuffers			(1, &fbo);
1341	ctx.glGenTextures				(1, &texture);
1342	ctx.glBindFramebuffer			(GL_FRAMEBUFFER, fbo);
1343	ctx.glBindTexture				(GL_TEXTURE_2D, texture);
1344	ctx.glTexImage2D				(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1345	ctx.glFramebufferTexture2D		(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
1346	ctx.glCheckFramebufferStatus	(GL_FRAMEBUFFER);
1347	ctx.expectError					(GL_NO_ERROR);
1348
1349	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_FRAMEBUFFER, GL_READ_FRAMEBUFFER or GL_DRAW_FRAMEBUFFER.");
1350	ctx.glInvalidateSubFramebuffer	(-1, 1, &attachments[0], 0, 0, 16, 16);
1351	ctx.expectError					(GL_INVALID_ENUM);
1352	ctx.glInvalidateSubFramebuffer	(GL_BACK, 1, &attachments[0], 0, 0, 16, 16);
1353	ctx.expectError					(GL_INVALID_ENUM);
1354	ctx.endSection();
1355
1356	ctx.beginSection("GL_INVALID_OPERATION is generated if attachments contains GL_COLOR_ATTACHMENTm and m is greater than or equal to the value of GL_MAX_COLOR_ATTACHMENTS.");
1357	ctx.glInvalidateSubFramebuffer	(GL_FRAMEBUFFER, 1, &attachments[1], 0, 0, 16, 16);
1358	ctx.expectError					(GL_INVALID_OPERATION);
1359	ctx.endSection();
1360
1361	ctx.glDeleteTextures		(1, &texture);
1362	ctx.glDeleteFramebuffers	(1, &fbo);
1363}
1364
1365void renderbuffer_storage_multisample (NegativeTestContext& ctx)
1366{
1367	deUint32							rbo = 0x1234;
1368	int									maxSamplesSupportedRGBA4 = -1;
1369
1370	ctx.glGetInternalformativ				(GL_RENDERBUFFER, GL_RGBA4, GL_SAMPLES, 1, &maxSamplesSupportedRGBA4);
1371	ctx.glGenRenderbuffers					(1, &rbo);
1372	ctx.glBindRenderbuffer					(GL_RENDERBUFFER, rbo);
1373
1374	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER.");
1375	ctx.glRenderbufferStorageMultisample	(-1, 2, GL_RGBA4, 1, 1);
1376	ctx.expectError							(GL_INVALID_ENUM);
1377	ctx.glRenderbufferStorageMultisample	(GL_FRAMEBUFFER, 2, GL_RGBA4, 1, 1);
1378	ctx.expectError							(GL_INVALID_ENUM);
1379	ctx.endSection();
1380
1381	ctx.beginSection("GL_INVALID_OPERATION is generated if samples is greater than the maximum number of samples supported for internalformat.");
1382	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, maxSamplesSupportedRGBA4+1, GL_RGBA4, 1, 1);
1383	ctx.expectError							(GL_INVALID_OPERATION);
1384	ctx.endSection();
1385
1386	ctx.beginSection("GL_INVALID_ENUM is generated if internalformat is not a color-renderable, depth-renderable, or stencil-renderable format.");
1387	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, 2, -1, 1, 1);
1388	ctx.expectError							(GL_INVALID_ENUM);
1389
1390	if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_color_buffer_half_float")) // GL_EXT_color_buffer_half_float disables error
1391	{
1392		ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, 2, GL_RGB16F, 1, 1);
1393		ctx.expectError							(GL_INVALID_ENUM);
1394	}
1395
1396	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, 2, GL_RGBA8_SNORM, 1, 1);
1397	ctx.expectError							(GL_INVALID_ENUM);
1398	ctx.endSection();
1399
1400	ctx.beginSection("GL_INVALID_OPERATION is generated if internalformat is a signed or unsigned integer format and samples is greater than 0.");
1401	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, 1, GL_RGBA8UI, 1, 1);
1402	ctx.expectError							(GL_INVALID_OPERATION);
1403	ctx.endSection();
1404
1405	ctx.beginSection("GL_INVALID_VALUE is generated if width or height is less than zero.");
1406	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, 2, GL_RGBA4, -1, 1);
1407	ctx.expectError							(GL_INVALID_VALUE);
1408	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, 2, GL_RGBA4, 1, -1);
1409	ctx.expectError							(GL_INVALID_VALUE);
1410	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, 2, GL_RGBA4, -1, -1);
1411	ctx.expectError							(GL_INVALID_VALUE);
1412	ctx.endSection();
1413
1414	ctx.beginSection("GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_RENDERBUFFER_SIZE.");
1415	GLint maxSize = 0x1234;
1416	ctx.glGetIntegerv						(GL_MAX_RENDERBUFFER_SIZE, &maxSize);
1417	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, 4, GL_RGBA4, 1, maxSize+1);
1418	ctx.expectError							(GL_INVALID_VALUE);
1419	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, 4, GL_RGBA4, maxSize+1, 1);
1420	ctx.expectError							(GL_INVALID_VALUE);
1421	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, 4, GL_RGBA4, maxSize+1, maxSize+1);
1422	ctx.expectError							(GL_INVALID_VALUE);
1423	ctx.endSection();
1424
1425	ctx.glDeleteRenderbuffers(1, &rbo);
1426}
1427
1428std::vector<FunctionContainer> getNegativeBufferApiTestFunctions ()
1429{
1430	FunctionContainer funcs[] =
1431	{
1432		{bind_buffer,						"bind_buffer",						"Invalid glBindBuffer() usage"					  },
1433		{delete_buffers,					"delete_buffers",					"Invalid glDeleteBuffers() usage"				  },
1434		{gen_buffers,						"gen_buffers",						"Invalid glGenBuffers() usage"					  },
1435		{buffer_data,						"buffer_data",						"Invalid glBufferData() usage"					  },
1436		{buffer_sub_data,					"buffer_sub_data",					"Invalid glBufferSubData() usage"				  },
1437		{buffer_sub_data_size_offset,		"buffer_sub_data_size_offset",		"Invalid glBufferSubData() usage"				  },
1438		{clear,								"clear",							"Invalid glClear() usage"						  },
1439		{read_pixels,						"read_pixels",						"Invalid glReadPixels() usage"					  },
1440		{read_pixels_format_mismatch,		"read_pixels_format_mismatch",		"Invalid glReadPixels() usage"					  },
1441		{read_pixels_fbo_format_mismatch,	"read_pixels_fbo_format_mismatch",	"Invalid glReadPixels() usage"					  },
1442		{bind_buffer_range,					"bind_buffer_range",				"Invalid glBindBufferRange() usage"				  },
1443		{bind_buffer_base,					"bind_buffer_base",					"Invalid glBindBufferBase() usage"				  },
1444		{clear_bufferiv,					"clear_bufferiv",					"Invalid glClearBufferiv() usage"				  },
1445		{clear_bufferuiv,					"clear_bufferuiv",					"Invalid glClearBufferuiv() usage"				  },
1446		{clear_bufferfv,					"clear_bufferfv",					"Invalid glClearBufferfv() usage"				  },
1447		{clear_bufferfi,					"clear_bufferfi",					"Invalid glClearBufferfi() usage"				  },
1448		{copy_buffer_sub_data,				"copy_buffer_sub_data",				"Invalid glCopyBufferSubData() usage"			  },
1449		{draw_buffers,						"draw_buffers",						"Invalid glDrawBuffers() usage"					  },
1450		{flush_mapped_buffer_range,			"flush_mapped_buffer_range",		"Invalid glFlushMappedBufferRange() usage"		  },
1451		{map_buffer_range,					"map_buffer_range",					"Invalid glMapBufferRange() usage"				  },
1452		{read_buffer,						"read_buffer",						"Invalid glReadBuffer() usage"					  },
1453		{unmap_buffer,						"unmap_buffer",						"Invalid glUnmapBuffer() usage"					  },
1454		{bind_framebuffer,					"bind_framebuffer",					"Invalid glBindFramebuffer() usage"				  },
1455		{bind_renderbuffer,					"bind_renderbuffer",				"Invalid glBindRenderbuffer() usage"			  },
1456		{check_framebuffer_status,			"check_framebuffer_status",			"Invalid glCheckFramebufferStatus() usage"		  },
1457		{gen_framebuffers,					"gen_framebuffers",					"Invalid glGenFramebuffers() usage"				  },
1458		{gen_renderbuffers,					"gen_renderbuffers",				"Invalid glGenRenderbuffers() usage"			  },
1459		{delete_framebuffers,				"delete_framebuffers",				"Invalid glDeleteFramebuffers() usage"			  },
1460		{delete_renderbuffers,				"delete_renderbuffers",				"Invalid glDeleteRenderbuffers() usage"			  },
1461		{framebuffer_renderbuffer,			"framebuffer_renderbuffer",			"Invalid glFramebufferRenderbuffer() usage"		  },
1462		{framebuffer_texture2d,				"framebuffer_texture2d",			"Invalid glFramebufferTexture2D() usage"		  },
1463		{renderbuffer_storage,				"renderbuffer_storage",				"Invalid glRenderbufferStorage() usage"			  },
1464		{blit_framebuffer,					"blit_framebuffer",					"Invalid glBlitFramebuffer() usage"				  },
1465		{blit_framebuffer_multisample,		"blit_framebuffer_multisample",		"Invalid glBlitFramebuffer() usage"				  },
1466		{framebuffer_texture_layer,			"framebuffer_texture_layer",		"Invalid glFramebufferTextureLayer() usage"		  },
1467		{invalidate_framebuffer,			"invalidate_framebuffer",			"Invalid glInvalidateFramebuffer() usage"		  },
1468		{invalidate_sub_framebuffer,		"invalidate_sub_framebuffer",		"Invalid glInvalidateSubFramebuffer() usage"	  },
1469		{renderbuffer_storage_multisample,	"renderbuffer_storage_multisample",	"Invalid glRenderbufferStorageMultisample() usage"},
1470	};
1471
1472	return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs));
1473}
1474
1475} // NegativeTestShared
1476} // Functional
1477} // gles31
1478} // deqp
1479