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 FBO stencilbuffer tests.
22*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker
24*35238bceSAndroid Build Coastguard Worker #include "es3fFramebufferBlitTests.hpp"
25*35238bceSAndroid Build Coastguard Worker #include "es3fFboTestCase.hpp"
26*35238bceSAndroid Build Coastguard Worker #include "es3fFboTestUtil.hpp"
27*35238bceSAndroid Build Coastguard Worker #include "gluTextureUtil.hpp"
28*35238bceSAndroid Build Coastguard Worker #include "gluContextInfo.hpp"
29*35238bceSAndroid Build Coastguard Worker #include "tcuTextureUtil.hpp"
30*35238bceSAndroid Build Coastguard Worker #include "tcuVectorUtil.hpp"
31*35238bceSAndroid Build Coastguard Worker #include "tcuTestLog.hpp"
32*35238bceSAndroid Build Coastguard Worker #include "tcuImageCompare.hpp"
33*35238bceSAndroid Build Coastguard Worker #include "tcuRenderTarget.hpp"
34*35238bceSAndroid Build Coastguard Worker #include "sglrContextUtil.hpp"
35*35238bceSAndroid Build Coastguard Worker #include "glwEnums.hpp"
36*35238bceSAndroid Build Coastguard Worker #include "deStringUtil.hpp"
37*35238bceSAndroid Build Coastguard Worker
38*35238bceSAndroid Build Coastguard Worker namespace deqp
39*35238bceSAndroid Build Coastguard Worker {
40*35238bceSAndroid Build Coastguard Worker namespace gles3
41*35238bceSAndroid Build Coastguard Worker {
42*35238bceSAndroid Build Coastguard Worker namespace Functional
43*35238bceSAndroid Build Coastguard Worker {
44*35238bceSAndroid Build Coastguard Worker
45*35238bceSAndroid Build Coastguard Worker using std::string;
46*35238bceSAndroid Build Coastguard Worker using tcu::IVec2;
47*35238bceSAndroid Build Coastguard Worker using tcu::IVec3;
48*35238bceSAndroid Build Coastguard Worker using tcu::IVec4;
49*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
50*35238bceSAndroid Build Coastguard Worker using tcu::UVec4;
51*35238bceSAndroid Build Coastguard Worker using tcu::Vec2;
52*35238bceSAndroid Build Coastguard Worker using tcu::Vec3;
53*35238bceSAndroid Build Coastguard Worker using tcu::Vec4;
54*35238bceSAndroid Build Coastguard Worker using namespace FboTestUtil;
55*35238bceSAndroid Build Coastguard Worker
56*35238bceSAndroid Build Coastguard Worker class BlitRectCase : public FboTestCase
57*35238bceSAndroid Build Coastguard Worker {
58*35238bceSAndroid Build Coastguard Worker public:
BlitRectCase(Context & context,const char * name,const char * desc,uint32_t filter,const IVec2 & srcSize,const IVec4 & srcRect,const IVec2 & dstSize,const IVec4 & dstRect,int cellSize=8)59*35238bceSAndroid Build Coastguard Worker BlitRectCase(Context &context, const char *name, const char *desc, uint32_t filter, const IVec2 &srcSize,
60*35238bceSAndroid Build Coastguard Worker const IVec4 &srcRect, const IVec2 &dstSize, const IVec4 &dstRect, int cellSize = 8)
61*35238bceSAndroid Build Coastguard Worker : FboTestCase(context, name, desc)
62*35238bceSAndroid Build Coastguard Worker , m_filter(filter)
63*35238bceSAndroid Build Coastguard Worker , m_srcSize(srcSize)
64*35238bceSAndroid Build Coastguard Worker , m_srcRect(srcRect)
65*35238bceSAndroid Build Coastguard Worker , m_dstSize(dstSize)
66*35238bceSAndroid Build Coastguard Worker , m_dstRect(dstRect)
67*35238bceSAndroid Build Coastguard Worker , m_cellSize(cellSize)
68*35238bceSAndroid Build Coastguard Worker , m_gridCellColorA(0.2f, 0.7f, 0.1f, 1.0f)
69*35238bceSAndroid Build Coastguard Worker , m_gridCellColorB(0.7f, 0.1f, 0.5f, 0.8f)
70*35238bceSAndroid Build Coastguard Worker {
71*35238bceSAndroid Build Coastguard Worker }
72*35238bceSAndroid Build Coastguard Worker
render(tcu::Surface & dst)73*35238bceSAndroid Build Coastguard Worker void render(tcu::Surface &dst)
74*35238bceSAndroid Build Coastguard Worker {
75*35238bceSAndroid Build Coastguard Worker const uint32_t colorFormat = GL_RGBA8;
76*35238bceSAndroid Build Coastguard Worker
77*35238bceSAndroid Build Coastguard Worker GradientShader gradShader(glu::TYPE_FLOAT_VEC4);
78*35238bceSAndroid Build Coastguard Worker Texture2DShader texShader(DataTypes() << glu::TYPE_SAMPLER_2D, glu::TYPE_FLOAT_VEC4);
79*35238bceSAndroid Build Coastguard Worker uint32_t gradShaderID = getCurrentContext()->createProgram(&gradShader);
80*35238bceSAndroid Build Coastguard Worker uint32_t texShaderID = getCurrentContext()->createProgram(&texShader);
81*35238bceSAndroid Build Coastguard Worker
82*35238bceSAndroid Build Coastguard Worker uint32_t srcFbo = 0;
83*35238bceSAndroid Build Coastguard Worker uint32_t dstFbo = 0;
84*35238bceSAndroid Build Coastguard Worker uint32_t srcRbo = 0;
85*35238bceSAndroid Build Coastguard Worker uint32_t dstRbo = 0;
86*35238bceSAndroid Build Coastguard Worker
87*35238bceSAndroid Build Coastguard Worker // Setup shaders
88*35238bceSAndroid Build Coastguard Worker gradShader.setGradient(*getCurrentContext(), gradShaderID, Vec4(0.0f), Vec4(1.0f));
89*35238bceSAndroid Build Coastguard Worker texShader.setUniforms(*getCurrentContext(), texShaderID);
90*35238bceSAndroid Build Coastguard Worker
91*35238bceSAndroid Build Coastguard Worker // Create framebuffers.
92*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < 2; ndx++)
93*35238bceSAndroid Build Coastguard Worker {
94*35238bceSAndroid Build Coastguard Worker uint32_t &fbo = ndx ? dstFbo : srcFbo;
95*35238bceSAndroid Build Coastguard Worker uint32_t &rbo = ndx ? dstRbo : srcRbo;
96*35238bceSAndroid Build Coastguard Worker const IVec2 &size = ndx ? m_dstSize : m_srcSize;
97*35238bceSAndroid Build Coastguard Worker
98*35238bceSAndroid Build Coastguard Worker glGenFramebuffers(1, &fbo);
99*35238bceSAndroid Build Coastguard Worker glGenRenderbuffers(1, &rbo);
100*35238bceSAndroid Build Coastguard Worker
101*35238bceSAndroid Build Coastguard Worker glBindRenderbuffer(GL_RENDERBUFFER, rbo);
102*35238bceSAndroid Build Coastguard Worker glRenderbufferStorage(GL_RENDERBUFFER, colorFormat, size.x(), size.y());
103*35238bceSAndroid Build Coastguard Worker
104*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_FRAMEBUFFER, fbo);
105*35238bceSAndroid Build Coastguard Worker glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo);
106*35238bceSAndroid Build Coastguard Worker checkError();
107*35238bceSAndroid Build Coastguard Worker checkFramebufferStatus(GL_FRAMEBUFFER);
108*35238bceSAndroid Build Coastguard Worker }
109*35238bceSAndroid Build Coastguard Worker
110*35238bceSAndroid Build Coastguard Worker // Fill destination with gradient.
111*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_FRAMEBUFFER, dstFbo);
112*35238bceSAndroid Build Coastguard Worker glViewport(0, 0, m_dstSize.x(), m_dstSize.y());
113*35238bceSAndroid Build Coastguard Worker
114*35238bceSAndroid Build Coastguard Worker sglr::drawQuad(*getCurrentContext(), gradShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
115*35238bceSAndroid Build Coastguard Worker
116*35238bceSAndroid Build Coastguard Worker // Fill source with grid pattern.
117*35238bceSAndroid Build Coastguard Worker {
118*35238bceSAndroid Build Coastguard Worker const uint32_t format = GL_RGBA;
119*35238bceSAndroid Build Coastguard Worker const uint32_t dataType = GL_UNSIGNED_BYTE;
120*35238bceSAndroid Build Coastguard Worker const int texW = m_srcSize.x();
121*35238bceSAndroid Build Coastguard Worker const int texH = m_srcSize.y();
122*35238bceSAndroid Build Coastguard Worker uint32_t gridTex = 0;
123*35238bceSAndroid Build Coastguard Worker tcu::TextureLevel data(glu::mapGLTransferFormat(format, dataType), texW, texH, 1);
124*35238bceSAndroid Build Coastguard Worker
125*35238bceSAndroid Build Coastguard Worker tcu::fillWithGrid(data.getAccess(), m_cellSize, m_gridCellColorA, m_gridCellColorB);
126*35238bceSAndroid Build Coastguard Worker
127*35238bceSAndroid Build Coastguard Worker glGenTextures(1, &gridTex);
128*35238bceSAndroid Build Coastguard Worker glBindTexture(GL_TEXTURE_2D, gridTex);
129*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
130*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
131*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
132*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
133*35238bceSAndroid Build Coastguard Worker glTexImage2D(GL_TEXTURE_2D, 0, format, texW, texH, 0, format, dataType, data.getAccess().getDataPtr());
134*35238bceSAndroid Build Coastguard Worker
135*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_FRAMEBUFFER, srcFbo);
136*35238bceSAndroid Build Coastguard Worker glViewport(0, 0, m_srcSize.x(), m_srcSize.y());
137*35238bceSAndroid Build Coastguard Worker sglr::drawQuad(*getCurrentContext(), texShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
138*35238bceSAndroid Build Coastguard Worker }
139*35238bceSAndroid Build Coastguard Worker
140*35238bceSAndroid Build Coastguard Worker // Perform copy.
141*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_READ_FRAMEBUFFER, srcFbo);
142*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_DRAW_FRAMEBUFFER, dstFbo);
143*35238bceSAndroid Build Coastguard Worker glBlitFramebuffer(m_srcRect.x(), m_srcRect.y(), m_srcRect.z(), m_srcRect.w(), m_dstRect.x(), m_dstRect.y(),
144*35238bceSAndroid Build Coastguard Worker m_dstRect.z(), m_dstRect.w(), GL_COLOR_BUFFER_BIT, m_filter);
145*35238bceSAndroid Build Coastguard Worker
146*35238bceSAndroid Build Coastguard Worker // Read back results.
147*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_READ_FRAMEBUFFER, dstFbo);
148*35238bceSAndroid Build Coastguard Worker readPixels(dst, 0, 0, m_dstSize.x(), m_dstSize.y(), glu::mapGLInternalFormat(colorFormat), Vec4(1.0f),
149*35238bceSAndroid Build Coastguard Worker Vec4(0.0f));
150*35238bceSAndroid Build Coastguard Worker }
151*35238bceSAndroid Build Coastguard Worker
compare(const tcu::Surface & reference,const tcu::Surface & result)152*35238bceSAndroid Build Coastguard Worker virtual bool compare(const tcu::Surface &reference, const tcu::Surface &result)
153*35238bceSAndroid Build Coastguard Worker {
154*35238bceSAndroid Build Coastguard Worker // Use pixel-threshold compare for rect cases since 1px off will mean failure.
155*35238bceSAndroid Build Coastguard Worker tcu::RGBA threshold =
156*35238bceSAndroid Build Coastguard Worker TestCase::m_context.getRenderTarget().getPixelFormat().getColorThreshold() + tcu::RGBA(7, 7, 7, 7);
157*35238bceSAndroid Build Coastguard Worker return tcu::pixelThresholdCompare(m_testCtx.getLog(), "Result", "Image comparison result", reference, result,
158*35238bceSAndroid Build Coastguard Worker threshold, tcu::COMPARE_LOG_RESULT);
159*35238bceSAndroid Build Coastguard Worker }
160*35238bceSAndroid Build Coastguard Worker
161*35238bceSAndroid Build Coastguard Worker protected:
162*35238bceSAndroid Build Coastguard Worker const uint32_t m_filter;
163*35238bceSAndroid Build Coastguard Worker const IVec2 m_srcSize;
164*35238bceSAndroid Build Coastguard Worker const IVec4 m_srcRect;
165*35238bceSAndroid Build Coastguard Worker const IVec2 m_dstSize;
166*35238bceSAndroid Build Coastguard Worker const IVec4 m_dstRect;
167*35238bceSAndroid Build Coastguard Worker const int m_cellSize;
168*35238bceSAndroid Build Coastguard Worker const Vec4 m_gridCellColorA;
169*35238bceSAndroid Build Coastguard Worker const Vec4 m_gridCellColorB;
170*35238bceSAndroid Build Coastguard Worker };
171*35238bceSAndroid Build Coastguard Worker
172*35238bceSAndroid Build Coastguard Worker class BlitNearestFilterConsistencyCase : public BlitRectCase
173*35238bceSAndroid Build Coastguard Worker {
174*35238bceSAndroid Build Coastguard Worker public:
175*35238bceSAndroid Build Coastguard Worker BlitNearestFilterConsistencyCase(Context &context, const char *name, const char *desc, const IVec2 &srcSize,
176*35238bceSAndroid Build Coastguard Worker const IVec4 &srcRect, const IVec2 &dstSize, const IVec4 &dstRect);
177*35238bceSAndroid Build Coastguard Worker
178*35238bceSAndroid Build Coastguard Worker bool compare(const tcu::Surface &reference, const tcu::Surface &result);
179*35238bceSAndroid Build Coastguard Worker };
180*35238bceSAndroid Build Coastguard Worker
BlitNearestFilterConsistencyCase(Context & context,const char * name,const char * desc,const IVec2 & srcSize,const IVec4 & srcRect,const IVec2 & dstSize,const IVec4 & dstRect)181*35238bceSAndroid Build Coastguard Worker BlitNearestFilterConsistencyCase::BlitNearestFilterConsistencyCase(Context &context, const char *name, const char *desc,
182*35238bceSAndroid Build Coastguard Worker const IVec2 &srcSize, const IVec4 &srcRect,
183*35238bceSAndroid Build Coastguard Worker const IVec2 &dstSize, const IVec4 &dstRect)
184*35238bceSAndroid Build Coastguard Worker : BlitRectCase(context, name, desc, GL_NEAREST, srcSize, srcRect, dstSize, dstRect, 1)
185*35238bceSAndroid Build Coastguard Worker {
186*35238bceSAndroid Build Coastguard Worker }
187*35238bceSAndroid Build Coastguard Worker
compare(const tcu::Surface & reference,const tcu::Surface & result)188*35238bceSAndroid Build Coastguard Worker bool BlitNearestFilterConsistencyCase::compare(const tcu::Surface &reference, const tcu::Surface &result)
189*35238bceSAndroid Build Coastguard Worker {
190*35238bceSAndroid Build Coastguard Worker DE_ASSERT(reference.getWidth() == result.getWidth());
191*35238bceSAndroid Build Coastguard Worker DE_ASSERT(reference.getHeight() == result.getHeight());
192*35238bceSAndroid Build Coastguard Worker DE_UNREF(reference);
193*35238bceSAndroid Build Coastguard Worker
194*35238bceSAndroid Build Coastguard Worker // Image origin must be visible (for baseColor)
195*35238bceSAndroid Build Coastguard Worker DE_ASSERT(de::min(m_dstRect.x(), m_dstRect.z()) >= 0);
196*35238bceSAndroid Build Coastguard Worker DE_ASSERT(de::min(m_dstRect.y(), m_dstRect.w()) >= 0);
197*35238bceSAndroid Build Coastguard Worker
198*35238bceSAndroid Build Coastguard Worker const tcu::RGBA cellColorA(m_gridCellColorA);
199*35238bceSAndroid Build Coastguard Worker const tcu::RGBA cellColorB(m_gridCellColorB);
200*35238bceSAndroid Build Coastguard Worker const tcu::RGBA threshold =
201*35238bceSAndroid Build Coastguard Worker TestCase::m_context.getRenderTarget().getPixelFormat().getColorThreshold() + tcu::RGBA(7, 7, 7, 7);
202*35238bceSAndroid Build Coastguard Worker const tcu::IVec4 destinationArea =
203*35238bceSAndroid Build Coastguard Worker tcu::IVec4(de::clamp(de::min(m_dstRect.x(), m_dstRect.z()), 0, result.getWidth()),
204*35238bceSAndroid Build Coastguard Worker de::clamp(de::min(m_dstRect.y(), m_dstRect.w()), 0, result.getHeight()),
205*35238bceSAndroid Build Coastguard Worker de::clamp(de::max(m_dstRect.x(), m_dstRect.z()), 0, result.getWidth()),
206*35238bceSAndroid Build Coastguard Worker de::clamp(de::max(m_dstRect.y(), m_dstRect.w()), 0, result.getHeight()));
207*35238bceSAndroid Build Coastguard Worker const tcu::RGBA baseColor = result.getPixel(destinationArea.x(), destinationArea.y());
208*35238bceSAndroid Build Coastguard Worker const bool signConfig = tcu::compareThreshold(baseColor, cellColorA, threshold);
209*35238bceSAndroid Build Coastguard Worker
210*35238bceSAndroid Build Coastguard Worker bool error = false;
211*35238bceSAndroid Build Coastguard Worker tcu::Surface errorMask(result.getWidth(), result.getHeight());
212*35238bceSAndroid Build Coastguard Worker std::vector<bool> horisontalSign(destinationArea.z() - destinationArea.x());
213*35238bceSAndroid Build Coastguard Worker std::vector<bool> verticalSign(destinationArea.w() - destinationArea.y());
214*35238bceSAndroid Build Coastguard Worker
215*35238bceSAndroid Build Coastguard Worker tcu::clear(errorMask.getAccess(), tcu::Vec4(0.0f, 1.0f, 0.0f, 1.0f));
216*35238bceSAndroid Build Coastguard Worker
217*35238bceSAndroid Build Coastguard Worker // Checking only area in our destination rect
218*35238bceSAndroid Build Coastguard Worker
219*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog()
220*35238bceSAndroid Build Coastguard Worker << tcu::TestLog::Message << "Verifying consistency of NEAREST filtering. Verifying rect " << m_dstRect << ".\n"
221*35238bceSAndroid Build Coastguard Worker << "Rounding direction of the NEAREST filter at the horisontal texel edge (x = n + 0.5) should not depend on "
222*35238bceSAndroid Build Coastguard Worker "the y-coordinate.\n"
223*35238bceSAndroid Build Coastguard Worker << "Rounding direction of the NEAREST filter at the vertical texel edge (y = n + 0.5) should not depend on the "
224*35238bceSAndroid Build Coastguard Worker "x-coordinate.\n"
225*35238bceSAndroid Build Coastguard Worker << "Blitting a grid (with uniform sized cells) should result in a grid (with non-uniform sized cells)."
226*35238bceSAndroid Build Coastguard Worker << tcu::TestLog::EndMessage;
227*35238bceSAndroid Build Coastguard Worker
228*35238bceSAndroid Build Coastguard Worker // Verify that destination only contains valid colors
229*35238bceSAndroid Build Coastguard Worker
230*35238bceSAndroid Build Coastguard Worker for (int dy = 0; dy < destinationArea.w() - destinationArea.y(); ++dy)
231*35238bceSAndroid Build Coastguard Worker for (int dx = 0; dx < destinationArea.z() - destinationArea.x(); ++dx)
232*35238bceSAndroid Build Coastguard Worker {
233*35238bceSAndroid Build Coastguard Worker const tcu::RGBA color = result.getPixel(destinationArea.x() + dx, destinationArea.y() + dy);
234*35238bceSAndroid Build Coastguard Worker const bool isValidColor = tcu::compareThreshold(color, cellColorA, threshold) ||
235*35238bceSAndroid Build Coastguard Worker tcu::compareThreshold(color, cellColorB, threshold);
236*35238bceSAndroid Build Coastguard Worker
237*35238bceSAndroid Build Coastguard Worker if (!isValidColor)
238*35238bceSAndroid Build Coastguard Worker {
239*35238bceSAndroid Build Coastguard Worker errorMask.setPixel(destinationArea.x() + dx, destinationArea.y() + dy, tcu::RGBA::red());
240*35238bceSAndroid Build Coastguard Worker error = true;
241*35238bceSAndroid Build Coastguard Worker }
242*35238bceSAndroid Build Coastguard Worker }
243*35238bceSAndroid Build Coastguard Worker if (error)
244*35238bceSAndroid Build Coastguard Worker {
245*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << tcu::TestLog::Message
246*35238bceSAndroid Build Coastguard Worker << "Image verification failed, destination rect contains unexpected values. "
247*35238bceSAndroid Build Coastguard Worker << "Expected either " << cellColorA << " or " << cellColorB << "."
248*35238bceSAndroid Build Coastguard Worker << tcu::TestLog::EndMessage << tcu::TestLog::ImageSet("Result", "Image verification result")
249*35238bceSAndroid Build Coastguard Worker << tcu::TestLog::Image("Result", "Result", result)
250*35238bceSAndroid Build Coastguard Worker << tcu::TestLog::Image("ErrorMask", "Error mask", errorMask) << tcu::TestLog::EndImageSet;
251*35238bceSAndroid Build Coastguard Worker return false;
252*35238bceSAndroid Build Coastguard Worker }
253*35238bceSAndroid Build Coastguard Worker
254*35238bceSAndroid Build Coastguard Worker // Detect result edges by reading the first row and first column of the blitted area.
255*35238bceSAndroid Build Coastguard Worker // Blitting a grid should result in a grid-like image. ("sign changes" should be consistent)
256*35238bceSAndroid Build Coastguard Worker
257*35238bceSAndroid Build Coastguard Worker for (int dx = 0; dx < destinationArea.z() - destinationArea.x(); ++dx)
258*35238bceSAndroid Build Coastguard Worker {
259*35238bceSAndroid Build Coastguard Worker const tcu::RGBA color = result.getPixel(destinationArea.x() + dx, destinationArea.y());
260*35238bceSAndroid Build Coastguard Worker
261*35238bceSAndroid Build Coastguard Worker if (tcu::compareThreshold(color, cellColorA, threshold))
262*35238bceSAndroid Build Coastguard Worker horisontalSign[dx] = true;
263*35238bceSAndroid Build Coastguard Worker else if (tcu::compareThreshold(color, cellColorB, threshold))
264*35238bceSAndroid Build Coastguard Worker horisontalSign[dx] = false;
265*35238bceSAndroid Build Coastguard Worker else
266*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
267*35238bceSAndroid Build Coastguard Worker }
268*35238bceSAndroid Build Coastguard Worker for (int dy = 0; dy < destinationArea.w() - destinationArea.y(); ++dy)
269*35238bceSAndroid Build Coastguard Worker {
270*35238bceSAndroid Build Coastguard Worker const tcu::RGBA color = result.getPixel(destinationArea.x(), destinationArea.y() + dy);
271*35238bceSAndroid Build Coastguard Worker
272*35238bceSAndroid Build Coastguard Worker if (tcu::compareThreshold(color, cellColorA, threshold))
273*35238bceSAndroid Build Coastguard Worker verticalSign[dy] = true;
274*35238bceSAndroid Build Coastguard Worker else if (tcu::compareThreshold(color, cellColorB, threshold))
275*35238bceSAndroid Build Coastguard Worker verticalSign[dy] = false;
276*35238bceSAndroid Build Coastguard Worker else
277*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
278*35238bceSAndroid Build Coastguard Worker }
279*35238bceSAndroid Build Coastguard Worker
280*35238bceSAndroid Build Coastguard Worker // Verify grid-like image
281*35238bceSAndroid Build Coastguard Worker
282*35238bceSAndroid Build Coastguard Worker for (int dy = 0; dy < destinationArea.w() - destinationArea.y(); ++dy)
283*35238bceSAndroid Build Coastguard Worker for (int dx = 0; dx < destinationArea.z() - destinationArea.x(); ++dx)
284*35238bceSAndroid Build Coastguard Worker {
285*35238bceSAndroid Build Coastguard Worker const tcu::RGBA color = result.getPixel(destinationArea.x() + dx, destinationArea.y() + dy);
286*35238bceSAndroid Build Coastguard Worker const bool resultSign = tcu::compareThreshold(cellColorA, color, threshold);
287*35238bceSAndroid Build Coastguard Worker const bool correctSign = (horisontalSign[dx] == verticalSign[dy]) == signConfig;
288*35238bceSAndroid Build Coastguard Worker
289*35238bceSAndroid Build Coastguard Worker if (resultSign != correctSign)
290*35238bceSAndroid Build Coastguard Worker {
291*35238bceSAndroid Build Coastguard Worker errorMask.setPixel(destinationArea.x() + dx, destinationArea.y() + dy, tcu::RGBA::red());
292*35238bceSAndroid Build Coastguard Worker error = true;
293*35238bceSAndroid Build Coastguard Worker }
294*35238bceSAndroid Build Coastguard Worker }
295*35238bceSAndroid Build Coastguard Worker
296*35238bceSAndroid Build Coastguard Worker // Report result
297*35238bceSAndroid Build Coastguard Worker
298*35238bceSAndroid Build Coastguard Worker if (error)
299*35238bceSAndroid Build Coastguard Worker {
300*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << tcu::TestLog::Message << "Image verification failed, nearest filter is not consistent."
301*35238bceSAndroid Build Coastguard Worker << tcu::TestLog::EndMessage << tcu::TestLog::ImageSet("Result", "Image verification result")
302*35238bceSAndroid Build Coastguard Worker << tcu::TestLog::Image("Result", "Result", result)
303*35238bceSAndroid Build Coastguard Worker << tcu::TestLog::Image("ErrorMask", "Error mask", errorMask) << tcu::TestLog::EndImageSet;
304*35238bceSAndroid Build Coastguard Worker }
305*35238bceSAndroid Build Coastguard Worker else
306*35238bceSAndroid Build Coastguard Worker {
307*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << tcu::TestLog::Message << "Image verification passed." << tcu::TestLog::EndMessage
308*35238bceSAndroid Build Coastguard Worker << tcu::TestLog::ImageSet("Result", "Image verification result")
309*35238bceSAndroid Build Coastguard Worker << tcu::TestLog::Image("Result", "Result", result) << tcu::TestLog::EndImageSet;
310*35238bceSAndroid Build Coastguard Worker }
311*35238bceSAndroid Build Coastguard Worker
312*35238bceSAndroid Build Coastguard Worker return !error;
313*35238bceSAndroid Build Coastguard Worker }
314*35238bceSAndroid Build Coastguard Worker
getChannelMask(tcu::TextureFormat::ChannelOrder order)315*35238bceSAndroid Build Coastguard Worker static tcu::BVec4 getChannelMask(tcu::TextureFormat::ChannelOrder order)
316*35238bceSAndroid Build Coastguard Worker {
317*35238bceSAndroid Build Coastguard Worker switch (order)
318*35238bceSAndroid Build Coastguard Worker {
319*35238bceSAndroid Build Coastguard Worker case tcu::TextureFormat::R:
320*35238bceSAndroid Build Coastguard Worker return tcu::BVec4(true, false, false, false);
321*35238bceSAndroid Build Coastguard Worker case tcu::TextureFormat::RG:
322*35238bceSAndroid Build Coastguard Worker return tcu::BVec4(true, true, false, false);
323*35238bceSAndroid Build Coastguard Worker case tcu::TextureFormat::RGB:
324*35238bceSAndroid Build Coastguard Worker return tcu::BVec4(true, true, true, false);
325*35238bceSAndroid Build Coastguard Worker case tcu::TextureFormat::RGBA:
326*35238bceSAndroid Build Coastguard Worker return tcu::BVec4(true, true, true, true);
327*35238bceSAndroid Build Coastguard Worker case tcu::TextureFormat::sRGB:
328*35238bceSAndroid Build Coastguard Worker return tcu::BVec4(true, true, true, false);
329*35238bceSAndroid Build Coastguard Worker case tcu::TextureFormat::sRGBA:
330*35238bceSAndroid Build Coastguard Worker return tcu::BVec4(true, true, true, true);
331*35238bceSAndroid Build Coastguard Worker default:
332*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
333*35238bceSAndroid Build Coastguard Worker return tcu::BVec4(false);
334*35238bceSAndroid Build Coastguard Worker }
335*35238bceSAndroid Build Coastguard Worker }
336*35238bceSAndroid Build Coastguard Worker
337*35238bceSAndroid Build Coastguard Worker class BlitColorConversionCase : public FboTestCase
338*35238bceSAndroid Build Coastguard Worker {
339*35238bceSAndroid Build Coastguard Worker public:
BlitColorConversionCase(Context & context,const char * name,const char * desc,uint32_t srcFormat,uint32_t dstFormat,const IVec2 & size)340*35238bceSAndroid Build Coastguard Worker BlitColorConversionCase(Context &context, const char *name, const char *desc, uint32_t srcFormat,
341*35238bceSAndroid Build Coastguard Worker uint32_t dstFormat, const IVec2 &size)
342*35238bceSAndroid Build Coastguard Worker : FboTestCase(context, name, desc)
343*35238bceSAndroid Build Coastguard Worker , m_srcFormat(srcFormat)
344*35238bceSAndroid Build Coastguard Worker , m_dstFormat(dstFormat)
345*35238bceSAndroid Build Coastguard Worker , m_size(size)
346*35238bceSAndroid Build Coastguard Worker {
347*35238bceSAndroid Build Coastguard Worker }
348*35238bceSAndroid Build Coastguard Worker
349*35238bceSAndroid Build Coastguard Worker protected:
preCheck(void)350*35238bceSAndroid Build Coastguard Worker void preCheck(void)
351*35238bceSAndroid Build Coastguard Worker {
352*35238bceSAndroid Build Coastguard Worker checkFormatSupport(m_srcFormat);
353*35238bceSAndroid Build Coastguard Worker checkFormatSupport(m_dstFormat);
354*35238bceSAndroid Build Coastguard Worker }
355*35238bceSAndroid Build Coastguard Worker
render(tcu::Surface & dst)356*35238bceSAndroid Build Coastguard Worker void render(tcu::Surface &dst)
357*35238bceSAndroid Build Coastguard Worker {
358*35238bceSAndroid Build Coastguard Worker tcu::TextureFormat srcFormat = glu::mapGLInternalFormat(m_srcFormat);
359*35238bceSAndroid Build Coastguard Worker tcu::TextureFormat dstFormat = glu::mapGLInternalFormat(m_dstFormat);
360*35238bceSAndroid Build Coastguard Worker glu::DataType srcOutputType = getFragmentOutputType(srcFormat);
361*35238bceSAndroid Build Coastguard Worker glu::DataType dstOutputType = getFragmentOutputType(dstFormat);
362*35238bceSAndroid Build Coastguard Worker
363*35238bceSAndroid Build Coastguard Worker // Compute ranges \note Doesn't handle case where src or dest is not subset of the another!
364*35238bceSAndroid Build Coastguard Worker tcu::TextureFormatInfo srcFmtRangeInfo = tcu::getTextureFormatInfo(srcFormat);
365*35238bceSAndroid Build Coastguard Worker tcu::TextureFormatInfo dstFmtRangeInfo = tcu::getTextureFormatInfo(dstFormat);
366*35238bceSAndroid Build Coastguard Worker tcu::BVec4 copyMask = tcu::logicalAnd(getChannelMask(srcFormat.order), getChannelMask(dstFormat.order));
367*35238bceSAndroid Build Coastguard Worker tcu::BVec4 srcIsGreater = tcu::greaterThan(srcFmtRangeInfo.valueMax - srcFmtRangeInfo.valueMin,
368*35238bceSAndroid Build Coastguard Worker dstFmtRangeInfo.valueMax - dstFmtRangeInfo.valueMin);
369*35238bceSAndroid Build Coastguard Worker tcu::TextureFormatInfo srcRangeInfo(
370*35238bceSAndroid Build Coastguard Worker tcu::select(dstFmtRangeInfo.valueMin, srcFmtRangeInfo.valueMin, tcu::logicalAnd(copyMask, srcIsGreater)),
371*35238bceSAndroid Build Coastguard Worker tcu::select(dstFmtRangeInfo.valueMax, srcFmtRangeInfo.valueMax, tcu::logicalAnd(copyMask, srcIsGreater)),
372*35238bceSAndroid Build Coastguard Worker tcu::select(dstFmtRangeInfo.lookupScale, srcFmtRangeInfo.lookupScale,
373*35238bceSAndroid Build Coastguard Worker tcu::logicalAnd(copyMask, srcIsGreater)),
374*35238bceSAndroid Build Coastguard Worker tcu::select(dstFmtRangeInfo.lookupBias, srcFmtRangeInfo.lookupBias,
375*35238bceSAndroid Build Coastguard Worker tcu::logicalAnd(copyMask, srcIsGreater)));
376*35238bceSAndroid Build Coastguard Worker tcu::TextureFormatInfo dstRangeInfo(tcu::select(dstFmtRangeInfo.valueMin, srcFmtRangeInfo.valueMin,
377*35238bceSAndroid Build Coastguard Worker tcu::logicalOr(tcu::logicalNot(copyMask), srcIsGreater)),
378*35238bceSAndroid Build Coastguard Worker tcu::select(dstFmtRangeInfo.valueMax, srcFmtRangeInfo.valueMax,
379*35238bceSAndroid Build Coastguard Worker tcu::logicalOr(tcu::logicalNot(copyMask), srcIsGreater)),
380*35238bceSAndroid Build Coastguard Worker tcu::select(dstFmtRangeInfo.lookupScale, srcFmtRangeInfo.lookupScale,
381*35238bceSAndroid Build Coastguard Worker tcu::logicalOr(tcu::logicalNot(copyMask), srcIsGreater)),
382*35238bceSAndroid Build Coastguard Worker tcu::select(dstFmtRangeInfo.lookupBias, srcFmtRangeInfo.lookupBias,
383*35238bceSAndroid Build Coastguard Worker tcu::logicalOr(tcu::logicalNot(copyMask), srcIsGreater)));
384*35238bceSAndroid Build Coastguard Worker
385*35238bceSAndroid Build Coastguard Worker // Shaders.
386*35238bceSAndroid Build Coastguard Worker GradientShader gradientToSrcShader(srcOutputType);
387*35238bceSAndroid Build Coastguard Worker GradientShader gradientToDstShader(dstOutputType);
388*35238bceSAndroid Build Coastguard Worker
389*35238bceSAndroid Build Coastguard Worker uint32_t gradShaderSrcID = getCurrentContext()->createProgram(&gradientToSrcShader);
390*35238bceSAndroid Build Coastguard Worker uint32_t gradShaderDstID = getCurrentContext()->createProgram(&gradientToDstShader);
391*35238bceSAndroid Build Coastguard Worker
392*35238bceSAndroid Build Coastguard Worker uint32_t srcFbo, dstFbo;
393*35238bceSAndroid Build Coastguard Worker uint32_t srcRbo, dstRbo;
394*35238bceSAndroid Build Coastguard Worker
395*35238bceSAndroid Build Coastguard Worker // Create framebuffers.
396*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < 2; ndx++)
397*35238bceSAndroid Build Coastguard Worker {
398*35238bceSAndroid Build Coastguard Worker uint32_t &fbo = ndx ? dstFbo : srcFbo;
399*35238bceSAndroid Build Coastguard Worker uint32_t &rbo = ndx ? dstRbo : srcRbo;
400*35238bceSAndroid Build Coastguard Worker uint32_t format = ndx ? m_dstFormat : m_srcFormat;
401*35238bceSAndroid Build Coastguard Worker
402*35238bceSAndroid Build Coastguard Worker glGenFramebuffers(1, &fbo);
403*35238bceSAndroid Build Coastguard Worker glGenRenderbuffers(1, &rbo);
404*35238bceSAndroid Build Coastguard Worker
405*35238bceSAndroid Build Coastguard Worker glBindRenderbuffer(GL_RENDERBUFFER, rbo);
406*35238bceSAndroid Build Coastguard Worker glRenderbufferStorage(GL_RENDERBUFFER, format, m_size.x(), m_size.y());
407*35238bceSAndroid Build Coastguard Worker
408*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_FRAMEBUFFER, fbo);
409*35238bceSAndroid Build Coastguard Worker glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo);
410*35238bceSAndroid Build Coastguard Worker checkError();
411*35238bceSAndroid Build Coastguard Worker checkFramebufferStatus(GL_FRAMEBUFFER);
412*35238bceSAndroid Build Coastguard Worker }
413*35238bceSAndroid Build Coastguard Worker
414*35238bceSAndroid Build Coastguard Worker glViewport(0, 0, m_size.x(), m_size.y());
415*35238bceSAndroid Build Coastguard Worker
416*35238bceSAndroid Build Coastguard Worker // Render gradients.
417*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < 2; ndx++)
418*35238bceSAndroid Build Coastguard Worker {
419*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_FRAMEBUFFER, ndx ? dstFbo : srcFbo);
420*35238bceSAndroid Build Coastguard Worker
421*35238bceSAndroid Build Coastguard Worker if (ndx)
422*35238bceSAndroid Build Coastguard Worker {
423*35238bceSAndroid Build Coastguard Worker gradientToDstShader.setGradient(*getCurrentContext(), gradShaderDstID, dstRangeInfo.valueMax,
424*35238bceSAndroid Build Coastguard Worker dstRangeInfo.valueMin);
425*35238bceSAndroid Build Coastguard Worker sglr::drawQuad(*getCurrentContext(), gradShaderDstID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
426*35238bceSAndroid Build Coastguard Worker }
427*35238bceSAndroid Build Coastguard Worker else
428*35238bceSAndroid Build Coastguard Worker {
429*35238bceSAndroid Build Coastguard Worker gradientToSrcShader.setGradient(*getCurrentContext(), gradShaderSrcID, srcRangeInfo.valueMin,
430*35238bceSAndroid Build Coastguard Worker dstRangeInfo.valueMax);
431*35238bceSAndroid Build Coastguard Worker sglr::drawQuad(*getCurrentContext(), gradShaderSrcID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
432*35238bceSAndroid Build Coastguard Worker }
433*35238bceSAndroid Build Coastguard Worker }
434*35238bceSAndroid Build Coastguard Worker
435*35238bceSAndroid Build Coastguard Worker // Execute copy.
436*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_READ_FRAMEBUFFER, srcFbo);
437*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_DRAW_FRAMEBUFFER, dstFbo);
438*35238bceSAndroid Build Coastguard Worker glBlitFramebuffer(0, 0, m_size.x(), m_size.y(), 0, 0, m_size.x(), m_size.y(), GL_COLOR_BUFFER_BIT, GL_NEAREST);
439*35238bceSAndroid Build Coastguard Worker checkError();
440*35238bceSAndroid Build Coastguard Worker
441*35238bceSAndroid Build Coastguard Worker // Read results.
442*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_READ_FRAMEBUFFER, dstFbo);
443*35238bceSAndroid Build Coastguard Worker readPixels(dst, 0, 0, m_size.x(), m_size.y(), dstFormat, dstRangeInfo.lookupScale, dstRangeInfo.lookupBias);
444*35238bceSAndroid Build Coastguard Worker }
445*35238bceSAndroid Build Coastguard Worker
compare(const tcu::Surface & reference,const tcu::Surface & result)446*35238bceSAndroid Build Coastguard Worker bool compare(const tcu::Surface &reference, const tcu::Surface &result)
447*35238bceSAndroid Build Coastguard Worker {
448*35238bceSAndroid Build Coastguard Worker const tcu::TextureFormat srcFormat = glu::mapGLInternalFormat(m_srcFormat);
449*35238bceSAndroid Build Coastguard Worker const tcu::TextureFormat dstFormat = glu::mapGLInternalFormat(m_dstFormat);
450*35238bceSAndroid Build Coastguard Worker const bool srcIsSRGB = tcu::isSRGB(srcFormat);
451*35238bceSAndroid Build Coastguard Worker const bool dstIsSRGB = tcu::isSRGB(dstFormat);
452*35238bceSAndroid Build Coastguard Worker
453*35238bceSAndroid Build Coastguard Worker tcu::RGBA threshold;
454*35238bceSAndroid Build Coastguard Worker
455*35238bceSAndroid Build Coastguard Worker if (dstIsSRGB)
456*35238bceSAndroid Build Coastguard Worker {
457*35238bceSAndroid Build Coastguard Worker threshold = getToSRGBConversionThreshold(srcFormat, dstFormat);
458*35238bceSAndroid Build Coastguard Worker }
459*35238bceSAndroid Build Coastguard Worker else
460*35238bceSAndroid Build Coastguard Worker {
461*35238bceSAndroid Build Coastguard Worker const tcu::RGBA srcMaxDiff = getFormatThreshold(srcFormat) * (srcIsSRGB ? 2 : 1);
462*35238bceSAndroid Build Coastguard Worker const tcu::RGBA dstMaxDiff = getFormatThreshold(dstFormat);
463*35238bceSAndroid Build Coastguard Worker
464*35238bceSAndroid Build Coastguard Worker threshold = tcu::max(srcMaxDiff, dstMaxDiff);
465*35238bceSAndroid Build Coastguard Worker }
466*35238bceSAndroid Build Coastguard Worker
467*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << tcu::TestLog::Message << "threshold = " << threshold << tcu::TestLog::EndMessage;
468*35238bceSAndroid Build Coastguard Worker return tcu::pixelThresholdCompare(m_testCtx.getLog(), "Result", "Image comparison result", reference, result,
469*35238bceSAndroid Build Coastguard Worker threshold, tcu::COMPARE_LOG_RESULT);
470*35238bceSAndroid Build Coastguard Worker }
471*35238bceSAndroid Build Coastguard Worker
472*35238bceSAndroid Build Coastguard Worker private:
473*35238bceSAndroid Build Coastguard Worker uint32_t m_srcFormat;
474*35238bceSAndroid Build Coastguard Worker uint32_t m_dstFormat;
475*35238bceSAndroid Build Coastguard Worker IVec2 m_size;
476*35238bceSAndroid Build Coastguard Worker };
477*35238bceSAndroid Build Coastguard Worker
478*35238bceSAndroid Build Coastguard Worker class BlitDepthStencilCase : public FboTestCase
479*35238bceSAndroid Build Coastguard Worker {
480*35238bceSAndroid Build Coastguard Worker public:
BlitDepthStencilCase(Context & context,const char * name,const char * desc,uint32_t depthFormat,uint32_t stencilFormat,uint32_t srcBuffers,const IVec2 & srcSize,const IVec4 & srcRect,uint32_t dstBuffers,const IVec2 & dstSize,const IVec4 & dstRect,uint32_t copyBuffers)481*35238bceSAndroid Build Coastguard Worker BlitDepthStencilCase(Context &context, const char *name, const char *desc, uint32_t depthFormat,
482*35238bceSAndroid Build Coastguard Worker uint32_t stencilFormat, uint32_t srcBuffers, const IVec2 &srcSize, const IVec4 &srcRect,
483*35238bceSAndroid Build Coastguard Worker uint32_t dstBuffers, const IVec2 &dstSize, const IVec4 &dstRect, uint32_t copyBuffers)
484*35238bceSAndroid Build Coastguard Worker : FboTestCase(context, name, desc)
485*35238bceSAndroid Build Coastguard Worker , m_depthFormat(depthFormat)
486*35238bceSAndroid Build Coastguard Worker , m_stencilFormat(stencilFormat)
487*35238bceSAndroid Build Coastguard Worker , m_srcBuffers(srcBuffers)
488*35238bceSAndroid Build Coastguard Worker , m_srcSize(srcSize)
489*35238bceSAndroid Build Coastguard Worker , m_srcRect(srcRect)
490*35238bceSAndroid Build Coastguard Worker , m_dstBuffers(dstBuffers)
491*35238bceSAndroid Build Coastguard Worker , m_dstSize(dstSize)
492*35238bceSAndroid Build Coastguard Worker , m_dstRect(dstRect)
493*35238bceSAndroid Build Coastguard Worker , m_copyBuffers(copyBuffers)
494*35238bceSAndroid Build Coastguard Worker {
495*35238bceSAndroid Build Coastguard Worker }
496*35238bceSAndroid Build Coastguard Worker
497*35238bceSAndroid Build Coastguard Worker protected:
preCheck(void)498*35238bceSAndroid Build Coastguard Worker void preCheck(void)
499*35238bceSAndroid Build Coastguard Worker {
500*35238bceSAndroid Build Coastguard Worker if (m_depthFormat != GL_NONE)
501*35238bceSAndroid Build Coastguard Worker checkFormatSupport(m_depthFormat);
502*35238bceSAndroid Build Coastguard Worker if (m_stencilFormat != GL_NONE)
503*35238bceSAndroid Build Coastguard Worker checkFormatSupport(m_stencilFormat);
504*35238bceSAndroid Build Coastguard Worker if (!m_context.getContextInfo().isExtensionSupported("GL_EXT_separate_depth_stencil") &&
505*35238bceSAndroid Build Coastguard Worker m_depthFormat != GL_NONE && m_stencilFormat != GL_NONE)
506*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("Separate depth and stencil buffers not supported");
507*35238bceSAndroid Build Coastguard Worker }
508*35238bceSAndroid Build Coastguard Worker
render(tcu::Surface & dst)509*35238bceSAndroid Build Coastguard Worker void render(tcu::Surface &dst)
510*35238bceSAndroid Build Coastguard Worker {
511*35238bceSAndroid Build Coastguard Worker const uint32_t colorFormat = GL_RGBA8;
512*35238bceSAndroid Build Coastguard Worker
513*35238bceSAndroid Build Coastguard Worker GradientShader gradShader(glu::TYPE_FLOAT_VEC4);
514*35238bceSAndroid Build Coastguard Worker Texture2DShader texShader(DataTypes() << glu::TYPE_SAMPLER_2D, glu::TYPE_FLOAT_VEC4);
515*35238bceSAndroid Build Coastguard Worker FlatColorShader flatShader(glu::TYPE_FLOAT_VEC4);
516*35238bceSAndroid Build Coastguard Worker
517*35238bceSAndroid Build Coastguard Worker uint32_t flatShaderID = getCurrentContext()->createProgram(&flatShader);
518*35238bceSAndroid Build Coastguard Worker uint32_t texShaderID = getCurrentContext()->createProgram(&texShader);
519*35238bceSAndroid Build Coastguard Worker uint32_t gradShaderID = getCurrentContext()->createProgram(&gradShader);
520*35238bceSAndroid Build Coastguard Worker
521*35238bceSAndroid Build Coastguard Worker uint32_t srcFbo = 0;
522*35238bceSAndroid Build Coastguard Worker uint32_t dstFbo = 0;
523*35238bceSAndroid Build Coastguard Worker uint32_t srcColorRbo = 0;
524*35238bceSAndroid Build Coastguard Worker uint32_t dstColorRbo = 0;
525*35238bceSAndroid Build Coastguard Worker uint32_t srcDepthRbo = 0;
526*35238bceSAndroid Build Coastguard Worker uint32_t srcStencilRbo = 0;
527*35238bceSAndroid Build Coastguard Worker uint32_t dstDepthRbo = 0;
528*35238bceSAndroid Build Coastguard Worker uint32_t dstStencilRbo = 0;
529*35238bceSAndroid Build Coastguard Worker
530*35238bceSAndroid Build Coastguard Worker // setup shaders
531*35238bceSAndroid Build Coastguard Worker gradShader.setGradient(*getCurrentContext(), gradShaderID, Vec4(0.0f), Vec4(1.0f));
532*35238bceSAndroid Build Coastguard Worker texShader.setUniforms(*getCurrentContext(), texShaderID);
533*35238bceSAndroid Build Coastguard Worker
534*35238bceSAndroid Build Coastguard Worker // Create framebuffers.
535*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < 2; ndx++)
536*35238bceSAndroid Build Coastguard Worker {
537*35238bceSAndroid Build Coastguard Worker uint32_t &fbo = ndx ? dstFbo : srcFbo;
538*35238bceSAndroid Build Coastguard Worker uint32_t &colorRbo = ndx ? dstColorRbo : srcColorRbo;
539*35238bceSAndroid Build Coastguard Worker uint32_t &depthRbo = ndx ? dstDepthRbo : srcDepthRbo;
540*35238bceSAndroid Build Coastguard Worker uint32_t &stencilRbo = ndx ? dstStencilRbo : srcStencilRbo;
541*35238bceSAndroid Build Coastguard Worker uint32_t bufs = ndx ? m_dstBuffers : m_srcBuffers;
542*35238bceSAndroid Build Coastguard Worker const IVec2 &size = ndx ? m_dstSize : m_srcSize;
543*35238bceSAndroid Build Coastguard Worker
544*35238bceSAndroid Build Coastguard Worker glGenFramebuffers(1, &fbo);
545*35238bceSAndroid Build Coastguard Worker glGenRenderbuffers(1, &colorRbo);
546*35238bceSAndroid Build Coastguard Worker
547*35238bceSAndroid Build Coastguard Worker glBindRenderbuffer(GL_RENDERBUFFER, colorRbo);
548*35238bceSAndroid Build Coastguard Worker glRenderbufferStorage(GL_RENDERBUFFER, colorFormat, size.x(), size.y());
549*35238bceSAndroid Build Coastguard Worker
550*35238bceSAndroid Build Coastguard Worker if (m_depthFormat != GL_NONE)
551*35238bceSAndroid Build Coastguard Worker {
552*35238bceSAndroid Build Coastguard Worker glGenRenderbuffers(1, &depthRbo);
553*35238bceSAndroid Build Coastguard Worker glBindRenderbuffer(GL_RENDERBUFFER, depthRbo);
554*35238bceSAndroid Build Coastguard Worker glRenderbufferStorage(GL_RENDERBUFFER, m_depthFormat, size.x(), size.y());
555*35238bceSAndroid Build Coastguard Worker }
556*35238bceSAndroid Build Coastguard Worker
557*35238bceSAndroid Build Coastguard Worker if (m_stencilFormat != GL_NONE)
558*35238bceSAndroid Build Coastguard Worker {
559*35238bceSAndroid Build Coastguard Worker glGenRenderbuffers(1, &stencilRbo);
560*35238bceSAndroid Build Coastguard Worker glBindRenderbuffer(GL_RENDERBUFFER, stencilRbo);
561*35238bceSAndroid Build Coastguard Worker glRenderbufferStorage(GL_RENDERBUFFER, m_stencilFormat, size.x(), size.y());
562*35238bceSAndroid Build Coastguard Worker }
563*35238bceSAndroid Build Coastguard Worker
564*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_FRAMEBUFFER, fbo);
565*35238bceSAndroid Build Coastguard Worker glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorRbo);
566*35238bceSAndroid Build Coastguard Worker
567*35238bceSAndroid Build Coastguard Worker if (bufs & GL_DEPTH_BUFFER_BIT)
568*35238bceSAndroid Build Coastguard Worker glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthRbo);
569*35238bceSAndroid Build Coastguard Worker if (bufs & GL_STENCIL_BUFFER_BIT)
570*35238bceSAndroid Build Coastguard Worker glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER,
571*35238bceSAndroid Build Coastguard Worker m_stencilFormat == GL_NONE ? depthRbo : stencilRbo);
572*35238bceSAndroid Build Coastguard Worker
573*35238bceSAndroid Build Coastguard Worker checkError();
574*35238bceSAndroid Build Coastguard Worker checkFramebufferStatus(GL_FRAMEBUFFER);
575*35238bceSAndroid Build Coastguard Worker
576*35238bceSAndroid Build Coastguard Worker // Clear depth to 1 and stencil to 0.
577*35238bceSAndroid Build Coastguard Worker glClearBufferfi(GL_DEPTH_STENCIL, 0, 1.0f, 0);
578*35238bceSAndroid Build Coastguard Worker }
579*35238bceSAndroid Build Coastguard Worker
580*35238bceSAndroid Build Coastguard Worker // Fill source with gradient, depth = [-1..1], stencil = 7
581*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_FRAMEBUFFER, srcFbo);
582*35238bceSAndroid Build Coastguard Worker glViewport(0, 0, m_srcSize.x(), m_srcSize.y());
583*35238bceSAndroid Build Coastguard Worker glEnable(GL_DEPTH_TEST);
584*35238bceSAndroid Build Coastguard Worker glEnable(GL_STENCIL_TEST);
585*35238bceSAndroid Build Coastguard Worker glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
586*35238bceSAndroid Build Coastguard Worker glStencilFunc(GL_ALWAYS, 7, 0xffu);
587*35238bceSAndroid Build Coastguard Worker
588*35238bceSAndroid Build Coastguard Worker sglr::drawQuad(*getCurrentContext(), gradShaderID, Vec3(-1.0f, -1.0f, -1.0f), Vec3(1.0f, 1.0f, 1.0f));
589*35238bceSAndroid Build Coastguard Worker
590*35238bceSAndroid Build Coastguard Worker // Fill destination with grid pattern, depth = 0 and stencil = 1
591*35238bceSAndroid Build Coastguard Worker {
592*35238bceSAndroid Build Coastguard Worker const uint32_t format = GL_RGBA;
593*35238bceSAndroid Build Coastguard Worker const uint32_t dataType = GL_UNSIGNED_BYTE;
594*35238bceSAndroid Build Coastguard Worker const int texW = m_srcSize.x();
595*35238bceSAndroid Build Coastguard Worker const int texH = m_srcSize.y();
596*35238bceSAndroid Build Coastguard Worker uint32_t gridTex = 0;
597*35238bceSAndroid Build Coastguard Worker tcu::TextureLevel data(glu::mapGLTransferFormat(format, dataType), texW, texH, 1);
598*35238bceSAndroid Build Coastguard Worker
599*35238bceSAndroid Build Coastguard Worker tcu::fillWithGrid(data.getAccess(), 8, Vec4(0.2f, 0.7f, 0.1f, 1.0f), Vec4(0.7f, 0.1f, 0.5f, 0.8f));
600*35238bceSAndroid Build Coastguard Worker
601*35238bceSAndroid Build Coastguard Worker glGenTextures(1, &gridTex);
602*35238bceSAndroid Build Coastguard Worker glBindTexture(GL_TEXTURE_2D, gridTex);
603*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
604*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
605*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
606*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
607*35238bceSAndroid Build Coastguard Worker glTexImage2D(GL_TEXTURE_2D, 0, format, texW, texH, 0, format, dataType, data.getAccess().getDataPtr());
608*35238bceSAndroid Build Coastguard Worker
609*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_FRAMEBUFFER, dstFbo);
610*35238bceSAndroid Build Coastguard Worker glViewport(0, 0, m_dstSize.x(), m_dstSize.y());
611*35238bceSAndroid Build Coastguard Worker glStencilFunc(GL_ALWAYS, 1, 0xffu);
612*35238bceSAndroid Build Coastguard Worker sglr::drawQuad(*getCurrentContext(), texShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
613*35238bceSAndroid Build Coastguard Worker }
614*35238bceSAndroid Build Coastguard Worker
615*35238bceSAndroid Build Coastguard Worker // Perform copy.
616*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_READ_FRAMEBUFFER, srcFbo);
617*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_DRAW_FRAMEBUFFER, dstFbo);
618*35238bceSAndroid Build Coastguard Worker glBlitFramebuffer(m_srcRect.x(), m_srcRect.y(), m_srcRect.z(), m_srcRect.w(), m_dstRect.x(), m_dstRect.y(),
619*35238bceSAndroid Build Coastguard Worker m_dstRect.z(), m_dstRect.w(), m_copyBuffers, GL_NEAREST);
620*35238bceSAndroid Build Coastguard Worker
621*35238bceSAndroid Build Coastguard Worker // Render blue color where depth < 0, decrement on depth failure.
622*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_FRAMEBUFFER, dstFbo);
623*35238bceSAndroid Build Coastguard Worker glViewport(0, 0, m_dstSize.x(), m_dstSize.y());
624*35238bceSAndroid Build Coastguard Worker glStencilOp(GL_KEEP, GL_DECR, GL_KEEP);
625*35238bceSAndroid Build Coastguard Worker glStencilFunc(GL_ALWAYS, 0, 0xffu);
626*35238bceSAndroid Build Coastguard Worker
627*35238bceSAndroid Build Coastguard Worker flatShader.setColor(*getCurrentContext(), flatShaderID, Vec4(0.0f, 0.0f, 1.0f, 1.0f));
628*35238bceSAndroid Build Coastguard Worker sglr::drawQuad(*getCurrentContext(), flatShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
629*35238bceSAndroid Build Coastguard Worker
630*35238bceSAndroid Build Coastguard Worker if (m_dstBuffers & GL_STENCIL_BUFFER_BIT)
631*35238bceSAndroid Build Coastguard Worker {
632*35238bceSAndroid Build Coastguard Worker // Render green color where stencil == 6.
633*35238bceSAndroid Build Coastguard Worker glDisable(GL_DEPTH_TEST);
634*35238bceSAndroid Build Coastguard Worker glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
635*35238bceSAndroid Build Coastguard Worker glStencilFunc(GL_EQUAL, 6, 0xffu);
636*35238bceSAndroid Build Coastguard Worker
637*35238bceSAndroid Build Coastguard Worker flatShader.setColor(*getCurrentContext(), flatShaderID, Vec4(0.0f, 1.0f, 0.0f, 1.0f));
638*35238bceSAndroid Build Coastguard Worker sglr::drawQuad(*getCurrentContext(), flatShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
639*35238bceSAndroid Build Coastguard Worker }
640*35238bceSAndroid Build Coastguard Worker
641*35238bceSAndroid Build Coastguard Worker readPixels(dst, 0, 0, m_dstSize.x(), m_dstSize.y(), glu::mapGLInternalFormat(colorFormat), Vec4(1.0f),
642*35238bceSAndroid Build Coastguard Worker Vec4(0.0f));
643*35238bceSAndroid Build Coastguard Worker }
644*35238bceSAndroid Build Coastguard Worker
645*35238bceSAndroid Build Coastguard Worker private:
646*35238bceSAndroid Build Coastguard Worker uint32_t m_depthFormat;
647*35238bceSAndroid Build Coastguard Worker uint32_t m_stencilFormat;
648*35238bceSAndroid Build Coastguard Worker uint32_t m_srcBuffers;
649*35238bceSAndroid Build Coastguard Worker IVec2 m_srcSize;
650*35238bceSAndroid Build Coastguard Worker IVec4 m_srcRect;
651*35238bceSAndroid Build Coastguard Worker uint32_t m_dstBuffers;
652*35238bceSAndroid Build Coastguard Worker IVec2 m_dstSize;
653*35238bceSAndroid Build Coastguard Worker IVec4 m_dstRect;
654*35238bceSAndroid Build Coastguard Worker uint32_t m_copyBuffers;
655*35238bceSAndroid Build Coastguard Worker };
656*35238bceSAndroid Build Coastguard Worker
657*35238bceSAndroid Build Coastguard Worker class BlitDefaultFramebufferCase : public FboTestCase
658*35238bceSAndroid Build Coastguard Worker {
659*35238bceSAndroid Build Coastguard Worker public:
BlitDefaultFramebufferCase(Context & context,const char * name,const char * desc,uint32_t format,uint32_t filter)660*35238bceSAndroid Build Coastguard Worker BlitDefaultFramebufferCase(Context &context, const char *name, const char *desc, uint32_t format, uint32_t filter)
661*35238bceSAndroid Build Coastguard Worker : FboTestCase(context, name, desc)
662*35238bceSAndroid Build Coastguard Worker , m_format(format)
663*35238bceSAndroid Build Coastguard Worker , m_filter(filter)
664*35238bceSAndroid Build Coastguard Worker {
665*35238bceSAndroid Build Coastguard Worker }
666*35238bceSAndroid Build Coastguard Worker
667*35238bceSAndroid Build Coastguard Worker protected:
preCheck(void)668*35238bceSAndroid Build Coastguard Worker void preCheck(void)
669*35238bceSAndroid Build Coastguard Worker {
670*35238bceSAndroid Build Coastguard Worker if (m_context.getRenderTarget().getNumSamples() > 0)
671*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("Not supported in MSAA config");
672*35238bceSAndroid Build Coastguard Worker
673*35238bceSAndroid Build Coastguard Worker checkFormatSupport(m_format);
674*35238bceSAndroid Build Coastguard Worker }
675*35238bceSAndroid Build Coastguard Worker
render(tcu::Surface & dst)676*35238bceSAndroid Build Coastguard Worker virtual void render(tcu::Surface &dst)
677*35238bceSAndroid Build Coastguard Worker {
678*35238bceSAndroid Build Coastguard Worker tcu::TextureFormat colorFormat = glu::mapGLInternalFormat(m_format);
679*35238bceSAndroid Build Coastguard Worker glu::TransferFormat transferFmt = glu::getTransferFormat(colorFormat);
680*35238bceSAndroid Build Coastguard Worker GradientShader gradShader(glu::TYPE_FLOAT_VEC4);
681*35238bceSAndroid Build Coastguard Worker Texture2DShader texShader(DataTypes() << glu::getSampler2DType(colorFormat), glu::TYPE_FLOAT_VEC4);
682*35238bceSAndroid Build Coastguard Worker uint32_t gradShaderID = getCurrentContext()->createProgram(&gradShader);
683*35238bceSAndroid Build Coastguard Worker uint32_t texShaderID = getCurrentContext()->createProgram(&texShader);
684*35238bceSAndroid Build Coastguard Worker uint32_t fbo = 0;
685*35238bceSAndroid Build Coastguard Worker uint32_t tex = 0;
686*35238bceSAndroid Build Coastguard Worker const int texW = 128;
687*35238bceSAndroid Build Coastguard Worker const int texH = 128;
688*35238bceSAndroid Build Coastguard Worker
689*35238bceSAndroid Build Coastguard Worker // Setup shaders
690*35238bceSAndroid Build Coastguard Worker gradShader.setGradient(*getCurrentContext(), gradShaderID, Vec4(0.0f), Vec4(1.0f));
691*35238bceSAndroid Build Coastguard Worker texShader.setUniforms(*getCurrentContext(), texShaderID);
692*35238bceSAndroid Build Coastguard Worker
693*35238bceSAndroid Build Coastguard Worker // FBO
694*35238bceSAndroid Build Coastguard Worker glGenFramebuffers(1, &fbo);
695*35238bceSAndroid Build Coastguard Worker glGenTextures(1, &tex);
696*35238bceSAndroid Build Coastguard Worker
697*35238bceSAndroid Build Coastguard Worker glBindTexture(GL_TEXTURE_2D, tex);
698*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
699*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
700*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, m_filter);
701*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, m_filter);
702*35238bceSAndroid Build Coastguard Worker glTexImage2D(GL_TEXTURE_2D, 0, m_format, texW, texH, 0, transferFmt.format, transferFmt.dataType, DE_NULL);
703*35238bceSAndroid Build Coastguard Worker
704*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_FRAMEBUFFER, fbo);
705*35238bceSAndroid Build Coastguard Worker glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0);
706*35238bceSAndroid Build Coastguard Worker checkError();
707*35238bceSAndroid Build Coastguard Worker checkFramebufferStatus(GL_FRAMEBUFFER);
708*35238bceSAndroid Build Coastguard Worker
709*35238bceSAndroid Build Coastguard Worker // Render gradient to screen.
710*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_FRAMEBUFFER, m_context.getRenderContext().getDefaultFramebuffer());
711*35238bceSAndroid Build Coastguard Worker
712*35238bceSAndroid Build Coastguard Worker sglr::drawQuad(*getCurrentContext(), gradShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
713*35238bceSAndroid Build Coastguard Worker
714*35238bceSAndroid Build Coastguard Worker // Blit gradient from screen to fbo.
715*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
716*35238bceSAndroid Build Coastguard Worker glBlitFramebuffer(0, 0, getWidth(), getHeight(), 0, 0, texW, texH, GL_COLOR_BUFFER_BIT, m_filter);
717*35238bceSAndroid Build Coastguard Worker
718*35238bceSAndroid Build Coastguard Worker // Fill left half of viewport with quad that uses texture.
719*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_context.getRenderContext().getDefaultFramebuffer());
720*35238bceSAndroid Build Coastguard Worker glClearBufferfv(GL_COLOR, 0, Vec4(1.0f, 0.0f, 0.0f, 1.0f).getPtr());
721*35238bceSAndroid Build Coastguard Worker sglr::drawQuad(*getCurrentContext(), texShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(0.0f, 1.0f, 0.0f));
722*35238bceSAndroid Build Coastguard Worker
723*35238bceSAndroid Build Coastguard Worker // Blit fbo to right half.
724*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
725*35238bceSAndroid Build Coastguard Worker glBlitFramebuffer(0, 0, texW, texH, getWidth() / 2, 0, getWidth(), getHeight(), GL_COLOR_BUFFER_BIT, m_filter);
726*35238bceSAndroid Build Coastguard Worker
727*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_READ_FRAMEBUFFER, m_context.getRenderContext().getDefaultFramebuffer());
728*35238bceSAndroid Build Coastguard Worker readPixels(dst, 0, 0, getWidth(), getHeight());
729*35238bceSAndroid Build Coastguard Worker }
730*35238bceSAndroid Build Coastguard Worker
compare(const tcu::Surface & reference,const tcu::Surface & result)731*35238bceSAndroid Build Coastguard Worker bool compare(const tcu::Surface &reference, const tcu::Surface &result)
732*35238bceSAndroid Build Coastguard Worker {
733*35238bceSAndroid Build Coastguard Worker const tcu::RGBA threshold(tcu::max(getFormatThreshold(m_format), tcu::RGBA(12, 12, 12, 12)));
734*35238bceSAndroid Build Coastguard Worker
735*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Comparing images, threshold: " << threshold << TestLog::EndMessage;
736*35238bceSAndroid Build Coastguard Worker
737*35238bceSAndroid Build Coastguard Worker return tcu::bilinearCompare(m_testCtx.getLog(), "Result", "Image comparison result", reference.getAccess(),
738*35238bceSAndroid Build Coastguard Worker result.getAccess(), threshold, tcu::COMPARE_LOG_RESULT);
739*35238bceSAndroid Build Coastguard Worker }
740*35238bceSAndroid Build Coastguard Worker
741*35238bceSAndroid Build Coastguard Worker protected:
742*35238bceSAndroid Build Coastguard Worker const uint32_t m_format;
743*35238bceSAndroid Build Coastguard Worker const uint32_t m_filter;
744*35238bceSAndroid Build Coastguard Worker };
745*35238bceSAndroid Build Coastguard Worker
746*35238bceSAndroid Build Coastguard Worker class DefaultFramebufferBlitCase : public BlitDefaultFramebufferCase
747*35238bceSAndroid Build Coastguard Worker {
748*35238bceSAndroid Build Coastguard Worker public:
749*35238bceSAndroid Build Coastguard Worker enum BlitDirection
750*35238bceSAndroid Build Coastguard Worker {
751*35238bceSAndroid Build Coastguard Worker BLIT_DEFAULT_TO_TARGET,
752*35238bceSAndroid Build Coastguard Worker BLIT_TO_DEFAULT_FROM_TARGET,
753*35238bceSAndroid Build Coastguard Worker
754*35238bceSAndroid Build Coastguard Worker BLIT_LAST
755*35238bceSAndroid Build Coastguard Worker };
756*35238bceSAndroid Build Coastguard Worker enum BlitArea
757*35238bceSAndroid Build Coastguard Worker {
758*35238bceSAndroid Build Coastguard Worker AREA_SCALE,
759*35238bceSAndroid Build Coastguard Worker AREA_OUT_OF_BOUNDS,
760*35238bceSAndroid Build Coastguard Worker
761*35238bceSAndroid Build Coastguard Worker AREA_LAST
762*35238bceSAndroid Build Coastguard Worker };
763*35238bceSAndroid Build Coastguard Worker
DefaultFramebufferBlitCase(Context & context,const char * name,const char * desc,uint32_t format,uint32_t filter,BlitDirection dir,BlitArea area)764*35238bceSAndroid Build Coastguard Worker DefaultFramebufferBlitCase(Context &context, const char *name, const char *desc, uint32_t format, uint32_t filter,
765*35238bceSAndroid Build Coastguard Worker BlitDirection dir, BlitArea area)
766*35238bceSAndroid Build Coastguard Worker : BlitDefaultFramebufferCase(context, name, desc, format, filter)
767*35238bceSAndroid Build Coastguard Worker , m_blitDir(dir)
768*35238bceSAndroid Build Coastguard Worker , m_blitArea(area)
769*35238bceSAndroid Build Coastguard Worker , m_srcRect(-1, -1, -1, -1)
770*35238bceSAndroid Build Coastguard Worker , m_dstRect(-1, -1, -1, -1)
771*35238bceSAndroid Build Coastguard Worker , m_interestingArea(-1, -1, -1, -1)
772*35238bceSAndroid Build Coastguard Worker {
773*35238bceSAndroid Build Coastguard Worker DE_ASSERT(dir < BLIT_LAST);
774*35238bceSAndroid Build Coastguard Worker DE_ASSERT(area < AREA_LAST);
775*35238bceSAndroid Build Coastguard Worker }
776*35238bceSAndroid Build Coastguard Worker
init(void)777*35238bceSAndroid Build Coastguard Worker void init(void)
778*35238bceSAndroid Build Coastguard Worker {
779*35238bceSAndroid Build Coastguard Worker // requirements
780*35238bceSAndroid Build Coastguard Worker const int minViewportSize = 128;
781*35238bceSAndroid Build Coastguard Worker if (m_context.getRenderTarget().getWidth() < minViewportSize ||
782*35238bceSAndroid Build Coastguard Worker m_context.getRenderTarget().getHeight() < minViewportSize)
783*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("Viewport size " + de::toString(minViewportSize) + "x" +
784*35238bceSAndroid Build Coastguard Worker de::toString(minViewportSize) + " required");
785*35238bceSAndroid Build Coastguard Worker
786*35238bceSAndroid Build Coastguard Worker // prevent viewport randoming
787*35238bceSAndroid Build Coastguard Worker m_viewportWidth = m_context.getRenderTarget().getWidth();
788*35238bceSAndroid Build Coastguard Worker m_viewportHeight = m_context.getRenderTarget().getHeight();
789*35238bceSAndroid Build Coastguard Worker
790*35238bceSAndroid Build Coastguard Worker // set proper areas
791*35238bceSAndroid Build Coastguard Worker if (m_blitArea == AREA_SCALE)
792*35238bceSAndroid Build Coastguard Worker {
793*35238bceSAndroid Build Coastguard Worker m_srcRect = IVec4(10, 20, 65, 100);
794*35238bceSAndroid Build Coastguard Worker m_dstRect = IVec4(25, 30, 125, 94);
795*35238bceSAndroid Build Coastguard Worker m_interestingArea = IVec4(0, 0, 128, 128);
796*35238bceSAndroid Build Coastguard Worker }
797*35238bceSAndroid Build Coastguard Worker else if (m_blitArea == AREA_OUT_OF_BOUNDS)
798*35238bceSAndroid Build Coastguard Worker {
799*35238bceSAndroid Build Coastguard Worker const tcu::IVec2 ubound =
800*35238bceSAndroid Build Coastguard Worker (m_blitDir == BLIT_DEFAULT_TO_TARGET) ?
801*35238bceSAndroid Build Coastguard Worker (tcu::IVec2(128, 128)) :
802*35238bceSAndroid Build Coastguard Worker (tcu::IVec2(m_context.getRenderTarget().getWidth(), m_context.getRenderTarget().getHeight()));
803*35238bceSAndroid Build Coastguard Worker
804*35238bceSAndroid Build Coastguard Worker m_srcRect = IVec4(-10, -15, 100, 63);
805*35238bceSAndroid Build Coastguard Worker m_dstRect = ubound.swizzle(0, 1, 0, 1) + IVec4(-75, -99, 8, 16);
806*35238bceSAndroid Build Coastguard Worker m_interestingArea = IVec4(ubound.x() - 128, ubound.y() - 128, ubound.x(), ubound.y());
807*35238bceSAndroid Build Coastguard Worker }
808*35238bceSAndroid Build Coastguard Worker else
809*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
810*35238bceSAndroid Build Coastguard Worker }
811*35238bceSAndroid Build Coastguard Worker
render(tcu::Surface & dst)812*35238bceSAndroid Build Coastguard Worker void render(tcu::Surface &dst)
813*35238bceSAndroid Build Coastguard Worker {
814*35238bceSAndroid Build Coastguard Worker const tcu::TextureFormat colorFormat = glu::mapGLInternalFormat(m_format);
815*35238bceSAndroid Build Coastguard Worker const glu::TransferFormat transferFmt = glu::getTransferFormat(colorFormat);
816*35238bceSAndroid Build Coastguard Worker const tcu::TextureChannelClass targetClass = (m_blitDir == BLIT_DEFAULT_TO_TARGET) ?
817*35238bceSAndroid Build Coastguard Worker (tcu::getTextureChannelClass(colorFormat.type)) :
818*35238bceSAndroid Build Coastguard Worker (tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT);
819*35238bceSAndroid Build Coastguard Worker uint32_t fbo = 0;
820*35238bceSAndroid Build Coastguard Worker uint32_t fboTex = 0;
821*35238bceSAndroid Build Coastguard Worker const int fboTexW = 128;
822*35238bceSAndroid Build Coastguard Worker const int fboTexH = 128;
823*35238bceSAndroid Build Coastguard Worker const int sourceWidth = (m_blitDir == BLIT_DEFAULT_TO_TARGET) ? (getWidth()) : (fboTexW);
824*35238bceSAndroid Build Coastguard Worker const int sourceHeight = (m_blitDir == BLIT_DEFAULT_TO_TARGET) ? (getHeight()) : (fboTexH);
825*35238bceSAndroid Build Coastguard Worker const int gridRenderWidth = de::min(256, sourceWidth);
826*35238bceSAndroid Build Coastguard Worker const int gridRenderHeight = de::min(256, sourceHeight);
827*35238bceSAndroid Build Coastguard Worker
828*35238bceSAndroid Build Coastguard Worker int targetFbo = -1;
829*35238bceSAndroid Build Coastguard Worker int sourceFbo = -1;
830*35238bceSAndroid Build Coastguard Worker
831*35238bceSAndroid Build Coastguard Worker // FBO
832*35238bceSAndroid Build Coastguard Worker glGenFramebuffers(1, &fbo);
833*35238bceSAndroid Build Coastguard Worker glGenTextures(1, &fboTex);
834*35238bceSAndroid Build Coastguard Worker
835*35238bceSAndroid Build Coastguard Worker glBindTexture(GL_TEXTURE_2D, fboTex);
836*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
837*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
838*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, m_filter);
839*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, m_filter);
840*35238bceSAndroid Build Coastguard Worker glTexImage2D(GL_TEXTURE_2D, 0, m_format, fboTexW, fboTexH, 0, transferFmt.format, transferFmt.dataType,
841*35238bceSAndroid Build Coastguard Worker DE_NULL);
842*35238bceSAndroid Build Coastguard Worker
843*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_FRAMEBUFFER, fbo);
844*35238bceSAndroid Build Coastguard Worker glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fboTex, 0);
845*35238bceSAndroid Build Coastguard Worker checkError();
846*35238bceSAndroid Build Coastguard Worker checkFramebufferStatus(GL_FRAMEBUFFER);
847*35238bceSAndroid Build Coastguard Worker
848*35238bceSAndroid Build Coastguard Worker targetFbo =
849*35238bceSAndroid Build Coastguard Worker (m_blitDir == BLIT_DEFAULT_TO_TARGET) ? (fbo) : (m_context.getRenderContext().getDefaultFramebuffer());
850*35238bceSAndroid Build Coastguard Worker sourceFbo =
851*35238bceSAndroid Build Coastguard Worker (m_blitDir == BLIT_DEFAULT_TO_TARGET) ? (m_context.getRenderContext().getDefaultFramebuffer()) : (fbo);
852*35238bceSAndroid Build Coastguard Worker
853*35238bceSAndroid Build Coastguard Worker // Render grid to source framebuffer
854*35238bceSAndroid Build Coastguard Worker {
855*35238bceSAndroid Build Coastguard Worker Texture2DShader texShader(DataTypes() << glu::TYPE_SAMPLER_2D, glu::TYPE_FLOAT_VEC4);
856*35238bceSAndroid Build Coastguard Worker const uint32_t texShaderID = getCurrentContext()->createProgram(&texShader);
857*35238bceSAndroid Build Coastguard Worker const uint32_t internalFormat = GL_RGBA8;
858*35238bceSAndroid Build Coastguard Worker const uint32_t format = GL_RGBA;
859*35238bceSAndroid Build Coastguard Worker const uint32_t dataType = GL_UNSIGNED_BYTE;
860*35238bceSAndroid Build Coastguard Worker const int gridTexW = 128;
861*35238bceSAndroid Build Coastguard Worker const int gridTexH = 128;
862*35238bceSAndroid Build Coastguard Worker uint32_t gridTex = 0;
863*35238bceSAndroid Build Coastguard Worker tcu::TextureLevel data(glu::mapGLTransferFormat(format, dataType), gridTexW, gridTexH, 1);
864*35238bceSAndroid Build Coastguard Worker
865*35238bceSAndroid Build Coastguard Worker tcu::fillWithGrid(data.getAccess(), 9, tcu::Vec4(0.9f, 0.5f, 0.1f, 0.9f),
866*35238bceSAndroid Build Coastguard Worker tcu::Vec4(0.2f, 0.8f, 0.2f, 0.7f));
867*35238bceSAndroid Build Coastguard Worker
868*35238bceSAndroid Build Coastguard Worker glGenTextures(1, &gridTex);
869*35238bceSAndroid Build Coastguard Worker glBindTexture(GL_TEXTURE_2D, gridTex);
870*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
871*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
872*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
873*35238bceSAndroid Build Coastguard Worker glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
874*35238bceSAndroid Build Coastguard Worker glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, gridTexW, gridTexH, 0, format, dataType,
875*35238bceSAndroid Build Coastguard Worker data.getAccess().getDataPtr());
876*35238bceSAndroid Build Coastguard Worker
877*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_FRAMEBUFFER, sourceFbo);
878*35238bceSAndroid Build Coastguard Worker glViewport(0, 0, gridRenderWidth, gridRenderHeight);
879*35238bceSAndroid Build Coastguard Worker glClearBufferfv(GL_COLOR, 0, Vec4(1.0f, 0.0f, 0.0f, 1.0f).getPtr());
880*35238bceSAndroid Build Coastguard Worker
881*35238bceSAndroid Build Coastguard Worker texShader.setUniforms(*getCurrentContext(), texShaderID);
882*35238bceSAndroid Build Coastguard Worker sglr::drawQuad(*getCurrentContext(), texShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(1.0f, 1.0f, 0.0f));
883*35238bceSAndroid Build Coastguard Worker glUseProgram(0);
884*35238bceSAndroid Build Coastguard Worker }
885*35238bceSAndroid Build Coastguard Worker
886*35238bceSAndroid Build Coastguard Worker // Blit source framebuffer to destination
887*35238bceSAndroid Build Coastguard Worker
888*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_READ_FRAMEBUFFER, sourceFbo);
889*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_DRAW_FRAMEBUFFER, targetFbo);
890*35238bceSAndroid Build Coastguard Worker checkError();
891*35238bceSAndroid Build Coastguard Worker
892*35238bceSAndroid Build Coastguard Worker if (targetClass == tcu::TEXTURECHANNELCLASS_SIGNED_FIXED_POINT ||
893*35238bceSAndroid Build Coastguard Worker targetClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT ||
894*35238bceSAndroid Build Coastguard Worker targetClass == tcu::TEXTURECHANNELCLASS_FLOATING_POINT)
895*35238bceSAndroid Build Coastguard Worker glClearBufferfv(GL_COLOR, 0, Vec4(1.0f, 1.0f, 0.0f, 1.0f).getPtr());
896*35238bceSAndroid Build Coastguard Worker else if (targetClass == tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER)
897*35238bceSAndroid Build Coastguard Worker glClearBufferiv(GL_COLOR, 0, IVec4(0, 0, 0, 0).getPtr());
898*35238bceSAndroid Build Coastguard Worker else if (targetClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER)
899*35238bceSAndroid Build Coastguard Worker glClearBufferuiv(GL_COLOR, 0, UVec4(0, 0, 0, 0).getPtr());
900*35238bceSAndroid Build Coastguard Worker else
901*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
902*35238bceSAndroid Build Coastguard Worker
903*35238bceSAndroid Build Coastguard Worker glBlitFramebuffer(m_srcRect.x(), m_srcRect.y(), m_srcRect.z(), m_srcRect.w(), m_dstRect.x(), m_dstRect.y(),
904*35238bceSAndroid Build Coastguard Worker m_dstRect.z(), m_dstRect.w(), GL_COLOR_BUFFER_BIT, m_filter);
905*35238bceSAndroid Build Coastguard Worker checkError();
906*35238bceSAndroid Build Coastguard Worker
907*35238bceSAndroid Build Coastguard Worker // Read target
908*35238bceSAndroid Build Coastguard Worker
909*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_FRAMEBUFFER, targetFbo);
910*35238bceSAndroid Build Coastguard Worker
911*35238bceSAndroid Build Coastguard Worker if (m_blitDir == BLIT_TO_DEFAULT_FROM_TARGET)
912*35238bceSAndroid Build Coastguard Worker readPixels(dst, m_interestingArea.x(), m_interestingArea.y(), m_interestingArea.z() - m_interestingArea.x(),
913*35238bceSAndroid Build Coastguard Worker m_interestingArea.w() - m_interestingArea.y());
914*35238bceSAndroid Build Coastguard Worker else
915*35238bceSAndroid Build Coastguard Worker readPixels(dst, m_interestingArea.x(), m_interestingArea.y(), m_interestingArea.z() - m_interestingArea.x(),
916*35238bceSAndroid Build Coastguard Worker m_interestingArea.w() - m_interestingArea.y(), colorFormat, tcu::Vec4(1.0f), tcu::Vec4(0.0f));
917*35238bceSAndroid Build Coastguard Worker
918*35238bceSAndroid Build Coastguard Worker checkError();
919*35238bceSAndroid Build Coastguard Worker }
920*35238bceSAndroid Build Coastguard Worker
921*35238bceSAndroid Build Coastguard Worker private:
922*35238bceSAndroid Build Coastguard Worker const BlitDirection m_blitDir;
923*35238bceSAndroid Build Coastguard Worker const BlitArea m_blitArea;
924*35238bceSAndroid Build Coastguard Worker tcu::IVec4 m_srcRect;
925*35238bceSAndroid Build Coastguard Worker tcu::IVec4 m_dstRect;
926*35238bceSAndroid Build Coastguard Worker tcu::IVec4 m_interestingArea;
927*35238bceSAndroid Build Coastguard Worker };
928*35238bceSAndroid Build Coastguard Worker
FramebufferBlitTests(Context & context)929*35238bceSAndroid Build Coastguard Worker FramebufferBlitTests::FramebufferBlitTests(Context &context) : TestCaseGroup(context, "blit", "Framebuffer blit tests")
930*35238bceSAndroid Build Coastguard Worker {
931*35238bceSAndroid Build Coastguard Worker }
932*35238bceSAndroid Build Coastguard Worker
~FramebufferBlitTests(void)933*35238bceSAndroid Build Coastguard Worker FramebufferBlitTests::~FramebufferBlitTests(void)
934*35238bceSAndroid Build Coastguard Worker {
935*35238bceSAndroid Build Coastguard Worker }
936*35238bceSAndroid Build Coastguard Worker
init(void)937*35238bceSAndroid Build Coastguard Worker void FramebufferBlitTests::init(void)
938*35238bceSAndroid Build Coastguard Worker {
939*35238bceSAndroid Build Coastguard Worker static const uint32_t colorFormats[] = {
940*35238bceSAndroid Build Coastguard Worker // RGBA formats
941*35238bceSAndroid Build Coastguard Worker GL_RGBA32I, GL_RGBA32UI, GL_RGBA16I, GL_RGBA16UI, GL_RGBA8, GL_RGBA8I, GL_RGBA8UI, GL_SRGB8_ALPHA8, GL_RGB10_A2,
942*35238bceSAndroid Build Coastguard Worker GL_RGB10_A2UI, GL_RGBA4, GL_RGB5_A1,
943*35238bceSAndroid Build Coastguard Worker
944*35238bceSAndroid Build Coastguard Worker // RGB formats
945*35238bceSAndroid Build Coastguard Worker GL_RGB8, GL_RGB565,
946*35238bceSAndroid Build Coastguard Worker
947*35238bceSAndroid Build Coastguard Worker // RG formats
948*35238bceSAndroid Build Coastguard Worker GL_RG32I, GL_RG32UI, GL_RG16I, GL_RG16UI, GL_RG8, GL_RG8I, GL_RG8UI,
949*35238bceSAndroid Build Coastguard Worker
950*35238bceSAndroid Build Coastguard Worker // R formats
951*35238bceSAndroid Build Coastguard Worker GL_R32I, GL_R32UI, GL_R16I, GL_R16UI, GL_R8, GL_R8I, GL_R8UI,
952*35238bceSAndroid Build Coastguard Worker
953*35238bceSAndroid Build Coastguard Worker // GL_EXT_color_buffer_float
954*35238bceSAndroid Build Coastguard Worker GL_RGBA32F, GL_RGBA16F, GL_R11F_G11F_B10F, GL_RG32F, GL_RG16F, GL_R32F, GL_R16F};
955*35238bceSAndroid Build Coastguard Worker
956*35238bceSAndroid Build Coastguard Worker static const uint32_t depthStencilFormats[] = {GL_NONE,
957*35238bceSAndroid Build Coastguard Worker GL_DEPTH_COMPONENT32F,
958*35238bceSAndroid Build Coastguard Worker GL_DEPTH_COMPONENT24,
959*35238bceSAndroid Build Coastguard Worker GL_DEPTH_COMPONENT16,
960*35238bceSAndroid Build Coastguard Worker GL_DEPTH32F_STENCIL8,
961*35238bceSAndroid Build Coastguard Worker GL_DEPTH24_STENCIL8};
962*35238bceSAndroid Build Coastguard Worker
963*35238bceSAndroid Build Coastguard Worker static const uint32_t stencilFormats[] = {GL_NONE, GL_STENCIL_INDEX8};
964*35238bceSAndroid Build Coastguard Worker
965*35238bceSAndroid Build Coastguard Worker // .rect
966*35238bceSAndroid Build Coastguard Worker {
967*35238bceSAndroid Build Coastguard Worker static const struct
968*35238bceSAndroid Build Coastguard Worker {
969*35238bceSAndroid Build Coastguard Worker const char *name;
970*35238bceSAndroid Build Coastguard Worker IVec4 srcRect;
971*35238bceSAndroid Build Coastguard Worker IVec4 dstRect;
972*35238bceSAndroid Build Coastguard Worker } copyRects[] = {
973*35238bceSAndroid Build Coastguard Worker {"basic", IVec4(10, 20, 65, 100), IVec4(45, 5, 100, 85)},
974*35238bceSAndroid Build Coastguard Worker {"scale", IVec4(10, 20, 65, 100), IVec4(25, 30, 125, 94)},
975*35238bceSAndroid Build Coastguard Worker {"out_of_bounds", IVec4(-10, -15, 100, 63), IVec4(50, 30, 136, 144)},
976*35238bceSAndroid Build Coastguard Worker };
977*35238bceSAndroid Build Coastguard Worker
978*35238bceSAndroid Build Coastguard Worker static const struct
979*35238bceSAndroid Build Coastguard Worker {
980*35238bceSAndroid Build Coastguard Worker const char *name;
981*35238bceSAndroid Build Coastguard Worker IVec4 srcRect;
982*35238bceSAndroid Build Coastguard Worker IVec4 dstRect;
983*35238bceSAndroid Build Coastguard Worker } filterConsistencyRects[] = {
984*35238bceSAndroid Build Coastguard Worker {"mag", IVec4(20, 10, 74, 88), IVec4(10, 10, 91, 101)},
985*35238bceSAndroid Build Coastguard Worker {"min", IVec4(10, 20, 78, 100), IVec4(20, 20, 71, 80)},
986*35238bceSAndroid Build Coastguard Worker {"out_of_bounds_mag", IVec4(21, 10, 73, 82), IVec4(11, 43, 141, 151)},
987*35238bceSAndroid Build Coastguard Worker {"out_of_bounds_min", IVec4(11, 21, 77, 97), IVec4(80, 82, 135, 139)},
988*35238bceSAndroid Build Coastguard Worker };
989*35238bceSAndroid Build Coastguard Worker
990*35238bceSAndroid Build Coastguard Worker static const struct
991*35238bceSAndroid Build Coastguard Worker {
992*35238bceSAndroid Build Coastguard Worker const char *name;
993*35238bceSAndroid Build Coastguard Worker IVec4 srcSwizzle;
994*35238bceSAndroid Build Coastguard Worker IVec4 dstSwizzle;
995*35238bceSAndroid Build Coastguard Worker } swizzles[] = {{DE_NULL, IVec4(0, 1, 2, 3), IVec4(0, 1, 2, 3)},
996*35238bceSAndroid Build Coastguard Worker {"reverse_src_x", IVec4(2, 1, 0, 3), IVec4(0, 1, 2, 3)},
997*35238bceSAndroid Build Coastguard Worker {"reverse_src_y", IVec4(0, 3, 2, 1), IVec4(0, 1, 2, 3)},
998*35238bceSAndroid Build Coastguard Worker {"reverse_dst_x", IVec4(0, 1, 2, 3), IVec4(2, 1, 0, 3)},
999*35238bceSAndroid Build Coastguard Worker {"reverse_dst_y", IVec4(0, 1, 2, 3), IVec4(0, 3, 2, 1)},
1000*35238bceSAndroid Build Coastguard Worker {"reverse_src_dst_x", IVec4(2, 1, 0, 3), IVec4(2, 1, 0, 3)},
1001*35238bceSAndroid Build Coastguard Worker {"reverse_src_dst_y", IVec4(0, 3, 2, 1), IVec4(0, 3, 2, 1)}};
1002*35238bceSAndroid Build Coastguard Worker
1003*35238bceSAndroid Build Coastguard Worker const IVec2 srcSize(127, 119);
1004*35238bceSAndroid Build Coastguard Worker const IVec2 dstSize(132, 128);
1005*35238bceSAndroid Build Coastguard Worker
1006*35238bceSAndroid Build Coastguard Worker // Blit rectangle tests.
1007*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *rectGroup = new tcu::TestCaseGroup(m_testCtx, "rect", "Blit rectangle tests");
1008*35238bceSAndroid Build Coastguard Worker addChild(rectGroup);
1009*35238bceSAndroid Build Coastguard Worker for (int rectNdx = 0; rectNdx < DE_LENGTH_OF_ARRAY(copyRects); rectNdx++)
1010*35238bceSAndroid Build Coastguard Worker {
1011*35238bceSAndroid Build Coastguard Worker for (int swzNdx = 0; swzNdx < DE_LENGTH_OF_ARRAY(swizzles); swzNdx++)
1012*35238bceSAndroid Build Coastguard Worker {
1013*35238bceSAndroid Build Coastguard Worker string name = string(copyRects[rectNdx].name) +
1014*35238bceSAndroid Build Coastguard Worker (swizzles[swzNdx].name ? (string("_") + swizzles[swzNdx].name) : string());
1015*35238bceSAndroid Build Coastguard Worker IVec4 srcSwz = swizzles[swzNdx].srcSwizzle;
1016*35238bceSAndroid Build Coastguard Worker IVec4 dstSwz = swizzles[swzNdx].dstSwizzle;
1017*35238bceSAndroid Build Coastguard Worker IVec4 srcRect = copyRects[rectNdx].srcRect.swizzle(srcSwz[0], srcSwz[1], srcSwz[2], srcSwz[3]);
1018*35238bceSAndroid Build Coastguard Worker IVec4 dstRect = copyRects[rectNdx].dstRect.swizzle(dstSwz[0], dstSwz[1], dstSwz[2], dstSwz[3]);
1019*35238bceSAndroid Build Coastguard Worker
1020*35238bceSAndroid Build Coastguard Worker rectGroup->addChild(new BlitRectCase(m_context, (name + "_nearest").c_str(), "", GL_NEAREST, srcSize,
1021*35238bceSAndroid Build Coastguard Worker srcRect, dstSize, dstRect));
1022*35238bceSAndroid Build Coastguard Worker rectGroup->addChild(new BlitRectCase(m_context, (name + "_linear").c_str(), "", GL_LINEAR, srcSize,
1023*35238bceSAndroid Build Coastguard Worker srcRect, dstSize, dstRect));
1024*35238bceSAndroid Build Coastguard Worker }
1025*35238bceSAndroid Build Coastguard Worker }
1026*35238bceSAndroid Build Coastguard Worker
1027*35238bceSAndroid Build Coastguard Worker // Nearest filter tests
1028*35238bceSAndroid Build Coastguard Worker for (int rectNdx = 0; rectNdx < DE_LENGTH_OF_ARRAY(filterConsistencyRects); rectNdx++)
1029*35238bceSAndroid Build Coastguard Worker {
1030*35238bceSAndroid Build Coastguard Worker for (int swzNdx = 0; swzNdx < DE_LENGTH_OF_ARRAY(swizzles); swzNdx++)
1031*35238bceSAndroid Build Coastguard Worker {
1032*35238bceSAndroid Build Coastguard Worker string name = string("nearest_consistency_") + filterConsistencyRects[rectNdx].name +
1033*35238bceSAndroid Build Coastguard Worker (swizzles[swzNdx].name ? (string("_") + swizzles[swzNdx].name) : string());
1034*35238bceSAndroid Build Coastguard Worker IVec4 srcSwz = swizzles[swzNdx].srcSwizzle;
1035*35238bceSAndroid Build Coastguard Worker IVec4 dstSwz = swizzles[swzNdx].dstSwizzle;
1036*35238bceSAndroid Build Coastguard Worker IVec4 srcRect =
1037*35238bceSAndroid Build Coastguard Worker filterConsistencyRects[rectNdx].srcRect.swizzle(srcSwz[0], srcSwz[1], srcSwz[2], srcSwz[3]);
1038*35238bceSAndroid Build Coastguard Worker IVec4 dstRect =
1039*35238bceSAndroid Build Coastguard Worker filterConsistencyRects[rectNdx].dstRect.swizzle(dstSwz[0], dstSwz[1], dstSwz[2], dstSwz[3]);
1040*35238bceSAndroid Build Coastguard Worker
1041*35238bceSAndroid Build Coastguard Worker rectGroup->addChild(new BlitNearestFilterConsistencyCase(m_context, name.c_str(),
1042*35238bceSAndroid Build Coastguard Worker "Test consistency of the nearest filter",
1043*35238bceSAndroid Build Coastguard Worker srcSize, srcRect, dstSize, dstRect));
1044*35238bceSAndroid Build Coastguard Worker }
1045*35238bceSAndroid Build Coastguard Worker }
1046*35238bceSAndroid Build Coastguard Worker }
1047*35238bceSAndroid Build Coastguard Worker
1048*35238bceSAndroid Build Coastguard Worker // .conversion
1049*35238bceSAndroid Build Coastguard Worker {
1050*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *conversionGroup = new tcu::TestCaseGroup(m_testCtx, "conversion", "Color conversion tests");
1051*35238bceSAndroid Build Coastguard Worker addChild(conversionGroup);
1052*35238bceSAndroid Build Coastguard Worker
1053*35238bceSAndroid Build Coastguard Worker for (int srcFmtNdx = 0; srcFmtNdx < DE_LENGTH_OF_ARRAY(colorFormats); srcFmtNdx++)
1054*35238bceSAndroid Build Coastguard Worker {
1055*35238bceSAndroid Build Coastguard Worker for (int dstFmtNdx = 0; dstFmtNdx < DE_LENGTH_OF_ARRAY(colorFormats); dstFmtNdx++)
1056*35238bceSAndroid Build Coastguard Worker {
1057*35238bceSAndroid Build Coastguard Worker uint32_t srcFormat = colorFormats[srcFmtNdx];
1058*35238bceSAndroid Build Coastguard Worker tcu::TextureFormat srcTexFmt = glu::mapGLInternalFormat(srcFormat);
1059*35238bceSAndroid Build Coastguard Worker tcu::TextureChannelClass srcType = tcu::getTextureChannelClass(srcTexFmt.type);
1060*35238bceSAndroid Build Coastguard Worker uint32_t dstFormat = colorFormats[dstFmtNdx];
1061*35238bceSAndroid Build Coastguard Worker tcu::TextureFormat dstTexFmt = glu::mapGLInternalFormat(dstFormat);
1062*35238bceSAndroid Build Coastguard Worker tcu::TextureChannelClass dstType = tcu::getTextureChannelClass(dstTexFmt.type);
1063*35238bceSAndroid Build Coastguard Worker
1064*35238bceSAndroid Build Coastguard Worker if (((srcType == tcu::TEXTURECHANNELCLASS_FLOATING_POINT ||
1065*35238bceSAndroid Build Coastguard Worker srcType == tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT) !=
1066*35238bceSAndroid Build Coastguard Worker (dstType == tcu::TEXTURECHANNELCLASS_FLOATING_POINT ||
1067*35238bceSAndroid Build Coastguard Worker dstType == tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT)) ||
1068*35238bceSAndroid Build Coastguard Worker ((srcType == tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER) !=
1069*35238bceSAndroid Build Coastguard Worker (dstType == tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER)) ||
1070*35238bceSAndroid Build Coastguard Worker ((srcType == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER) !=
1071*35238bceSAndroid Build Coastguard Worker (dstType == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER)))
1072*35238bceSAndroid Build Coastguard Worker continue; // Conversion not supported.
1073*35238bceSAndroid Build Coastguard Worker
1074*35238bceSAndroid Build Coastguard Worker string name = string(getFormatName(srcFormat)) + "_to_" + getFormatName(dstFormat);
1075*35238bceSAndroid Build Coastguard Worker
1076*35238bceSAndroid Build Coastguard Worker conversionGroup->addChild(
1077*35238bceSAndroid Build Coastguard Worker new BlitColorConversionCase(m_context, name.c_str(), "", srcFormat, dstFormat, IVec2(127, 113)));
1078*35238bceSAndroid Build Coastguard Worker }
1079*35238bceSAndroid Build Coastguard Worker }
1080*35238bceSAndroid Build Coastguard Worker }
1081*35238bceSAndroid Build Coastguard Worker
1082*35238bceSAndroid Build Coastguard Worker // .depth_stencil
1083*35238bceSAndroid Build Coastguard Worker {
1084*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *depthStencilGroup =
1085*35238bceSAndroid Build Coastguard Worker new tcu::TestCaseGroup(m_testCtx, "depth_stencil", "Depth and stencil blits");
1086*35238bceSAndroid Build Coastguard Worker addChild(depthStencilGroup);
1087*35238bceSAndroid Build Coastguard Worker
1088*35238bceSAndroid Build Coastguard Worker for (int dFmtNdx = 0; dFmtNdx < DE_LENGTH_OF_ARRAY(depthStencilFormats); dFmtNdx++)
1089*35238bceSAndroid Build Coastguard Worker {
1090*35238bceSAndroid Build Coastguard Worker for (int sFmtNdx = 0; sFmtNdx < DE_LENGTH_OF_ARRAY(stencilFormats); sFmtNdx++)
1091*35238bceSAndroid Build Coastguard Worker {
1092*35238bceSAndroid Build Coastguard Worker uint32_t depthFormat = depthStencilFormats[dFmtNdx];
1093*35238bceSAndroid Build Coastguard Worker uint32_t stencilFormat = stencilFormats[sFmtNdx];
1094*35238bceSAndroid Build Coastguard Worker bool depth = false;
1095*35238bceSAndroid Build Coastguard Worker bool stencil = false;
1096*35238bceSAndroid Build Coastguard Worker string fmtName;
1097*35238bceSAndroid Build Coastguard Worker
1098*35238bceSAndroid Build Coastguard Worker if (depthFormat != GL_NONE)
1099*35238bceSAndroid Build Coastguard Worker {
1100*35238bceSAndroid Build Coastguard Worker tcu::TextureFormat info = glu::mapGLInternalFormat(depthFormat);
1101*35238bceSAndroid Build Coastguard Worker
1102*35238bceSAndroid Build Coastguard Worker fmtName += getFormatName(depthFormat);
1103*35238bceSAndroid Build Coastguard Worker if (info.order == tcu::TextureFormat::D || info.order == tcu::TextureFormat::DS)
1104*35238bceSAndroid Build Coastguard Worker depth = true;
1105*35238bceSAndroid Build Coastguard Worker if (info.order == tcu::TextureFormat::DS)
1106*35238bceSAndroid Build Coastguard Worker stencil = true;
1107*35238bceSAndroid Build Coastguard Worker }
1108*35238bceSAndroid Build Coastguard Worker
1109*35238bceSAndroid Build Coastguard Worker if (stencilFormat != GL_NONE)
1110*35238bceSAndroid Build Coastguard Worker {
1111*35238bceSAndroid Build Coastguard Worker // Do not try separate stencil along with a combined depth/stencil
1112*35238bceSAndroid Build Coastguard Worker if (stencil)
1113*35238bceSAndroid Build Coastguard Worker continue;
1114*35238bceSAndroid Build Coastguard Worker
1115*35238bceSAndroid Build Coastguard Worker if (depthFormat != GL_NONE)
1116*35238bceSAndroid Build Coastguard Worker fmtName += "_";
1117*35238bceSAndroid Build Coastguard Worker fmtName += getFormatName(stencilFormat);
1118*35238bceSAndroid Build Coastguard Worker stencil = true;
1119*35238bceSAndroid Build Coastguard Worker }
1120*35238bceSAndroid Build Coastguard Worker
1121*35238bceSAndroid Build Coastguard Worker if (!stencil && !depth)
1122*35238bceSAndroid Build Coastguard Worker continue;
1123*35238bceSAndroid Build Coastguard Worker
1124*35238bceSAndroid Build Coastguard Worker uint32_t buffers = (depth ? GL_DEPTH_BUFFER_BIT : 0) | (stencil ? GL_STENCIL_BUFFER_BIT : 0);
1125*35238bceSAndroid Build Coastguard Worker
1126*35238bceSAndroid Build Coastguard Worker depthStencilGroup->addChild(new BlitDepthStencilCase(
1127*35238bceSAndroid Build Coastguard Worker m_context, (fmtName + "_basic").c_str(), "", depthFormat, stencilFormat, buffers, IVec2(128, 128),
1128*35238bceSAndroid Build Coastguard Worker IVec4(0, 0, 128, 128), buffers, IVec2(128, 128), IVec4(0, 0, 128, 128), buffers));
1129*35238bceSAndroid Build Coastguard Worker depthStencilGroup->addChild(new BlitDepthStencilCase(
1130*35238bceSAndroid Build Coastguard Worker m_context, (fmtName + "_scale").c_str(), "", depthFormat, stencilFormat, buffers, IVec2(127, 119),
1131*35238bceSAndroid Build Coastguard Worker IVec4(10, 30, 100, 70), buffers, IVec2(111, 130), IVec4(20, 5, 80, 130), buffers));
1132*35238bceSAndroid Build Coastguard Worker
1133*35238bceSAndroid Build Coastguard Worker if (depth && stencil)
1134*35238bceSAndroid Build Coastguard Worker {
1135*35238bceSAndroid Build Coastguard Worker depthStencilGroup->addChild(
1136*35238bceSAndroid Build Coastguard Worker new BlitDepthStencilCase(m_context, (fmtName + "_depth_only").c_str(), "", depthFormat,
1137*35238bceSAndroid Build Coastguard Worker stencilFormat, buffers, IVec2(128, 128), IVec4(0, 0, 128, 128),
1138*35238bceSAndroid Build Coastguard Worker buffers, IVec2(128, 128), IVec4(0, 0, 128, 128), GL_DEPTH_BUFFER_BIT));
1139*35238bceSAndroid Build Coastguard Worker depthStencilGroup->addChild(new BlitDepthStencilCase(
1140*35238bceSAndroid Build Coastguard Worker m_context, (fmtName + "_stencil_only").c_str(), "", depthFormat, stencilFormat, buffers,
1141*35238bceSAndroid Build Coastguard Worker IVec2(128, 128), IVec4(0, 0, 128, 128), buffers, IVec2(128, 128), IVec4(0, 0, 128, 128),
1142*35238bceSAndroid Build Coastguard Worker GL_STENCIL_BUFFER_BIT));
1143*35238bceSAndroid Build Coastguard Worker }
1144*35238bceSAndroid Build Coastguard Worker }
1145*35238bceSAndroid Build Coastguard Worker }
1146*35238bceSAndroid Build Coastguard Worker }
1147*35238bceSAndroid Build Coastguard Worker
1148*35238bceSAndroid Build Coastguard Worker // .default_framebuffer
1149*35238bceSAndroid Build Coastguard Worker {
1150*35238bceSAndroid Build Coastguard Worker static const struct
1151*35238bceSAndroid Build Coastguard Worker {
1152*35238bceSAndroid Build Coastguard Worker const char *name;
1153*35238bceSAndroid Build Coastguard Worker DefaultFramebufferBlitCase::BlitArea area;
1154*35238bceSAndroid Build Coastguard Worker } areas[] = {
1155*35238bceSAndroid Build Coastguard Worker {"scale", DefaultFramebufferBlitCase::AREA_SCALE},
1156*35238bceSAndroid Build Coastguard Worker {"out_of_bounds", DefaultFramebufferBlitCase::AREA_OUT_OF_BOUNDS},
1157*35238bceSAndroid Build Coastguard Worker };
1158*35238bceSAndroid Build Coastguard Worker
1159*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *defaultFbGroup =
1160*35238bceSAndroid Build Coastguard Worker new tcu::TestCaseGroup(m_testCtx, "default_framebuffer", "Blits with default framebuffer");
1161*35238bceSAndroid Build Coastguard Worker addChild(defaultFbGroup);
1162*35238bceSAndroid Build Coastguard Worker
1163*35238bceSAndroid Build Coastguard Worker for (int fmtNdx = 0; fmtNdx < DE_LENGTH_OF_ARRAY(colorFormats); fmtNdx++)
1164*35238bceSAndroid Build Coastguard Worker {
1165*35238bceSAndroid Build Coastguard Worker const uint32_t format = colorFormats[fmtNdx];
1166*35238bceSAndroid Build Coastguard Worker const tcu::TextureFormat texFmt = glu::mapGLInternalFormat(format);
1167*35238bceSAndroid Build Coastguard Worker const tcu::TextureChannelClass fmtClass = tcu::getTextureChannelClass(texFmt.type);
1168*35238bceSAndroid Build Coastguard Worker const uint32_t filter = glu::isGLInternalColorFormatFilterable(format) ? GL_LINEAR : GL_NEAREST;
1169*35238bceSAndroid Build Coastguard Worker const bool filterable = glu::isGLInternalColorFormatFilterable(format);
1170*35238bceSAndroid Build Coastguard Worker
1171*35238bceSAndroid Build Coastguard Worker if (fmtClass != tcu::TEXTURECHANNELCLASS_FLOATING_POINT &&
1172*35238bceSAndroid Build Coastguard Worker fmtClass != tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT &&
1173*35238bceSAndroid Build Coastguard Worker fmtClass != tcu::TEXTURECHANNELCLASS_SIGNED_FIXED_POINT)
1174*35238bceSAndroid Build Coastguard Worker continue; // Conversion not supported.
1175*35238bceSAndroid Build Coastguard Worker
1176*35238bceSAndroid Build Coastguard Worker defaultFbGroup->addChild(
1177*35238bceSAndroid Build Coastguard Worker new BlitDefaultFramebufferCase(m_context, getFormatName(format), "", format, filter));
1178*35238bceSAndroid Build Coastguard Worker
1179*35238bceSAndroid Build Coastguard Worker for (int areaNdx = 0; areaNdx < DE_LENGTH_OF_ARRAY(areas); areaNdx++)
1180*35238bceSAndroid Build Coastguard Worker {
1181*35238bceSAndroid Build Coastguard Worker const string name = string(areas[areaNdx].name);
1182*35238bceSAndroid Build Coastguard Worker const bool addLinear = filterable;
1183*35238bceSAndroid Build Coastguard Worker const bool addNearest =
1184*35238bceSAndroid Build Coastguard Worker !addLinear || (areas[areaNdx].area !=
1185*35238bceSAndroid Build Coastguard Worker DefaultFramebufferBlitCase::
1186*35238bceSAndroid Build Coastguard Worker AREA_OUT_OF_BOUNDS); // No need to check out-of-bounds with different filtering
1187*35238bceSAndroid Build Coastguard Worker
1188*35238bceSAndroid Build Coastguard Worker if (addNearest)
1189*35238bceSAndroid Build Coastguard Worker {
1190*35238bceSAndroid Build Coastguard Worker defaultFbGroup->addChild(new DefaultFramebufferBlitCase(
1191*35238bceSAndroid Build Coastguard Worker m_context,
1192*35238bceSAndroid Build Coastguard Worker (std::string(getFormatName(format)) + "_nearest_" + name + "_blit_from_default").c_str(), "",
1193*35238bceSAndroid Build Coastguard Worker format, GL_NEAREST, DefaultFramebufferBlitCase::BLIT_DEFAULT_TO_TARGET, areas[areaNdx].area));
1194*35238bceSAndroid Build Coastguard Worker defaultFbGroup->addChild(new DefaultFramebufferBlitCase(
1195*35238bceSAndroid Build Coastguard Worker m_context,
1196*35238bceSAndroid Build Coastguard Worker (std::string(getFormatName(format)) + "_nearest_" + name + "_blit_to_default").c_str(), "",
1197*35238bceSAndroid Build Coastguard Worker format, GL_NEAREST, DefaultFramebufferBlitCase::BLIT_TO_DEFAULT_FROM_TARGET,
1198*35238bceSAndroid Build Coastguard Worker areas[areaNdx].area));
1199*35238bceSAndroid Build Coastguard Worker }
1200*35238bceSAndroid Build Coastguard Worker
1201*35238bceSAndroid Build Coastguard Worker if (addLinear)
1202*35238bceSAndroid Build Coastguard Worker {
1203*35238bceSAndroid Build Coastguard Worker defaultFbGroup->addChild(new DefaultFramebufferBlitCase(
1204*35238bceSAndroid Build Coastguard Worker m_context,
1205*35238bceSAndroid Build Coastguard Worker (std::string(getFormatName(format)) + "_linear_" + name + "_blit_from_default").c_str(), "",
1206*35238bceSAndroid Build Coastguard Worker format, GL_LINEAR, DefaultFramebufferBlitCase::BLIT_DEFAULT_TO_TARGET, areas[areaNdx].area));
1207*35238bceSAndroid Build Coastguard Worker defaultFbGroup->addChild(new DefaultFramebufferBlitCase(
1208*35238bceSAndroid Build Coastguard Worker m_context,
1209*35238bceSAndroid Build Coastguard Worker (std::string(getFormatName(format)) + "_linear_" + name + "_blit_to_default").c_str(), "",
1210*35238bceSAndroid Build Coastguard Worker format, GL_LINEAR, DefaultFramebufferBlitCase::BLIT_TO_DEFAULT_FROM_TARGET,
1211*35238bceSAndroid Build Coastguard Worker areas[areaNdx].area));
1212*35238bceSAndroid Build Coastguard Worker }
1213*35238bceSAndroid Build Coastguard Worker }
1214*35238bceSAndroid Build Coastguard Worker }
1215*35238bceSAndroid Build Coastguard Worker }
1216*35238bceSAndroid Build Coastguard Worker }
1217*35238bceSAndroid Build Coastguard Worker
1218*35238bceSAndroid Build Coastguard Worker } // namespace Functional
1219*35238bceSAndroid Build Coastguard Worker } // namespace gles3
1220*35238bceSAndroid Build Coastguard Worker } // namespace deqp
1221