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