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 "es3fFboStencilbufferTests.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 "tcuTextureUtil.hpp"
29*35238bceSAndroid Build Coastguard Worker #include "sglrContextUtil.hpp"
30*35238bceSAndroid Build Coastguard Worker #include "glwEnums.hpp"
31*35238bceSAndroid Build Coastguard Worker
32*35238bceSAndroid Build Coastguard Worker namespace deqp
33*35238bceSAndroid Build Coastguard Worker {
34*35238bceSAndroid Build Coastguard Worker namespace gles3
35*35238bceSAndroid Build Coastguard Worker {
36*35238bceSAndroid Build Coastguard Worker namespace Functional
37*35238bceSAndroid Build Coastguard Worker {
38*35238bceSAndroid Build Coastguard Worker
39*35238bceSAndroid Build Coastguard Worker using std::string;
40*35238bceSAndroid Build Coastguard Worker using tcu::IVec2;
41*35238bceSAndroid Build Coastguard Worker using tcu::IVec3;
42*35238bceSAndroid Build Coastguard Worker using tcu::IVec4;
43*35238bceSAndroid Build Coastguard Worker using tcu::UVec4;
44*35238bceSAndroid Build Coastguard Worker using tcu::Vec2;
45*35238bceSAndroid Build Coastguard Worker using tcu::Vec3;
46*35238bceSAndroid Build Coastguard Worker using tcu::Vec4;
47*35238bceSAndroid Build Coastguard Worker using namespace FboTestUtil;
48*35238bceSAndroid Build Coastguard Worker
49*35238bceSAndroid Build Coastguard Worker class BasicFboStencilCase : public FboTestCase
50*35238bceSAndroid Build Coastguard Worker {
51*35238bceSAndroid Build Coastguard Worker public:
BasicFboStencilCase(Context & context,const char * name,const char * desc,uint32_t format,IVec2 size,bool useDepth)52*35238bceSAndroid Build Coastguard Worker BasicFboStencilCase(Context &context, const char *name, const char *desc, uint32_t format, IVec2 size,
53*35238bceSAndroid Build Coastguard Worker bool useDepth)
54*35238bceSAndroid Build Coastguard Worker : FboTestCase(context, name, desc)
55*35238bceSAndroid Build Coastguard Worker , m_format(format)
56*35238bceSAndroid Build Coastguard Worker , m_size(size)
57*35238bceSAndroid Build Coastguard Worker , m_useDepth(useDepth)
58*35238bceSAndroid Build Coastguard Worker {
59*35238bceSAndroid Build Coastguard Worker }
60*35238bceSAndroid Build Coastguard Worker
61*35238bceSAndroid Build Coastguard Worker protected:
preCheck(void)62*35238bceSAndroid Build Coastguard Worker void preCheck(void)
63*35238bceSAndroid Build Coastguard Worker {
64*35238bceSAndroid Build Coastguard Worker checkFormatSupport(m_format);
65*35238bceSAndroid Build Coastguard Worker }
66*35238bceSAndroid Build Coastguard Worker
render(tcu::Surface & dst)67*35238bceSAndroid Build Coastguard Worker void render(tcu::Surface &dst)
68*35238bceSAndroid Build Coastguard Worker {
69*35238bceSAndroid Build Coastguard Worker const uint32_t colorFormat = GL_RGBA8;
70*35238bceSAndroid Build Coastguard Worker
71*35238bceSAndroid Build Coastguard Worker GradientShader gradShader(glu::TYPE_FLOAT_VEC4);
72*35238bceSAndroid Build Coastguard Worker FlatColorShader flatShader(glu::TYPE_FLOAT_VEC4);
73*35238bceSAndroid Build Coastguard Worker uint32_t flatShaderID = getCurrentContext()->createProgram(&flatShader);
74*35238bceSAndroid Build Coastguard Worker uint32_t gradShaderID = getCurrentContext()->createProgram(&gradShader);
75*35238bceSAndroid Build Coastguard Worker
76*35238bceSAndroid Build Coastguard Worker uint32_t fbo = 0;
77*35238bceSAndroid Build Coastguard Worker uint32_t colorRbo = 0;
78*35238bceSAndroid Build Coastguard Worker uint32_t depthStencilRbo = 0;
79*35238bceSAndroid Build Coastguard Worker
80*35238bceSAndroid Build Coastguard Worker // Colorbuffer.
81*35238bceSAndroid Build Coastguard Worker glGenRenderbuffers(1, &colorRbo);
82*35238bceSAndroid Build Coastguard Worker glBindRenderbuffer(GL_RENDERBUFFER, colorRbo);
83*35238bceSAndroid Build Coastguard Worker glRenderbufferStorage(GL_RENDERBUFFER, colorFormat, m_size.x(), m_size.y());
84*35238bceSAndroid Build Coastguard Worker
85*35238bceSAndroid Build Coastguard Worker // Stencil (and depth) buffer.
86*35238bceSAndroid Build Coastguard Worker glGenRenderbuffers(1, &depthStencilRbo);
87*35238bceSAndroid Build Coastguard Worker glBindRenderbuffer(GL_RENDERBUFFER, depthStencilRbo);
88*35238bceSAndroid Build Coastguard Worker glRenderbufferStorage(GL_RENDERBUFFER, m_format, m_size.x(), m_size.y());
89*35238bceSAndroid Build Coastguard Worker
90*35238bceSAndroid Build Coastguard Worker // Framebuffer.
91*35238bceSAndroid Build Coastguard Worker glGenFramebuffers(1, &fbo);
92*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_FRAMEBUFFER, fbo);
93*35238bceSAndroid Build Coastguard Worker glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorRbo);
94*35238bceSAndroid Build Coastguard Worker glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, depthStencilRbo);
95*35238bceSAndroid Build Coastguard Worker if (m_useDepth)
96*35238bceSAndroid Build Coastguard Worker glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthStencilRbo);
97*35238bceSAndroid Build Coastguard Worker checkError();
98*35238bceSAndroid Build Coastguard Worker checkFramebufferStatus(GL_FRAMEBUFFER);
99*35238bceSAndroid Build Coastguard Worker
100*35238bceSAndroid Build Coastguard Worker glViewport(0, 0, m_size.x(), m_size.y());
101*35238bceSAndroid Build Coastguard Worker
102*35238bceSAndroid Build Coastguard Worker // Clear framebuffer.
103*35238bceSAndroid Build Coastguard Worker glClearBufferfv(GL_COLOR, 0, Vec4(0.0f).getPtr());
104*35238bceSAndroid Build Coastguard Worker glClearBufferfi(GL_DEPTH_STENCIL, 0, 1.0f, 0);
105*35238bceSAndroid Build Coastguard Worker
106*35238bceSAndroid Build Coastguard Worker // Render intersecting quads - increment stencil on depth pass
107*35238bceSAndroid Build Coastguard Worker glEnable(GL_DEPTH_TEST);
108*35238bceSAndroid Build Coastguard Worker glEnable(GL_STENCIL_TEST);
109*35238bceSAndroid Build Coastguard Worker glStencilFunc(GL_ALWAYS, 0, 0xffu);
110*35238bceSAndroid Build Coastguard Worker glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
111*35238bceSAndroid Build Coastguard Worker
112*35238bceSAndroid Build Coastguard Worker flatShader.setColor(*getCurrentContext(), flatShaderID, Vec4(1.0f, 0.0f, 0.0f, 1.0f));
113*35238bceSAndroid Build Coastguard Worker sglr::drawQuad(*getCurrentContext(), flatShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(+1.0f, +1.0f, 0.0f));
114*35238bceSAndroid Build Coastguard Worker
115*35238bceSAndroid Build Coastguard Worker gradShader.setGradient(*getCurrentContext(), gradShaderID, Vec4(0.0f), Vec4(1.0f));
116*35238bceSAndroid Build Coastguard Worker sglr::drawQuad(*getCurrentContext(), gradShaderID, Vec3(-1.0f, -1.0f, -1.0f), Vec3(+1.0f, +1.0f, +1.0f));
117*35238bceSAndroid Build Coastguard Worker
118*35238bceSAndroid Build Coastguard Worker glDisable(GL_DEPTH_TEST);
119*35238bceSAndroid Build Coastguard Worker
120*35238bceSAndroid Build Coastguard Worker // Draw quad with stencil test (stencil == 1 or 2 depending on depth) - decrement on stencil failure
121*35238bceSAndroid Build Coastguard Worker glStencilFunc(GL_EQUAL, m_useDepth ? 2 : 1, 0xffu);
122*35238bceSAndroid Build Coastguard Worker glStencilOp(GL_DECR, GL_KEEP, GL_KEEP);
123*35238bceSAndroid Build Coastguard Worker
124*35238bceSAndroid Build Coastguard Worker flatShader.setColor(*getCurrentContext(), flatShaderID, Vec4(0.0f, 1.0f, 0.0f, 1.0));
125*35238bceSAndroid Build Coastguard Worker sglr::drawQuad(*getCurrentContext(), flatShaderID, Vec3(-0.5f, -0.5f, 0.0f), Vec3(+0.5f, +0.5f, 0.0f));
126*35238bceSAndroid Build Coastguard Worker
127*35238bceSAndroid Build Coastguard Worker // Draw quad with stencil test where stencil > 1 or 2 depending on depth buffer
128*35238bceSAndroid Build Coastguard Worker glStencilFunc(GL_GREATER, m_useDepth ? 1 : 2, 0xffu);
129*35238bceSAndroid Build Coastguard Worker
130*35238bceSAndroid Build Coastguard Worker flatShader.setColor(*getCurrentContext(), flatShaderID, Vec4(0.0f, 0.0f, 1.0f, 1.0f));
131*35238bceSAndroid Build Coastguard Worker sglr::drawQuad(*getCurrentContext(), flatShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(+1.0f, +1.0f, 0.0f));
132*35238bceSAndroid Build Coastguard Worker
133*35238bceSAndroid Build Coastguard Worker readPixels(dst, 0, 0, m_size.x(), m_size.y(), glu::mapGLInternalFormat(colorFormat), Vec4(1.0f), Vec4(0.0f));
134*35238bceSAndroid Build Coastguard Worker }
135*35238bceSAndroid Build Coastguard Worker
136*35238bceSAndroid Build Coastguard Worker private:
137*35238bceSAndroid Build Coastguard Worker uint32_t m_format;
138*35238bceSAndroid Build Coastguard Worker IVec2 m_size;
139*35238bceSAndroid Build Coastguard Worker bool m_useDepth;
140*35238bceSAndroid Build Coastguard Worker };
141*35238bceSAndroid Build Coastguard Worker
142*35238bceSAndroid Build Coastguard Worker class DepthStencilAttachCase : public FboTestCase
143*35238bceSAndroid Build Coastguard Worker {
144*35238bceSAndroid Build Coastguard Worker public:
DepthStencilAttachCase(Context & context,const char * name,const char * desc,uint32_t attachDepth,uint32_t attachStencil)145*35238bceSAndroid Build Coastguard Worker DepthStencilAttachCase(Context &context, const char *name, const char *desc, uint32_t attachDepth,
146*35238bceSAndroid Build Coastguard Worker uint32_t attachStencil)
147*35238bceSAndroid Build Coastguard Worker : FboTestCase(context, name, desc)
148*35238bceSAndroid Build Coastguard Worker , m_attachDepth(attachDepth)
149*35238bceSAndroid Build Coastguard Worker , m_attachStencil(attachStencil)
150*35238bceSAndroid Build Coastguard Worker {
151*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_attachDepth == GL_DEPTH_ATTACHMENT || m_attachDepth == GL_DEPTH_STENCIL_ATTACHMENT ||
152*35238bceSAndroid Build Coastguard Worker m_attachDepth == GL_NONE);
153*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_attachStencil == GL_STENCIL_ATTACHMENT || m_attachStencil == GL_NONE);
154*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_attachDepth != GL_DEPTH_STENCIL || m_attachStencil == GL_NONE);
155*35238bceSAndroid Build Coastguard Worker }
156*35238bceSAndroid Build Coastguard Worker
157*35238bceSAndroid Build Coastguard Worker protected:
render(tcu::Surface & dst)158*35238bceSAndroid Build Coastguard Worker void render(tcu::Surface &dst)
159*35238bceSAndroid Build Coastguard Worker {
160*35238bceSAndroid Build Coastguard Worker const uint32_t colorFormat = GL_RGBA8;
161*35238bceSAndroid Build Coastguard Worker const uint32_t depthStencilFormat = GL_DEPTH24_STENCIL8;
162*35238bceSAndroid Build Coastguard Worker const int width = 128;
163*35238bceSAndroid Build Coastguard Worker const int height = 128;
164*35238bceSAndroid Build Coastguard Worker const bool hasDepth = (m_attachDepth == GL_DEPTH_STENCIL || m_attachDepth == GL_DEPTH_ATTACHMENT);
165*35238bceSAndroid Build Coastguard Worker // const bool hasStencil = (m_attachDepth == GL_DEPTH_STENCIL || m_attachStencil == GL_DEPTH_STENCIL_ATTACHMENT);
166*35238bceSAndroid Build Coastguard Worker
167*35238bceSAndroid Build Coastguard Worker GradientShader gradShader(glu::TYPE_FLOAT_VEC4);
168*35238bceSAndroid Build Coastguard Worker FlatColorShader flatShader(glu::TYPE_FLOAT_VEC4);
169*35238bceSAndroid Build Coastguard Worker uint32_t flatShaderID = getCurrentContext()->createProgram(&flatShader);
170*35238bceSAndroid Build Coastguard Worker uint32_t gradShaderID = getCurrentContext()->createProgram(&gradShader);
171*35238bceSAndroid Build Coastguard Worker
172*35238bceSAndroid Build Coastguard Worker uint32_t fbo = 0;
173*35238bceSAndroid Build Coastguard Worker uint32_t colorRbo = 0;
174*35238bceSAndroid Build Coastguard Worker uint32_t depthStencilRbo = 0;
175*35238bceSAndroid Build Coastguard Worker
176*35238bceSAndroid Build Coastguard Worker // Colorbuffer.
177*35238bceSAndroid Build Coastguard Worker glGenRenderbuffers(1, &colorRbo);
178*35238bceSAndroid Build Coastguard Worker glBindRenderbuffer(GL_RENDERBUFFER, colorRbo);
179*35238bceSAndroid Build Coastguard Worker glRenderbufferStorage(GL_RENDERBUFFER, colorFormat, width, height);
180*35238bceSAndroid Build Coastguard Worker
181*35238bceSAndroid Build Coastguard Worker // Depth-stencil buffer.
182*35238bceSAndroid Build Coastguard Worker glGenRenderbuffers(1, &depthStencilRbo);
183*35238bceSAndroid Build Coastguard Worker glBindRenderbuffer(GL_RENDERBUFFER, depthStencilRbo);
184*35238bceSAndroid Build Coastguard Worker glRenderbufferStorage(GL_RENDERBUFFER, depthStencilFormat, width, height);
185*35238bceSAndroid Build Coastguard Worker
186*35238bceSAndroid Build Coastguard Worker // Framebuffer.
187*35238bceSAndroid Build Coastguard Worker glGenFramebuffers(1, &fbo);
188*35238bceSAndroid Build Coastguard Worker glBindFramebuffer(GL_FRAMEBUFFER, fbo);
189*35238bceSAndroid Build Coastguard Worker glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorRbo);
190*35238bceSAndroid Build Coastguard Worker
191*35238bceSAndroid Build Coastguard Worker if (m_attachDepth != GL_NONE)
192*35238bceSAndroid Build Coastguard Worker glFramebufferRenderbuffer(GL_FRAMEBUFFER, m_attachDepth, GL_RENDERBUFFER, depthStencilRbo);
193*35238bceSAndroid Build Coastguard Worker if (m_attachStencil != GL_NONE)
194*35238bceSAndroid Build Coastguard Worker glFramebufferRenderbuffer(GL_FRAMEBUFFER, m_attachStencil, GL_RENDERBUFFER, depthStencilRbo);
195*35238bceSAndroid Build Coastguard Worker
196*35238bceSAndroid Build Coastguard Worker checkError();
197*35238bceSAndroid Build Coastguard Worker checkFramebufferStatus(GL_FRAMEBUFFER);
198*35238bceSAndroid Build Coastguard Worker
199*35238bceSAndroid Build Coastguard Worker glViewport(0, 0, width, height);
200*35238bceSAndroid Build Coastguard Worker
201*35238bceSAndroid Build Coastguard Worker // Clear framebuffer.
202*35238bceSAndroid Build Coastguard Worker glClearBufferfv(GL_COLOR, 0, Vec4(0.0f).getPtr());
203*35238bceSAndroid Build Coastguard Worker glClearBufferfi(GL_DEPTH_STENCIL, 0, 1.0f, 0);
204*35238bceSAndroid Build Coastguard Worker
205*35238bceSAndroid Build Coastguard Worker // Render intersecting quads - increment stencil on depth pass
206*35238bceSAndroid Build Coastguard Worker glEnable(GL_DEPTH_TEST);
207*35238bceSAndroid Build Coastguard Worker glEnable(GL_STENCIL_TEST);
208*35238bceSAndroid Build Coastguard Worker glStencilFunc(GL_ALWAYS, 0, 0xffu);
209*35238bceSAndroid Build Coastguard Worker glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
210*35238bceSAndroid Build Coastguard Worker
211*35238bceSAndroid Build Coastguard Worker flatShader.setColor(*getCurrentContext(), flatShaderID, Vec4(1.0f, 0.0f, 0.0f, 1.0f));
212*35238bceSAndroid Build Coastguard Worker sglr::drawQuad(*getCurrentContext(), flatShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(+1.0f, +1.0f, 0.0f));
213*35238bceSAndroid Build Coastguard Worker
214*35238bceSAndroid Build Coastguard Worker gradShader.setGradient(*getCurrentContext(), gradShaderID, Vec4(0.0f), Vec4(1.0f));
215*35238bceSAndroid Build Coastguard Worker sglr::drawQuad(*getCurrentContext(), gradShaderID, Vec3(-1.0f, -1.0f, -1.0f), Vec3(+1.0f, +1.0f, +1.0f));
216*35238bceSAndroid Build Coastguard Worker
217*35238bceSAndroid Build Coastguard Worker glDisable(GL_DEPTH_TEST);
218*35238bceSAndroid Build Coastguard Worker
219*35238bceSAndroid Build Coastguard Worker // Draw quad with stencil test (stencil == 1 or 2 depending on depth) - decrement on stencil failure
220*35238bceSAndroid Build Coastguard Worker glStencilFunc(GL_EQUAL, hasDepth ? 2 : 1, 0xffu);
221*35238bceSAndroid Build Coastguard Worker glStencilOp(GL_DECR, GL_KEEP, GL_KEEP);
222*35238bceSAndroid Build Coastguard Worker
223*35238bceSAndroid Build Coastguard Worker flatShader.setColor(*getCurrentContext(), flatShaderID, Vec4(0.0f, 1.0f, 0.0f, 1.0));
224*35238bceSAndroid Build Coastguard Worker sglr::drawQuad(*getCurrentContext(), flatShaderID, Vec3(-0.5f, -0.5f, 0.0f), Vec3(+0.5f, +0.5f, 0.0f));
225*35238bceSAndroid Build Coastguard Worker
226*35238bceSAndroid Build Coastguard Worker // Draw quad with stencil test where stencil > 1 or 2 depending on depth buffer
227*35238bceSAndroid Build Coastguard Worker glStencilFunc(GL_GREATER, hasDepth ? 1 : 2, 0xffu);
228*35238bceSAndroid Build Coastguard Worker
229*35238bceSAndroid Build Coastguard Worker flatShader.setColor(*getCurrentContext(), flatShaderID, Vec4(0.0f, 0.0f, 1.0f, 1.0f));
230*35238bceSAndroid Build Coastguard Worker sglr::drawQuad(*getCurrentContext(), flatShaderID, Vec3(-1.0f, -1.0f, 0.0f), Vec3(+1.0f, +1.0f, 0.0f));
231*35238bceSAndroid Build Coastguard Worker
232*35238bceSAndroid Build Coastguard Worker readPixels(dst, 0, 0, width, height, glu::mapGLInternalFormat(colorFormat), Vec4(1.0f), Vec4(0.0f));
233*35238bceSAndroid Build Coastguard Worker }
234*35238bceSAndroid Build Coastguard Worker
235*35238bceSAndroid Build Coastguard Worker private:
236*35238bceSAndroid Build Coastguard Worker uint32_t m_attachDepth;
237*35238bceSAndroid Build Coastguard Worker uint32_t m_attachStencil;
238*35238bceSAndroid Build Coastguard Worker };
239*35238bceSAndroid Build Coastguard Worker
FboStencilTests(Context & context)240*35238bceSAndroid Build Coastguard Worker FboStencilTests::FboStencilTests(Context &context) : TestCaseGroup(context, "stencil", "FBO Stencilbuffer tests")
241*35238bceSAndroid Build Coastguard Worker {
242*35238bceSAndroid Build Coastguard Worker }
243*35238bceSAndroid Build Coastguard Worker
~FboStencilTests(void)244*35238bceSAndroid Build Coastguard Worker FboStencilTests::~FboStencilTests(void)
245*35238bceSAndroid Build Coastguard Worker {
246*35238bceSAndroid Build Coastguard Worker }
247*35238bceSAndroid Build Coastguard Worker
init(void)248*35238bceSAndroid Build Coastguard Worker void FboStencilTests::init(void)
249*35238bceSAndroid Build Coastguard Worker {
250*35238bceSAndroid Build Coastguard Worker static const uint32_t stencilFormats[] = {GL_DEPTH32F_STENCIL8, GL_DEPTH24_STENCIL8, GL_STENCIL_INDEX8};
251*35238bceSAndroid Build Coastguard Worker
252*35238bceSAndroid Build Coastguard Worker // .basic
253*35238bceSAndroid Build Coastguard Worker {
254*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *basicGroup = new tcu::TestCaseGroup(m_testCtx, "basic", "Basic stencil tests");
255*35238bceSAndroid Build Coastguard Worker addChild(basicGroup);
256*35238bceSAndroid Build Coastguard Worker
257*35238bceSAndroid Build Coastguard Worker for (int fmtNdx = 0; fmtNdx < DE_LENGTH_OF_ARRAY(stencilFormats); fmtNdx++)
258*35238bceSAndroid Build Coastguard Worker {
259*35238bceSAndroid Build Coastguard Worker uint32_t format = stencilFormats[fmtNdx];
260*35238bceSAndroid Build Coastguard Worker tcu::TextureFormat texFmt = glu::mapGLInternalFormat(format);
261*35238bceSAndroid Build Coastguard Worker
262*35238bceSAndroid Build Coastguard Worker basicGroup->addChild(
263*35238bceSAndroid Build Coastguard Worker new BasicFboStencilCase(m_context, getFormatName(format), "", format, IVec2(111, 132), false));
264*35238bceSAndroid Build Coastguard Worker
265*35238bceSAndroid Build Coastguard Worker if (texFmt.order == tcu::TextureFormat::DS)
266*35238bceSAndroid Build Coastguard Worker basicGroup->addChild(new BasicFboStencilCase(
267*35238bceSAndroid Build Coastguard Worker m_context, (string(getFormatName(format)) + "_depth").c_str(), "", format, IVec2(111, 132), true));
268*35238bceSAndroid Build Coastguard Worker }
269*35238bceSAndroid Build Coastguard Worker }
270*35238bceSAndroid Build Coastguard Worker
271*35238bceSAndroid Build Coastguard Worker // .attach
272*35238bceSAndroid Build Coastguard Worker {
273*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *attachGroup = new tcu::TestCaseGroup(m_testCtx, "attach", "Attaching depth stencil");
274*35238bceSAndroid Build Coastguard Worker addChild(attachGroup);
275*35238bceSAndroid Build Coastguard Worker
276*35238bceSAndroid Build Coastguard Worker attachGroup->addChild(new DepthStencilAttachCase(
277*35238bceSAndroid Build Coastguard Worker m_context, "depth_only", "Only depth part of depth-stencil RBO attached", GL_DEPTH_ATTACHMENT, GL_NONE));
278*35238bceSAndroid Build Coastguard Worker attachGroup->addChild(new DepthStencilAttachCase(m_context, "stencil_only",
279*35238bceSAndroid Build Coastguard Worker "Only stencil part of depth-stencil RBO attached", GL_NONE,
280*35238bceSAndroid Build Coastguard Worker GL_STENCIL_ATTACHMENT));
281*35238bceSAndroid Build Coastguard Worker attachGroup->addChild(new DepthStencilAttachCase(m_context, "depth_stencil_separate",
282*35238bceSAndroid Build Coastguard Worker "Depth and stencil attached separately", GL_DEPTH_ATTACHMENT,
283*35238bceSAndroid Build Coastguard Worker GL_STENCIL_ATTACHMENT));
284*35238bceSAndroid Build Coastguard Worker attachGroup->addChild(new DepthStencilAttachCase(m_context, "depth_stencil_attachment",
285*35238bceSAndroid Build Coastguard Worker "Depth and stencil attached with DEPTH_STENCIL_ATTACHMENT",
286*35238bceSAndroid Build Coastguard Worker GL_DEPTH_STENCIL_ATTACHMENT, GL_NONE));
287*35238bceSAndroid Build Coastguard Worker }
288*35238bceSAndroid Build Coastguard Worker }
289*35238bceSAndroid Build Coastguard Worker
290*35238bceSAndroid Build Coastguard Worker } // namespace Functional
291*35238bceSAndroid Build Coastguard Worker } // namespace gles3
292*35238bceSAndroid Build Coastguard Worker } // namespace deqp
293