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