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 Read pixels tests
22  *//*--------------------------------------------------------------------*/
23 
24 #include "es3fReadPixelsTests.hpp"
25 
26 #include "tcuTexture.hpp"
27 #include "tcuTextureUtil.hpp"
28 #include "tcuImageCompare.hpp"
29 #include "tcuTestLog.hpp"
30 #include "tcuRenderTarget.hpp"
31 
32 #include "deRandom.hpp"
33 #include "deMath.h"
34 #include "deString.h"
35 #include "deStringUtil.hpp"
36 
37 #include "gluDefs.hpp"
38 #include "gluShaderProgram.hpp"
39 #include "gluStrUtil.hpp"
40 #include "gluTextureUtil.hpp"
41 
42 #include <cstring>
43 #include <sstream>
44 
45 #include "glw.h"
46 
47 using std::vector;
48 
49 namespace deqp
50 {
51 namespace gles3
52 {
53 namespace Functional
54 {
55 
56 namespace
57 {
58 
59 class ReadPixelsTest : public TestCase
60 {
61 public:
62 	enum
63 	{
64 		FLAG_NO_FLAGS		= 0x0,
65 		FLAG_CHOOSE_FORMAT	= 0x1,
66 		FLAG_USE_RBO		= 0x2,
67 	};
68 
69 					ReadPixelsTest	(Context& context, const char* name, const char* description, int flags, int alignment, GLint rowLength, GLint skipRows, GLint skipPixels, GLenum format = GL_RGBA, GLenum type = GL_UNSIGNED_BYTE);
70 
71 	IterateResult	iterate			(void);
72 	void			render			(tcu::Texture2D& reference);
73 
74 private:
75 	int				m_seed;
76 	bool			m_chooseFormat;
77 	bool			m_useRenderBuffer;
78 	int				m_alignment;
79 	GLint			m_rowLength;
80 	GLint			m_skipRows;
81 	GLint			m_skipPixels;
82 	GLint			m_format;
83 	GLint			m_type;
84 
85 	const int		m_width;
86 	const int		m_height;
87 
88 	void			getFormatInfo	(tcu::TextureFormat& format, int& pixelSize);
89 	void			clearColor		(tcu::Texture2D& reference, vector<deUint8>& pixelData, int pixelSize);
90 };
91 
ReadPixelsTest(Context & context,const char * name,const char * description,int flags,int alignment,GLint rowLength,GLint skipRows,GLint skipPixels,GLenum format,GLenum type)92 ReadPixelsTest::ReadPixelsTest	(Context& context, const char* name, const char* description, int flags, int alignment, GLint rowLength, GLint skipRows, GLint skipPixels, GLenum format, GLenum type)
93 	: TestCase			(context, name, description)
94 	, m_seed			(deStringHash(name))
95 	, m_chooseFormat	((flags & FLAG_CHOOSE_FORMAT) != 0)
96 	, m_useRenderBuffer	((flags & FLAG_USE_RBO) != 0)
97 	, m_alignment		(alignment)
98 	, m_rowLength		(rowLength)
99 	, m_skipRows		(skipRows)
100 	, m_skipPixels		(skipPixels)
101 	, m_format			(format)
102 	, m_type			(type)
103 	, m_width			(13)
104 	, m_height			(13)
105 {
106 }
107 
render(tcu::Texture2D & reference)108 void ReadPixelsTest::render (tcu::Texture2D& reference)
109 {
110 	// Create program
111 	const char* vertexSource =
112 	"#version 300 es\n"
113 	"in mediump vec2 i_coord;\n"
114 	"void main (void)\n"
115 	"{\n"
116 	"\tgl_Position = vec4(i_coord, 0.0, 1.0);\n"
117 	"}\n";
118 
119 	std::stringstream fragmentSource;
120 
121 
122 	fragmentSource <<
123 	"#version 300 es\n";
124 
125 	if (reference.getFormat().type == tcu::TextureFormat::SIGNED_INT32)
126 		fragmentSource << "layout(location = 0) out mediump ivec4 o_color;\n";
127 	else if (reference.getFormat().type == tcu::TextureFormat::UNSIGNED_INT32)
128 		fragmentSource << "layout(location = 0) out mediump uvec4 o_color;\n";
129 	else
130 		fragmentSource << "layout(location = 0) out mediump vec4 o_color;\n";
131 
132 	fragmentSource <<
133 	"void main (void)\n"
134 	"{\n";
135 
136 	if (reference.getFormat().type == tcu::TextureFormat::UNSIGNED_INT32)
137 		fragmentSource << "\to_color = uvec4(0, 0, 0, 1000);\n";
138 	else if (reference.getFormat().type == tcu::TextureFormat::SIGNED_INT32)
139 		fragmentSource << "\to_color = ivec4(0, 0, 0, 1000);\n";
140 	else
141 		fragmentSource << "\to_color = vec4(0.0, 0.0, 0.0, 1.0);\n";
142 
143 	fragmentSource <<
144 	"}\n";
145 
146 	glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexSource, fragmentSource.str()));
147 
148 	m_testCtx.getLog() << program;
149 	TCU_CHECK(program.isOk());
150 	GLU_CHECK_CALL(glUseProgram(program.getProgram()));
151 
152 	// Render
153 	{
154 		const float coords[] =
155 		{
156 			-0.5f, -0.5f,
157 			 0.5f, -0.5f,
158 			 0.5f,  0.5f,
159 
160 			 0.5f,  0.5f,
161 			-0.5f,  0.5f,
162 			-0.5f, -0.5f
163 		};
164 		GLuint coordLoc;
165 
166 		coordLoc = glGetAttribLocation(program.getProgram(), "i_coord");
167 		GLU_CHECK_MSG("glGetAttribLocation()");
168 
169 		GLU_CHECK_CALL(glEnableVertexAttribArray(coordLoc));
170 
171 		GLU_CHECK_CALL(glVertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, coords));
172 
173 		GLU_CHECK_CALL(glDrawArrays(GL_TRIANGLES, 0, 6));
174 		GLU_CHECK_CALL(glDisableVertexAttribArray(coordLoc));
175 	}
176 
177 	// Render reference
178 
179 	const int coordX1 = (int)((-0.5f * (float)reference.getWidth()	/ 2.0f) + (float)reference.getWidth() / 2.0f);
180 	const int coordY1 = (int)((-0.5f * (float)reference.getHeight()	/ 2.0f) + (float)reference.getHeight() / 2.0f);
181 	const int coordX2 = (int)(( 0.5f * (float)reference.getWidth()	/ 2.0f) + (float)reference.getWidth() / 2.0f);
182 	const int coordY2 = (int)(( 0.5f * (float)reference.getHeight()	/ 2.0f) + (float)reference.getHeight() / 2.0f);
183 
184 	for (int x = 0; x < reference.getWidth(); x++)
185 	{
186 		if (x < coordX1 || x > coordX2)
187 			continue;
188 
189 		for (int y = 0; y < reference.getHeight(); y++)
190 		{
191 			if (y >= coordY1 && y <= coordY2)
192 			{
193 				if (reference.getFormat().type == tcu::TextureFormat::SIGNED_INT32)
194 					reference.getLevel(0).setPixel(tcu::IVec4(0, 0, 0, 1000), x, y);
195 				else if (reference.getFormat().type == tcu::TextureFormat::UNSIGNED_INT32)
196 					reference.getLevel(0).setPixel(tcu::UVec4(0, 0, 0, 1000), x, y);
197 				else
198 					reference.getLevel(0).setPixel(tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f), x, y);
199 			}
200 		}
201 	}
202 }
203 
getFormatInfo(tcu::TextureFormat & format,int & pixelSize)204 void ReadPixelsTest::getFormatInfo (tcu::TextureFormat& format, int& pixelSize)
205 {
206 	if (m_chooseFormat)
207 	{
208 		GLU_CHECK_CALL(glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &m_format));
209 		GLU_CHECK_CALL(glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &m_type));
210 
211 		if (m_format != GL_RGBA && m_format != GL_BGRA && m_format != GL_RGB)
212 			TCU_THROW(NotSupportedError, ("Unsupported IMPLEMENTATION_COLOR_READ_FORMAT: " + de::toString(glu::getTextureFormatStr(m_format))).c_str());
213 		if (glu::getTypeName(m_type) == DE_NULL)
214 			TCU_THROW(NotSupportedError, ("Unsupported GL_IMPLEMENTATION_COLOR_READ_TYPE: " + de::toString(tcu::Format::Hex<4>(m_type))).c_str());
215 	}
216 
217 	format = glu::mapGLTransferFormat(m_format, m_type);
218 	pixelSize = format.getPixelSize();
219 }
220 
clearColor(tcu::Texture2D & reference,vector<deUint8> & pixelData,int pixelSize)221 void ReadPixelsTest::clearColor (tcu::Texture2D& reference, vector<deUint8>& pixelData, int pixelSize)
222 {
223 	de::Random					rnd(m_seed);
224 	GLuint						framebuffer = 0;
225 	GLuint						renderbuffer = 0;
226 
227 	if (m_useRenderBuffer)
228 	{
229 		if (m_type == GL_UNSIGNED_INT)
230 		{
231 			GLU_CHECK_CALL(glGenRenderbuffers(1, &renderbuffer));
232 			GLU_CHECK_CALL(glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer));
233 			GLU_CHECK_CALL(glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA32UI, m_width, m_height));
234 		}
235 		else if (m_type == GL_INT)
236 		{
237 			GLU_CHECK_CALL(glGenRenderbuffers(1, &renderbuffer));
238 			GLU_CHECK_CALL(glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer));
239 			GLU_CHECK_CALL(glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA32I, m_width, m_height));
240 		}
241 		else
242 			DE_ASSERT(false);
243 
244 		GLU_CHECK_CALL(glBindRenderbuffer(GL_RENDERBUFFER, 0));
245 		GLU_CHECK_CALL(glGenFramebuffers(1, &framebuffer));
246 		GLU_CHECK_CALL(glBindFramebuffer(GL_FRAMEBUFFER, framebuffer));
247 		GLU_CHECK_CALL(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, renderbuffer));
248 	}
249 	else if (m_format == GL_RGBA || m_format == GL_BGRA || m_format == GL_RGB)
250 	{
251 		// Empty
252 	}
253 	else
254 		DE_ASSERT(false);
255 
256 	GLU_CHECK_CALL(glViewport(0, 0, reference.getWidth(), reference.getHeight()));
257 
258 	// Clear color
259 	if (m_format == GL_RGBA || m_format == GL_BGRA || m_format == GL_RGB)
260 	{
261 		const float red		= rnd.getFloat();
262 		const float green	= rnd.getFloat();
263 		const float blue	= rnd.getFloat();
264 		const float alpha	= rnd.getFloat();
265 
266 		const GLfloat color[] = { red, green, blue, alpha };
267 		// Clear target
268 		GLU_CHECK_CALL(glClearColor(red, green, blue, alpha));
269 		m_testCtx.getLog() << tcu::TestLog::Message << "ClearColor: (" << red << ", " << green << ", " << blue << ")" << tcu::TestLog::EndMessage;
270 
271 		GLU_CHECK_CALL(glClearBufferfv(GL_COLOR, 0, color));
272 
273 		tcu::clear(reference.getLevel(0), tcu::Vec4(red, green, blue, alpha));
274 	}
275 	else if (m_format == GL_RGBA_INTEGER)
276 	{
277 		if (m_type == GL_INT)
278 		{
279 			const GLint red		= rnd.getUint32();
280 			const GLint green	= rnd.getUint32();
281 			const GLint blue	= rnd.getUint32();
282 			const GLint alpha	= rnd.getUint32();
283 
284 			const GLint color[] = { red, green, blue, alpha };
285 			m_testCtx.getLog() << tcu::TestLog::Message << "ClearColor: (" << red << ", " << green << ", " << blue << ")" << tcu::TestLog::EndMessage;
286 
287 			GLU_CHECK_CALL(glClearBufferiv(GL_COLOR, 0, color));
288 
289 			tcu::clear(reference.getLevel(0), tcu::IVec4(red, green, blue, alpha));
290 		}
291 		else if (m_type == GL_UNSIGNED_INT)
292 		{
293 			const GLuint red	= rnd.getUint32();
294 			const GLuint green	= rnd.getUint32();
295 			const GLuint blue	= rnd.getUint32();
296 			const GLuint alpha	= rnd.getUint32();
297 
298 			const GLuint color[] = { red, green, blue, alpha };
299 			m_testCtx.getLog() << tcu::TestLog::Message << "ClearColor: (" << red << ", " << green << ", " << blue << ")" << tcu::TestLog::EndMessage;
300 
301 			GLU_CHECK_CALL(glClearBufferuiv(GL_COLOR, 0, color));
302 
303 			tcu::clear(reference.getLevel(0), tcu::UVec4(red, green, blue, alpha));
304 		}
305 		else
306 			DE_ASSERT(false);
307 	}
308 	else
309 		DE_ASSERT(false);
310 
311 	render(reference);
312 
313 	const int rowWidth	= (m_rowLength == 0 ? m_width : m_rowLength) + m_skipPixels;
314 	const int rowPitch	= m_alignment * deCeilFloatToInt32(float(pixelSize * rowWidth) / (float)m_alignment);
315 
316 	pixelData.resize(rowPitch * (m_height + m_skipRows), 0);
317 
318 	GLU_CHECK_CALL(glReadPixels(0, 0, m_width, m_height, m_format, m_type, &(pixelData[0])));
319 
320 	if (framebuffer)
321 		GLU_CHECK_CALL(glDeleteFramebuffers(1, &framebuffer));
322 
323 	if (renderbuffer)
324 		GLU_CHECK_CALL(glDeleteRenderbuffers(1, &renderbuffer));
325 }
326 
iterate(void)327 TestCase::IterateResult ReadPixelsTest::iterate (void)
328 {
329 	tcu::TextureFormat			format(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8);
330 	int							pixelSize;
331 
332 	getFormatInfo(format, pixelSize);
333 	m_testCtx.getLog() << tcu::TestLog::Message << "Format: " << glu::getTextureFormatStr(m_format) << ", Type: " << glu::getTypeStr(m_type) << tcu::TestLog::EndMessage;
334 
335 	tcu::Texture2D reference(format, m_width, m_height);
336 	reference.allocLevel(0);
337 
338 	GLU_CHECK_CALL(glPixelStorei(GL_PACK_ALIGNMENT, m_alignment));
339 	m_testCtx.getLog() << tcu::TestLog::Message << "GL_PACK_ALIGNMENT: " << m_alignment << tcu::TestLog::EndMessage;
340 
341 	GLU_CHECK_CALL(glPixelStorei(GL_PACK_ROW_LENGTH, m_rowLength));
342 	m_testCtx.getLog() << tcu::TestLog::Message << "GL_PACK_ROW_LENGTH: " << m_rowLength << tcu::TestLog::EndMessage;
343 
344 	GLU_CHECK_CALL(glPixelStorei(GL_PACK_SKIP_ROWS, m_skipRows));
345 	m_testCtx.getLog() << tcu::TestLog::Message << "GL_PACK_SKIP_ROWS: " << m_skipRows << tcu::TestLog::EndMessage;
346 
347 	GLU_CHECK_CALL(glPixelStorei(GL_PACK_SKIP_PIXELS, m_skipPixels));
348 	m_testCtx.getLog() << tcu::TestLog::Message << "GL_PACK_SKIP_PIXELS: " << m_skipPixels << tcu::TestLog::EndMessage;
349 
350 	GLU_CHECK_CALL(glViewport(0, 0, m_width, m_height));
351 
352 	vector<deUint8>	pixelData;
353 	clearColor(reference, pixelData, pixelSize);
354 
355 	const int							rowWidth		= (m_rowLength == 0 ? m_width : m_rowLength);
356 	const int							rowPitch		= m_alignment * deCeilFloatToInt32((float)(pixelSize * rowWidth) / (float)m_alignment);
357 	const tcu::ConstPixelBufferAccess	resultAccess	= tcu::ConstPixelBufferAccess(format, m_width, m_height, 1, rowPitch, 0, &(pixelData[pixelSize * m_skipPixels + m_skipRows * rowPitch]));
358 
359 	// \note Renderbuffers are never multisampled
360 	if (!m_useRenderBuffer && m_context.getRenderTarget().getNumSamples() > 1)
361 	{
362 		const tcu::IVec4	formatBitDepths	= tcu::getTextureFormatBitDepth(format);
363 		const deUint8		redThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits,	formatBitDepths.x()))));
364 		const deUint8		greenThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits,	formatBitDepths.y()))));
365 		const deUint8		blueThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits,	formatBitDepths.z()))));
366 		const deUint8		alphaThreshold	= (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits,	formatBitDepths.w()))));
367 
368 		// bilinearCompare only accepts RGBA, UINT8
369 		tcu::Texture2D		referenceRGBA8	(tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), m_width, m_height);
370 		tcu::Texture2D		resultRGBA8		(tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), m_width, m_height);
371 
372 		referenceRGBA8.allocLevel(0);
373 		resultRGBA8.allocLevel(0);
374 
375 		tcu::copy(referenceRGBA8.getLevel(0), reference.getLevel(0));
376 		tcu::copy(resultRGBA8.getLevel(0), resultAccess);
377 
378 		if (tcu::bilinearCompare(m_testCtx.getLog(), "Result", "Result", referenceRGBA8.getLevel(0), resultRGBA8.getLevel(0), tcu::RGBA(redThreshold, greenThreshold, blueThreshold, alphaThreshold), tcu::COMPARE_LOG_RESULT))
379 			m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
380 		else
381 			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
382 	}
383 	else
384 	{
385 		const tcu::IVec4	formatBitDepths	= tcu::getTextureFormatBitDepth(format);
386 		const float			redThreshold	= 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits,		formatBitDepths.x()));
387 		const float			greenThreshold	= 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits,	formatBitDepths.y()));
388 		const float			blueThreshold	= 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits,	formatBitDepths.z()));
389 		const float			alphaThreshold	= 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits,	formatBitDepths.w()));
390 
391 		// Compare
392 		if (tcu::floatThresholdCompare(m_testCtx.getLog(), "Result", "Result", reference.getLevel(0), resultAccess, tcu::Vec4(redThreshold, greenThreshold, blueThreshold, alphaThreshold), tcu::COMPARE_LOG_RESULT))
393 			m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
394 		else
395 			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
396 	}
397 
398 	return STOP;
399 }
400 
401 } // anonymous
402 
ReadPixelsTests(Context & context)403 ReadPixelsTests::ReadPixelsTests (Context& context)
404 	: TestCaseGroup(context, "read_pixels", "ReadPixel tests")
405 {
406 }
407 
init(void)408 void ReadPixelsTests::init (void)
409 {
410 	{
411 		TestCaseGroup* group = new TestCaseGroup(m_context, "alignment", "Read pixels pack alignment parameter tests");
412 
413 		group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_1", "", ReadPixelsTest::FLAG_NO_FLAGS, 1, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE));
414 		group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_2", "", ReadPixelsTest::FLAG_NO_FLAGS, 2, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE));
415 		group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_4", "", ReadPixelsTest::FLAG_NO_FLAGS, 4, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE));
416 		group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_8", "", ReadPixelsTest::FLAG_NO_FLAGS, 8, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE));
417 
418 		group->addChild(new ReadPixelsTest(m_context, "rgba_int_1", "", ReadPixelsTest::FLAG_USE_RBO, 1, 0, 0, 0, GL_RGBA_INTEGER, GL_INT));
419 		group->addChild(new ReadPixelsTest(m_context, "rgba_int_2", "", ReadPixelsTest::FLAG_USE_RBO, 2, 0, 0, 0, GL_RGBA_INTEGER, GL_INT));
420 		group->addChild(new ReadPixelsTest(m_context, "rgba_int_4", "", ReadPixelsTest::FLAG_USE_RBO, 4, 0, 0, 0, GL_RGBA_INTEGER, GL_INT));
421 		group->addChild(new ReadPixelsTest(m_context, "rgba_int_8", "", ReadPixelsTest::FLAG_USE_RBO, 8, 0, 0, 0, GL_RGBA_INTEGER, GL_INT));
422 
423 		group->addChild(new ReadPixelsTest(m_context, "rgba_uint_1", "", ReadPixelsTest::FLAG_USE_RBO, 1, 0, 0, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT));
424 		group->addChild(new ReadPixelsTest(m_context, "rgba_uint_2", "", ReadPixelsTest::FLAG_USE_RBO, 2, 0, 0, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT));
425 		group->addChild(new ReadPixelsTest(m_context, "rgba_uint_4", "", ReadPixelsTest::FLAG_USE_RBO, 4, 0, 0, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT));
426 		group->addChild(new ReadPixelsTest(m_context, "rgba_uint_8", "", ReadPixelsTest::FLAG_USE_RBO, 8, 0, 0, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT));
427 
428 		group->addChild(new ReadPixelsTest(m_context, "choose_1", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 1, 0, 0, 0));
429 		group->addChild(new ReadPixelsTest(m_context, "choose_2", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 2, 0, 0, 0));
430 		group->addChild(new ReadPixelsTest(m_context, "choose_4", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 4, 0, 0, 0));
431 		group->addChild(new ReadPixelsTest(m_context, "choose_8", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 8, 0, 0, 0));
432 
433 		addChild(group);
434 	}
435 
436 	{
437 		TestCaseGroup* group = new TestCaseGroup(m_context, "rowlength", "Read pixels rowlength test");
438 		group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_17", "", ReadPixelsTest::FLAG_NO_FLAGS, 4, 17, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE));
439 		group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_19", "", ReadPixelsTest::FLAG_NO_FLAGS, 4, 19, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE));
440 		group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_23", "", ReadPixelsTest::FLAG_NO_FLAGS, 4, 23, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE));
441 		group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_29", "", ReadPixelsTest::FLAG_NO_FLAGS, 4, 29, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE));
442 
443 		group->addChild(new ReadPixelsTest(m_context, "rgba_int_17", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 0, 0, GL_RGBA_INTEGER, GL_INT));
444 		group->addChild(new ReadPixelsTest(m_context, "rgba_int_19", "", ReadPixelsTest::FLAG_USE_RBO, 4, 19, 0, 0, GL_RGBA_INTEGER, GL_INT));
445 		group->addChild(new ReadPixelsTest(m_context, "rgba_int_23", "", ReadPixelsTest::FLAG_USE_RBO, 4, 23, 0, 0, GL_RGBA_INTEGER, GL_INT));
446 		group->addChild(new ReadPixelsTest(m_context, "rgba_int_29", "", ReadPixelsTest::FLAG_USE_RBO, 4, 29, 0, 0, GL_RGBA_INTEGER, GL_INT));
447 
448 		group->addChild(new ReadPixelsTest(m_context, "rgba_uint_17", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 0, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT));
449 		group->addChild(new ReadPixelsTest(m_context, "rgba_uint_19", "", ReadPixelsTest::FLAG_USE_RBO, 4, 19, 0, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT));
450 		group->addChild(new ReadPixelsTest(m_context, "rgba_uint_23", "", ReadPixelsTest::FLAG_USE_RBO, 4, 23, 0, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT));
451 		group->addChild(new ReadPixelsTest(m_context, "rgba_uint_29", "", ReadPixelsTest::FLAG_USE_RBO, 4, 29, 0, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT));
452 
453 		group->addChild(new ReadPixelsTest(m_context, "choose_17", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 4, 17, 0, 0));
454 		group->addChild(new ReadPixelsTest(m_context, "choose_19", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 4, 19, 0, 0));
455 		group->addChild(new ReadPixelsTest(m_context, "choose_23", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 4, 23, 0, 0));
456 		group->addChild(new ReadPixelsTest(m_context, "choose_29", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 4, 29, 0, 0));
457 
458 		addChild(group);
459 	}
460 
461 	{
462 		TestCaseGroup* group = new TestCaseGroup(m_context, "skip", "Read pixels skip pixels and rows test");
463 		group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_0_3", "", ReadPixelsTest::FLAG_NO_FLAGS, 4, 17, 0, 3, GL_RGBA, GL_UNSIGNED_BYTE));
464 		group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_3_0", "", ReadPixelsTest::FLAG_NO_FLAGS, 4, 17, 3, 0, GL_RGBA, GL_UNSIGNED_BYTE));
465 		group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_3_3", "", ReadPixelsTest::FLAG_NO_FLAGS, 4, 17, 3, 3, GL_RGBA, GL_UNSIGNED_BYTE));
466 		group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_3_5", "", ReadPixelsTest::FLAG_NO_FLAGS, 4, 17, 3, 5, GL_RGBA, GL_UNSIGNED_BYTE));
467 
468 		group->addChild(new ReadPixelsTest(m_context, "rgba_int_0_3", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 0, 3, GL_RGBA_INTEGER, GL_INT));
469 		group->addChild(new ReadPixelsTest(m_context, "rgba_int_3_0", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 3, 0, GL_RGBA_INTEGER, GL_INT));
470 		group->addChild(new ReadPixelsTest(m_context, "rgba_int_3_3", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 3, 3, GL_RGBA_INTEGER, GL_INT));
471 		group->addChild(new ReadPixelsTest(m_context, "rgba_int_3_5", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 3, 5, GL_RGBA_INTEGER, GL_INT));
472 
473 		group->addChild(new ReadPixelsTest(m_context, "rgba_uint_0_3", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 0, 3, GL_RGBA_INTEGER, GL_UNSIGNED_INT));
474 		group->addChild(new ReadPixelsTest(m_context, "rgba_uint_3_0", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 3, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT));
475 		group->addChild(new ReadPixelsTest(m_context, "rgba_uint_3_3", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 3, 3, GL_RGBA_INTEGER, GL_UNSIGNED_INT));
476 		group->addChild(new ReadPixelsTest(m_context, "rgba_uint_3_5", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 3, 5, GL_RGBA_INTEGER, GL_UNSIGNED_INT));
477 
478 		group->addChild(new ReadPixelsTest(m_context, "choose_0_3", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 4, 17, 0, 3));
479 		group->addChild(new ReadPixelsTest(m_context, "choose_3_0", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 4, 17, 3, 0));
480 		group->addChild(new ReadPixelsTest(m_context, "choose_3_3", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 4, 17, 3, 3));
481 		group->addChild(new ReadPixelsTest(m_context, "choose_3_5", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 4, 17, 3, 5));
482 
483 		addChild(group);
484 	}
485 }
486 
487 } // Functional
488 } // gles3
489 } // deqp
490