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,
70 GLint rowLength, GLint skipRows, GLint skipPixels, GLenum format = GL_RGBA,
71 GLenum type = GL_UNSIGNED_BYTE);
72
73 IterateResult iterate(void);
74 void render(tcu::Texture2D &reference);
75
76 private:
77 int m_seed;
78 bool m_chooseFormat;
79 bool m_useRenderBuffer;
80 int m_alignment;
81 GLint m_rowLength;
82 GLint m_skipRows;
83 GLint m_skipPixels;
84 GLint m_format;
85 GLint m_type;
86
87 const int m_width;
88 const int m_height;
89
90 void getFormatInfo(tcu::TextureFormat &format, int &pixelSize);
91 void clearColor(tcu::Texture2D &reference, vector<uint8_t> &pixelData, int pixelSize);
92 };
93
ReadPixelsTest(Context & context,const char * name,const char * description,int flags,int alignment,GLint rowLength,GLint skipRows,GLint skipPixels,GLenum format,GLenum type)94 ReadPixelsTest::ReadPixelsTest(Context &context, const char *name, const char *description, int flags, int alignment,
95 GLint rowLength, GLint skipRows, GLint skipPixels, GLenum format, GLenum type)
96 : TestCase(context, name, description)
97 , m_seed(deStringHash(name))
98 , m_chooseFormat((flags & FLAG_CHOOSE_FORMAT) != 0)
99 , m_useRenderBuffer((flags & FLAG_USE_RBO) != 0)
100 , m_alignment(alignment)
101 , m_rowLength(rowLength)
102 , m_skipRows(skipRows)
103 , m_skipPixels(skipPixels)
104 , m_format(format)
105 , m_type(type)
106 , m_width(13)
107 , m_height(13)
108 {
109 }
110
render(tcu::Texture2D & reference)111 void ReadPixelsTest::render(tcu::Texture2D &reference)
112 {
113 // Create program
114 const char *vertexSource = "#version 300 es\n"
115 "in mediump vec2 i_coord;\n"
116 "void main (void)\n"
117 "{\n"
118 "\tgl_Position = vec4(i_coord, 0.0, 1.0);\n"
119 "}\n";
120
121 std::stringstream fragmentSource;
122
123 fragmentSource << "#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 << "void main (void)\n"
133 "{\n";
134
135 if (reference.getFormat().type == tcu::TextureFormat::UNSIGNED_INT32)
136 fragmentSource << "\to_color = uvec4(0, 0, 0, 1000);\n";
137 else if (reference.getFormat().type == tcu::TextureFormat::SIGNED_INT32)
138 fragmentSource << "\to_color = ivec4(0, 0, 0, 1000);\n";
139 else
140 fragmentSource << "\to_color = vec4(0.0, 0.0, 0.0, 1.0);\n";
141
142 fragmentSource << "}\n";
143
144 glu::ShaderProgram program(m_context.getRenderContext(),
145 glu::makeVtxFragSources(vertexSource, fragmentSource.str()));
146
147 m_testCtx.getLog() << program;
148 TCU_CHECK(program.isOk());
149 GLU_CHECK_CALL(glUseProgram(program.getProgram()));
150
151 // Render
152 {
153 const float coords[] = {-0.5f, -0.5f, 0.5f, -0.5f, 0.5f, 0.5f,
154
155 0.5f, 0.5f, -0.5f, 0.5f, -0.5f, -0.5f};
156 GLuint coordLoc;
157
158 coordLoc = glGetAttribLocation(program.getProgram(), "i_coord");
159 GLU_CHECK_MSG("glGetAttribLocation()");
160
161 GLU_CHECK_CALL(glEnableVertexAttribArray(coordLoc));
162
163 GLU_CHECK_CALL(glVertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, coords));
164
165 GLU_CHECK_CALL(glDrawArrays(GL_TRIANGLES, 0, 6));
166 GLU_CHECK_CALL(glDisableVertexAttribArray(coordLoc));
167 }
168
169 // Render reference
170
171 const int coordX1 = (int)((-0.5f * (float)reference.getWidth() / 2.0f) + (float)reference.getWidth() / 2.0f);
172 const int coordY1 = (int)((-0.5f * (float)reference.getHeight() / 2.0f) + (float)reference.getHeight() / 2.0f);
173 const int coordX2 = (int)((0.5f * (float)reference.getWidth() / 2.0f) + (float)reference.getWidth() / 2.0f);
174 const int coordY2 = (int)((0.5f * (float)reference.getHeight() / 2.0f) + (float)reference.getHeight() / 2.0f);
175
176 for (int x = 0; x < reference.getWidth(); x++)
177 {
178 if (x < coordX1 || x > coordX2)
179 continue;
180
181 for (int y = 0; y < reference.getHeight(); y++)
182 {
183 if (y >= coordY1 && y <= coordY2)
184 {
185 if (reference.getFormat().type == tcu::TextureFormat::SIGNED_INT32)
186 reference.getLevel(0).setPixel(tcu::IVec4(0, 0, 0, 1000), x, y);
187 else if (reference.getFormat().type == tcu::TextureFormat::UNSIGNED_INT32)
188 reference.getLevel(0).setPixel(tcu::UVec4(0, 0, 0, 1000), x, y);
189 else
190 reference.getLevel(0).setPixel(tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f), x, y);
191 }
192 }
193 }
194 }
195
getFormatInfo(tcu::TextureFormat & format,int & pixelSize)196 void ReadPixelsTest::getFormatInfo(tcu::TextureFormat &format, int &pixelSize)
197 {
198 if (m_chooseFormat)
199 {
200 GLU_CHECK_CALL(glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &m_format));
201 GLU_CHECK_CALL(glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &m_type));
202
203 if (m_format != GL_RGBA && m_format != GL_BGRA && m_format != GL_RGB)
204 TCU_THROW(NotSupportedError, ("Unsupported IMPLEMENTATION_COLOR_READ_FORMAT: " +
205 de::toString(glu::getTextureFormatStr(m_format)))
206 .c_str());
207 if (glu::getTypeName(m_type) == DE_NULL)
208 TCU_THROW(NotSupportedError,
209 ("Unsupported GL_IMPLEMENTATION_COLOR_READ_TYPE: " + de::toString(tcu::Format::Hex<4>(m_type)))
210 .c_str());
211 }
212
213 format = glu::mapGLTransferFormat(m_format, m_type);
214 pixelSize = format.getPixelSize();
215 }
216
clearColor(tcu::Texture2D & reference,vector<uint8_t> & pixelData,int pixelSize)217 void ReadPixelsTest::clearColor(tcu::Texture2D &reference, vector<uint8_t> &pixelData, int pixelSize)
218 {
219 de::Random rnd(m_seed);
220 GLuint framebuffer = 0;
221 GLuint renderbuffer = 0;
222
223 if (m_useRenderBuffer)
224 {
225 if (m_type == GL_UNSIGNED_INT)
226 {
227 GLU_CHECK_CALL(glGenRenderbuffers(1, &renderbuffer));
228 GLU_CHECK_CALL(glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer));
229 GLU_CHECK_CALL(glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA32UI, m_width, m_height));
230 }
231 else if (m_type == GL_INT)
232 {
233 GLU_CHECK_CALL(glGenRenderbuffers(1, &renderbuffer));
234 GLU_CHECK_CALL(glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer));
235 GLU_CHECK_CALL(glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA32I, m_width, m_height));
236 }
237 else
238 DE_ASSERT(false);
239
240 GLU_CHECK_CALL(glBindRenderbuffer(GL_RENDERBUFFER, 0));
241 GLU_CHECK_CALL(glGenFramebuffers(1, &framebuffer));
242 GLU_CHECK_CALL(glBindFramebuffer(GL_FRAMEBUFFER, framebuffer));
243 GLU_CHECK_CALL(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, renderbuffer));
244 }
245 else if (m_format == GL_RGBA || m_format == GL_BGRA || m_format == GL_RGB)
246 {
247 // Empty
248 }
249 else
250 DE_ASSERT(false);
251
252 GLU_CHECK_CALL(glViewport(0, 0, reference.getWidth(), reference.getHeight()));
253
254 // Clear color
255 if (m_format == GL_RGBA || m_format == GL_BGRA || m_format == GL_RGB)
256 {
257 const float red = rnd.getFloat();
258 const float green = rnd.getFloat();
259 const float blue = rnd.getFloat();
260 const float alpha = rnd.getFloat();
261
262 const GLfloat color[] = {red, green, blue, alpha};
263 // Clear target
264 GLU_CHECK_CALL(glClearColor(red, green, blue, alpha));
265 m_testCtx.getLog() << tcu::TestLog::Message << "ClearColor: (" << red << ", " << green << ", " << blue << ")"
266 << tcu::TestLog::EndMessage;
267
268 GLU_CHECK_CALL(glClearBufferfv(GL_COLOR, 0, color));
269
270 tcu::clear(reference.getLevel(0), tcu::Vec4(red, green, blue, alpha));
271 }
272 else if (m_format == GL_RGBA_INTEGER)
273 {
274 if (m_type == GL_INT)
275 {
276 const GLint red = rnd.getUint32();
277 const GLint green = rnd.getUint32();
278 const GLint blue = rnd.getUint32();
279 const GLint alpha = rnd.getUint32();
280
281 const GLint color[] = {red, green, blue, alpha};
282 m_testCtx.getLog() << tcu::TestLog::Message << "ClearColor: (" << red << ", " << green << ", " << blue
283 << ")" << tcu::TestLog::EndMessage;
284
285 GLU_CHECK_CALL(glClearBufferiv(GL_COLOR, 0, color));
286
287 tcu::clear(reference.getLevel(0), tcu::IVec4(red, green, blue, alpha));
288 }
289 else if (m_type == GL_UNSIGNED_INT)
290 {
291 const GLuint red = rnd.getUint32();
292 const GLuint green = rnd.getUint32();
293 const GLuint blue = rnd.getUint32();
294 const GLuint alpha = rnd.getUint32();
295
296 const GLuint color[] = {red, green, blue, alpha};
297 m_testCtx.getLog() << tcu::TestLog::Message << "ClearColor: (" << red << ", " << green << ", " << blue
298 << ")" << tcu::TestLog::EndMessage;
299
300 GLU_CHECK_CALL(glClearBufferuiv(GL_COLOR, 0, color));
301
302 tcu::clear(reference.getLevel(0), tcu::UVec4(red, green, blue, alpha));
303 }
304 else
305 DE_ASSERT(false);
306 }
307 else
308 DE_ASSERT(false);
309
310 render(reference);
311
312 const int rowWidth = (m_rowLength == 0 ? m_width : m_rowLength) + m_skipPixels;
313 const int rowPitch = m_alignment * deCeilFloatToInt32(float(pixelSize * rowWidth) / (float)m_alignment);
314
315 pixelData.resize(rowPitch * (m_height + m_skipRows), 0);
316
317 GLU_CHECK_CALL(glReadPixels(0, 0, m_width, m_height, m_format, m_type, &(pixelData[0])));
318
319 if (framebuffer)
320 GLU_CHECK_CALL(glDeleteFramebuffers(1, &framebuffer));
321
322 if (renderbuffer)
323 GLU_CHECK_CALL(glDeleteRenderbuffers(1, &renderbuffer));
324 }
325
iterate(void)326 TestCase::IterateResult ReadPixelsTest::iterate(void)
327 {
328 tcu::TextureFormat format(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8);
329 int pixelSize;
330
331 getFormatInfo(format, pixelSize);
332 m_testCtx.getLog() << tcu::TestLog::Message << "Format: " << glu::getTextureFormatStr(m_format)
333 << ", 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<uint8_t> 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(
358 format, m_width, m_height, 1, rowPitch, 0, &(pixelData[pixelSize * m_skipPixels + m_skipRows * rowPitch]));
359
360 // \note Renderbuffers are never multisampled
361 if (!m_useRenderBuffer && m_context.getRenderTarget().getNumSamples() > 1)
362 {
363 const tcu::IVec4 formatBitDepths = tcu::getTextureFormatBitDepth(format);
364 const uint8_t redThreshold = (uint8_t)deCeilFloatToInt32(
365 256.0f *
366 (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits, formatBitDepths.x()))));
367 const uint8_t greenThreshold = (uint8_t)deCeilFloatToInt32(
368 256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits,
369 formatBitDepths.y()))));
370 const uint8_t blueThreshold = (uint8_t)deCeilFloatToInt32(
371 256.0f *
372 (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits, formatBitDepths.z()))));
373 const uint8_t alphaThreshold = (uint8_t)deCeilFloatToInt32(
374 256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits,
375 formatBitDepths.w()))));
376
377 // bilinearCompare only accepts RGBA, UINT8
378 tcu::Texture2D referenceRGBA8(tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8),
379 m_width, m_height);
380 tcu::Texture2D resultRGBA8(tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8),
381 m_width, m_height);
382
383 referenceRGBA8.allocLevel(0);
384 resultRGBA8.allocLevel(0);
385
386 tcu::copy(referenceRGBA8.getLevel(0), reference.getLevel(0));
387 tcu::copy(resultRGBA8.getLevel(0), resultAccess);
388
389 if (tcu::bilinearCompare(
390 m_testCtx.getLog(), "Result", "Result", referenceRGBA8.getLevel(0), resultRGBA8.getLevel(0),
391 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 =
400 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits, formatBitDepths.x()));
401 const float greenThreshold =
402 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits, formatBitDepths.y()));
403 const float blueThreshold =
404 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits, formatBitDepths.z()));
405 const float alphaThreshold =
406 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits, formatBitDepths.w()));
407
408 // Compare
409 if (tcu::floatThresholdCompare(m_testCtx.getLog(), "Result", "Result", reference.getLevel(0), resultAccess,
410 tcu::Vec4(redThreshold, greenThreshold, blueThreshold, alphaThreshold),
411 tcu::COMPARE_LOG_RESULT))
412 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
413 else
414 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
415 }
416
417 return STOP;
418 }
419
420 } // namespace
421
ReadPixelsTests(Context & context)422 ReadPixelsTests::ReadPixelsTests(Context &context) : TestCaseGroup(context, "read_pixels", "ReadPixel tests")
423 {
424 }
425
init(void)426 void ReadPixelsTests::init(void)
427 {
428 {
429 TestCaseGroup *group = new TestCaseGroup(m_context, "alignment", "Read pixels pack alignment parameter tests");
430
431 group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_1", "", ReadPixelsTest::FLAG_NO_FLAGS, 1, 0, 0, 0,
432 GL_RGBA, GL_UNSIGNED_BYTE));
433 group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_2", "", ReadPixelsTest::FLAG_NO_FLAGS, 2, 0, 0, 0,
434 GL_RGBA, GL_UNSIGNED_BYTE));
435 group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_4", "", ReadPixelsTest::FLAG_NO_FLAGS, 4, 0, 0, 0,
436 GL_RGBA, GL_UNSIGNED_BYTE));
437 group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_8", "", ReadPixelsTest::FLAG_NO_FLAGS, 8, 0, 0, 0,
438 GL_RGBA, GL_UNSIGNED_BYTE));
439
440 group->addChild(new ReadPixelsTest(m_context, "rgba_int_1", "", ReadPixelsTest::FLAG_USE_RBO, 1, 0, 0, 0,
441 GL_RGBA_INTEGER, GL_INT));
442 group->addChild(new ReadPixelsTest(m_context, "rgba_int_2", "", ReadPixelsTest::FLAG_USE_RBO, 2, 0, 0, 0,
443 GL_RGBA_INTEGER, GL_INT));
444 group->addChild(new ReadPixelsTest(m_context, "rgba_int_4", "", ReadPixelsTest::FLAG_USE_RBO, 4, 0, 0, 0,
445 GL_RGBA_INTEGER, GL_INT));
446 group->addChild(new ReadPixelsTest(m_context, "rgba_int_8", "", ReadPixelsTest::FLAG_USE_RBO, 8, 0, 0, 0,
447 GL_RGBA_INTEGER, GL_INT));
448
449 group->addChild(new ReadPixelsTest(m_context, "rgba_uint_1", "", ReadPixelsTest::FLAG_USE_RBO, 1, 0, 0, 0,
450 GL_RGBA_INTEGER, GL_UNSIGNED_INT));
451 group->addChild(new ReadPixelsTest(m_context, "rgba_uint_2", "", ReadPixelsTest::FLAG_USE_RBO, 2, 0, 0, 0,
452 GL_RGBA_INTEGER, GL_UNSIGNED_INT));
453 group->addChild(new ReadPixelsTest(m_context, "rgba_uint_4", "", ReadPixelsTest::FLAG_USE_RBO, 4, 0, 0, 0,
454 GL_RGBA_INTEGER, GL_UNSIGNED_INT));
455 group->addChild(new ReadPixelsTest(m_context, "rgba_uint_8", "", ReadPixelsTest::FLAG_USE_RBO, 8, 0, 0, 0,
456 GL_RGBA_INTEGER, GL_UNSIGNED_INT));
457
458 group->addChild(new ReadPixelsTest(m_context, "choose_1", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 1, 0, 0, 0));
459 group->addChild(new ReadPixelsTest(m_context, "choose_2", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 2, 0, 0, 0));
460 group->addChild(new ReadPixelsTest(m_context, "choose_4", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 4, 0, 0, 0));
461 group->addChild(new ReadPixelsTest(m_context, "choose_8", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 8, 0, 0, 0));
462
463 addChild(group);
464 }
465
466 {
467 TestCaseGroup *group = new TestCaseGroup(m_context, "rowlength", "Read pixels rowlength test");
468 group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_17", "", ReadPixelsTest::FLAG_NO_FLAGS, 4, 17, 0, 0,
469 GL_RGBA, GL_UNSIGNED_BYTE));
470 group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_19", "", ReadPixelsTest::FLAG_NO_FLAGS, 4, 19, 0, 0,
471 GL_RGBA, GL_UNSIGNED_BYTE));
472 group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_23", "", ReadPixelsTest::FLAG_NO_FLAGS, 4, 23, 0, 0,
473 GL_RGBA, GL_UNSIGNED_BYTE));
474 group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_29", "", ReadPixelsTest::FLAG_NO_FLAGS, 4, 29, 0, 0,
475 GL_RGBA, GL_UNSIGNED_BYTE));
476
477 group->addChild(new ReadPixelsTest(m_context, "rgba_int_17", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 0, 0,
478 GL_RGBA_INTEGER, GL_INT));
479 group->addChild(new ReadPixelsTest(m_context, "rgba_int_19", "", ReadPixelsTest::FLAG_USE_RBO, 4, 19, 0, 0,
480 GL_RGBA_INTEGER, GL_INT));
481 group->addChild(new ReadPixelsTest(m_context, "rgba_int_23", "", ReadPixelsTest::FLAG_USE_RBO, 4, 23, 0, 0,
482 GL_RGBA_INTEGER, GL_INT));
483 group->addChild(new ReadPixelsTest(m_context, "rgba_int_29", "", ReadPixelsTest::FLAG_USE_RBO, 4, 29, 0, 0,
484 GL_RGBA_INTEGER, GL_INT));
485
486 group->addChild(new ReadPixelsTest(m_context, "rgba_uint_17", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 0, 0,
487 GL_RGBA_INTEGER, GL_UNSIGNED_INT));
488 group->addChild(new ReadPixelsTest(m_context, "rgba_uint_19", "", ReadPixelsTest::FLAG_USE_RBO, 4, 19, 0, 0,
489 GL_RGBA_INTEGER, GL_UNSIGNED_INT));
490 group->addChild(new ReadPixelsTest(m_context, "rgba_uint_23", "", ReadPixelsTest::FLAG_USE_RBO, 4, 23, 0, 0,
491 GL_RGBA_INTEGER, GL_UNSIGNED_INT));
492 group->addChild(new ReadPixelsTest(m_context, "rgba_uint_29", "", ReadPixelsTest::FLAG_USE_RBO, 4, 29, 0, 0,
493 GL_RGBA_INTEGER, GL_UNSIGNED_INT));
494
495 group->addChild(
496 new ReadPixelsTest(m_context, "choose_17", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 4, 17, 0, 0));
497 group->addChild(
498 new ReadPixelsTest(m_context, "choose_19", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 4, 19, 0, 0));
499 group->addChild(
500 new ReadPixelsTest(m_context, "choose_23", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 4, 23, 0, 0));
501 group->addChild(
502 new ReadPixelsTest(m_context, "choose_29", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 4, 29, 0, 0));
503
504 addChild(group);
505 }
506
507 {
508 TestCaseGroup *group = new TestCaseGroup(m_context, "skip", "Read pixels skip pixels and rows test");
509 group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_0_3", "", ReadPixelsTest::FLAG_NO_FLAGS, 4, 17, 0, 3,
510 GL_RGBA, GL_UNSIGNED_BYTE));
511 group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_3_0", "", ReadPixelsTest::FLAG_NO_FLAGS, 4, 17, 3, 0,
512 GL_RGBA, GL_UNSIGNED_BYTE));
513 group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_3_3", "", ReadPixelsTest::FLAG_NO_FLAGS, 4, 17, 3, 3,
514 GL_RGBA, GL_UNSIGNED_BYTE));
515 group->addChild(new ReadPixelsTest(m_context, "rgba_ubyte_3_5", "", ReadPixelsTest::FLAG_NO_FLAGS, 4, 17, 3, 5,
516 GL_RGBA, GL_UNSIGNED_BYTE));
517
518 group->addChild(new ReadPixelsTest(m_context, "rgba_int_0_3", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 0, 3,
519 GL_RGBA_INTEGER, GL_INT));
520 group->addChild(new ReadPixelsTest(m_context, "rgba_int_3_0", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 3, 0,
521 GL_RGBA_INTEGER, GL_INT));
522 group->addChild(new ReadPixelsTest(m_context, "rgba_int_3_3", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 3, 3,
523 GL_RGBA_INTEGER, GL_INT));
524 group->addChild(new ReadPixelsTest(m_context, "rgba_int_3_5", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 3, 5,
525 GL_RGBA_INTEGER, GL_INT));
526
527 group->addChild(new ReadPixelsTest(m_context, "rgba_uint_0_3", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 0, 3,
528 GL_RGBA_INTEGER, GL_UNSIGNED_INT));
529 group->addChild(new ReadPixelsTest(m_context, "rgba_uint_3_0", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 3, 0,
530 GL_RGBA_INTEGER, GL_UNSIGNED_INT));
531 group->addChild(new ReadPixelsTest(m_context, "rgba_uint_3_3", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 3, 3,
532 GL_RGBA_INTEGER, GL_UNSIGNED_INT));
533 group->addChild(new ReadPixelsTest(m_context, "rgba_uint_3_5", "", ReadPixelsTest::FLAG_USE_RBO, 4, 17, 3, 5,
534 GL_RGBA_INTEGER, GL_UNSIGNED_INT));
535
536 group->addChild(
537 new ReadPixelsTest(m_context, "choose_0_3", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 4, 17, 0, 3));
538 group->addChild(
539 new ReadPixelsTest(m_context, "choose_3_0", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 4, 17, 3, 0));
540 group->addChild(
541 new ReadPixelsTest(m_context, "choose_3_3", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 4, 17, 3, 3));
542 group->addChild(
543 new ReadPixelsTest(m_context, "choose_3_5", "", ReadPixelsTest::FLAG_CHOOSE_FORMAT, 4, 17, 3, 5));
544
545 addChild(group);
546 }
547 }
548
549 } // namespace Functional
550 } // namespace gles3
551 } // namespace deqp
552