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