es31fNegativeBufferApiTests.cpp revision fb059fdb43c8b6073ada028a68124263c59a000a
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	GLuint					fbo			= 0x1234;
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	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 readn_pixels (NegativeTestContext& ctx)
198{
199	std::vector<GLubyte>	ubyteData	(4);
200	GLuint					fbo			= 0x1234;
201
202	ctx.beginSection("GL_INVALID_OPERATION is generated if the combination of format and type is unsupported.");
203	ctx.glReadnPixels(0, 0, 1, 1, GL_LUMINANCE_ALPHA, GL_UNSIGNED_SHORT_4_4_4_4, (int) ubyteData.size(), &ubyteData[0]);
204	ctx.expectError(GL_INVALID_OPERATION);
205	ctx.endSection();
206
207	ctx.beginSection("GL_INVALID_VALUE is generated if either width or height is negative.");
208	ctx.glReadnPixels(0, 0, -1, 1, GL_RGBA, GL_UNSIGNED_BYTE, (int) ubyteData.size(), &ubyteData[0]);
209	ctx.expectError(GL_INVALID_VALUE);
210	ctx.glReadnPixels(0, 0, 1, -1, GL_RGBA, GL_UNSIGNED_BYTE, (int) ubyteData.size(), &ubyteData[0]);
211	ctx.expectError(GL_INVALID_VALUE);
212	ctx.glReadnPixels(0, 0, -1, -1, GL_RGBA, GL_UNSIGNED_BYTE, (int) ubyteData.size(), &ubyteData[0]);
213	ctx.expectError(GL_INVALID_VALUE);
214	ctx.endSection();
215
216	ctx.beginSection("GL_INVALID_OPERATION is generated by ReadnPixels if the buffer size required to store the requested data is larger than bufSize.");
217	ctx.glReadnPixels(0, 0, 0x1234, 0x1234, GL_RGBA, GL_UNSIGNED_BYTE, (int) ubyteData.size(), &ubyteData[0]);
218	ctx.expectError(GL_INVALID_OPERATION);
219	ctx.endSection();
220
221	ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
222	ctx.glGenFramebuffers(1, &fbo);
223	ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
224	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
225	ctx.glReadnPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, (int) ubyteData.size(), &ubyteData[0]);
226	ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
227	ctx.endSection();
228
229	ctx.glDeleteFramebuffers(1, &fbo);
230}
231
232void read_pixels_format_mismatch (NegativeTestContext& ctx)
233{
234	std::vector<GLubyte>	ubyteData	(4);
235	std::vector<GLushort>	ushortData	(4);
236	std::vector<GLfloat>	floatData	(4);
237	GLint					readFormat	= 0x1234;
238	GLint					readType	= 0x1234;
239
240	ctx.beginSection("Unsupported combinations of format and type will generate an GL_INVALID_OPERATION error.");
241	ctx.glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_SHORT_5_6_5, &ushortData[0]);
242	ctx.expectError(GL_INVALID_OPERATION);
243	ctx.glReadPixels(0, 0, 1, 1, GL_ALPHA, GL_UNSIGNED_SHORT_5_6_5, &ushortData[0]);
244	ctx.expectError(GL_INVALID_OPERATION);
245	ctx.glReadPixels(0, 0, 1, 1, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, &ushortData[0]);
246	ctx.expectError(GL_INVALID_OPERATION);
247	ctx.glReadPixels(0, 0, 1, 1, GL_ALPHA, GL_UNSIGNED_SHORT_4_4_4_4, &ushortData[0]);
248	ctx.expectError(GL_INVALID_OPERATION);
249	ctx.glReadPixels(0, 0, 1, 1, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, &ushortData[0]);
250	ctx.expectError(GL_INVALID_OPERATION);
251	ctx.glReadPixels(0, 0, 1, 1, GL_ALPHA, GL_UNSIGNED_SHORT_5_5_5_1, &ushortData[0]);
252	ctx.expectError(GL_INVALID_OPERATION);
253	ctx.glReadnPixels(0, 0, 1, 1, GL_RGBA, GL_FLOAT, (int) floatData.size(), &floatData[0]);
254	ctx.expectError(GL_INVALID_OPERATION);
255	ctx.endSection();
256
257	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.");
258	ctx.glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &ubyteData[0]);
259	ctx.expectError(GL_NO_ERROR);
260	ctx.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &readFormat);
261	ctx.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &readType);
262	ctx.glReadPixels(0, 0, 1, 1, readFormat, readType, &ubyteData[0]);
263	ctx.expectError(GL_NO_ERROR);
264	ctx.endSection();
265}
266
267void read_pixels_fbo_format_mismatch (NegativeTestContext& ctx)
268{
269	std::vector<GLubyte>	ubyteData(4);
270	std::vector<float>		floatData(4);
271	deUint32				fbo = 0x1234;
272	deUint32				texture = 0x1234;
273
274	ctx.glGenTextures			(1, &texture);
275	ctx.glBindTexture			(GL_TEXTURE_2D, texture);
276	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
277	ctx.glGenFramebuffers		(1, &fbo);
278	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, fbo);
279	ctx.glFramebufferTexture2D	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
280	ctx.expectError				(GL_NO_ERROR);
281
282	ctx.beginSection("GL_INVALID_OPERATION is generated if currently bound framebuffer format is incompatible with format and type.");
283
284	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
285	ctx.glFramebufferTexture2D	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
286	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
287	ctx.expectError				(GL_NO_ERROR);
288	ctx.glReadPixels			(0, 0, 1, 1, GL_RGBA, GL_FLOAT, &floatData[0]);
289	ctx.expectError				(GL_INVALID_OPERATION);
290
291	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32I, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, NULL);
292	ctx.glFramebufferTexture2D	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
293	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
294	ctx.expectError				(GL_NO_ERROR);
295	ctx.glReadPixels			(0, 0, 1, 1, GL_RGBA, GL_FLOAT, &floatData[0]);
296	ctx.expectError				(GL_INVALID_OPERATION);
297
298	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32UI, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, NULL);
299	ctx.glFramebufferTexture2D	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
300	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
301	ctx.expectError				(GL_NO_ERROR);
302	ctx.glReadPixels			(0, 0, 1, 1, GL_RGBA, GL_FLOAT, &floatData[0]);
303	ctx.expectError				(GL_INVALID_OPERATION);
304
305	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32F, 32, 32, 0, GL_RGBA, GL_FLOAT, NULL);
306	ctx.expectError				(GL_NO_ERROR);
307	ctx.glFramebufferTexture2D	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
308	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
309	ctx.expectError				(GL_NO_ERROR);
310	ctx.glReadPixels			(0, 0, 1, 1, GL_RGBA, GL_INT, &floatData[0]);
311	ctx.expectError				(GL_INVALID_OPERATION);
312
313	ctx.endSection();
314
315	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.");
316
317	int			binding			= -1;
318	int			sampleBuffers = 0x1234;
319	deUint32	rbo = 0x1234;
320
321	ctx.glGenRenderbuffers(1, &rbo);
322	ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo);
323	ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA8, 32, 32);
324	ctx.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo);
325
326	ctx.glGetIntegerv			(GL_READ_FRAMEBUFFER_BINDING, &binding);
327	ctx.getLog() << TestLog::Message << "// GL_READ_FRAMEBUFFER_BINDING: " << binding << TestLog::EndMessage;
328	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
329	ctx.glGetIntegerv			(GL_SAMPLE_BUFFERS, &sampleBuffers);
330	ctx.getLog() << TestLog::Message << "// GL_SAMPLE_BUFFERS: " << sampleBuffers << TestLog::EndMessage;
331	ctx.expectError				(GL_NO_ERROR);
332
333	if (binding == 0 || sampleBuffers <= 0)
334	{
335		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;
336		ctx.fail("Got invalid value");
337	}
338	else
339	{
340		ctx.glReadPixels	(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &ubyteData[0]);
341		ctx.expectError		(GL_INVALID_OPERATION);
342	}
343
344	ctx.endSection();
345
346	ctx.glBindRenderbuffer		(GL_RENDERBUFFER, 0);
347	ctx.glBindTexture			(GL_TEXTURE_2D, 0);
348	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, 0);
349	ctx.glDeleteFramebuffers	(1, &fbo);
350	ctx.glDeleteTextures		(1, &texture);
351	ctx.glDeleteRenderbuffers	(1, &rbo);
352}
353
354void bind_buffer_range (NegativeTestContext& ctx)
355{
356	deUint32	bufAC		= 0x1234;
357	deUint32	bufU		= 0x1234;
358	deUint32	bufTF		= 0x1234;
359	int			maxTFSize	= 0x1234;
360	int			maxUSize	= 0x1234;
361	int			uAlignment	= 0x1234;
362
363	ctx.glGenBuffers(1, &bufU);
364	ctx.glBindBuffer(GL_UNIFORM_BUFFER, bufU);
365	ctx.glBufferData(GL_UNIFORM_BUFFER, 16, NULL, GL_STREAM_DRAW);
366
367	ctx.glGenBuffers(1, &bufTF);
368	ctx.glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, bufTF);
369	ctx.glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 16, NULL, GL_STREAM_DRAW);
370
371	ctx.glGenBuffers(1, &bufAC);
372	ctx.glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, bufAC);
373	ctx.glBufferData(GL_ATOMIC_COUNTER_BUFFER, 16, NULL, GL_STREAM_DRAW);
374
375	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_ATOMIC_COUNTER_BUFFER, GL_SHADER_STORAGE_BUFFER, GL_TRANSFORM_FEEDBACK_BUFFER or GL_UNIFORM_BUFFER.");
376	ctx.glBindBufferRange(GL_ARRAY_BUFFER, 0, bufU, 0, 4);
377	ctx.expectError(GL_INVALID_ENUM);
378	ctx.endSection();
379
380	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.");
381	ctx.glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, &maxTFSize);
382	ctx.glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, maxTFSize, bufTF, 0, 4);
383	ctx.expectError(GL_INVALID_VALUE);
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	ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUSize);
388	ctx.glBindBufferRange(GL_UNIFORM_BUFFER, maxUSize, bufU, 0, 4);
389	ctx.expectError(GL_INVALID_VALUE);
390	ctx.endSection();
391
392	ctx.beginSection("GL_INVALID_VALUE is generated if size is less than or equal to zero.");
393	ctx.glBindBufferRange(GL_UNIFORM_BUFFER, 0, bufU, 0, -1);
394	ctx.expectError(GL_INVALID_VALUE);
395	ctx.glBindBufferRange(GL_UNIFORM_BUFFER, 0, bufU, 0, 0);
396	ctx.expectError(GL_INVALID_VALUE);
397	ctx.endSection();
398
399	ctx.beginSection("GL_INVALID_VALUE is generated if offset is less than zero.");
400	ctx.glBindBufferRange(GL_UNIFORM_BUFFER, 0, bufU, -1, 0);
401	ctx.expectError(GL_INVALID_VALUE);
402	ctx.endSection();
403
404	ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_TRANSFORM_FEEDBACK_BUFFER and size or offset are not multiples of 4.");
405	ctx.glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, bufTF, 4, 5);
406	ctx.expectError(GL_INVALID_VALUE);
407	ctx.glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, bufTF, 5, 4);
408	ctx.expectError(GL_INVALID_VALUE);
409	ctx.glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, bufTF, 5, 7);
410	ctx.expectError(GL_INVALID_VALUE);
411	ctx.endSection();
412
413	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.");
414	ctx.glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &uAlignment);
415	ctx.glBindBufferRange(GL_UNIFORM_BUFFER, 0, bufU, uAlignment+1, 4);
416	ctx.expectError(GL_INVALID_VALUE);
417	ctx.endSection();
418
419	if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
420	{
421		int maxACize	= 0x1234;
422		int maxSSize	= 0x1234;
423		int ssAlignment	= 0x1234;
424
425		ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_ATOMIC_COUNTER_BUFFER and index is greater than or equal to GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS.");
426		ctx.glGetIntegerv(GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS, &maxACize);
427		ctx.glBindBufferRange(GL_ATOMIC_COUNTER_BUFFER, maxACize, bufU, 0, 4);
428		ctx.expectError(GL_INVALID_VALUE);
429		ctx.endSection();
430
431		ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_SHADER_STORAGE_BUFFER and index is greater than or equal to GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS.");
432		ctx.glGetIntegerv(GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS, &maxSSize);
433		ctx.glBindBufferRange(GL_SHADER_STORAGE_BUFFER, maxSSize, bufU, 0, 4);
434		ctx.expectError(GL_INVALID_VALUE);
435		ctx.endSection();
436
437		ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_ATOMIC_COUNTER_BUFFER and offset is not multiples of 4.");
438		ctx.glBindBufferRange(GL_ATOMIC_COUNTER_BUFFER, 0, bufTF, 5, 0);
439		ctx.expectError(GL_INVALID_VALUE);
440		ctx.endSection();
441
442		ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_SHADER_STORAGE_BUFFER and offset is not a multiple of the value of GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT.");
443		ctx.glGetIntegerv(GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT, &ssAlignment);
444		ctx.glBindBufferRange(GL_ATOMIC_COUNTER_BUFFER, 0, bufTF, ssAlignment+1, 0);
445		ctx.expectError(GL_INVALID_VALUE);
446		ctx.endSection();
447	}
448
449	ctx.glDeleteBuffers(1, &bufU);
450	ctx.glDeleteBuffers(1, &bufTF);
451	ctx.glDeleteBuffers(1, &bufAC);
452}
453
454void bind_buffer_base (NegativeTestContext& ctx)
455{
456	deUint32	bufU		= 0x1234;
457	deUint32	bufTF		= 0x1234;
458	int			maxUSize	= 0x1234;
459	int			maxTFSize	= 0x1234;
460
461	ctx.glGenBuffers(1, &bufU);
462	ctx.glBindBuffer(GL_UNIFORM_BUFFER, bufU);
463	ctx.glBufferData(GL_UNIFORM_BUFFER, 16, NULL, GL_STREAM_DRAW);
464
465	ctx.glGenBuffers(1, &bufTF);
466	ctx.glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, bufTF);
467	ctx.glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 16, NULL, GL_STREAM_DRAW);
468	ctx.expectError(GL_NO_ERROR);
469
470	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_ATOMIC_COUNTER_BUFFER, GL_SHADER_STORAGE_BUFFER, GL_TRANSFORM_FEEDBACK_BUFFER or GL_UNIFORM_BUFFER.");
471	ctx.glBindBufferBase(-1, 0, bufU);
472	ctx.expectError(GL_INVALID_ENUM);
473	ctx.glBindBufferBase(GL_ARRAY_BUFFER, 0, bufU);
474	ctx.expectError(GL_INVALID_ENUM);
475	ctx.endSection();
476
477	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.");
478	ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUSize);
479	ctx.glBindBufferBase(GL_UNIFORM_BUFFER, maxUSize, bufU);
480	ctx.expectError(GL_INVALID_VALUE);
481	ctx.endSection();
482
483	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.");
484	ctx.glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, &maxTFSize);
485	ctx.glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, maxTFSize, bufTF);
486	ctx.expectError(GL_INVALID_VALUE);
487	ctx.endSection();
488
489	if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
490	{
491		int maxACize = 0x1234;
492		int maxSSize = 0x1234;
493
494		ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_ATOMIC_COUNTER_BUFFER and index is greater than or equal to GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS.");
495		ctx.glGetIntegerv(GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS, &maxACize);
496		ctx.glBindBufferRange(GL_ATOMIC_COUNTER_BUFFER, maxACize, bufU, 0, 4);
497		ctx.expectError(GL_INVALID_VALUE);
498		ctx.endSection();
499
500		ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_SHADER_STORAGE_BUFFER and index is greater than or equal to GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS.");
501		ctx.glGetIntegerv(GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS, &maxSSize);
502		ctx.glBindBufferRange(GL_SHADER_STORAGE_BUFFER, maxSSize, bufU, 0, 4);
503		ctx.expectError(GL_INVALID_VALUE);
504		ctx.endSection();
505	}
506
507	ctx.glDeleteBuffers(1, &bufU);
508	ctx.glDeleteBuffers(1, &bufTF);
509}
510
511void clear_bufferiv (NegativeTestContext& ctx)
512{
513	std::vector<int>	data			(32*32);
514	deUint32			fbo				= 0x1234;
515	deUint32			texture			= 0x1234;
516	int					maxDrawBuffers	= 0x1234;
517
518	ctx.glGenTextures			(1, &texture);
519	ctx.glBindTexture			(GL_TEXTURE_2D, texture);
520	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32I, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, NULL);
521	ctx.glGenFramebuffers		(1, &fbo);
522	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, fbo);
523	ctx.glFramebufferTexture2D	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
524	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
525	ctx.expectError				(GL_NO_ERROR);
526
527	ctx.beginSection("GL_INVALID_ENUM is generated if buffer is not an accepted value.");
528	ctx.glClearBufferiv			(-1, 0, &data[0]);
529	ctx.expectError				(GL_INVALID_ENUM);
530	ctx.glClearBufferiv			(GL_FRAMEBUFFER, 0, &data[0]);
531	ctx.expectError				(GL_INVALID_ENUM);
532	ctx.endSection();
533
534	ctx.beginSection("GL_INVALID_ENUM is generated if buffer is GL_DEPTH or GL_DEPTH_STENCIL.");
535	ctx.glClearBufferiv			(GL_DEPTH, 1, &data[0]);
536	ctx.expectError				(GL_INVALID_ENUM);
537	ctx.glClearBufferiv			(GL_DEPTH_STENCIL, 1, &data[0]);
538	ctx.expectError				(GL_INVALID_ENUM);
539	ctx.endSection();
540
541	ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_COLOR or GL_STENCIL and drawBuffer is greater than or equal to GL_MAX_DRAW_BUFFERS.");
542	ctx.glGetIntegerv			(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
543	ctx.glClearBufferiv			(GL_COLOR, maxDrawBuffers, &data[0]);
544	ctx.expectError				(GL_INVALID_VALUE);
545	ctx.endSection();
546
547	ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_COLOR or GL_STENCIL and drawBuffer is negative.");
548	ctx.glClearBufferiv			(GL_COLOR, -1, &data[0]);
549	ctx.expectError				(GL_INVALID_VALUE);
550	ctx.endSection();
551
552	ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_STENCIL and drawBuffer is not zero.");
553	ctx.glClearBufferiv			(GL_STENCIL, 1, &data[0]);
554	ctx.expectError				(GL_INVALID_VALUE);
555	ctx.endSection();
556
557	ctx.glDeleteFramebuffers	(1, &fbo);
558	ctx.glDeleteTextures		(1, &texture);
559}
560
561void clear_bufferuiv (NegativeTestContext& ctx)
562{
563	std::vector<deUint32>	data			(32*32);
564	deUint32				fbo				= 0x1234;
565	deUint32				texture			= 0x1234;
566	int						maxDrawBuffers	= 0x1234;
567
568	ctx.glGenTextures			(1, &texture);
569	ctx.glBindTexture			(GL_TEXTURE_2D, texture);
570	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32UI, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, NULL);
571	ctx.glGenFramebuffers		(1, &fbo);
572	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, fbo);
573	ctx.glFramebufferTexture2D	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
574	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
575	ctx.expectError				(GL_NO_ERROR);
576
577	ctx.beginSection("GL_INVALID_ENUM is generated if buffer is not GL_COLOR.");
578	ctx.glClearBufferuiv		(-1, 0, &data[0]);
579	ctx.expectError				(GL_INVALID_ENUM);
580	ctx.glClearBufferuiv		(GL_FRAMEBUFFER, 0, &data[0]);
581	ctx.expectError				(GL_INVALID_ENUM);
582	ctx.endSection();
583
584	ctx.beginSection("GL_INVALID_ENUM is generated if buffer is GL_DEPTH, GL_STENCIL, or GL_DEPTH_STENCIL.");
585	ctx.glClearBufferuiv		(GL_DEPTH, 0, &data[0]);
586	ctx.expectError				(GL_INVALID_ENUM);
587	ctx.glClearBufferuiv		(GL_STENCIL, 0, &data[0]);
588	ctx.expectError				(GL_INVALID_ENUM);
589	ctx.glClearBufferuiv		(GL_DEPTH_STENCIL, 0, &data[0]);
590	ctx.expectError				(GL_INVALID_ENUM);
591	ctx.endSection();
592
593	ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_COLOR and drawBuffer is greater than or equal to GL_MAX_DRAW_BUFFERS.");
594	ctx.glGetIntegerv			(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
595	ctx.glClearBufferuiv		(GL_COLOR, maxDrawBuffers, &data[0]);
596	ctx.expectError				(GL_INVALID_VALUE);
597	ctx.endSection();
598
599	ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_COLOR and drawBuffer is negative.");
600	ctx.glClearBufferuiv		(GL_COLOR, -1, &data[0]);
601	ctx.expectError				(GL_INVALID_VALUE);
602	ctx.endSection();
603
604	ctx.glDeleteFramebuffers	(1, &fbo);
605	ctx.glDeleteTextures		(1, &texture);
606}
607
608void clear_bufferfv (NegativeTestContext& ctx)
609{
610	std::vector<float>	data			(32*32);
611	deUint32			fbo				= 0x1234;
612	deUint32			texture			= 0x1234;
613	int 				maxDrawBuffers	= 0x1234;
614
615	ctx.glGenTextures			(1, &texture);
616	ctx.glBindTexture			(GL_TEXTURE_2D, texture);
617	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32F, 32, 32, 0, GL_RGBA, GL_FLOAT, NULL);
618	ctx.glGenFramebuffers		(1, &fbo);
619	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, fbo);
620	ctx.glFramebufferTexture2D	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
621	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
622	ctx.expectError				(GL_NO_ERROR);
623
624	ctx.beginSection("GL_INVALID_ENUM is generated if buffer is not GL_COLOR or GL_DEPTH.");
625	ctx.glClearBufferfv			(-1, 0, &data[0]);
626	ctx.expectError				(GL_INVALID_ENUM);
627	ctx.glClearBufferfv			(GL_FRAMEBUFFER, 0, &data[0]);
628	ctx.expectError				(GL_INVALID_ENUM);
629	ctx.endSection();
630
631	ctx.beginSection("GL_INVALID_ENUM is generated if buffer is GL_STENCIL or GL_DEPTH_STENCIL.");
632	ctx.glClearBufferfv			(GL_STENCIL, 1, &data[0]);
633	ctx.expectError				(GL_INVALID_ENUM);
634	ctx.glClearBufferfv			(GL_DEPTH_STENCIL, 1, &data[0]);
635	ctx.expectError				(GL_INVALID_ENUM);
636	ctx.endSection();
637
638	ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_COLOR and drawBuffer is greater than or equal to GL_MAX_DRAW_BUFFERS.");
639	ctx.glGetIntegerv			(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
640	ctx.glClearBufferfv			(GL_COLOR, maxDrawBuffers, &data[0]);
641	ctx.expectError				(GL_INVALID_VALUE);
642	ctx.endSection();
643
644	ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_COLOR and drawBuffer is negative.");
645	ctx.glClearBufferfv			(GL_COLOR, -1, &data[0]);
646	ctx.expectError				(GL_INVALID_VALUE);
647	ctx.endSection();
648
649	ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_DEPTH and drawBuffer is not zero.");
650	ctx.glClearBufferfv			(GL_DEPTH, 1, &data[0]);
651	ctx.expectError				(GL_INVALID_VALUE);
652	ctx.endSection();
653
654	ctx.glDeleteFramebuffers	(1, &fbo);
655	ctx.glDeleteTextures		(1, &texture);
656}
657
658void clear_bufferfi (NegativeTestContext& ctx)
659{
660	ctx.beginSection("GL_INVALID_ENUM is generated if buffer is not GL_DEPTH_STENCIL.");
661	ctx.glClearBufferfi		(-1, 0, 1.0f, 1);
662	ctx.expectError			(GL_INVALID_ENUM);
663	ctx.glClearBufferfi		(GL_FRAMEBUFFER, 0, 1.0f, 1);
664	ctx.expectError			(GL_INVALID_ENUM);
665	ctx.glClearBufferfi		(GL_DEPTH, 0, 1.0f, 1);
666	ctx.expectError			(GL_INVALID_ENUM);
667	ctx.glClearBufferfi		(GL_STENCIL, 0, 1.0f, 1);
668	ctx.expectError			(GL_INVALID_ENUM);
669	ctx.glClearBufferfi		(GL_COLOR, 0, 1.0f, 1);
670	ctx.expectError			(GL_INVALID_ENUM);
671	ctx.endSection();
672
673	ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_DEPTH_STENCIL and drawBuffer is not zero.");
674	ctx.glClearBufferfi		(GL_DEPTH_STENCIL, 1, 1.0f, 1);
675	ctx.expectError			(GL_INVALID_VALUE);
676	ctx.endSection();
677}
678
679void copy_buffer_sub_data (NegativeTestContext& ctx)
680{
681	deUint32				buf[2];
682	std::vector<float>		data	(32*32);
683
684	ctx.glGenBuffers			(2, buf);
685	ctx.glBindBuffer			(GL_COPY_READ_BUFFER, buf[0]);
686	ctx.glBufferData			(GL_COPY_READ_BUFFER, 32, &data[0], GL_DYNAMIC_COPY);
687	ctx.glBindBuffer			(GL_COPY_WRITE_BUFFER, buf[1]);
688	ctx.glBufferData			(GL_COPY_WRITE_BUFFER, 32, &data[0], GL_DYNAMIC_COPY);
689	ctx.expectError				(GL_NO_ERROR);
690
691	ctx.beginSection("GL_INVALID_VALUE is generated if any of readoffset, writeoffset or size is negative.");
692	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, -4);
693	ctx.expectError				(GL_INVALID_VALUE);
694	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, -1, 0, 4);
695	ctx.expectError				(GL_INVALID_VALUE);
696	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, -1, 4);
697	ctx.expectError				(GL_INVALID_VALUE);
698	ctx.endSection();
699
700	ctx.beginSection("GL_INVALID_VALUE is generated if readoffset + size exceeds the size of the buffer object bound to readtarget.");
701	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 36);
702	ctx.expectError				(GL_INVALID_VALUE);
703	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 24, 0, 16);
704	ctx.expectError				(GL_INVALID_VALUE);
705	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 36, 0, 4);
706	ctx.expectError				(GL_INVALID_VALUE);
707	ctx.endSection();
708
709	ctx.beginSection("GL_INVALID_VALUE is generated if writeoffset + size exceeds the size of the buffer object bound to writetarget.");
710	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 36);
711	ctx.expectError				(GL_INVALID_VALUE);
712	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 24, 16);
713	ctx.expectError				(GL_INVALID_VALUE);
714	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 36, 4);
715	ctx.expectError				(GL_INVALID_VALUE);
716	ctx.endSection();
717
718	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.");
719	ctx.glBindBuffer			(GL_COPY_WRITE_BUFFER, buf[0]);
720	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 16, 4);
721	ctx.expectError				(GL_NO_ERROR);
722	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 4);
723	ctx.expectError				(GL_INVALID_VALUE);
724	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 16, 18);
725	ctx.expectError				(GL_INVALID_VALUE);
726	ctx.glBindBuffer			(GL_COPY_WRITE_BUFFER, buf[1]);
727	ctx.endSection();
728
729	ctx.beginSection("GL_INVALID_OPERATION is generated if zero is bound to readtarget or writetarget.");
730	ctx.glBindBuffer			(GL_COPY_READ_BUFFER, 0);
731	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 16);
732	ctx.expectError				(GL_INVALID_OPERATION);
733
734	ctx.glBindBuffer			(GL_COPY_READ_BUFFER, buf[0]);
735	ctx.glBindBuffer			(GL_COPY_WRITE_BUFFER, 0);
736	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 16);
737	ctx.expectError				(GL_INVALID_OPERATION);
738
739	ctx.glBindBuffer			(GL_COPY_WRITE_BUFFER, buf[1]);
740	ctx.endSection();
741
742	ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer object bound to either readtarget or writetarget is mapped.");
743	ctx.glMapBufferRange		(GL_COPY_READ_BUFFER, 0, 4, GL_MAP_READ_BIT);
744	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 16);
745	ctx.expectError				(GL_INVALID_OPERATION);
746	ctx.glUnmapBuffer			(GL_COPY_READ_BUFFER);
747
748	ctx.glMapBufferRange		(GL_COPY_WRITE_BUFFER, 0, 4, GL_MAP_READ_BIT);
749	ctx.glCopyBufferSubData		(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 16);
750	ctx.expectError				(GL_INVALID_OPERATION);
751	ctx.glUnmapBuffer			(GL_COPY_WRITE_BUFFER);
752	ctx.endSection();
753
754	ctx.glDeleteBuffers(2, buf);
755}
756
757void draw_buffers (NegativeTestContext& ctx)
758{
759	deUint32				fbo 					= 0x1234;
760	deUint32				texture 				= 0x1234;
761	int						maxDrawBuffers 			= 0x1234;
762	int						maxColorAttachments		= -1;
763	ctx.glGetIntegerv		(GL_MAX_COLOR_ATTACHMENTS, &maxColorAttachments);
764	ctx.glGetIntegerv		(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
765	std::vector<deUint32>	values					(maxDrawBuffers+1);
766	std::vector<deUint32>	attachments				(4);
767	std::vector<GLfloat>	data					(32*32);
768	values[0]				= GL_NONE;
769	values[1]				= GL_BACK;
770	values[2]				= GL_COLOR_ATTACHMENT0;
771	values[3]				= GL_DEPTH_ATTACHMENT;
772	attachments[0]			= (glw::GLenum) (GL_COLOR_ATTACHMENT0 + maxColorAttachments);
773	attachments[1]			= GL_COLOR_ATTACHMENT0;
774	attachments[2]			= GL_COLOR_ATTACHMENT1;
775	attachments[3]			= GL_NONE;
776
777	ctx.glGenTextures			(1, &texture);
778	ctx.glBindTexture			(GL_TEXTURE_2D, texture);
779	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
780	ctx.glGenFramebuffers		(1, &fbo);
781	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, fbo);
782	ctx.glFramebufferTexture2D	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
783	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
784	ctx.expectError				(GL_NO_ERROR);
785
786	ctx.beginSection("GL_INVALID_ENUM is generated if one of the values in bufs is not an accepted value.");
787	ctx.glDrawBuffers			(2, &values[2]);
788	ctx.expectError				(GL_INVALID_ENUM);
789	ctx.endSection();
790
791	ctx.beginSection("GL_INVALID_OPERATION is generated if the GL is bound to a draw framebuffer and DrawBuffers is supplied with BACK or COLOR_ATTACHMENTm where m is greater than or equal to the value of MAX_COLOR_ATTACHMENTS.");
792	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, fbo);
793	ctx.glDrawBuffers			(1, &values[1]);
794	ctx.expectError				(GL_INVALID_OPERATION);
795	ctx.glDrawBuffers			(4, &attachments[0]);
796	ctx.expectError				(GL_INVALID_OPERATION);
797	ctx.endSection();
798
799	ctx.beginSection("GL_INVALID_OPERATION is generated if the GL is bound to the default framebuffer and n is not 1.");
800	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, 0);
801	ctx.glDrawBuffers			(2, &values[0]);
802	ctx.expectError				(GL_INVALID_OPERATION);
803	ctx.endSection();
804
805	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.");
806	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, 0);
807	ctx.glDrawBuffers			(1, &values[2]);
808	ctx.expectError				(GL_INVALID_OPERATION);
809	ctx.endSection();
810
811	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.");
812	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, fbo);
813	ctx.glDrawBuffers			(1, &values[1]);
814	ctx.expectError				(GL_INVALID_OPERATION);
815	ctx.glDrawBuffers			(4, &attachments[0]);
816	ctx.expectError				(GL_INVALID_OPERATION);
817
818	ctx.endSection();
819
820	ctx.beginSection("GL_INVALID_VALUE is generated if n is less than 0 or greater than GL_MAX_DRAW_BUFFERS.");
821	ctx.glDrawBuffers			(-1, &values[1]);
822	ctx.expectError				(GL_INVALID_VALUE);
823	ctx.glDrawBuffers			(maxDrawBuffers+1, &values[0]);
824	ctx.expectError				(GL_INVALID_VALUE);
825	ctx.endSection();
826
827	ctx.glDeleteTextures(1, &texture);
828	ctx.glDeleteFramebuffers(1, &fbo);
829}
830
831void flush_mapped_buffer_range (NegativeTestContext& ctx)
832{
833	deUint32				buf		= 0x1234;
834	std::vector<GLfloat>	data	(32);
835
836	ctx.glGenBuffers			(1, &buf);
837	ctx.glBindBuffer			(GL_ARRAY_BUFFER, buf);
838	ctx.glBufferData			(GL_ARRAY_BUFFER, 32, &data[0], GL_STATIC_READ);
839	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT);
840	ctx.expectError				(GL_NO_ERROR);
841
842	ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted values.");
843	ctx.glFlushMappedBufferRange(-1, 0, 16);
844	ctx.expectError				(GL_INVALID_ENUM);
845	ctx.endSection();
846
847	ctx.beginSection("GL_INVALID_VALUE is generated if offset or length is negative, or if offset + length exceeds the size of the mapping.");
848	ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, -1, 1);
849	ctx.expectError				(GL_INVALID_VALUE);
850	ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 0, -1);
851	ctx.expectError				(GL_INVALID_VALUE);
852	ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 12, 8);
853	ctx.expectError				(GL_INVALID_VALUE);
854	ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 24, 4);
855	ctx.expectError				(GL_INVALID_VALUE);
856	ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 0, 24);
857	ctx.expectError				(GL_INVALID_VALUE);
858	ctx.endSection();
859
860	ctx.beginSection("GL_INVALID_OPERATION is generated if zero is bound to target.");
861	ctx.glBindBuffer			(GL_ARRAY_BUFFER, 0);
862	ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 0, 8);
863	ctx.expectError				(GL_INVALID_OPERATION);
864	ctx.endSection();
865
866	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.");
867	ctx.glBindBuffer			(GL_ARRAY_BUFFER, buf);
868	ctx.glUnmapBuffer			(GL_ARRAY_BUFFER);
869	ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 0, 8);
870	ctx.expectError				(GL_INVALID_OPERATION);
871	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_WRITE_BIT);
872	ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 0, 8);
873	ctx.expectError				(GL_INVALID_OPERATION);
874	ctx.endSection();
875
876	ctx.glUnmapBuffer			(GL_ARRAY_BUFFER);
877	ctx.glDeleteBuffers			(1, &buf);
878}
879
880void map_buffer_range (NegativeTestContext& ctx)
881{
882	deUint32				buf		= 0x1234;
883	std::vector<GLfloat>	data	(32);
884
885	ctx.glGenBuffers			(1, &buf);
886	ctx.glBindBuffer			(GL_ARRAY_BUFFER, buf);
887	ctx.glBufferData			(GL_ARRAY_BUFFER, 32, &data[0], GL_DYNAMIC_COPY);
888	ctx.expectError				(GL_NO_ERROR);
889
890	ctx.beginSection("GL_INVALID_VALUE is generated if either of offset or length is negative.");
891	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, -1, 1, GL_MAP_READ_BIT);
892	ctx.expectError				(GL_INVALID_VALUE);
893
894	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 1, -1, GL_MAP_READ_BIT);
895	ctx.expectError				(GL_INVALID_VALUE);
896	ctx.endSection();
897
898	ctx.beginSection("GL_INVALID_VALUE is generated if offset + length is greater than the value of GL_BUFFER_SIZE.");
899	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 33, GL_MAP_READ_BIT);
900	ctx.expectError				(GL_INVALID_VALUE);
901
902	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 32, 1, GL_MAP_READ_BIT);
903	ctx.expectError				(GL_INVALID_VALUE);
904
905	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 16, 17, GL_MAP_READ_BIT);
906	ctx.expectError				(GL_INVALID_VALUE);
907	ctx.endSection();
908
909	ctx.beginSection("GL_INVALID_VALUE is generated if access has any bits set other than those accepted.");
910	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_READ_BIT | 0x1000);
911	ctx.expectError				(GL_INVALID_VALUE);
912
913	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_WRITE_BIT | 0x1000);
914	ctx.expectError				(GL_INVALID_VALUE);
915	ctx.endSection();
916
917	ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer is already in a mapped state.");
918	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_WRITE_BIT);
919	ctx.expectError				(GL_NO_ERROR);
920	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 16, 8, GL_MAP_READ_BIT);
921	ctx.expectError				(GL_INVALID_OPERATION);
922	ctx.glUnmapBuffer			(GL_ARRAY_BUFFER);
923	ctx.endSection();
924
925	ctx.beginSection("GL_INVALID_OPERATION is generated if neither GL_MAP_READ_BIT or GL_MAP_WRITE_BIT is set.");
926	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_INVALIDATE_RANGE_BIT);
927	ctx.expectError				(GL_INVALID_OPERATION);
928	ctx.endSection();
929
930	ctx.beginSection("GL_INVALID_OPERATION is generated if length is 0");
931	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 0, GL_MAP_READ_BIT);
932	ctx.expectError				(GL_INVALID_OPERATION);
933	ctx.endSection();
934
935	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.");
936	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_READ_BIT | GL_MAP_INVALIDATE_RANGE_BIT);
937	ctx.expectError				(GL_INVALID_OPERATION);
938
939	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_READ_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
940	ctx.expectError				(GL_INVALID_OPERATION);
941
942	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_READ_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
943	ctx.expectError				(GL_INVALID_OPERATION);
944	ctx.endSection();
945
946	ctx.beginSection("GL_INVALID_OPERATION is generated if GL_MAP_FLUSH_EXPLICIT_BIT is set and GL_MAP_WRITE_BIT is not set.");
947	ctx.glMapBufferRange		(GL_ARRAY_BUFFER, 0, 16, GL_MAP_READ_BIT | GL_MAP_FLUSH_EXPLICIT_BIT);
948	ctx.expectError				(GL_INVALID_OPERATION);
949	ctx.endSection();
950
951	ctx.glDeleteBuffers			(1, &buf);
952}
953
954void read_buffer (NegativeTestContext& ctx)
955{
956	deUint32	fbo					= 0x1234;
957	deUint32	texture				= 0x1234;
958	int			maxColorAttachments	= 0x1234;
959
960	ctx.glGetIntegerv			(GL_MAX_COLOR_ATTACHMENTS, &maxColorAttachments);
961	ctx.glGenTextures			(1, &texture);
962	ctx.glBindTexture			(GL_TEXTURE_2D, texture);
963	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
964	ctx.glGenFramebuffers		(1, &fbo);
965	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, fbo);
966	ctx.glFramebufferTexture2D	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
967	ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
968	ctx.expectError				(GL_NO_ERROR);
969
970	ctx.beginSection("GL_INVALID_ENUM is generated if mode is not GL_BACK, GL_NONE, or GL_COLOR_ATTACHMENTi.");
971	ctx.glReadBuffer			(GL_NONE);
972	ctx.expectError				(GL_NO_ERROR);
973	ctx.glReadBuffer			(1);
974	ctx.expectError				(GL_INVALID_ENUM);
975	ctx.glReadBuffer			(GL_FRAMEBUFFER);
976	ctx.expectError				(GL_INVALID_ENUM);
977	ctx.glReadBuffer			(GL_COLOR_ATTACHMENT0 - 1);
978	ctx.expectError				(GL_INVALID_ENUM);
979	ctx.glReadBuffer			(GL_FRONT);
980	ctx.expectError				(GL_INVALID_ENUM);
981
982	// \ note Spec isn't actually clear here, but it is safe to assume that
983	//		  GL_DEPTH_ATTACHMENT can't be interpreted as GL_COLOR_ATTACHMENTm
984	//		  where m = (GL_DEPTH_ATTACHMENT - GL_COLOR_ATTACHMENT0).
985	ctx.glReadBuffer			(GL_DEPTH_ATTACHMENT);
986	ctx.expectError				(GL_INVALID_ENUM);
987	ctx.glReadBuffer			(GL_STENCIL_ATTACHMENT);
988	ctx.expectError				(GL_INVALID_ENUM);
989	ctx.glReadBuffer			(GL_STENCIL_ATTACHMENT+1);
990	ctx.expectError				(GL_INVALID_ENUM);
991	ctx.glReadBuffer			(0xffffffffu);
992	ctx.expectError				(GL_INVALID_ENUM);
993	ctx.endSection();
994
995	ctx.beginSection("GL_INVALID_OPERATION error is generated if src is GL_BACK or if src is GL_COLOR_ATTACHMENTm where m is greater than or equal to the value of GL_MAX_COLOR_ATTACHMENTS.");
996	ctx.glReadBuffer			(GL_BACK);
997	ctx.expectError				(GL_INVALID_OPERATION);
998	ctx.glReadBuffer			(GL_COLOR_ATTACHMENT0 + maxColorAttachments);
999	ctx.expectError				(GL_INVALID_OPERATION);
1000
1001	if (GL_COLOR_ATTACHMENT0+maxColorAttachments < GL_DEPTH_ATTACHMENT-1)
1002	{
1003		ctx.glReadBuffer			(GL_DEPTH_ATTACHMENT - 1);
1004		ctx.expectError				(GL_INVALID_OPERATION);
1005	}
1006
1007	ctx.endSection();
1008
1009	ctx.beginSection("GL_INVALID_OPERATION is generated if the current framebuffer is the default framebuffer and mode is not GL_NONE or GL_BACK.");
1010	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, 0);
1011	ctx.glReadBuffer			(GL_COLOR_ATTACHMENT0);
1012	ctx.expectError				(GL_INVALID_OPERATION);
1013	ctx.endSection();
1014
1015	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.");
1016	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, fbo);
1017	ctx.glReadBuffer			(GL_BACK);
1018	ctx.expectError				(GL_INVALID_OPERATION);
1019	ctx.endSection();
1020
1021	ctx.glDeleteTextures(1, &texture);
1022	ctx.glDeleteFramebuffers(1, &fbo);
1023}
1024
1025void unmap_buffer (NegativeTestContext& ctx)
1026{
1027	deUint32				buf		= 0x1234;
1028	std::vector<GLfloat>	data	(32);
1029
1030	ctx.glGenBuffers			(1, &buf);
1031	ctx.glBindBuffer			(GL_ARRAY_BUFFER, buf);
1032	ctx.glBufferData			(GL_ARRAY_BUFFER, 32, &data[0], GL_DYNAMIC_COPY);
1033	ctx.expectError				(GL_NO_ERROR);
1034
1035	ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer data store is already in an unmapped state.");
1036	ctx.glUnmapBuffer			(GL_ARRAY_BUFFER);
1037	ctx.expectError				(GL_INVALID_OPERATION);
1038	ctx.endSection();
1039
1040	ctx.glDeleteBuffers			(1, &buf);
1041}
1042// Framebuffer Objects
1043
1044void bind_framebuffer (NegativeTestContext& ctx)
1045{
1046	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_DRAW_FRAMEBUFFER, GL_READ_FRAMEBUFFER, or GL_FRAMEBUFFER.");
1047	ctx.glBindFramebuffer(-1, 0);
1048	ctx.expectError(GL_INVALID_ENUM);
1049	ctx.glBindFramebuffer(GL_RENDERBUFFER, 0);
1050	ctx.expectError(GL_INVALID_ENUM);
1051	ctx.endSection();
1052}
1053
1054void bind_renderbuffer (NegativeTestContext& ctx)
1055{
1056	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER.");
1057	ctx.glBindRenderbuffer(-1, 0);
1058	ctx.expectError(GL_INVALID_ENUM);
1059	ctx.glBindRenderbuffer(GL_FRAMEBUFFER, 0);
1060	ctx.expectError(GL_INVALID_ENUM);
1061	ctx.endSection();
1062}
1063
1064void check_framebuffer_status (NegativeTestContext& ctx)
1065{
1066	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_DRAW_FRAMEBUFFER, GL_READ_FRAMEBUFFER, or GL_FRAMEBUFFER..");
1067	ctx.glCheckFramebufferStatus(-1);
1068	ctx.expectError(GL_INVALID_ENUM);
1069	ctx.glCheckFramebufferStatus(GL_RENDERBUFFER);
1070	ctx.expectError(GL_INVALID_ENUM);
1071	ctx.endSection();
1072}
1073
1074void gen_framebuffers (NegativeTestContext& ctx)
1075{
1076	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
1077	ctx.glGenFramebuffers(-1, 0);
1078	ctx.expectError(GL_INVALID_VALUE);
1079	ctx.endSection();
1080}
1081
1082void gen_renderbuffers (NegativeTestContext& ctx)
1083{
1084	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
1085	ctx.glGenRenderbuffers(-1, 0);
1086	ctx.expectError(GL_INVALID_VALUE);
1087	ctx.endSection();
1088}
1089
1090void delete_framebuffers (NegativeTestContext& ctx)
1091{
1092	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
1093	ctx.glDeleteFramebuffers(-1, 0);
1094	ctx.expectError(GL_INVALID_VALUE);
1095	ctx.endSection();
1096}
1097
1098void delete_renderbuffers (NegativeTestContext& ctx)
1099{;
1100	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
1101	ctx.glDeleteRenderbuffers(-1, 0);
1102	ctx.expectError(GL_INVALID_VALUE);
1103	ctx.endSection();
1104}
1105
1106void framebuffer_renderbuffer (NegativeTestContext& ctx)
1107{
1108	GLuint fbo = 0x1234;
1109	GLuint rbo = 0x1234;
1110	ctx.glGenFramebuffers(1, &fbo);
1111	ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1112	ctx.glGenRenderbuffers(1, &rbo);
1113
1114	ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
1115	ctx.glFramebufferRenderbuffer(-1, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0);
1116	ctx.expectError(GL_INVALID_ENUM);
1117	ctx.endSection();
1118
1119	ctx.beginSection("GL_INVALID_ENUM is generated if attachment is not one of the accepted tokens.");
1120	ctx.glFramebufferRenderbuffer(GL_FRAMEBUFFER, -1, GL_RENDERBUFFER, 0);
1121	ctx.expectError(GL_INVALID_ENUM);
1122	ctx.endSection();
1123
1124	ctx.beginSection("GL_INVALID_ENUM is generated if renderbuffertarget is not GL_RENDERBUFFER.");
1125	ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo);
1126	ctx.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, -1, rbo);
1127	ctx.expectError(GL_INVALID_ENUM);
1128	ctx.glBindRenderbuffer(GL_RENDERBUFFER, 0);
1129	ctx.endSection();
1130
1131	ctx.beginSection("GL_INVALID_OPERATION is generated if renderbuffer is neither 0 nor the name of an existing renderbuffer object.");
1132	ctx.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, -1);
1133	ctx.expectError(GL_INVALID_OPERATION);
1134	ctx.endSection();
1135
1136	ctx.beginSection("GL_INVALID_OPERATION is generated if zero is bound to target.");
1137	ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1138	ctx.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0);
1139	ctx.expectError(GL_INVALID_OPERATION);
1140	ctx.endSection();
1141
1142	ctx.glDeleteRenderbuffers(1, &rbo);
1143	ctx.glDeleteFramebuffers(1, &fbo);
1144}
1145
1146void framebuffer_texture (NegativeTestContext& ctx)
1147{
1148	if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
1149	{
1150		GLuint fbo = 0x1234;
1151		GLuint texture[] = {0x1234, 0x1234};
1152
1153		ctx.glGenFramebuffers(1, &fbo);
1154		ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1155		ctx.glGenTextures(2, texture);
1156		ctx.glBindTexture(GL_TEXTURE_2D, texture[0]);
1157		ctx.glBindTexture(GL_TEXTURE_BUFFER, texture[1]);
1158		ctx.expectError(GL_NO_ERROR);
1159
1160		ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
1161		ctx.glFramebufferTexture(-1, GL_COLOR_ATTACHMENT0, texture[0], 0);
1162		ctx.expectError(GL_INVALID_ENUM);
1163		ctx.endSection();
1164
1165		ctx.beginSection("GL_INVALID_ENUM is generated if attachment is not one of the accepted tokens.");
1166		ctx.glFramebufferTexture(GL_FRAMEBUFFER, -1, texture[0], 0);
1167		ctx.expectError(GL_INVALID_ENUM);
1168		ctx.endSection();
1169
1170		ctx.beginSection("GL_INVALID_OPERATION is generated if texture is neither 0 nor the name of an existing texture object.");
1171		ctx.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, -1, 0);
1172		ctx.expectError(GL_INVALID_VALUE);
1173		ctx.endSection();
1174
1175		ctx.beginSection("GL_INVALID_OPERATION is generated if zero is bound to target.");
1176		ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1177		ctx.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 0, 0);
1178		ctx.expectError(GL_INVALID_OPERATION);
1179		ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1180		ctx.endSection();
1181
1182		ctx.beginSection("GL_INVALID_OPERATION is generated by if texture is a buffer texture.");
1183		ctx.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture[1], 0);
1184		ctx.expectError(GL_INVALID_OPERATION);
1185		ctx.endSection();
1186
1187		ctx.glDeleteFramebuffers(1, &fbo);
1188		ctx.glDeleteBuffers(2, texture);
1189	}
1190}
1191
1192void framebuffer_texture2d (NegativeTestContext& ctx)
1193{
1194	GLuint	fbo				= 0x1234;
1195	GLuint	tex2D			= 0x1234;
1196	GLuint	texCube			= 0x1234;
1197	GLuint	tex2DMS			= 0x1234;
1198	GLint	maxTexSize		= 0x1234;
1199	GLint	maxTexCubeSize	= 0x1234;
1200	int		maxSize			= 0x1234;
1201
1202	ctx.glGenFramebuffers(1, &fbo);
1203	ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1204	ctx.glGenTextures(1, &tex2D);
1205	ctx.glBindTexture(GL_TEXTURE_2D, tex2D);
1206	ctx.glGenTextures(1, &texCube);
1207	ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, texCube);
1208	ctx.glGenTextures(1, &tex2DMS);
1209	ctx.glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, tex2DMS);
1210	ctx.glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTexSize);
1211	ctx.glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &maxTexCubeSize);
1212	ctx.expectError(GL_NO_ERROR);
1213
1214	ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
1215	ctx.glFramebufferTexture2D(-1, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
1216	ctx.expectError(GL_INVALID_ENUM);
1217	ctx.endSection();
1218
1219	ctx.beginSection("GL_INVALID_ENUM is generated if textarget is not an accepted texture target.");
1220	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, -1, tex2D, 0);
1221	ctx.expectError(GL_INVALID_ENUM);
1222	ctx.endSection();
1223
1224	ctx.beginSection("GL_INVALID_ENUM is generated if attachment is not an accepted token.");
1225	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, -1, GL_TEXTURE_2D, tex2D, 0);
1226	ctx.expectError(GL_INVALID_ENUM);
1227	ctx.endSection();
1228
1229	ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0 or larger than log_2 of maximum texture size.");
1230	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2D, -1);
1231	ctx.expectError(GL_INVALID_VALUE);
1232	maxSize = deLog2Floor32(maxTexSize) + 1;
1233	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2D, maxSize);
1234	ctx.expectError(GL_INVALID_VALUE);
1235	maxSize = deLog2Floor32(maxTexSize) + 1;
1236	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X, texCube, maxSize);
1237	ctx.expectError(GL_INVALID_VALUE);
1238	ctx.endSection();
1239
1240	ctx.beginSection("GL_INVALID_VALUE is generated if level is larger than maximum texture size.");
1241	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2D, maxTexSize + 1);
1242	ctx.expectError(GL_INVALID_VALUE);
1243	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2D, -1);
1244	ctx.expectError(GL_INVALID_VALUE);
1245	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, texCube, maxTexCubeSize + 1);
1246	ctx.expectError(GL_INVALID_VALUE);
1247	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, texCube, -1);
1248	ctx.expectError(GL_INVALID_VALUE);
1249	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, tex2D, 1);
1250	ctx.expectError(GL_INVALID_VALUE);
1251	ctx.endSection();
1252
1253	ctx.beginSection("GL_INVALID_OPERATION is generated if texture is neither 0 nor the name of an existing texture object.");
1254	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, -1, 0);
1255	ctx.expectError(GL_INVALID_OPERATION);
1256	ctx.endSection();
1257
1258	ctx.beginSection("GL_INVALID_OPERATION is generated if textarget and texture are not compatible.");
1259	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X, tex2D, 0);
1260	ctx.expectError(GL_INVALID_OPERATION);
1261	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, tex2D, 0);
1262	ctx.expectError(GL_INVALID_OPERATION);
1263	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texCube, 0);
1264	ctx.expectError(GL_INVALID_OPERATION);
1265	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2DMS, 0);
1266	ctx.expectError(GL_INVALID_OPERATION);
1267	ctx.glDeleteTextures(1, &tex2D);
1268	ctx.glDeleteTextures(1, &texCube);
1269	ctx.glDeleteTextures(1, &tex2DMS);
1270	ctx.endSection();
1271
1272	ctx.beginSection("GL_INVALID_OPERATION is generated if zero is bound to target.");
1273	ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1274	ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
1275	ctx.expectError(GL_INVALID_OPERATION);
1276	ctx.endSection();
1277
1278	if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
1279	{
1280		GLuint texBuf = 0x1234;
1281		ctx.beginSection("GL_INVALID_OPERATION error is generated if texture is the name of a buffer texture.");
1282		ctx.glGenTextures(1, &texBuf);
1283		ctx.glBindTexture(GL_TEXTURE_BUFFER, texBuf);
1284		ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1285		ctx.expectError(GL_NO_ERROR);
1286		ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texBuf, 0);
1287		ctx.expectError(GL_INVALID_OPERATION);
1288		ctx.endSection();
1289	}
1290
1291	ctx.glDeleteFramebuffers(1, &fbo);
1292}
1293
1294void renderbuffer_storage (NegativeTestContext& ctx)
1295{
1296	deUint32	rbo		= 0x1234;
1297	GLint		maxSize	= 0x1234;
1298
1299	ctx.glGenRenderbuffers		(1, &rbo);
1300	ctx.glBindRenderbuffer		(GL_RENDERBUFFER, rbo);
1301
1302	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER.");
1303	ctx.glRenderbufferStorage	(-1, GL_RGBA4, 1, 1);
1304	ctx.expectError				(GL_INVALID_ENUM);
1305	ctx.glRenderbufferStorage	(GL_FRAMEBUFFER, GL_RGBA4, 1, 1);
1306	ctx.expectError				(GL_INVALID_ENUM);
1307	ctx.endSection();
1308
1309	ctx.beginSection("GL_INVALID_ENUM is generated if internalformat is not a color-renderable, depth-renderable, or stencil-renderable format.");
1310	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, -1, 1, 1);
1311	ctx.expectError				(GL_INVALID_ENUM);
1312
1313	if (!ctx.isExtensionSupported("GL_EXT_color_buffer_half_float")) // GL_EXT_color_buffer_half_float disables error
1314	{
1315		ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_RGB16F, 1, 1);
1316		ctx.expectError				(GL_INVALID_ENUM);
1317	}
1318
1319	if (!ctx.isExtensionSupported("GL_EXT_render_snorm")) // GL_EXT_render_snorm disables error
1320	{
1321		ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_RGBA8_SNORM, 1, 1);
1322		ctx.expectError				(GL_INVALID_ENUM);
1323	}
1324
1325	ctx.endSection();
1326
1327	ctx.beginSection("GL_INVALID_VALUE is generated if width or height is less than zero.");
1328	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_RGBA4, -1, 1);
1329	ctx.expectError				(GL_INVALID_VALUE);
1330	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_RGBA4, 1, -1);
1331	ctx.expectError				(GL_INVALID_VALUE);
1332	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_RGBA4, -1, -1);
1333	ctx.expectError				(GL_INVALID_VALUE);
1334	ctx.endSection();
1335
1336	ctx.beginSection("GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_RENDERBUFFER_SIZE.");
1337	ctx.glGetIntegerv			(GL_MAX_RENDERBUFFER_SIZE, &maxSize);
1338	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_RGBA4, 1, maxSize+1);
1339	ctx.expectError				(GL_INVALID_VALUE);
1340	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_RGBA4, maxSize+1, 1);
1341	ctx.expectError				(GL_INVALID_VALUE);
1342	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_RGBA4, maxSize+1, maxSize+1);
1343	ctx.expectError				(GL_INVALID_VALUE);
1344	ctx.endSection();
1345
1346	ctx.glDeleteRenderbuffers(1, &rbo);
1347}
1348
1349void blit_framebuffer (NegativeTestContext& ctx)
1350{
1351	deUint32					fbo[2];
1352	deUint32					rbo[2];
1353	deUint32					texture[2];
1354	deUint32 					blankFrameBuffer;
1355
1356	ctx.glGenFramebuffers		(1, &blankFrameBuffer);
1357	ctx.glGenFramebuffers		(2, fbo);
1358	ctx.glGenTextures			(2, texture);
1359	ctx.glGenRenderbuffers		(2, rbo);
1360
1361	ctx.glBindTexture			(GL_TEXTURE_2D, texture[0]);
1362	ctx.glBindRenderbuffer		(GL_RENDERBUFFER, rbo[0]);
1363	ctx.glBindFramebuffer		(GL_READ_FRAMEBUFFER, fbo[0]);
1364
1365	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1366	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 32, 32);
1367	ctx.glFramebufferTexture2D	(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[0], 0);
1368	ctx.glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo[0]);
1369	ctx.glCheckFramebufferStatus(GL_READ_FRAMEBUFFER);
1370
1371	ctx.glBindTexture			(GL_TEXTURE_2D, texture[1]);
1372	ctx.glBindRenderbuffer		(GL_RENDERBUFFER, rbo[1]);
1373	ctx.glBindFramebuffer		(GL_DRAW_FRAMEBUFFER, fbo[1]);
1374
1375	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1376	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 32, 32);
1377	ctx.glFramebufferTexture2D	(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[1], 0);
1378	ctx.glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo[1]);
1379	ctx.glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
1380	ctx.expectError				(GL_NO_ERROR);
1381
1382	ctx.beginSection("GL_INVALID_VALUE is generated if mask contains any bits other than GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, or GL_STENCIL_BUFFER_BIT.");
1383	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, 1, GL_NEAREST);
1384	ctx.expectError				(GL_INVALID_VALUE);
1385	ctx.endSection();
1386
1387	ctx.beginSection("GL_INVALID_ENUM is generated if filter is not GL_LINEAR or GL_NEAREST.");
1388	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, 0);
1389	ctx.expectError				(GL_INVALID_ENUM);
1390	ctx.endSection();
1391
1392	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.");
1393	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_LINEAR);
1394	ctx.expectError				(GL_INVALID_OPERATION);
1395	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, GL_LINEAR);
1396	ctx.expectError				(GL_INVALID_OPERATION);
1397	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_LINEAR);
1398	ctx.expectError				(GL_INVALID_OPERATION);
1399	ctx.endSection();
1400
1401	ctx.beginSection("GL_INVALID_OPERATION is generated if mask contains GL_COLOR_BUFFER_BIT and read buffer format is incompatible with draw buffer format.");
1402	ctx.glBindTexture			(GL_TEXTURE_2D, texture[0]);
1403
1404	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32UI, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, NULL);
1405	ctx.glFramebufferTexture2D	(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[0], 0);
1406	ctx.getLog() << TestLog::Message << "// Read buffer: GL_RGBA32UI, draw buffer: GL_RGBA" << TestLog::EndMessage;
1407	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
1408	ctx.expectError				(GL_INVALID_OPERATION);
1409
1410	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32I, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, NULL);
1411	ctx.glFramebufferTexture2D	(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[0], 0);
1412	ctx.getLog() << TestLog::Message << "// Read buffer: GL_RGBA32I, draw buffer: GL_RGBA" << TestLog::EndMessage;
1413	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
1414	ctx.expectError				(GL_INVALID_OPERATION);
1415
1416	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1417	ctx.glFramebufferTexture2D	(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[0], 0);
1418	ctx.glBindTexture			(GL_TEXTURE_2D, texture[1]);
1419	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32I, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, NULL);
1420	ctx.glFramebufferTexture2D	(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[1], 0);
1421	ctx.getLog() << TestLog::Message << "// Read buffer: GL_RGBA8, draw buffer: GL_RGBA32I" << TestLog::EndMessage;
1422	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
1423	ctx.expectError				(GL_INVALID_OPERATION);
1424	ctx.endSection();
1425
1426	ctx.beginSection("GL_INVALID_OPERATION is generated if filter is GL_LINEAR and the read buffer contains integer data.");
1427	ctx.glBindTexture			(GL_TEXTURE_2D, texture[0]);
1428	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32UI, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, NULL);
1429	ctx.glFramebufferTexture2D	(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[0], 0);
1430	ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1431	ctx.glFramebufferTexture2D	(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[1], 0);
1432	ctx.getLog() << TestLog::Message << "// Read buffer: GL_RGBA32I, draw buffer: GL_RGBA8" << TestLog::EndMessage;
1433	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_LINEAR);
1434	ctx.expectError				(GL_INVALID_OPERATION);
1435	ctx.endSection();
1436
1437	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.");
1438	ctx.glBindRenderbuffer		(GL_RENDERBUFFER, rbo[0]);
1439	ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_DEPTH32F_STENCIL8, 32, 32);
1440	ctx.glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo[0]);
1441	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
1442	ctx.expectError				(GL_INVALID_OPERATION);
1443	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, GL_STENCIL_BUFFER_BIT, GL_NEAREST);
1444	ctx.expectError				(GL_INVALID_OPERATION);
1445	ctx.endSection();
1446
1447	ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the read or draw framebuffer is not framebuffer complete.");
1448	ctx.glCheckFramebufferStatus(GL_READ_FRAMEBUFFER);
1449	ctx.glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
1450	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, 0, GL_NEAREST);
1451	ctx.expectError				(GL_NO_ERROR);
1452	ctx.getLog() << TestLog::Message << "// incomplete read framebuffer" << TestLog::EndMessage;
1453	ctx.glBindFramebuffer		(GL_READ_FRAMEBUFFER, blankFrameBuffer);
1454	ctx.glBindFramebuffer		(GL_DRAW_FRAMEBUFFER, fbo[1]);
1455	TCU_CHECK(ctx.glCheckFramebufferStatus(GL_READ_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE);
1456	TCU_CHECK(ctx.glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);
1457	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, 0, GL_NEAREST);
1458	ctx.expectError				(GL_INVALID_FRAMEBUFFER_OPERATION);
1459	ctx.getLog() << TestLog::Message << "// incomplete draw framebuffer" << TestLog::EndMessage;
1460	ctx.glBindFramebuffer		(GL_READ_FRAMEBUFFER, fbo[1]);
1461	ctx.glBindFramebuffer		(GL_DRAW_FRAMEBUFFER, blankFrameBuffer);
1462	TCU_CHECK(ctx.glCheckFramebufferStatus(GL_READ_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);
1463	TCU_CHECK(ctx.glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE);
1464	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, 0, GL_NEAREST);
1465	ctx.expectError				(GL_INVALID_FRAMEBUFFER_OPERATION);
1466	ctx.getLog() << TestLog::Message << "// incomplete read and draw framebuffer" << TestLog::EndMessage;
1467	ctx.glBindFramebuffer		(GL_READ_FRAMEBUFFER, blankFrameBuffer);
1468	ctx.glBindFramebuffer		(GL_DRAW_FRAMEBUFFER, blankFrameBuffer);
1469	TCU_CHECK(ctx.glCheckFramebufferStatus(GL_READ_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE);
1470	TCU_CHECK(ctx.glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE);
1471	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, 0, GL_NEAREST);
1472	ctx.expectError				(GL_INVALID_FRAMEBUFFER_OPERATION);
1473	// restore
1474	ctx.glBindFramebuffer		(GL_READ_FRAMEBUFFER, fbo[0]);
1475	ctx.glCheckFramebufferStatus(GL_READ_FRAMEBUFFER);
1476	ctx.glBindFramebuffer		(GL_DRAW_FRAMEBUFFER, fbo[1]);
1477	ctx.glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
1478	ctx.endSection();
1479
1480	ctx.beginSection("GL_INVALID_OPERATION is generated if the source and destination buffers are identical.");
1481	ctx.glBindFramebuffer		(GL_DRAW_FRAMEBUFFER, fbo[0]);
1482	ctx.expectError				(GL_NO_ERROR);
1483	ctx.glBlitFramebuffer		(0, 0, 16, 16, 0, 0, 16, 16, 0, GL_NEAREST);
1484	ctx.expectError				(GL_INVALID_OPERATION);
1485	// restore
1486	ctx.glBindFramebuffer		(GL_DRAW_FRAMEBUFFER, fbo[1]);
1487	ctx.endSection();
1488
1489	ctx.glBindFramebuffer		(GL_FRAMEBUFFER, 0);
1490	ctx.glBindRenderbuffer		(GL_RENDERBUFFER, 0);
1491	ctx.glDeleteFramebuffers	(2, fbo);
1492	ctx.glDeleteFramebuffers	(1, &blankFrameBuffer);
1493	ctx.glDeleteTextures		(2, texture);
1494	ctx.glDeleteRenderbuffers	(2, rbo);
1495}
1496
1497void blit_framebuffer_multisample (NegativeTestContext& ctx)
1498{
1499	deUint32							fbo[2];
1500	deUint32							rbo[2];
1501
1502	ctx.glGenFramebuffers				(2, fbo);
1503	ctx.glGenRenderbuffers				(2, rbo);
1504
1505	ctx.glBindRenderbuffer				(GL_RENDERBUFFER, rbo[0]);
1506	ctx.glBindFramebuffer				(GL_READ_FRAMEBUFFER, fbo[0]);
1507	ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA8, 32, 32);
1508	ctx.glFramebufferRenderbuffer		(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[0]);
1509	ctx.glCheckFramebufferStatus		(GL_READ_FRAMEBUFFER);
1510
1511	ctx.glBindRenderbuffer				(GL_RENDERBUFFER, rbo[1]);
1512	ctx.glBindFramebuffer				(GL_DRAW_FRAMEBUFFER, fbo[1]);
1513
1514	ctx.expectError						(GL_NO_ERROR);
1515
1516	if (!ctx.isExtensionSupported("GL_NV_framebuffer_multisample"))
1517	{
1518		ctx.beginSection("GL_INVALID_OPERATION is generated if the value of GL_SAMPLE_BUFFERS for the draw buffer is greater than zero.");
1519		ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA8, 32, 32);
1520		ctx.glFramebufferRenderbuffer		(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
1521		ctx.glBlitFramebuffer				(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
1522		ctx.expectError						(GL_INVALID_OPERATION);
1523		ctx.endSection();
1524
1525		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.");
1526		ctx.glRenderbufferStorage			(GL_RENDERBUFFER, GL_RGBA4, 32, 32);
1527		ctx.glFramebufferRenderbuffer		(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
1528		ctx.glBlitFramebuffer				(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
1529		ctx.expectError						(GL_INVALID_OPERATION);
1530		ctx.endSection();
1531
1532		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.");
1533		ctx.glRenderbufferStorage			(GL_RENDERBUFFER, GL_RGBA8, 32, 32);
1534		ctx.glFramebufferRenderbuffer		(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
1535		ctx.glBlitFramebuffer				(0, 0, 16, 16, 2, 2, 18, 18, GL_COLOR_BUFFER_BIT, GL_NEAREST);
1536		ctx.expectError						(GL_INVALID_OPERATION);
1537		ctx.endSection();
1538	}
1539
1540	ctx.glBindFramebuffer				(GL_FRAMEBUFFER, 0);
1541	ctx.glDeleteRenderbuffers			(2, rbo);
1542	ctx.glDeleteFramebuffers			(2, fbo);
1543}
1544
1545void framebuffer_texture_layer (NegativeTestContext& ctx)
1546{
1547	deUint32						fbo					= 0x1234;
1548	deUint32						tex3D				= 0x1234;
1549	deUint32						tex2DArray			= 0x1234;
1550	deUint32						tex2D				= 0x1234;
1551	deUint32						tex2DMSArray		= 0x1234;
1552	deUint32						texCube				= 0x1234;
1553	deUint32						texBuffer			= 0x1234;
1554	int								max3DTexSize		= 0x1234;
1555	int								maxTexSize			= 0x1234;
1556	int								maxArrayTexLayers	= 0x1234;
1557	int								maxCubeTexSize		= 0x1234;
1558	int 							log2Max3DTexSize	= 0x1234;
1559	int 							log2MaxTexSize		= 0x1234;
1560
1561	ctx.glGetIntegerv				(GL_MAX_3D_TEXTURE_SIZE, &max3DTexSize);
1562	ctx.glGetIntegerv				(GL_MAX_TEXTURE_SIZE, &maxTexSize);
1563
1564	ctx.glGenFramebuffers			(1, &fbo);
1565	ctx.glGenTextures				(1, &tex3D);
1566	ctx.glGenTextures				(1, &tex2DArray);
1567	ctx.glGenTextures				(1, &tex2D);
1568	ctx.glBindFramebuffer			(GL_FRAMEBUFFER, fbo);
1569
1570	ctx.glBindTexture				(GL_TEXTURE_3D, tex3D);
1571	ctx.glTexImage3D				(GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1572	ctx.glBindTexture				(GL_TEXTURE_2D_ARRAY, tex2DArray);
1573	ctx.glTexImage3D				(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1574	ctx.glBindTexture				(GL_TEXTURE_2D, tex2D);
1575	ctx.glTexImage2D				(GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1576
1577	ctx.expectError					(GL_NO_ERROR);
1578
1579	ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
1580	ctx.glFramebufferTextureLayer	(-1, GL_COLOR_ATTACHMENT0, tex3D, 0, 1);
1581	ctx.expectError					(GL_INVALID_ENUM);
1582	ctx.glFramebufferTextureLayer	(GL_RENDERBUFFER, GL_COLOR_ATTACHMENT0, tex3D, 0, 1);
1583	ctx.expectError					(GL_INVALID_ENUM);
1584	ctx.endSection();
1585
1586	ctx.beginSection("GL_INVALID_ENUM is generated if attachment is not one of the accepted tokens.");
1587	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, -1, tex3D, 0, 1);
1588	ctx.expectError					(GL_INVALID_ENUM);
1589	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_BACK, tex3D, 0, 1);
1590	ctx.expectError					(GL_INVALID_ENUM);
1591	ctx.endSection();
1592
1593	ctx.beginSection("GL_INVALID_OPERATION is generated if texture is non-zero and not the name of a 3D texture or 2D array texture, 2D multisample array texture or cube map array texture.");
1594	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, -1, 0, 0);
1595	ctx.expectError					(GL_INVALID_OPERATION);
1596	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex2D, 0, 0);
1597	ctx.expectError					(GL_INVALID_OPERATION);
1598	ctx.endSection();
1599
1600	ctx.beginSection("GL_INVALID_VALUE is generated if texture is not zero and layer is negative.");
1601	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex3D, 0, -1);
1602	ctx.expectError					(GL_INVALID_VALUE);
1603	ctx.endSection();
1604
1605	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.");
1606	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex3D, 0, max3DTexSize);
1607	ctx.expectError					(GL_INVALID_VALUE);
1608	ctx.endSection();
1609
1610	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.");
1611	ctx.glGetIntegerv				(GL_MAX_ARRAY_TEXTURE_LAYERS, &maxArrayTexLayers);
1612	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex2DArray, 0, maxArrayTexLayers);
1613	ctx.expectError					(GL_INVALID_VALUE);
1614	ctx.endSection();
1615
1616	ctx.beginSection("GL_INVALID_OPERATION is generated if zero is bound to target.");
1617	ctx.glBindFramebuffer			(GL_FRAMEBUFFER, 0);
1618	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex3D, 0, 1);
1619	ctx.expectError					(GL_INVALID_OPERATION);
1620	ctx.glBindFramebuffer			(GL_FRAMEBUFFER, fbo);
1621	ctx.endSection();
1622
1623	ctx.beginSection("GL_INVALID_VALUE is generated if texture is a 3D texture and level is less than 0 or greater than log2 of the value of GL_MAX_3D_TEXTURE_SIZE.");
1624	log2Max3DTexSize	= deLog2Floor32(max3DTexSize);
1625	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex3D, -1, max3DTexSize - 1);
1626	ctx.expectError					(GL_INVALID_VALUE);
1627	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex3D, log2Max3DTexSize + 1, max3DTexSize - 1);
1628	ctx.expectError					(GL_INVALID_VALUE);
1629	ctx.endSection();
1630
1631	ctx.beginSection("GL_INVALID_VALUE is generated if texture is a 2D array texture and layer is less than 0 or greater than log2 of the value of GL_MAX_TEXTURE_SIZE.");
1632	log2MaxTexSize		= deLog2Floor32(maxTexSize);
1633	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex2DArray, -1, maxArrayTexLayers - 1);
1634	ctx.expectError					(GL_INVALID_VALUE);
1635	ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex2DArray, log2MaxTexSize + 1, maxArrayTexLayers - 1);
1636	ctx.expectError					(GL_INVALID_VALUE);
1637	ctx.endSection();
1638
1639	if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
1640	{
1641		ctx.glGetIntegerv				(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &maxCubeTexSize);
1642		ctx.glGenTextures				(1, &tex2DMSArray);
1643		ctx.glGenTextures				(1, &texCube);
1644		ctx.glGenTextures				(1, &texBuffer);
1645		ctx.glBindTexture				(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, tex2DMSArray);
1646		ctx.glBindTexture				(GL_TEXTURE_CUBE_MAP, texCube);
1647		ctx.glBindTexture				(GL_TEXTURE_BUFFER, texBuffer);
1648		ctx.expectError					(GL_NO_ERROR);
1649
1650		ctx.beginSection("GL_INVALID_VALUE is generated if texture is a 2D multisample array texture and layer not 0.");
1651		ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex2DMSArray, -1, 0);
1652		ctx.expectError					(GL_INVALID_VALUE);
1653		ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex2DMSArray, 1, 0);
1654		ctx.expectError					(GL_INVALID_VALUE);
1655		ctx.endSection();
1656
1657		ctx.beginSection("GL_INVALID_VALUE is generated if texture is a cube map array texture and layer is larger than the value of MAX_CUBE_MAP_TEXTURE_SIZE-1 minus one.");
1658		ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texCube, 0, maxCubeTexSize);
1659		ctx.expectError					(GL_INVALID_VALUE);
1660		ctx.endSection();
1661
1662		ctx.beginSection("GL_INVALID_OPERATION is generated if texture is the name of a buffer texture.");
1663		ctx.glFramebufferTextureLayer	(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texBuffer, 0, 0);
1664		ctx.expectError					(GL_INVALID_OPERATION);
1665		ctx.endSection();
1666
1667		ctx.glDeleteTextures			(1, &tex2DMSArray);
1668		ctx.glDeleteTextures			(1, &texCube);
1669		ctx.glDeleteTextures			(1, &texBuffer);
1670	}
1671
1672	ctx.glDeleteTextures		(1, &tex3D);
1673	ctx.glDeleteTextures		(1, &tex2DArray);
1674	ctx.glDeleteTextures		(1, &tex2D);
1675	ctx.glDeleteFramebuffers	(1, &fbo);
1676}
1677
1678void invalidate_framebuffer (NegativeTestContext& ctx)
1679{
1680	deUint32	attachments[3];
1681	deUint32	fbo 				= 0x1234;
1682	deUint32	texture 			= 0x1234;
1683	int			maxColorAttachments = 0x1234;
1684
1685	ctx.glGetIntegerv				(GL_MAX_COLOR_ATTACHMENTS, &maxColorAttachments);
1686	attachments[0]					= GL_COLOR_ATTACHMENT0;
1687	attachments[1]					= GL_COLOR_ATTACHMENT0 + maxColorAttachments;
1688	attachments[2]					= GL_DEPTH_STENCIL_ATTACHMENT;
1689
1690	ctx.glGenFramebuffers			(1, &fbo);
1691	ctx.glGenTextures				(1, &texture);
1692	ctx.glBindFramebuffer			(GL_FRAMEBUFFER, fbo);
1693	ctx.glBindTexture				(GL_TEXTURE_2D, texture);
1694	ctx.glTexImage2D				(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1695	ctx.glFramebufferTexture2D		(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
1696	ctx.glCheckFramebufferStatus	(GL_FRAMEBUFFER);
1697	ctx.expectError					(GL_NO_ERROR);
1698
1699	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_FRAMEBUFFER, GL_READ_FRAMEBUFFER or GL_DRAW_FRAMEBUFFER.");
1700	ctx.glInvalidateFramebuffer		(-1, 1, &attachments[0]);
1701	ctx.expectError					(GL_INVALID_ENUM);
1702	ctx.glInvalidateFramebuffer		(GL_BACK, 1, &attachments[0]);
1703	ctx.expectError					(GL_INVALID_ENUM);
1704	ctx.endSection();
1705
1706	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.");
1707	ctx.glInvalidateFramebuffer		(GL_FRAMEBUFFER, 1, &attachments[1]);
1708	ctx.expectError					(GL_INVALID_OPERATION);
1709	ctx.endSection();
1710
1711	ctx.beginSection("GL_INVALID_VALUE is generated if numAttachments is negative.");
1712	ctx.glInvalidateFramebuffer		(GL_FRAMEBUFFER, -1, &attachments[0]);
1713	ctx.expectError					(GL_INVALID_VALUE);
1714	ctx.endSection();
1715
1716	ctx.beginSection("GL_INVALID_ENUM is generated if the default framebuffer is bound to target and any elements of attachments are not one of the accepted attachments.");
1717	ctx.glBindFramebuffer			(GL_FRAMEBUFFER, 0);
1718	ctx.glInvalidateFramebuffer		(GL_FRAMEBUFFER, 1, &attachments[2]);
1719	ctx.expectError					(GL_INVALID_ENUM);
1720	ctx.endSection();
1721
1722
1723	ctx.glDeleteTextures		(1, &texture);
1724	ctx.glDeleteFramebuffers	(1, &fbo);
1725}
1726
1727void invalidate_sub_framebuffer (NegativeTestContext& ctx)
1728{
1729	deUint32	attachments[3];
1730	deUint32	fbo					= 0x1234;
1731	deUint32	texture				= 0x1234;
1732	int			maxColorAttachments	= 0x1234;
1733
1734	ctx.glGetIntegerv				(GL_MAX_COLOR_ATTACHMENTS, &maxColorAttachments);
1735	attachments[0]					= GL_COLOR_ATTACHMENT0;
1736	attachments[1]					= GL_COLOR_ATTACHMENT0 + maxColorAttachments;
1737	attachments[2]					= GL_DEPTH_STENCIL_ATTACHMENT;
1738
1739	ctx.glGenFramebuffers			(1, &fbo);
1740	ctx.glGenTextures				(1, &texture);
1741	ctx.glBindFramebuffer			(GL_FRAMEBUFFER, fbo);
1742	ctx.glBindTexture				(GL_TEXTURE_2D, texture);
1743	ctx.glTexImage2D				(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1744	ctx.glFramebufferTexture2D		(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
1745	ctx.glCheckFramebufferStatus	(GL_FRAMEBUFFER);
1746	ctx.expectError					(GL_NO_ERROR);
1747
1748	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_FRAMEBUFFER, GL_READ_FRAMEBUFFER or GL_DRAW_FRAMEBUFFER.");
1749	ctx.glInvalidateSubFramebuffer	(-1, 1, &attachments[0], 0, 0, 16, 16);
1750	ctx.expectError					(GL_INVALID_ENUM);
1751	ctx.glInvalidateSubFramebuffer	(GL_BACK, 1, &attachments[0], 0, 0, 16, 16);
1752	ctx.expectError					(GL_INVALID_ENUM);
1753	ctx.endSection();
1754
1755	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.");
1756	ctx.glInvalidateSubFramebuffer	(GL_FRAMEBUFFER, 1, &attachments[1], 0, 0, 16, 16);
1757	ctx.expectError					(GL_INVALID_OPERATION);
1758	ctx.endSection();
1759
1760	ctx.beginSection("GL_INVALID_VALUE is generated if numAttachments, width, or heigh is negative.");
1761	ctx.glInvalidateSubFramebuffer	(GL_FRAMEBUFFER, -1, &attachments[0], 0, 0, 16, 16);
1762	ctx.expectError					(GL_INVALID_VALUE);
1763	ctx.glInvalidateSubFramebuffer	(GL_FRAMEBUFFER, -1, &attachments[0], 0, 0, -1, 16);
1764	ctx.expectError					(GL_INVALID_VALUE);
1765	ctx.glInvalidateSubFramebuffer	(GL_FRAMEBUFFER, -1, &attachments[0], 0, 0, 16, -1);
1766	ctx.expectError					(GL_INVALID_VALUE);
1767	ctx.glInvalidateSubFramebuffer	(GL_FRAMEBUFFER, -1, &attachments[0], 0, 0, -1, -1);
1768	ctx.expectError					(GL_INVALID_VALUE);
1769	ctx.glInvalidateSubFramebuffer	(GL_FRAMEBUFFER, 1, &attachments[0], 0, 0, -1, 16);
1770	ctx.expectError					(GL_INVALID_VALUE);
1771	ctx.glInvalidateSubFramebuffer	(GL_FRAMEBUFFER, 1, &attachments[0], 0, 0, 16, -1);
1772	ctx.expectError					(GL_INVALID_VALUE);
1773	ctx.glInvalidateSubFramebuffer	(GL_FRAMEBUFFER, 1, &attachments[0], 0, 0, -1, -1);
1774	ctx.expectError					(GL_INVALID_VALUE);
1775	ctx.endSection();
1776
1777	ctx.beginSection("GL_INVALID_ENUM is generated if the default framebuffer is bound to target and any elements of attachments are not one of the accepted attachments.");
1778	ctx.glBindFramebuffer			(GL_FRAMEBUFFER, 0);
1779	ctx.glInvalidateSubFramebuffer	(GL_FRAMEBUFFER, 1, &attachments[2], 0, 0, 16, 16);
1780	ctx.expectError					(GL_INVALID_ENUM);
1781	ctx.endSection();
1782
1783	ctx.glDeleteTextures		(1, &texture);
1784	ctx.glDeleteFramebuffers	(1, &fbo);
1785}
1786
1787void renderbuffer_storage_multisample (NegativeTestContext& ctx)
1788{
1789	deUint32	rbo							= 0x1234;
1790	int			maxSamplesSupportedRGBA4	= -1;
1791	int			maxSamplesSupportedRGBA8UI	= -1;
1792	GLint		maxSize						= 0x1234;
1793
1794	ctx.glGetInternalformativ				(GL_RENDERBUFFER, GL_RGBA4, GL_SAMPLES, 1, &maxSamplesSupportedRGBA4);
1795	ctx.glGetInternalformativ				(GL_RENDERBUFFER, GL_RGBA8UI, GL_SAMPLES, 1, &maxSamplesSupportedRGBA8UI);
1796
1797	ctx.glGenRenderbuffers					(1, &rbo);
1798	ctx.glBindRenderbuffer					(GL_RENDERBUFFER, rbo);
1799
1800	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER.");
1801	ctx.glRenderbufferStorageMultisample	(-1, 2, GL_RGBA4, 1, 1);
1802	ctx.expectError							(GL_INVALID_ENUM);
1803	ctx.glRenderbufferStorageMultisample	(GL_FRAMEBUFFER, 2, GL_RGBA4, 1, 1);
1804	ctx.expectError							(GL_INVALID_ENUM);
1805	ctx.endSection();
1806
1807	ctx.beginSection("GL_INVALID_OPERATION is generated if samples is greater than the maximum number of samples supported for internalformat.");
1808	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, maxSamplesSupportedRGBA4+1, GL_RGBA4, 1, 1);
1809	ctx.expectError							(GL_INVALID_OPERATION);
1810	ctx.endSection();
1811
1812	ctx.beginSection("GL_INVALID_ENUM is generated if internalformat is not a color-renderable, depth-renderable, or stencil-renderable format.");
1813	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, 2, -1, 1, 1);
1814	ctx.expectError							(GL_INVALID_ENUM);
1815
1816	if (!ctx.isExtensionSupported("GL_EXT_color_buffer_half_float")) // GL_EXT_color_buffer_half_float disables error
1817	{
1818		ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, 2, GL_RGB16F, 1, 1);
1819		ctx.expectError							(GL_INVALID_ENUM);
1820	}
1821
1822	if (!ctx.isExtensionSupported("GL_EXT_render_snorm")) // GL_EXT_render_snorm disables error
1823	{
1824		ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, 2, GL_RGBA8_SNORM, 1, 1);
1825		ctx.expectError							(GL_INVALID_ENUM);
1826	}
1827
1828	ctx.endSection();
1829
1830	ctx.beginSection("GL_INVALID_OPERATION is generated if samples is greater than the maximum number of samples supported for internalformat. (Unsigned integer format)");
1831	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, maxSamplesSupportedRGBA8UI+1, GL_RGBA8UI, 1, 1);
1832	ctx.expectError							(GL_INVALID_OPERATION);
1833	ctx.endSection();
1834
1835	ctx.beginSection("GL_INVALID_VALUE is generated if width or height is less than zero.");
1836	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, 2, GL_RGBA4, -1, 1);
1837	ctx.expectError							(GL_INVALID_VALUE);
1838	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, 2, GL_RGBA4, 1, -1);
1839	ctx.expectError							(GL_INVALID_VALUE);
1840	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, 2, GL_RGBA4, -1, -1);
1841	ctx.expectError							(GL_INVALID_VALUE);
1842	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, -1, GL_RGBA4, 1, 1);
1843	ctx.expectError							(GL_INVALID_VALUE);
1844	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, -1, GL_RGBA4, -1, 1);
1845	ctx.expectError							(GL_INVALID_VALUE);
1846	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, -1, GL_RGBA4, 1, -1);
1847	ctx.expectError							(GL_INVALID_VALUE);
1848	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, -1, GL_RGBA4, -1, -1);
1849	ctx.expectError							(GL_INVALID_VALUE);
1850	ctx.endSection();
1851
1852	ctx.beginSection("GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_RENDERBUFFER_SIZE.");
1853	ctx.glGetIntegerv						(GL_MAX_RENDERBUFFER_SIZE, &maxSize);
1854	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, 4, GL_RGBA4, 1, maxSize+1);
1855	ctx.expectError							(GL_INVALID_VALUE);
1856	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, 4, GL_RGBA4, maxSize+1, 1);
1857	ctx.expectError							(GL_INVALID_VALUE);
1858	ctx.glRenderbufferStorageMultisample	(GL_RENDERBUFFER, 4, GL_RGBA4, maxSize+1, maxSize+1);
1859	ctx.expectError							(GL_INVALID_VALUE);
1860	ctx.endSection();
1861
1862	ctx.glDeleteRenderbuffers(1, &rbo);
1863}
1864
1865void copy_image_sub_data (NegativeTestContext& ctx)
1866{
1867	if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
1868	{
1869		deUint32					texture[5];
1870		deUint32					rbo = 0x1234;
1871
1872		ctx.glGenTextures			(5, texture);
1873		ctx.glGenRenderbuffers		(1, &rbo);
1874		ctx.glBindRenderbuffer		(GL_RENDERBUFFER, rbo);
1875
1876		ctx.glBindTexture			(GL_TEXTURE_2D, texture[0]);
1877		ctx.glTexParameteri			(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1878		ctx.glTexParameteri			(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
1879		ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1880		ctx.glRenderbufferStorage	(GL_RENDERBUFFER, GL_RGBA8, 32, 32);
1881		ctx.glBindTexture			(GL_TEXTURE_2D, texture[1]);
1882		ctx.glTexParameteri			(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1883		ctx.glTexParameteri			(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
1884		ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1885		ctx.expectError				(GL_NO_ERROR);
1886
1887		ctx.glBindTexture			(GL_TEXTURE_3D, texture[2]);
1888		ctx.glTexParameteri			(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1889		ctx.glTexParameteri			(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
1890		ctx.glTexImage3D			(GL_TEXTURE_3D, 0, GL_RGBA8, 32, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1891		ctx.expectError				(GL_NO_ERROR);
1892
1893		ctx.glBindTexture			(GL_TEXTURE_3D, texture[3]);
1894		ctx.glTexImage3D			(GL_TEXTURE_3D, 0, GL_RGBA8, 32, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1895		ctx.expectError				(GL_NO_ERROR);
1896
1897		ctx.glBindTexture			(GL_TEXTURE_2D, texture[4]);
1898		ctx.glTexParameteri			(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1899		ctx.glTexParameteri			(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
1900		ctx.glTexImage2D			(GL_TEXTURE_2D, 0, GL_RGBA32F, 32, 32, 0, GL_RGBA, GL_FLOAT, NULL);
1901		ctx.expectError				(GL_NO_ERROR);
1902
1903		ctx.beginSection("GL_INVALID_VALUE is generated if srcWidth, srcHeight, or srcDepth is negative.");
1904		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, -1, 1, 1);
1905		ctx.expectError				(GL_INVALID_VALUE);
1906		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 1, -1, 1);
1907		ctx.expectError				(GL_INVALID_VALUE);
1908		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 1, 1, -1);
1909		ctx.expectError				(GL_INVALID_VALUE);
1910		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, -1, -1, 1);
1911		ctx.expectError				(GL_INVALID_VALUE);
1912		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, -1, 1, -1);
1913		ctx.expectError				(GL_INVALID_VALUE);
1914		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 1, -1, -1);
1915		ctx.expectError				(GL_INVALID_VALUE);
1916		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, -1, -1, -1);
1917		ctx.expectError				(GL_INVALID_VALUE);
1918		ctx.endSection();
1919
1920		ctx.beginSection("GL_INVALID_VALUE is generated if srcLevel and dstLevel are not valid levels for the corresponding images.");
1921		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_2D, 1, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
1922		ctx.expectError				(GL_INVALID_VALUE);
1923		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 1, 0, 0, 0, 0, 0, 1);
1924		ctx.expectError				(GL_INVALID_VALUE);
1925		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_2D, 1, 0, 0, 0, texture[1], GL_TEXTURE_2D, 1, 0, 0, 0, 0, 0, 1);
1926		ctx.expectError				(GL_INVALID_VALUE);
1927		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_2D, -1, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
1928		ctx.expectError				(GL_INVALID_VALUE);
1929		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, -1, 0, 0, 0, 0, 0, 1);
1930		ctx.expectError				(GL_INVALID_VALUE);
1931		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_2D, -1, 0, 0, 0, texture[1], GL_TEXTURE_2D, -1, 0, 0, 0, 0, 0, 1);
1932		ctx.expectError				(GL_INVALID_VALUE);
1933		ctx.glCopyImageSubData		(rbo, GL_RENDERBUFFER, -1, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
1934		ctx.expectError				(GL_INVALID_VALUE);
1935		ctx.glCopyImageSubData		(rbo, GL_RENDERBUFFER, 1, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
1936		ctx.expectError				(GL_INVALID_VALUE);
1937		ctx.glCopyImageSubData		(texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, rbo, GL_RENDERBUFFER, -1, 0, 0, 0, 0, 0, 1);
1938		ctx.expectError				(GL_INVALID_VALUE);
1939		ctx.glCopyImageSubData		(texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, rbo, GL_RENDERBUFFER, 1, 0, 0, 0, 0, 0, 1);
1940		ctx.expectError				(GL_INVALID_VALUE);
1941		ctx.endSection();
1942
1943		ctx.beginSection("GL_INVALID_ENUM is generated if either target does not match the type of the object.");
1944		// \note: This could be either:
1945		//		1. GL_INVALID_ENUM is generated if either target does not match the type of the object.
1946		//		2. GL_INVALID_VALUE is generated if either name does not correspond to a valid renderbuffer or texture object according to the corresponding target parameter.
1947		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, 1);
1948		ctx.expectError				(GL_INVALID_ENUM);
1949		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[2], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
1950		ctx.expectError				(GL_INVALID_ENUM);
1951		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_3D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
1952		ctx.expectError				(GL_INVALID_ENUM);
1953		ctx.glCopyImageSubData		(texture[2], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
1954		ctx.expectError				(GL_INVALID_ENUM);
1955		ctx.endSection();
1956
1957		ctx.beginSection("GL_INVALID_OPERATION is generated if either object is a texture and the texture is not complete.");
1958		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[3], GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, 1);
1959		ctx.expectError				(GL_INVALID_OPERATION);
1960		ctx.glCopyImageSubData		(texture[3], GL_TEXTURE_3D, 0, 0, 0, 0, texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
1961		ctx.expectError				(GL_INVALID_OPERATION);
1962		ctx.glCopyImageSubData		(texture[3], GL_TEXTURE_3D, 0, 0, 0, 0, texture[3], GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, 1);
1963		ctx.expectError				(GL_INVALID_OPERATION);
1964		ctx.endSection();
1965
1966		ctx.beginSection("GL_INVALID_VALUE is generated if the dimensions of either subregion exceeds the boundaries of the corresponding image object.");
1967		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 33, 0, 1);
1968		ctx.expectError				(GL_INVALID_VALUE);
1969		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 33, 1);
1970		ctx.expectError				(GL_INVALID_VALUE);
1971		ctx.endSection();
1972
1973		ctx.beginSection("GL_INVALID_OPERATION error is generated if the source and destination internal formats are not compatible.");
1974		ctx.glCopyImageSubData		(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[4], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
1975		ctx.expectError				(GL_INVALID_OPERATION);
1976		ctx.glCopyImageSubData		(texture[4], GL_TEXTURE_2D, 0, 0, 0, 0, texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
1977		ctx.expectError				(GL_INVALID_OPERATION);
1978		ctx.endSection();
1979
1980		ctx.glDeleteTextures		(5, texture);
1981		ctx.glDeleteRenderbuffers	(1, &rbo);
1982	}
1983}
1984
1985std::vector<FunctionContainer> getNegativeBufferApiTestFunctions ()
1986{
1987	const FunctionContainer funcs[] =
1988	{
1989		{bind_buffer,						"bind_buffer",						"Invalid glBindBuffer() usage"						},
1990		{delete_buffers,					"delete_buffers",					"Invalid glDeleteBuffers() usage"					},
1991		{gen_buffers,						"gen_buffers",						"Invalid glGenBuffers() usage"						},
1992		{buffer_data,						"buffer_data",						"Invalid glBufferData() usage"						},
1993		{buffer_sub_data,					"buffer_sub_data",					"Invalid glBufferSubData() usage"					},
1994		{buffer_sub_data_size_offset,		"buffer_sub_data_size_offset",		"Invalid glBufferSubData() usage"					},
1995		{clear,								"clear",							"Invalid glClear() usage"							},
1996		{read_pixels,						"read_pixels",						"Invalid glReadPixels() usage"						},
1997		{readn_pixels,						"readn_pixels",						"Invalid glReadPixels() usage"						},
1998		{read_pixels_format_mismatch,		"read_pixels_format_mismatch",		"Invalid glReadPixels() usage"						},
1999		{read_pixels_fbo_format_mismatch,	"read_pixels_fbo_format_mismatch",	"Invalid glReadPixels() usage"						},
2000		{bind_buffer_range,					"bind_buffer_range",				"Invalid glBindBufferRange() usage"					},
2001		{bind_buffer_base,					"bind_buffer_base",					"Invalid glBindBufferBase() usage"					},
2002		{clear_bufferiv,					"clear_bufferiv",					"Invalid glClearBufferiv() usage"					},
2003		{clear_bufferuiv,					"clear_bufferuiv",					"Invalid glClearBufferuiv() usage"					},
2004		{clear_bufferfv,					"clear_bufferfv",					"Invalid glClearBufferfv() usage"					},
2005		{clear_bufferfi,					"clear_bufferfi",					"Invalid glClearBufferfi() usage"					},
2006		{copy_buffer_sub_data,				"copy_buffer_sub_data",				"Invalid glCopyBufferSubData() usage"				},
2007		{draw_buffers,						"draw_buffers",						"Invalid glDrawBuffers() usage"						},
2008		{flush_mapped_buffer_range,			"flush_mapped_buffer_range",		"Invalid glFlushMappedBufferRange() usage"			},
2009		{map_buffer_range,					"map_buffer_range",					"Invalid glMapBufferRange() usage"					},
2010		{read_buffer,						"read_buffer",						"Invalid glReadBuffer() usage"						},
2011		{unmap_buffer,						"unmap_buffer",						"Invalid glUnmapBuffer() usage"						},
2012		{bind_framebuffer,					"bind_framebuffer",					"Invalid glBindFramebuffer() usage"					},
2013		{bind_renderbuffer,					"bind_renderbuffer",				"Invalid glBindRenderbuffer() usage"				},
2014		{check_framebuffer_status,			"check_framebuffer_status",			"Invalid glCheckFramebufferStatus() usage"			},
2015		{gen_framebuffers,					"gen_framebuffers",					"Invalid glGenFramebuffers() usage"					},
2016		{gen_renderbuffers,					"gen_renderbuffers",				"Invalid glGenRenderbuffers() usage"				},
2017		{delete_framebuffers,				"delete_framebuffers",				"Invalid glDeleteFramebuffers() usage"				},
2018		{delete_renderbuffers,				"delete_renderbuffers",				"Invalid glDeleteRenderbuffers() usage"				},
2019		{framebuffer_renderbuffer,			"framebuffer_renderbuffer",			"Invalid glFramebufferRenderbuffer() usage"			},
2020		{framebuffer_texture,				"framebuffer_texture",				"Invalid glFramebufferTexture() usage"				},
2021		{framebuffer_texture2d,				"framebuffer_texture2d",			"Invalid glFramebufferTexture2D() usage"			},
2022		{renderbuffer_storage,				"renderbuffer_storage",				"Invalid glRenderbufferStorage() usage"				},
2023		{blit_framebuffer,					"blit_framebuffer",					"Invalid glBlitFramebuffer() usage"					},
2024		{blit_framebuffer_multisample,		"blit_framebuffer_multisample",		"Invalid glBlitFramebuffer() usage"					},
2025		{framebuffer_texture_layer,			"framebuffer_texture_layer",		"Invalid glFramebufferTextureLayer() usage"			},
2026		{invalidate_framebuffer,			"invalidate_framebuffer",			"Invalid glInvalidateFramebuffer() usage"			},
2027		{invalidate_sub_framebuffer,		"invalidate_sub_framebuffer",		"Invalid glInvalidateSubFramebuffer() usage"		},
2028		{renderbuffer_storage_multisample,	"renderbuffer_storage_multisample",	"Invalid glRenderbufferStorageMultisample() usage"	},
2029		{copy_image_sub_data,				"copy_image_sub_data",				"Invalid glCopyImageSubData() usage"				},
2030	};
2031
2032	return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs));
2033}
2034
2035} // NegativeTestShared
2036} // Functional
2037} // gles31
2038} // deqp
2039