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