1*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
2*35238bceSAndroid Build Coastguard Worker * drawElements Quality Program OpenGL (ES) 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 Framebuffer completeness tests.
22*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker
24*35238bceSAndroid Build Coastguard Worker #include "glsFboCompletenessTests.hpp"
25*35238bceSAndroid Build Coastguard Worker
26*35238bceSAndroid Build Coastguard Worker #include "gluStrUtil.hpp"
27*35238bceSAndroid Build Coastguard Worker #include "gluObjectWrapper.hpp"
28*35238bceSAndroid Build Coastguard Worker #include "deStringUtil.hpp"
29*35238bceSAndroid Build Coastguard Worker
30*35238bceSAndroid Build Coastguard Worker #include <cctype>
31*35238bceSAndroid Build Coastguard Worker #include <iterator>
32*35238bceSAndroid Build Coastguard Worker #include <algorithm>
33*35238bceSAndroid Build Coastguard Worker
34*35238bceSAndroid Build Coastguard Worker using namespace glw;
35*35238bceSAndroid Build Coastguard Worker using de::toLower;
36*35238bceSAndroid Build Coastguard Worker using de::toString;
37*35238bceSAndroid Build Coastguard Worker using glu::Framebuffer;
38*35238bceSAndroid Build Coastguard Worker using glu::getErrorName;
39*35238bceSAndroid Build Coastguard Worker using glu::getFramebufferStatusName;
40*35238bceSAndroid Build Coastguard Worker using glu::getTextureFormatName;
41*35238bceSAndroid Build Coastguard Worker using glu::getTypeName;
42*35238bceSAndroid Build Coastguard Worker using glu::RenderContext;
43*35238bceSAndroid Build Coastguard Worker using std::string;
44*35238bceSAndroid Build Coastguard Worker using tcu::MessageBuilder;
45*35238bceSAndroid Build Coastguard Worker using tcu::TestCase;
46*35238bceSAndroid Build Coastguard Worker using tcu::TestCaseGroup;
47*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
48*35238bceSAndroid Build Coastguard Worker using tcu::TestNode;
49*35238bceSAndroid Build Coastguard Worker using namespace deqp::gls::FboUtil;
50*35238bceSAndroid Build Coastguard Worker using namespace deqp::gls::FboUtil::config;
51*35238bceSAndroid Build Coastguard Worker typedef TestCase::IterateResult IterateResult;
52*35238bceSAndroid Build Coastguard Worker
53*35238bceSAndroid Build Coastguard Worker namespace deqp
54*35238bceSAndroid Build Coastguard Worker {
55*35238bceSAndroid Build Coastguard Worker namespace gls
56*35238bceSAndroid Build Coastguard Worker {
57*35238bceSAndroid Build Coastguard Worker namespace fboc
58*35238bceSAndroid Build Coastguard Worker {
59*35238bceSAndroid Build Coastguard Worker
60*35238bceSAndroid Build Coastguard Worker namespace details
61*35238bceSAndroid Build Coastguard Worker {
62*35238bceSAndroid Build Coastguard Worker
63*35238bceSAndroid Build Coastguard Worker // The following extensions are applicable both to ES2 and ES3.
64*35238bceSAndroid Build Coastguard Worker
65*35238bceSAndroid Build Coastguard Worker // GL_OES_depth_texture
66*35238bceSAndroid Build Coastguard Worker static const FormatKey s_oesDepthTextureFormats[] = {
67*35238bceSAndroid Build Coastguard Worker GLS_UNSIZED_FORMATKEY(GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT),
68*35238bceSAndroid Build Coastguard Worker GLS_UNSIZED_FORMATKEY(GL_DEPTH_COMPONENT, GL_UNSIGNED_INT),
69*35238bceSAndroid Build Coastguard Worker };
70*35238bceSAndroid Build Coastguard Worker
71*35238bceSAndroid Build Coastguard Worker // GL_OES_packed_depth_stencil
72*35238bceSAndroid Build Coastguard Worker static const FormatKey s_oesPackedDepthStencilSizedFormats[] = {
73*35238bceSAndroid Build Coastguard Worker GL_DEPTH24_STENCIL8,
74*35238bceSAndroid Build Coastguard Worker };
75*35238bceSAndroid Build Coastguard Worker
76*35238bceSAndroid Build Coastguard Worker static const FormatKey s_oesPackedDepthStencilTexFormats[] = {
77*35238bceSAndroid Build Coastguard Worker GLS_UNSIZED_FORMATKEY(GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8),
78*35238bceSAndroid Build Coastguard Worker };
79*35238bceSAndroid Build Coastguard Worker
80*35238bceSAndroid Build Coastguard Worker // GL_OES_required_internalformat
81*35238bceSAndroid Build Coastguard Worker static const FormatKey s_oesRequiredInternalFormatColorFormats[] = {
82*35238bceSAndroid Build Coastguard Worker // Same as ES2 RBO formats, plus RGBA8 (even without OES_rgb8_rgba8)
83*35238bceSAndroid Build Coastguard Worker GL_RGB5_A1, GL_RGBA8, GL_RGBA4, GL_RGB565};
84*35238bceSAndroid Build Coastguard Worker
85*35238bceSAndroid Build Coastguard Worker static const FormatKey s_oesRequiredInternalFormatDepthFormats[] = {
86*35238bceSAndroid Build Coastguard Worker GL_DEPTH_COMPONENT16,
87*35238bceSAndroid Build Coastguard Worker };
88*35238bceSAndroid Build Coastguard Worker
89*35238bceSAndroid Build Coastguard Worker // GL_EXT_color_buffer_half_float
90*35238bceSAndroid Build Coastguard Worker static const FormatKey s_extColorBufferHalfFloatFormats[] = {
91*35238bceSAndroid Build Coastguard Worker GL_RGBA16F,
92*35238bceSAndroid Build Coastguard Worker GL_RGB16F,
93*35238bceSAndroid Build Coastguard Worker GL_RG16F,
94*35238bceSAndroid Build Coastguard Worker GL_R16F,
95*35238bceSAndroid Build Coastguard Worker };
96*35238bceSAndroid Build Coastguard Worker
97*35238bceSAndroid Build Coastguard Worker static const FormatKey s_oesDepth24SizedFormats[] = {GL_DEPTH_COMPONENT24};
98*35238bceSAndroid Build Coastguard Worker
99*35238bceSAndroid Build Coastguard Worker static const FormatKey s_oesDepth32SizedFormats[] = {GL_DEPTH_COMPONENT32};
100*35238bceSAndroid Build Coastguard Worker
101*35238bceSAndroid Build Coastguard Worker static const FormatKey s_oesRgb8Rgba8RboFormats[] = {
102*35238bceSAndroid Build Coastguard Worker GL_RGB8,
103*35238bceSAndroid Build Coastguard Worker GL_RGBA8,
104*35238bceSAndroid Build Coastguard Worker };
105*35238bceSAndroid Build Coastguard Worker
106*35238bceSAndroid Build Coastguard Worker static const FormatKey s_oesRequiredInternalFormatRgb8ColorFormat[] = {
107*35238bceSAndroid Build Coastguard Worker GL_RGB8,
108*35238bceSAndroid Build Coastguard Worker };
109*35238bceSAndroid Build Coastguard Worker
110*35238bceSAndroid Build Coastguard Worker static const FormatKey s_extTextureType2101010RevFormats[] = {
111*35238bceSAndroid Build Coastguard Worker GLS_UNSIZED_FORMATKEY(GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV),
112*35238bceSAndroid Build Coastguard Worker GLS_UNSIZED_FORMATKEY(GL_RGB, GL_UNSIGNED_INT_2_10_10_10_REV),
113*35238bceSAndroid Build Coastguard Worker };
114*35238bceSAndroid Build Coastguard Worker
115*35238bceSAndroid Build Coastguard Worker static const FormatKey s_oesRequiredInternalFormat10bitColorFormats[] = {
116*35238bceSAndroid Build Coastguard Worker GL_RGB10_A2,
117*35238bceSAndroid Build Coastguard Worker GL_RGB10,
118*35238bceSAndroid Build Coastguard Worker };
119*35238bceSAndroid Build Coastguard Worker
120*35238bceSAndroid Build Coastguard Worker static const FormatKey s_extTextureRgRboFormats[] = {
121*35238bceSAndroid Build Coastguard Worker GL_R8,
122*35238bceSAndroid Build Coastguard Worker GL_RG8,
123*35238bceSAndroid Build Coastguard Worker };
124*35238bceSAndroid Build Coastguard Worker
125*35238bceSAndroid Build Coastguard Worker static const FormatKey s_extTextureRgTexFormats[] = {
126*35238bceSAndroid Build Coastguard Worker GLS_UNSIZED_FORMATKEY(GL_RED, GL_UNSIGNED_BYTE),
127*35238bceSAndroid Build Coastguard Worker GLS_UNSIZED_FORMATKEY(GL_RG, GL_UNSIGNED_BYTE),
128*35238bceSAndroid Build Coastguard Worker };
129*35238bceSAndroid Build Coastguard Worker
130*35238bceSAndroid Build Coastguard Worker static const FormatKey s_extTextureRgFloatTexFormats[] = {
131*35238bceSAndroid Build Coastguard Worker GLS_UNSIZED_FORMATKEY(GL_RED, GL_FLOAT),
132*35238bceSAndroid Build Coastguard Worker GLS_UNSIZED_FORMATKEY(GL_RG, GL_FLOAT),
133*35238bceSAndroid Build Coastguard Worker };
134*35238bceSAndroid Build Coastguard Worker
135*35238bceSAndroid Build Coastguard Worker static const FormatKey s_extTextureRgHalfFloatTexFormats[] = {
136*35238bceSAndroid Build Coastguard Worker GLS_UNSIZED_FORMATKEY(GL_RED, GL_HALF_FLOAT_OES),
137*35238bceSAndroid Build Coastguard Worker GLS_UNSIZED_FORMATKEY(GL_RG, GL_HALF_FLOAT_OES),
138*35238bceSAndroid Build Coastguard Worker };
139*35238bceSAndroid Build Coastguard Worker
140*35238bceSAndroid Build Coastguard Worker static const FormatKey s_nvPackedFloatRboFormats[] = {
141*35238bceSAndroid Build Coastguard Worker GL_R11F_G11F_B10F,
142*35238bceSAndroid Build Coastguard Worker };
143*35238bceSAndroid Build Coastguard Worker
144*35238bceSAndroid Build Coastguard Worker static const FormatKey s_nvPackedFloatTexFormats[] = {
145*35238bceSAndroid Build Coastguard Worker GLS_UNSIZED_FORMATKEY(GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV),
146*35238bceSAndroid Build Coastguard Worker };
147*35238bceSAndroid Build Coastguard Worker
148*35238bceSAndroid Build Coastguard Worker static const FormatKey s_extSrgbRboFormats[] = {
149*35238bceSAndroid Build Coastguard Worker GL_SRGB8_ALPHA8,
150*35238bceSAndroid Build Coastguard Worker };
151*35238bceSAndroid Build Coastguard Worker
152*35238bceSAndroid Build Coastguard Worker static const FormatKey s_extSrgbRenderableTexFormats[] = {
153*35238bceSAndroid Build Coastguard Worker GLS_UNSIZED_FORMATKEY(GL_SRGB_ALPHA, GL_UNSIGNED_BYTE),
154*35238bceSAndroid Build Coastguard Worker };
155*35238bceSAndroid Build Coastguard Worker
156*35238bceSAndroid Build Coastguard Worker static const FormatKey s_extSrgbNonRenderableTexFormats[] = {
157*35238bceSAndroid Build Coastguard Worker GLS_UNSIZED_FORMATKEY(GL_SRGB, GL_UNSIGNED_BYTE),
158*35238bceSAndroid Build Coastguard Worker };
159*35238bceSAndroid Build Coastguard Worker
160*35238bceSAndroid Build Coastguard Worker static const FormatKey s_nvSrgbFormatsRboFormats[] = {
161*35238bceSAndroid Build Coastguard Worker GL_SRGB8,
162*35238bceSAndroid Build Coastguard Worker };
163*35238bceSAndroid Build Coastguard Worker
164*35238bceSAndroid Build Coastguard Worker static const FormatKey s_nvSrgbFormatsTextureFormats[] = {
165*35238bceSAndroid Build Coastguard Worker GL_SRGB8,
166*35238bceSAndroid Build Coastguard Worker
167*35238bceSAndroid Build Coastguard Worker // The extension does not actually require any unsized format
168*35238bceSAndroid Build Coastguard Worker // to be renderable. However, the renderablility of unsized
169*35238bceSAndroid Build Coastguard Worker // SRGB,UBYTE internalformat-type pair is implied.
170*35238bceSAndroid Build Coastguard Worker GLS_UNSIZED_FORMATKEY(GL_SRGB, GL_UNSIGNED_BYTE),
171*35238bceSAndroid Build Coastguard Worker };
172*35238bceSAndroid Build Coastguard Worker
173*35238bceSAndroid Build Coastguard Worker static const FormatKey s_oesRgb8Rgba8TexFormats[] = {
174*35238bceSAndroid Build Coastguard Worker GLS_UNSIZED_FORMATKEY(GL_RGB, GL_UNSIGNED_BYTE),
175*35238bceSAndroid Build Coastguard Worker GLS_UNSIZED_FORMATKEY(GL_RGBA, GL_UNSIGNED_BYTE),
176*35238bceSAndroid Build Coastguard Worker };
177*35238bceSAndroid Build Coastguard Worker
178*35238bceSAndroid Build Coastguard Worker static const FormatKey s_extTextureSRGBR8Formats[] = {
179*35238bceSAndroid Build Coastguard Worker GL_SR8_EXT,
180*35238bceSAndroid Build Coastguard Worker };
181*35238bceSAndroid Build Coastguard Worker
182*35238bceSAndroid Build Coastguard Worker static const FormatKey s_extTextureSRGBRG8Formats[] = {
183*35238bceSAndroid Build Coastguard Worker GL_SRG8_EXT,
184*35238bceSAndroid Build Coastguard Worker };
185*35238bceSAndroid Build Coastguard Worker
186*35238bceSAndroid Build Coastguard Worker static const FormatKey s_qcomRenderSRGBR8RG8Formats[] = {
187*35238bceSAndroid Build Coastguard Worker GL_SR8_EXT,
188*35238bceSAndroid Build Coastguard Worker GL_SRG8_EXT,
189*35238bceSAndroid Build Coastguard Worker };
190*35238bceSAndroid Build Coastguard Worker
191*35238bceSAndroid Build Coastguard Worker static const FormatExtEntry s_esExtFormats[] = {
192*35238bceSAndroid Build Coastguard Worker {
193*35238bceSAndroid Build Coastguard Worker "GL_OES_depth_texture",
194*35238bceSAndroid Build Coastguard Worker (uint32_t)(REQUIRED_RENDERABLE | DEPTH_RENDERABLE | TEXTURE_VALID),
195*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_oesDepthTextureFormats),
196*35238bceSAndroid Build Coastguard Worker },
197*35238bceSAndroid Build Coastguard Worker {"GL_OES_packed_depth_stencil",
198*35238bceSAndroid Build Coastguard Worker (uint32_t)(REQUIRED_RENDERABLE | DEPTH_RENDERABLE | STENCIL_RENDERABLE | RENDERBUFFER_VALID),
199*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_oesPackedDepthStencilSizedFormats)},
200*35238bceSAndroid Build Coastguard Worker {"GL_OES_packed_depth_stencil GL_OES_required_internalformat", (uint32_t)TEXTURE_VALID,
201*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_oesPackedDepthStencilSizedFormats)},
202*35238bceSAndroid Build Coastguard Worker {"GL_OES_packed_depth_stencil GL_OES_depth_texture",
203*35238bceSAndroid Build Coastguard Worker (uint32_t)(DEPTH_RENDERABLE | STENCIL_RENDERABLE | TEXTURE_VALID),
204*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_oesPackedDepthStencilTexFormats)},
205*35238bceSAndroid Build Coastguard Worker // The ANGLE extension incorporates GL_OES_depth_texture/GL_OES_packed_depth_stencil.
206*35238bceSAndroid Build Coastguard Worker {
207*35238bceSAndroid Build Coastguard Worker "GL_ANGLE_depth_texture",
208*35238bceSAndroid Build Coastguard Worker (uint32_t)(REQUIRED_RENDERABLE | DEPTH_RENDERABLE | TEXTURE_VALID),
209*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_oesDepthTextureFormats),
210*35238bceSAndroid Build Coastguard Worker },
211*35238bceSAndroid Build Coastguard Worker {
212*35238bceSAndroid Build Coastguard Worker "GL_OES_packed_depth_stencil GL_ANGLE_depth_texture",
213*35238bceSAndroid Build Coastguard Worker (uint32_t)(DEPTH_RENDERABLE | STENCIL_RENDERABLE | TEXTURE_VALID),
214*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_oesPackedDepthStencilTexFormats),
215*35238bceSAndroid Build Coastguard Worker },
216*35238bceSAndroid Build Coastguard Worker // \todo [2013-12-10 lauri] Find out if OES_texture_half_float is really a
217*35238bceSAndroid Build Coastguard Worker // requirement on ES3 also. Or is color_buffer_half_float applicatble at
218*35238bceSAndroid Build Coastguard Worker // all on ES3, since there's also EXT_color_buffer_float?
219*35238bceSAndroid Build Coastguard Worker {"GL_OES_texture_half_float GL_EXT_color_buffer_half_float",
220*35238bceSAndroid Build Coastguard Worker (uint32_t)(REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID),
221*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_extColorBufferHalfFloatFormats)},
222*35238bceSAndroid Build Coastguard Worker
223*35238bceSAndroid Build Coastguard Worker // OES_required_internalformat doesn't actually specify that these are renderable,
224*35238bceSAndroid Build Coastguard Worker // since it was written against ES 1.1.
225*35238bceSAndroid Build Coastguard Worker {"GL_OES_required_internalformat",
226*35238bceSAndroid Build Coastguard Worker // Allow but don't require RGBA8 to be color-renderable if
227*35238bceSAndroid Build Coastguard Worker // OES_rgb8_rgba8 is not present.
228*35238bceSAndroid Build Coastguard Worker (uint32_t)(COLOR_RENDERABLE | TEXTURE_VALID), GLS_ARRAY_RANGE(s_oesRequiredInternalFormatColorFormats)},
229*35238bceSAndroid Build Coastguard Worker {"GL_OES_required_internalformat", (uint32_t)(DEPTH_RENDERABLE | TEXTURE_VALID),
230*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_oesRequiredInternalFormatDepthFormats)},
231*35238bceSAndroid Build Coastguard Worker {"GL_EXT_texture_rg", (uint32_t)(REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID | TEXTURE_VALID),
232*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_extTextureRgRboFormats)},
233*35238bceSAndroid Build Coastguard Worker // These are not specified to be color-renderable, but the wording is
234*35238bceSAndroid Build Coastguard Worker // exactly as ambiguous as the wording in the ES2 spec.
235*35238bceSAndroid Build Coastguard Worker {"GL_EXT_texture_rg", (uint32_t)(COLOR_RENDERABLE | TEXTURE_VALID), GLS_ARRAY_RANGE(s_extTextureRgTexFormats)},
236*35238bceSAndroid Build Coastguard Worker {"GL_EXT_texture_rg GL_OES_texture_float", (uint32_t)(COLOR_RENDERABLE | TEXTURE_VALID),
237*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_extTextureRgFloatTexFormats)},
238*35238bceSAndroid Build Coastguard Worker {"GL_EXT_texture_rg GL_OES_texture_half_float", (uint32_t)(COLOR_RENDERABLE | TEXTURE_VALID),
239*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_extTextureRgHalfFloatTexFormats)},
240*35238bceSAndroid Build Coastguard Worker
241*35238bceSAndroid Build Coastguard Worker {"GL_NV_packed_float", (uint32_t)(COLOR_RENDERABLE | TEXTURE_VALID), GLS_ARRAY_RANGE(s_nvPackedFloatTexFormats)},
242*35238bceSAndroid Build Coastguard Worker {"GL_NV_packed_float GL_EXT_color_buffer_half_float",
243*35238bceSAndroid Build Coastguard Worker (uint32_t)(REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID),
244*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_nvPackedFloatRboFormats)},
245*35238bceSAndroid Build Coastguard Worker
246*35238bceSAndroid Build Coastguard Worker {"GL_EXT_sRGB", (uint32_t)(COLOR_RENDERABLE | TEXTURE_VALID), GLS_ARRAY_RANGE(s_extSrgbRenderableTexFormats)},
247*35238bceSAndroid Build Coastguard Worker {"GL_EXT_sRGB", (uint32_t)TEXTURE_VALID, GLS_ARRAY_RANGE(s_extSrgbNonRenderableTexFormats)},
248*35238bceSAndroid Build Coastguard Worker {"GL_EXT_sRGB", (uint32_t)(REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID),
249*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_extSrgbRboFormats)},
250*35238bceSAndroid Build Coastguard Worker {"GL_NV_sRGB_formats", (uint32_t)(REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID),
251*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_nvSrgbFormatsRboFormats)},
252*35238bceSAndroid Build Coastguard Worker {"GL_NV_sRGB_formats", (uint32_t)(REQUIRED_RENDERABLE | COLOR_RENDERABLE | TEXTURE_VALID),
253*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_nvSrgbFormatsTextureFormats)},
254*35238bceSAndroid Build Coastguard Worker
255*35238bceSAndroid Build Coastguard Worker // In Khronos bug 7333 discussion, the consensus is that these texture
256*35238bceSAndroid Build Coastguard Worker // formats, at least, should be color-renderable. Still, that cannot be
257*35238bceSAndroid Build Coastguard Worker // found in any extension specs, so only allow it, not require it.
258*35238bceSAndroid Build Coastguard Worker {"GL_OES_rgb8_rgba8", (uint32_t)(COLOR_RENDERABLE | TEXTURE_VALID), GLS_ARRAY_RANGE(s_oesRgb8Rgba8TexFormats)},
259*35238bceSAndroid Build Coastguard Worker {"GL_OES_rgb8_rgba8", (uint32_t)(REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID),
260*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_oesRgb8Rgba8RboFormats)},
261*35238bceSAndroid Build Coastguard Worker {"GL_OES_rgb8_rgba8 GL_OES_required_internalformat", (uint32_t)TEXTURE_VALID,
262*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_oesRequiredInternalFormatRgb8ColorFormat)},
263*35238bceSAndroid Build Coastguard Worker
264*35238bceSAndroid Build Coastguard Worker // The depth-renderability of the depth RBO formats is not explicitly
265*35238bceSAndroid Build Coastguard Worker // spelled out, but all renderbuffer formats are meant to be renderable.
266*35238bceSAndroid Build Coastguard Worker {"GL_OES_depth24", (uint32_t)(REQUIRED_RENDERABLE | DEPTH_RENDERABLE | RENDERBUFFER_VALID),
267*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_oesDepth24SizedFormats)},
268*35238bceSAndroid Build Coastguard Worker {"GL_OES_depth24 GL_OES_required_internalformat GL_OES_depth_texture", (uint32_t)TEXTURE_VALID,
269*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_oesDepth24SizedFormats)},
270*35238bceSAndroid Build Coastguard Worker
271*35238bceSAndroid Build Coastguard Worker {"GL_OES_depth32", (uint32_t)(REQUIRED_RENDERABLE | DEPTH_RENDERABLE | RENDERBUFFER_VALID),
272*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_oesDepth32SizedFormats)},
273*35238bceSAndroid Build Coastguard Worker {"GL_OES_depth32 GL_OES_required_internalformat GL_OES_depth_texture", (uint32_t)TEXTURE_VALID,
274*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_oesDepth32SizedFormats)},
275*35238bceSAndroid Build Coastguard Worker
276*35238bceSAndroid Build Coastguard Worker {"GL_EXT_texture_type_2_10_10_10_REV",
277*35238bceSAndroid Build Coastguard Worker (uint32_t)TEXTURE_VALID, // explicitly unrenderable
278*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_extTextureType2101010RevFormats)},
279*35238bceSAndroid Build Coastguard Worker {"GL_EXT_texture_type_2_10_10_10_REV GL_OES_required_internalformat",
280*35238bceSAndroid Build Coastguard Worker (uint32_t)TEXTURE_VALID, // explicitly unrenderable
281*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_oesRequiredInternalFormat10bitColorFormats)},
282*35238bceSAndroid Build Coastguard Worker
283*35238bceSAndroid Build Coastguard Worker {"GL_EXT_texture_sRGB_R8", (uint32_t)TEXTURE_VALID, GLS_ARRAY_RANGE(s_extTextureSRGBR8Formats)},
284*35238bceSAndroid Build Coastguard Worker {"GL_EXT_texture_sRGB_RG8", (uint32_t)TEXTURE_VALID, GLS_ARRAY_RANGE(s_extTextureSRGBRG8Formats)},
285*35238bceSAndroid Build Coastguard Worker
286*35238bceSAndroid Build Coastguard Worker {"GL_QCOM_render_sRGB_R8_RG8",
287*35238bceSAndroid Build Coastguard Worker (uint32_t)(REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID | TEXTURE_VALID),
288*35238bceSAndroid Build Coastguard Worker GLS_ARRAY_RANGE(s_qcomRenderSRGBR8RG8Formats)},
289*35238bceSAndroid Build Coastguard Worker };
290*35238bceSAndroid Build Coastguard Worker
Context(TestContext & testCtx,RenderContext & renderCtx,CheckerFactory & factory)291*35238bceSAndroid Build Coastguard Worker Context::Context(TestContext &testCtx, RenderContext &renderCtx, CheckerFactory &factory)
292*35238bceSAndroid Build Coastguard Worker : m_testCtx(testCtx)
293*35238bceSAndroid Build Coastguard Worker , m_renderCtx(renderCtx)
294*35238bceSAndroid Build Coastguard Worker , m_verifier(m_ctxFormats, factory, renderCtx)
295*35238bceSAndroid Build Coastguard Worker , m_haveMultiColorAtts(false)
296*35238bceSAndroid Build Coastguard Worker {
297*35238bceSAndroid Build Coastguard Worker FormatExtEntries extRange = GLS_ARRAY_RANGE(s_esExtFormats);
298*35238bceSAndroid Build Coastguard Worker addExtFormats(extRange);
299*35238bceSAndroid Build Coastguard Worker }
300*35238bceSAndroid Build Coastguard Worker
addFormats(FormatEntries fmtRange)301*35238bceSAndroid Build Coastguard Worker void Context::addFormats(FormatEntries fmtRange)
302*35238bceSAndroid Build Coastguard Worker {
303*35238bceSAndroid Build Coastguard Worker FboUtil::addFormats(m_coreFormats, fmtRange);
304*35238bceSAndroid Build Coastguard Worker FboUtil::addFormats(m_ctxFormats, fmtRange);
305*35238bceSAndroid Build Coastguard Worker FboUtil::addFormats(m_allFormats, fmtRange);
306*35238bceSAndroid Build Coastguard Worker }
307*35238bceSAndroid Build Coastguard Worker
addExtFormats(FormatExtEntries extRange)308*35238bceSAndroid Build Coastguard Worker void Context::addExtFormats(FormatExtEntries extRange)
309*35238bceSAndroid Build Coastguard Worker {
310*35238bceSAndroid Build Coastguard Worker FboUtil::addExtFormats(m_ctxFormats, extRange, &m_renderCtx);
311*35238bceSAndroid Build Coastguard Worker FboUtil::addExtFormats(m_allFormats, extRange, DE_NULL);
312*35238bceSAndroid Build Coastguard Worker }
313*35238bceSAndroid Build Coastguard Worker
pass(void)314*35238bceSAndroid Build Coastguard Worker void TestBase::pass(void)
315*35238bceSAndroid Build Coastguard Worker {
316*35238bceSAndroid Build Coastguard Worker m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
317*35238bceSAndroid Build Coastguard Worker }
318*35238bceSAndroid Build Coastguard Worker
qualityWarning(const char * msg)319*35238bceSAndroid Build Coastguard Worker void TestBase::qualityWarning(const char *msg)
320*35238bceSAndroid Build Coastguard Worker {
321*35238bceSAndroid Build Coastguard Worker m_testCtx.setTestResult(QP_TEST_RESULT_QUALITY_WARNING, msg);
322*35238bceSAndroid Build Coastguard Worker }
323*35238bceSAndroid Build Coastguard Worker
fail(const char * msg)324*35238bceSAndroid Build Coastguard Worker void TestBase::fail(const char *msg)
325*35238bceSAndroid Build Coastguard Worker {
326*35238bceSAndroid Build Coastguard Worker m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, msg);
327*35238bceSAndroid Build Coastguard Worker }
328*35238bceSAndroid Build Coastguard Worker
gl(const TestBase & test)329*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl(const TestBase &test)
330*35238bceSAndroid Build Coastguard Worker {
331*35238bceSAndroid Build Coastguard Worker return test.getContext().getRenderContext().getFunctions();
332*35238bceSAndroid Build Coastguard Worker }
333*35238bceSAndroid Build Coastguard Worker
isFormatFeatureSupported(const FormatDB & db,const ImageFormat & format,FormatFlags feature)334*35238bceSAndroid Build Coastguard Worker static bool isFormatFeatureSupported(const FormatDB &db, const ImageFormat &format, FormatFlags feature)
335*35238bceSAndroid Build Coastguard Worker {
336*35238bceSAndroid Build Coastguard Worker return db.isKnownFormat(format) && ((db.getFormatInfo(format) & feature) == feature);
337*35238bceSAndroid Build Coastguard Worker }
338*35238bceSAndroid Build Coastguard Worker
logAffectingExtensions(const char * prefix,const FormatDB & db,const ImageFormat & format,FormatFlags feature,tcu::MessageBuilder & msg)339*35238bceSAndroid Build Coastguard Worker static void logAffectingExtensions(const char *prefix, const FormatDB &db, const ImageFormat &format,
340*35238bceSAndroid Build Coastguard Worker FormatFlags feature, tcu::MessageBuilder &msg)
341*35238bceSAndroid Build Coastguard Worker {
342*35238bceSAndroid Build Coastguard Worker const std::set<std::set<std::string>> rows = db.getFormatFeatureExtensions(format, feature);
343*35238bceSAndroid Build Coastguard Worker
344*35238bceSAndroid Build Coastguard Worker for (std::set<std::set<std::string>>::const_iterator rowIt = rows.begin(); rowIt != rows.end(); ++rowIt)
345*35238bceSAndroid Build Coastguard Worker {
346*35238bceSAndroid Build Coastguard Worker const std::set<std::string> &requiredExtensions = *rowIt;
347*35238bceSAndroid Build Coastguard Worker std::set<std::string>::const_iterator it = requiredExtensions.begin();
348*35238bceSAndroid Build Coastguard Worker std::string extName;
349*35238bceSAndroid Build Coastguard Worker
350*35238bceSAndroid Build Coastguard Worker msg << prefix;
351*35238bceSAndroid Build Coastguard Worker
352*35238bceSAndroid Build Coastguard Worker extName = *it++;
353*35238bceSAndroid Build Coastguard Worker while (it != requiredExtensions.end())
354*35238bceSAndroid Build Coastguard Worker {
355*35238bceSAndroid Build Coastguard Worker msg << getExtensionDescription(extName);
356*35238bceSAndroid Build Coastguard Worker extName = *it++;
357*35238bceSAndroid Build Coastguard Worker msg << (it == requiredExtensions.end() ? " and " : ", ");
358*35238bceSAndroid Build Coastguard Worker }
359*35238bceSAndroid Build Coastguard Worker
360*35238bceSAndroid Build Coastguard Worker msg << getExtensionDescription(extName) << '\n';
361*35238bceSAndroid Build Coastguard Worker }
362*35238bceSAndroid Build Coastguard Worker }
363*35238bceSAndroid Build Coastguard Worker
logFormatInfo(const config::Framebuffer & fbo,const FormatDB & ctxFormats,const FormatDB & coreFormats,const FormatDB & allFormats,tcu::TestLog & log)364*35238bceSAndroid Build Coastguard Worker static void logFormatInfo(const config::Framebuffer &fbo, const FormatDB &ctxFormats, const FormatDB &coreFormats,
365*35238bceSAndroid Build Coastguard Worker const FormatDB &allFormats, tcu::TestLog &log)
366*35238bceSAndroid Build Coastguard Worker {
367*35238bceSAndroid Build Coastguard Worker static const struct
368*35238bceSAndroid Build Coastguard Worker {
369*35238bceSAndroid Build Coastguard Worker const char *name;
370*35238bceSAndroid Build Coastguard Worker const FormatFlags flag;
371*35238bceSAndroid Build Coastguard Worker } s_renderability[] = {
372*35238bceSAndroid Build Coastguard Worker {"color-renderable", COLOR_RENDERABLE},
373*35238bceSAndroid Build Coastguard Worker {"depth-renderable", DEPTH_RENDERABLE},
374*35238bceSAndroid Build Coastguard Worker {"stencil-renderable", STENCIL_RENDERABLE},
375*35238bceSAndroid Build Coastguard Worker };
376*35238bceSAndroid Build Coastguard Worker
377*35238bceSAndroid Build Coastguard Worker std::set<ImageFormat> formats;
378*35238bceSAndroid Build Coastguard Worker
379*35238bceSAndroid Build Coastguard Worker for (config::TextureMap::const_iterator it = fbo.textures.begin(); it != fbo.textures.end(); ++it)
380*35238bceSAndroid Build Coastguard Worker formats.insert(it->second->internalFormat);
381*35238bceSAndroid Build Coastguard Worker for (config::RboMap::const_iterator it = fbo.rbos.begin(); it != fbo.rbos.end(); ++it)
382*35238bceSAndroid Build Coastguard Worker formats.insert(it->second->internalFormat);
383*35238bceSAndroid Build Coastguard Worker
384*35238bceSAndroid Build Coastguard Worker if (!formats.empty())
385*35238bceSAndroid Build Coastguard Worker {
386*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection supersection(log, "Format", "Format info");
387*35238bceSAndroid Build Coastguard Worker
388*35238bceSAndroid Build Coastguard Worker for (std::set<ImageFormat>::const_iterator it = formats.begin(); it != formats.end(); ++it)
389*35238bceSAndroid Build Coastguard Worker {
390*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(log, "FormatInfo", de::toString(*it));
391*35238bceSAndroid Build Coastguard Worker
392*35238bceSAndroid Build Coastguard Worker // texture validity
393*35238bceSAndroid Build Coastguard Worker if (isFormatFeatureSupported(ctxFormats, *it, TEXTURE_VALID))
394*35238bceSAndroid Build Coastguard Worker {
395*35238bceSAndroid Build Coastguard Worker tcu::MessageBuilder msg(&log);
396*35238bceSAndroid Build Coastguard Worker msg << "* Valid texture format\n";
397*35238bceSAndroid Build Coastguard Worker
398*35238bceSAndroid Build Coastguard Worker if (isFormatFeatureSupported(coreFormats, *it, TEXTURE_VALID))
399*35238bceSAndroid Build Coastguard Worker msg << "\t* core feature";
400*35238bceSAndroid Build Coastguard Worker else
401*35238bceSAndroid Build Coastguard Worker {
402*35238bceSAndroid Build Coastguard Worker msg << "\t* defined in supported extension(s):\n";
403*35238bceSAndroid Build Coastguard Worker logAffectingExtensions("\t\t- ", ctxFormats, *it, TEXTURE_VALID, msg);
404*35238bceSAndroid Build Coastguard Worker }
405*35238bceSAndroid Build Coastguard Worker
406*35238bceSAndroid Build Coastguard Worker msg << tcu::TestLog::EndMessage;
407*35238bceSAndroid Build Coastguard Worker }
408*35238bceSAndroid Build Coastguard Worker else
409*35238bceSAndroid Build Coastguard Worker {
410*35238bceSAndroid Build Coastguard Worker tcu::MessageBuilder msg(&log);
411*35238bceSAndroid Build Coastguard Worker msg << "* Unsupported texture format\n";
412*35238bceSAndroid Build Coastguard Worker
413*35238bceSAndroid Build Coastguard Worker if (isFormatFeatureSupported(allFormats, *it, TEXTURE_VALID))
414*35238bceSAndroid Build Coastguard Worker {
415*35238bceSAndroid Build Coastguard Worker msg << "\t* requires any of the extensions or combinations:\n";
416*35238bceSAndroid Build Coastguard Worker logAffectingExtensions("\t\t- ", allFormats, *it, TEXTURE_VALID, msg);
417*35238bceSAndroid Build Coastguard Worker }
418*35238bceSAndroid Build Coastguard Worker else
419*35238bceSAndroid Build Coastguard Worker msg << "\t* no extension can make this format valid";
420*35238bceSAndroid Build Coastguard Worker
421*35238bceSAndroid Build Coastguard Worker msg << tcu::TestLog::EndMessage;
422*35238bceSAndroid Build Coastguard Worker }
423*35238bceSAndroid Build Coastguard Worker
424*35238bceSAndroid Build Coastguard Worker // RBO validity
425*35238bceSAndroid Build Coastguard Worker if (isFormatFeatureSupported(ctxFormats, *it, RENDERBUFFER_VALID))
426*35238bceSAndroid Build Coastguard Worker {
427*35238bceSAndroid Build Coastguard Worker tcu::MessageBuilder msg(&log);
428*35238bceSAndroid Build Coastguard Worker msg << "* Valid renderbuffer format\n";
429*35238bceSAndroid Build Coastguard Worker
430*35238bceSAndroid Build Coastguard Worker if (isFormatFeatureSupported(coreFormats, *it, RENDERBUFFER_VALID))
431*35238bceSAndroid Build Coastguard Worker msg << "\t* core feature";
432*35238bceSAndroid Build Coastguard Worker else
433*35238bceSAndroid Build Coastguard Worker {
434*35238bceSAndroid Build Coastguard Worker msg << "\t* defined in supported extension(s):\n";
435*35238bceSAndroid Build Coastguard Worker logAffectingExtensions("\t\t- ", ctxFormats, *it, RENDERBUFFER_VALID, msg);
436*35238bceSAndroid Build Coastguard Worker }
437*35238bceSAndroid Build Coastguard Worker
438*35238bceSAndroid Build Coastguard Worker msg << tcu::TestLog::EndMessage;
439*35238bceSAndroid Build Coastguard Worker }
440*35238bceSAndroid Build Coastguard Worker else
441*35238bceSAndroid Build Coastguard Worker {
442*35238bceSAndroid Build Coastguard Worker tcu::MessageBuilder msg(&log);
443*35238bceSAndroid Build Coastguard Worker msg << "* Unsupported renderbuffer format\n";
444*35238bceSAndroid Build Coastguard Worker
445*35238bceSAndroid Build Coastguard Worker if (isFormatFeatureSupported(allFormats, *it, RENDERBUFFER_VALID))
446*35238bceSAndroid Build Coastguard Worker {
447*35238bceSAndroid Build Coastguard Worker msg << "\t* requires any of the extensions or combinations:\n";
448*35238bceSAndroid Build Coastguard Worker logAffectingExtensions("\t\t- ", allFormats, *it, RENDERBUFFER_VALID, msg);
449*35238bceSAndroid Build Coastguard Worker }
450*35238bceSAndroid Build Coastguard Worker else
451*35238bceSAndroid Build Coastguard Worker msg << "\t* no extension can make this format valid";
452*35238bceSAndroid Build Coastguard Worker
453*35238bceSAndroid Build Coastguard Worker msg << tcu::TestLog::EndMessage;
454*35238bceSAndroid Build Coastguard Worker }
455*35238bceSAndroid Build Coastguard Worker
456*35238bceSAndroid Build Coastguard Worker // renderability
457*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(s_renderability); ++ndx)
458*35238bceSAndroid Build Coastguard Worker {
459*35238bceSAndroid Build Coastguard Worker if (isFormatFeatureSupported(ctxFormats, *it, s_renderability[ndx].flag | REQUIRED_RENDERABLE))
460*35238bceSAndroid Build Coastguard Worker {
461*35238bceSAndroid Build Coastguard Worker tcu::MessageBuilder msg(&log);
462*35238bceSAndroid Build Coastguard Worker msg << "* Format is " << s_renderability[ndx].name << "\n";
463*35238bceSAndroid Build Coastguard Worker
464*35238bceSAndroid Build Coastguard Worker if (isFormatFeatureSupported(coreFormats, *it, s_renderability[ndx].flag | REQUIRED_RENDERABLE))
465*35238bceSAndroid Build Coastguard Worker msg << "\t* core feature";
466*35238bceSAndroid Build Coastguard Worker else
467*35238bceSAndroid Build Coastguard Worker {
468*35238bceSAndroid Build Coastguard Worker msg << "\t* defined in supported extension(s):\n";
469*35238bceSAndroid Build Coastguard Worker logAffectingExtensions("\t\t- ", ctxFormats, *it,
470*35238bceSAndroid Build Coastguard Worker s_renderability[ndx].flag | REQUIRED_RENDERABLE, msg);
471*35238bceSAndroid Build Coastguard Worker }
472*35238bceSAndroid Build Coastguard Worker
473*35238bceSAndroid Build Coastguard Worker msg << tcu::TestLog::EndMessage;
474*35238bceSAndroid Build Coastguard Worker }
475*35238bceSAndroid Build Coastguard Worker else if (isFormatFeatureSupported(ctxFormats, *it, s_renderability[ndx].flag))
476*35238bceSAndroid Build Coastguard Worker {
477*35238bceSAndroid Build Coastguard Worker tcu::MessageBuilder msg(&log);
478*35238bceSAndroid Build Coastguard Worker msg << "* Format is allowed to be " << s_renderability[ndx].name << " but not required\n";
479*35238bceSAndroid Build Coastguard Worker
480*35238bceSAndroid Build Coastguard Worker if (isFormatFeatureSupported(coreFormats, *it, s_renderability[ndx].flag))
481*35238bceSAndroid Build Coastguard Worker msg << "\t* core feature";
482*35238bceSAndroid Build Coastguard Worker else if (isFormatFeatureSupported(allFormats, *it, s_renderability[ndx].flag))
483*35238bceSAndroid Build Coastguard Worker {
484*35238bceSAndroid Build Coastguard Worker msg << "\t* extensions that would make format " << s_renderability[ndx].name << ":\n";
485*35238bceSAndroid Build Coastguard Worker logAffectingExtensions("\t\t- ", allFormats, *it, s_renderability[ndx].flag, msg);
486*35238bceSAndroid Build Coastguard Worker }
487*35238bceSAndroid Build Coastguard Worker else
488*35238bceSAndroid Build Coastguard Worker msg << "\t* no extension can make this format " << s_renderability[ndx].name;
489*35238bceSAndroid Build Coastguard Worker
490*35238bceSAndroid Build Coastguard Worker msg << tcu::TestLog::EndMessage;
491*35238bceSAndroid Build Coastguard Worker }
492*35238bceSAndroid Build Coastguard Worker else
493*35238bceSAndroid Build Coastguard Worker {
494*35238bceSAndroid Build Coastguard Worker tcu::MessageBuilder msg(&log);
495*35238bceSAndroid Build Coastguard Worker msg << "* Format is NOT " << s_renderability[ndx].name << "\n";
496*35238bceSAndroid Build Coastguard Worker
497*35238bceSAndroid Build Coastguard Worker if (isFormatFeatureSupported(allFormats, *it, s_renderability[ndx].flag))
498*35238bceSAndroid Build Coastguard Worker {
499*35238bceSAndroid Build Coastguard Worker if (isFormatFeatureSupported(allFormats, *it, s_renderability[ndx].flag | REQUIRED_RENDERABLE))
500*35238bceSAndroid Build Coastguard Worker {
501*35238bceSAndroid Build Coastguard Worker msg << "\t* extensions that would make format " << s_renderability[ndx].name << ":\n";
502*35238bceSAndroid Build Coastguard Worker logAffectingExtensions("\t\t- ", allFormats, *it,
503*35238bceSAndroid Build Coastguard Worker s_renderability[ndx].flag | REQUIRED_RENDERABLE, msg);
504*35238bceSAndroid Build Coastguard Worker }
505*35238bceSAndroid Build Coastguard Worker else
506*35238bceSAndroid Build Coastguard Worker {
507*35238bceSAndroid Build Coastguard Worker msg << "\t* extensions that are allowed to make format " << s_renderability[ndx].name
508*35238bceSAndroid Build Coastguard Worker << ":\n";
509*35238bceSAndroid Build Coastguard Worker logAffectingExtensions("\t\t- ", allFormats, *it, s_renderability[ndx].flag, msg);
510*35238bceSAndroid Build Coastguard Worker }
511*35238bceSAndroid Build Coastguard Worker }
512*35238bceSAndroid Build Coastguard Worker else
513*35238bceSAndroid Build Coastguard Worker msg << "\t* no extension can make this format " << s_renderability[ndx].name;
514*35238bceSAndroid Build Coastguard Worker
515*35238bceSAndroid Build Coastguard Worker msg << tcu::TestLog::EndMessage;
516*35238bceSAndroid Build Coastguard Worker }
517*35238bceSAndroid Build Coastguard Worker }
518*35238bceSAndroid Build Coastguard Worker }
519*35238bceSAndroid Build Coastguard Worker }
520*35238bceSAndroid Build Coastguard Worker }
521*35238bceSAndroid Build Coastguard Worker
iterate(void)522*35238bceSAndroid Build Coastguard Worker IterateResult TestBase::iterate(void)
523*35238bceSAndroid Build Coastguard Worker {
524*35238bceSAndroid Build Coastguard Worker glu::Framebuffer fbo(m_ctx.getRenderContext());
525*35238bceSAndroid Build Coastguard Worker FboBuilder builder(*fbo, GL_FRAMEBUFFER, gl(*this));
526*35238bceSAndroid Build Coastguard Worker const IterateResult ret = build(builder);
527*35238bceSAndroid Build Coastguard Worker const ValidStatusCodes reference = m_ctx.getVerifier().validStatusCodes(builder);
528*35238bceSAndroid Build Coastguard Worker const GLenum errorCode = builder.getError();
529*35238bceSAndroid Build Coastguard Worker
530*35238bceSAndroid Build Coastguard Worker logFramebufferConfig(builder, m_testCtx.getLog());
531*35238bceSAndroid Build Coastguard Worker logFormatInfo(builder, m_ctx.getCtxFormats(), m_ctx.getCoreFormats(), m_ctx.getAllFormats(), m_testCtx.getLog());
532*35238bceSAndroid Build Coastguard Worker reference.logRules(m_testCtx.getLog());
533*35238bceSAndroid Build Coastguard Worker reference.logLegalResults(m_testCtx.getLog());
534*35238bceSAndroid Build Coastguard Worker
535*35238bceSAndroid Build Coastguard Worker // \todo [2013-12-04 lauri] Check if drawing operations succeed.
536*35238bceSAndroid Build Coastguard Worker
537*35238bceSAndroid Build Coastguard Worker if (errorCode != GL_NO_ERROR)
538*35238bceSAndroid Build Coastguard Worker {
539*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Received " << glu::getErrorStr(errorCode)
540*35238bceSAndroid Build Coastguard Worker << " (during FBO initialization)." << TestLog::EndMessage;
541*35238bceSAndroid Build Coastguard Worker
542*35238bceSAndroid Build Coastguard Worker if (reference.isErrorCodeValid(errorCode))
543*35238bceSAndroid Build Coastguard Worker pass();
544*35238bceSAndroid Build Coastguard Worker else if (reference.isErrorCodeRequired(GL_NO_ERROR))
545*35238bceSAndroid Build Coastguard Worker fail(("Expected no error but got " + de::toString(glu::getErrorStr(errorCode))).c_str());
546*35238bceSAndroid Build Coastguard Worker else
547*35238bceSAndroid Build Coastguard Worker fail("Got wrong error code");
548*35238bceSAndroid Build Coastguard Worker }
549*35238bceSAndroid Build Coastguard Worker else
550*35238bceSAndroid Build Coastguard Worker {
551*35238bceSAndroid Build Coastguard Worker const GLenum fboStatus = gl(*this).checkFramebufferStatus(GL_FRAMEBUFFER);
552*35238bceSAndroid Build Coastguard Worker const bool validStatus = reference.isFBOStatusValid(fboStatus);
553*35238bceSAndroid Build Coastguard Worker
554*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Received " << glu::getFramebufferStatusStr(fboStatus) << "."
555*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
556*35238bceSAndroid Build Coastguard Worker
557*35238bceSAndroid Build Coastguard Worker if (!validStatus)
558*35238bceSAndroid Build Coastguard Worker {
559*35238bceSAndroid Build Coastguard Worker if (fboStatus == GL_FRAMEBUFFER_COMPLETE)
560*35238bceSAndroid Build Coastguard Worker fail("Framebuffer checked as complete, expected incomplete");
561*35238bceSAndroid Build Coastguard Worker else if (reference.isFBOStatusRequired(GL_FRAMEBUFFER_COMPLETE))
562*35238bceSAndroid Build Coastguard Worker fail("Framebuffer checked is incomplete, expected complete");
563*35238bceSAndroid Build Coastguard Worker else
564*35238bceSAndroid Build Coastguard Worker // An incomplete status is allowed, but not _this_ incomplete status.
565*35238bceSAndroid Build Coastguard Worker fail("Framebuffer checked as incomplete, but with wrong status");
566*35238bceSAndroid Build Coastguard Worker }
567*35238bceSAndroid Build Coastguard Worker else if (fboStatus == GL_FRAMEBUFFER_UNSUPPORTED)
568*35238bceSAndroid Build Coastguard Worker {
569*35238bceSAndroid Build Coastguard Worker // The spec requires
570*35238bceSAndroid Build Coastguard Worker // "when both depth and stencil attachments are present,implementations are only required
571*35238bceSAndroid Build Coastguard Worker // to support framebuffer objects where both attachments refer to the same image."
572*35238bceSAndroid Build Coastguard Worker //
573*35238bceSAndroid Build Coastguard Worker // Thus, it is acceptable for an implementation returning GL_FRAMEBUFFER_UNSUPPORTED,
574*35238bceSAndroid Build Coastguard Worker // and the test cannot be marked as failed.
575*35238bceSAndroid Build Coastguard Worker pass();
576*35238bceSAndroid Build Coastguard Worker }
577*35238bceSAndroid Build Coastguard Worker else if (fboStatus != GL_FRAMEBUFFER_COMPLETE && reference.isFBOStatusValid(GL_FRAMEBUFFER_COMPLETE))
578*35238bceSAndroid Build Coastguard Worker qualityWarning("Framebuffer object could have checked as complete but did not.");
579*35238bceSAndroid Build Coastguard Worker else
580*35238bceSAndroid Build Coastguard Worker pass();
581*35238bceSAndroid Build Coastguard Worker }
582*35238bceSAndroid Build Coastguard Worker
583*35238bceSAndroid Build Coastguard Worker return ret;
584*35238bceSAndroid Build Coastguard Worker }
585*35238bceSAndroid Build Coastguard Worker
build(FboBuilder & builder)586*35238bceSAndroid Build Coastguard Worker IterateResult TestBase::build(FboBuilder &builder)
587*35238bceSAndroid Build Coastguard Worker {
588*35238bceSAndroid Build Coastguard Worker DE_UNREF(builder);
589*35238bceSAndroid Build Coastguard Worker return STOP;
590*35238bceSAndroid Build Coastguard Worker }
591*35238bceSAndroid Build Coastguard Worker
getDefaultFormat(GLenum attPoint,GLenum bufType) const592*35238bceSAndroid Build Coastguard Worker ImageFormat TestBase::getDefaultFormat(GLenum attPoint, GLenum bufType) const
593*35238bceSAndroid Build Coastguard Worker {
594*35238bceSAndroid Build Coastguard Worker if (bufType == GL_NONE)
595*35238bceSAndroid Build Coastguard Worker {
596*35238bceSAndroid Build Coastguard Worker return ImageFormat::none();
597*35238bceSAndroid Build Coastguard Worker }
598*35238bceSAndroid Build Coastguard Worker
599*35238bceSAndroid Build Coastguard Worker // Prefer a standard format, if there is one, but if not, use a format
600*35238bceSAndroid Build Coastguard Worker // provided by an extension.
601*35238bceSAndroid Build Coastguard Worker Formats formats = m_ctx.getCoreFormats().getFormats(formatFlag(attPoint) | formatFlag(bufType));
602*35238bceSAndroid Build Coastguard Worker Formats::const_iterator it = formats.begin();
603*35238bceSAndroid Build Coastguard Worker if (it == formats.end())
604*35238bceSAndroid Build Coastguard Worker {
605*35238bceSAndroid Build Coastguard Worker formats = m_ctx.getCtxFormats().getFormats(formatFlag(attPoint) | formatFlag(bufType));
606*35238bceSAndroid Build Coastguard Worker it = formats.begin();
607*35238bceSAndroid Build Coastguard Worker }
608*35238bceSAndroid Build Coastguard Worker if (it == formats.end())
609*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("Unsupported attachment kind for attachment point", "", __FILE__, __LINE__);
610*35238bceSAndroid Build Coastguard Worker return *it;
611*35238bceSAndroid Build Coastguard Worker }
612*35238bceSAndroid Build Coastguard Worker
makeImage(GLenum bufType,ImageFormat format,GLsizei width,GLsizei height,FboBuilder & builder)613*35238bceSAndroid Build Coastguard Worker Image *makeImage(GLenum bufType, ImageFormat format, GLsizei width, GLsizei height, FboBuilder &builder)
614*35238bceSAndroid Build Coastguard Worker {
615*35238bceSAndroid Build Coastguard Worker Image *image = DE_NULL;
616*35238bceSAndroid Build Coastguard Worker switch (bufType)
617*35238bceSAndroid Build Coastguard Worker {
618*35238bceSAndroid Build Coastguard Worker case GL_NONE:
619*35238bceSAndroid Build Coastguard Worker return DE_NULL;
620*35238bceSAndroid Build Coastguard Worker case GL_RENDERBUFFER:
621*35238bceSAndroid Build Coastguard Worker image = &builder.makeConfig<Renderbuffer>();
622*35238bceSAndroid Build Coastguard Worker break;
623*35238bceSAndroid Build Coastguard Worker case GL_TEXTURE:
624*35238bceSAndroid Build Coastguard Worker image = &builder.makeConfig<Texture2D>();
625*35238bceSAndroid Build Coastguard Worker break;
626*35238bceSAndroid Build Coastguard Worker default:
627*35238bceSAndroid Build Coastguard Worker DE_FATAL("Impossible case");
628*35238bceSAndroid Build Coastguard Worker }
629*35238bceSAndroid Build Coastguard Worker image->internalFormat = format;
630*35238bceSAndroid Build Coastguard Worker image->width = width;
631*35238bceSAndroid Build Coastguard Worker image->height = height;
632*35238bceSAndroid Build Coastguard Worker return image;
633*35238bceSAndroid Build Coastguard Worker }
634*35238bceSAndroid Build Coastguard Worker
makeAttachment(GLenum bufType,ImageFormat format,GLsizei width,GLsizei height,FboBuilder & builder)635*35238bceSAndroid Build Coastguard Worker Attachment *makeAttachment(GLenum bufType, ImageFormat format, GLsizei width, GLsizei height, FboBuilder &builder)
636*35238bceSAndroid Build Coastguard Worker {
637*35238bceSAndroid Build Coastguard Worker Image *const imgCfg = makeImage(bufType, format, width, height, builder);
638*35238bceSAndroid Build Coastguard Worker Attachment *att = DE_NULL;
639*35238bceSAndroid Build Coastguard Worker GLuint img = 0;
640*35238bceSAndroid Build Coastguard Worker
641*35238bceSAndroid Build Coastguard Worker if (Renderbuffer *rboCfg = dynamic_cast<Renderbuffer *>(imgCfg))
642*35238bceSAndroid Build Coastguard Worker {
643*35238bceSAndroid Build Coastguard Worker img = builder.glCreateRbo(*rboCfg);
644*35238bceSAndroid Build Coastguard Worker att = &builder.makeConfig<RenderbufferAttachment>();
645*35238bceSAndroid Build Coastguard Worker }
646*35238bceSAndroid Build Coastguard Worker else if (Texture2D *texCfg = dynamic_cast<Texture2D *>(imgCfg))
647*35238bceSAndroid Build Coastguard Worker {
648*35238bceSAndroid Build Coastguard Worker img = builder.glCreateTexture(*texCfg);
649*35238bceSAndroid Build Coastguard Worker TextureFlatAttachment &texAtt = builder.makeConfig<TextureFlatAttachment>();
650*35238bceSAndroid Build Coastguard Worker texAtt.texTarget = GL_TEXTURE_2D;
651*35238bceSAndroid Build Coastguard Worker att = &texAtt;
652*35238bceSAndroid Build Coastguard Worker }
653*35238bceSAndroid Build Coastguard Worker else
654*35238bceSAndroid Build Coastguard Worker {
655*35238bceSAndroid Build Coastguard Worker DE_ASSERT(imgCfg == DE_NULL);
656*35238bceSAndroid Build Coastguard Worker return DE_NULL;
657*35238bceSAndroid Build Coastguard Worker }
658*35238bceSAndroid Build Coastguard Worker att->imageName = img;
659*35238bceSAndroid Build Coastguard Worker return att;
660*35238bceSAndroid Build Coastguard Worker }
661*35238bceSAndroid Build Coastguard Worker
attachTargetToNew(GLenum target,GLenum bufType,ImageFormat format,GLsizei width,GLsizei height,FboBuilder & builder)662*35238bceSAndroid Build Coastguard Worker void TestBase::attachTargetToNew(GLenum target, GLenum bufType, ImageFormat format, GLsizei width, GLsizei height,
663*35238bceSAndroid Build Coastguard Worker FboBuilder &builder)
664*35238bceSAndroid Build Coastguard Worker {
665*35238bceSAndroid Build Coastguard Worker ImageFormat imgFmt = format;
666*35238bceSAndroid Build Coastguard Worker if (imgFmt.format == GL_NONE)
667*35238bceSAndroid Build Coastguard Worker imgFmt = getDefaultFormat(target, bufType);
668*35238bceSAndroid Build Coastguard Worker
669*35238bceSAndroid Build Coastguard Worker const Attachment *const att = makeAttachment(bufType, imgFmt, width, height, builder);
670*35238bceSAndroid Build Coastguard Worker builder.glAttach(target, att);
671*35238bceSAndroid Build Coastguard Worker }
672*35238bceSAndroid Build Coastguard Worker
formatName(ImageFormat format)673*35238bceSAndroid Build Coastguard Worker static string formatName(ImageFormat format)
674*35238bceSAndroid Build Coastguard Worker {
675*35238bceSAndroid Build Coastguard Worker const string s = getTextureFormatName(format.format);
676*35238bceSAndroid Build Coastguard Worker const string fmtStr = toLower(s.substr(3));
677*35238bceSAndroid Build Coastguard Worker
678*35238bceSAndroid Build Coastguard Worker if (format.unsizedType != GL_NONE)
679*35238bceSAndroid Build Coastguard Worker {
680*35238bceSAndroid Build Coastguard Worker const string typeStr = getTypeName(format.unsizedType);
681*35238bceSAndroid Build Coastguard Worker return fmtStr + "_" + toLower(typeStr.substr(3));
682*35238bceSAndroid Build Coastguard Worker }
683*35238bceSAndroid Build Coastguard Worker
684*35238bceSAndroid Build Coastguard Worker return fmtStr;
685*35238bceSAndroid Build Coastguard Worker }
686*35238bceSAndroid Build Coastguard Worker
formatDesc(ImageFormat format)687*35238bceSAndroid Build Coastguard Worker static string formatDesc(ImageFormat format)
688*35238bceSAndroid Build Coastguard Worker {
689*35238bceSAndroid Build Coastguard Worker const string fmtStr = getTextureFormatName(format.format);
690*35238bceSAndroid Build Coastguard Worker
691*35238bceSAndroid Build Coastguard Worker if (format.unsizedType != GL_NONE)
692*35238bceSAndroid Build Coastguard Worker {
693*35238bceSAndroid Build Coastguard Worker const string typeStr = getTypeName(format.unsizedType);
694*35238bceSAndroid Build Coastguard Worker return fmtStr + " with type " + typeStr;
695*35238bceSAndroid Build Coastguard Worker }
696*35238bceSAndroid Build Coastguard Worker
697*35238bceSAndroid Build Coastguard Worker return fmtStr;
698*35238bceSAndroid Build Coastguard Worker }
699*35238bceSAndroid Build Coastguard Worker
700*35238bceSAndroid Build Coastguard Worker struct RenderableParams
701*35238bceSAndroid Build Coastguard Worker {
702*35238bceSAndroid Build Coastguard Worker GLenum attPoint;
703*35238bceSAndroid Build Coastguard Worker GLenum bufType;
704*35238bceSAndroid Build Coastguard Worker ImageFormat format;
getNamedeqp::gls::fboc::details::RenderableParams705*35238bceSAndroid Build Coastguard Worker static string getName(const RenderableParams ¶ms)
706*35238bceSAndroid Build Coastguard Worker {
707*35238bceSAndroid Build Coastguard Worker return formatName(params.format);
708*35238bceSAndroid Build Coastguard Worker }
getDescriptiondeqp::gls::fboc::details::RenderableParams709*35238bceSAndroid Build Coastguard Worker static string getDescription(const RenderableParams ¶ms)
710*35238bceSAndroid Build Coastguard Worker {
711*35238bceSAndroid Build Coastguard Worker return formatDesc(params.format);
712*35238bceSAndroid Build Coastguard Worker }
713*35238bceSAndroid Build Coastguard Worker };
714*35238bceSAndroid Build Coastguard Worker
715*35238bceSAndroid Build Coastguard Worker class RenderableTest : public ParamTest<RenderableParams>
716*35238bceSAndroid Build Coastguard Worker {
717*35238bceSAndroid Build Coastguard Worker public:
RenderableTest(Context & group,const Params & params)718*35238bceSAndroid Build Coastguard Worker RenderableTest(Context &group, const Params ¶ms) : ParamTest<RenderableParams>(group, params)
719*35238bceSAndroid Build Coastguard Worker {
720*35238bceSAndroid Build Coastguard Worker }
721*35238bceSAndroid Build Coastguard Worker IterateResult build(FboBuilder &builder);
722*35238bceSAndroid Build Coastguard Worker };
723*35238bceSAndroid Build Coastguard Worker
build(FboBuilder & builder)724*35238bceSAndroid Build Coastguard Worker IterateResult RenderableTest::build(FboBuilder &builder)
725*35238bceSAndroid Build Coastguard Worker {
726*35238bceSAndroid Build Coastguard Worker attachTargetToNew(m_params.attPoint, m_params.bufType, m_params.format, 64, 64, builder);
727*35238bceSAndroid Build Coastguard Worker return STOP;
728*35238bceSAndroid Build Coastguard Worker }
729*35238bceSAndroid Build Coastguard Worker
attTypeName(GLenum bufType)730*35238bceSAndroid Build Coastguard Worker string attTypeName(GLenum bufType)
731*35238bceSAndroid Build Coastguard Worker {
732*35238bceSAndroid Build Coastguard Worker switch (bufType)
733*35238bceSAndroid Build Coastguard Worker {
734*35238bceSAndroid Build Coastguard Worker case GL_NONE:
735*35238bceSAndroid Build Coastguard Worker return "none";
736*35238bceSAndroid Build Coastguard Worker case GL_RENDERBUFFER:
737*35238bceSAndroid Build Coastguard Worker return "rbo";
738*35238bceSAndroid Build Coastguard Worker case GL_TEXTURE:
739*35238bceSAndroid Build Coastguard Worker return "tex";
740*35238bceSAndroid Build Coastguard Worker default:
741*35238bceSAndroid Build Coastguard Worker DE_FATAL("Impossible case");
742*35238bceSAndroid Build Coastguard Worker }
743*35238bceSAndroid Build Coastguard Worker return ""; // Shut up compiler
744*35238bceSAndroid Build Coastguard Worker }
745*35238bceSAndroid Build Coastguard Worker
746*35238bceSAndroid Build Coastguard Worker struct AttachmentParams
747*35238bceSAndroid Build Coastguard Worker {
748*35238bceSAndroid Build Coastguard Worker GLenum color0Kind;
749*35238bceSAndroid Build Coastguard Worker GLenum colornKind;
750*35238bceSAndroid Build Coastguard Worker GLenum depthKind;
751*35238bceSAndroid Build Coastguard Worker GLenum stencilKind;
752*35238bceSAndroid Build Coastguard Worker
753*35238bceSAndroid Build Coastguard Worker static string getName(const AttachmentParams ¶ms);
getDescriptiondeqp::gls::fboc::details::AttachmentParams754*35238bceSAndroid Build Coastguard Worker static string getDescription(const AttachmentParams ¶ms)
755*35238bceSAndroid Build Coastguard Worker {
756*35238bceSAndroid Build Coastguard Worker return getName(params);
757*35238bceSAndroid Build Coastguard Worker }
758*35238bceSAndroid Build Coastguard Worker };
759*35238bceSAndroid Build Coastguard Worker
getName(const AttachmentParams & params)760*35238bceSAndroid Build Coastguard Worker string AttachmentParams::getName(const AttachmentParams ¶ms)
761*35238bceSAndroid Build Coastguard Worker {
762*35238bceSAndroid Build Coastguard Worker return (attTypeName(params.color0Kind) + "_" + attTypeName(params.colornKind) + "_" +
763*35238bceSAndroid Build Coastguard Worker attTypeName(params.depthKind) + "_" + attTypeName(params.stencilKind));
764*35238bceSAndroid Build Coastguard Worker }
765*35238bceSAndroid Build Coastguard Worker
766*35238bceSAndroid Build Coastguard Worker //! Test for combinations of different kinds of attachments
767*35238bceSAndroid Build Coastguard Worker class AttachmentTest : public ParamTest<AttachmentParams>
768*35238bceSAndroid Build Coastguard Worker {
769*35238bceSAndroid Build Coastguard Worker public:
AttachmentTest(Context & group,Params & params)770*35238bceSAndroid Build Coastguard Worker AttachmentTest(Context &group, Params ¶ms) : ParamTest<AttachmentParams>(group, params)
771*35238bceSAndroid Build Coastguard Worker {
772*35238bceSAndroid Build Coastguard Worker }
773*35238bceSAndroid Build Coastguard Worker
774*35238bceSAndroid Build Coastguard Worker protected:
775*35238bceSAndroid Build Coastguard Worker IterateResult build(FboBuilder &builder);
776*35238bceSAndroid Build Coastguard Worker void makeDepthAndStencil(FboBuilder &builder);
777*35238bceSAndroid Build Coastguard Worker };
778*35238bceSAndroid Build Coastguard Worker
makeDepthAndStencil(FboBuilder & builder)779*35238bceSAndroid Build Coastguard Worker void AttachmentTest::makeDepthAndStencil(FboBuilder &builder)
780*35238bceSAndroid Build Coastguard Worker {
781*35238bceSAndroid Build Coastguard Worker if (m_params.stencilKind == m_params.depthKind)
782*35238bceSAndroid Build Coastguard Worker {
783*35238bceSAndroid Build Coastguard Worker // If there is a common stencil+depth -format, try to use a common
784*35238bceSAndroid Build Coastguard Worker // image for both attachments.
785*35238bceSAndroid Build Coastguard Worker const FormatFlags flags = DEPTH_RENDERABLE | STENCIL_RENDERABLE | formatFlag(m_params.stencilKind);
786*35238bceSAndroid Build Coastguard Worker const Formats &formats = m_ctx.getCoreFormats().getFormats(flags);
787*35238bceSAndroid Build Coastguard Worker Formats::const_iterator it = formats.begin();
788*35238bceSAndroid Build Coastguard Worker if (it != formats.end())
789*35238bceSAndroid Build Coastguard Worker {
790*35238bceSAndroid Build Coastguard Worker const ImageFormat format = *it;
791*35238bceSAndroid Build Coastguard Worker Attachment *att = makeAttachment(m_params.depthKind, format, 64, 64, builder);
792*35238bceSAndroid Build Coastguard Worker builder.glAttach(GL_DEPTH_ATTACHMENT, att);
793*35238bceSAndroid Build Coastguard Worker builder.glAttach(GL_STENCIL_ATTACHMENT, att);
794*35238bceSAndroid Build Coastguard Worker return;
795*35238bceSAndroid Build Coastguard Worker }
796*35238bceSAndroid Build Coastguard Worker }
797*35238bceSAndroid Build Coastguard Worker // Either the kinds were separate, or a suitable format was not found.
798*35238bceSAndroid Build Coastguard Worker // Create separate images.
799*35238bceSAndroid Build Coastguard Worker attachTargetToNew(GL_STENCIL_ATTACHMENT, m_params.stencilKind, ImageFormat::none(), 64, 64, builder);
800*35238bceSAndroid Build Coastguard Worker attachTargetToNew(GL_DEPTH_ATTACHMENT, m_params.depthKind, ImageFormat::none(), 64, 64, builder);
801*35238bceSAndroid Build Coastguard Worker }
802*35238bceSAndroid Build Coastguard Worker
build(FboBuilder & builder)803*35238bceSAndroid Build Coastguard Worker IterateResult AttachmentTest::build(FboBuilder &builder)
804*35238bceSAndroid Build Coastguard Worker {
805*35238bceSAndroid Build Coastguard Worker attachTargetToNew(GL_COLOR_ATTACHMENT0, m_params.color0Kind, ImageFormat::none(), 64, 64, builder);
806*35238bceSAndroid Build Coastguard Worker
807*35238bceSAndroid Build Coastguard Worker if (m_params.colornKind != GL_NONE)
808*35238bceSAndroid Build Coastguard Worker {
809*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, m_ctx.haveMultiColorAtts(), "Multiple attachments not supported");
810*35238bceSAndroid Build Coastguard Worker GLint maxAttachments = 1;
811*35238bceSAndroid Build Coastguard Worker gl(*this).getIntegerv(GL_MAX_COLOR_ATTACHMENTS, &maxAttachments);
812*35238bceSAndroid Build Coastguard Worker GLU_EXPECT_NO_ERROR(gl(*this).getError(), "Couldn't read GL_MAX_COLOR_ATTACHMENTS");
813*35238bceSAndroid Build Coastguard Worker
814*35238bceSAndroid Build Coastguard Worker for (int i = 1; i < maxAttachments; i++)
815*35238bceSAndroid Build Coastguard Worker {
816*35238bceSAndroid Build Coastguard Worker attachTargetToNew(GL_COLOR_ATTACHMENT0 + i, m_params.colornKind, ImageFormat::none(), 64, 64, builder);
817*35238bceSAndroid Build Coastguard Worker }
818*35238bceSAndroid Build Coastguard Worker }
819*35238bceSAndroid Build Coastguard Worker
820*35238bceSAndroid Build Coastguard Worker makeDepthAndStencil(builder);
821*35238bceSAndroid Build Coastguard Worker
822*35238bceSAndroid Build Coastguard Worker return STOP;
823*35238bceSAndroid Build Coastguard Worker }
824*35238bceSAndroid Build Coastguard Worker
825*35238bceSAndroid Build Coastguard Worker class EmptyImageTest : public TestBase
826*35238bceSAndroid Build Coastguard Worker {
827*35238bceSAndroid Build Coastguard Worker public:
EmptyImageTest(Context & group,const char * name,const char * desc)828*35238bceSAndroid Build Coastguard Worker EmptyImageTest(Context &group, const char *name, const char *desc) : TestBase(group, name, desc)
829*35238bceSAndroid Build Coastguard Worker {
830*35238bceSAndroid Build Coastguard Worker }
831*35238bceSAndroid Build Coastguard Worker
832*35238bceSAndroid Build Coastguard Worker IterateResult build(FboBuilder &builder);
833*35238bceSAndroid Build Coastguard Worker };
834*35238bceSAndroid Build Coastguard Worker
build(FboBuilder & builder)835*35238bceSAndroid Build Coastguard Worker IterateResult EmptyImageTest::build(FboBuilder &builder)
836*35238bceSAndroid Build Coastguard Worker {
837*35238bceSAndroid Build Coastguard Worker attachTargetToNew(GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, ImageFormat::none(), 0, 0, builder);
838*35238bceSAndroid Build Coastguard Worker return STOP;
839*35238bceSAndroid Build Coastguard Worker }
840*35238bceSAndroid Build Coastguard Worker
841*35238bceSAndroid Build Coastguard Worker class DistinctSizeTest : public TestBase
842*35238bceSAndroid Build Coastguard Worker {
843*35238bceSAndroid Build Coastguard Worker public:
DistinctSizeTest(Context & group,const char * name,const char * desc)844*35238bceSAndroid Build Coastguard Worker DistinctSizeTest(Context &group, const char *name, const char *desc) : TestBase(group, name, desc)
845*35238bceSAndroid Build Coastguard Worker {
846*35238bceSAndroid Build Coastguard Worker }
847*35238bceSAndroid Build Coastguard Worker
848*35238bceSAndroid Build Coastguard Worker IterateResult build(FboBuilder &builder);
849*35238bceSAndroid Build Coastguard Worker };
850*35238bceSAndroid Build Coastguard Worker
build(FboBuilder & builder)851*35238bceSAndroid Build Coastguard Worker IterateResult DistinctSizeTest::build(FboBuilder &builder)
852*35238bceSAndroid Build Coastguard Worker {
853*35238bceSAndroid Build Coastguard Worker attachTargetToNew(GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, ImageFormat::none(), 64, 64, builder);
854*35238bceSAndroid Build Coastguard Worker attachTargetToNew(GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, ImageFormat::none(), 128, 128, builder);
855*35238bceSAndroid Build Coastguard Worker return STOP;
856*35238bceSAndroid Build Coastguard Worker }
857*35238bceSAndroid Build Coastguard Worker
createRenderableTests(void)858*35238bceSAndroid Build Coastguard Worker TestCaseGroup *Context::createRenderableTests(void)
859*35238bceSAndroid Build Coastguard Worker {
860*35238bceSAndroid Build Coastguard Worker TestCaseGroup *const renderableTests =
861*35238bceSAndroid Build Coastguard Worker new TestCaseGroup(m_testCtx, "renderable", "Tests for support of renderable image formats");
862*35238bceSAndroid Build Coastguard Worker
863*35238bceSAndroid Build Coastguard Worker TestCaseGroup *const rbRenderableTests =
864*35238bceSAndroid Build Coastguard Worker new TestCaseGroup(m_testCtx, "renderbuffer", "Tests for renderbuffer formats");
865*35238bceSAndroid Build Coastguard Worker
866*35238bceSAndroid Build Coastguard Worker TestCaseGroup *const texRenderableTests = new TestCaseGroup(m_testCtx, "texture", "Tests for texture formats");
867*35238bceSAndroid Build Coastguard Worker
868*35238bceSAndroid Build Coastguard Worker static const struct AttPoint
869*35238bceSAndroid Build Coastguard Worker {
870*35238bceSAndroid Build Coastguard Worker GLenum attPoint;
871*35238bceSAndroid Build Coastguard Worker const char *name;
872*35238bceSAndroid Build Coastguard Worker const char *desc;
873*35238bceSAndroid Build Coastguard Worker } attPoints[] = {
874*35238bceSAndroid Build Coastguard Worker {GL_COLOR_ATTACHMENT0, "color0", "Tests for color attachments"},
875*35238bceSAndroid Build Coastguard Worker {GL_STENCIL_ATTACHMENT, "stencil", "Tests for stencil attachments"},
876*35238bceSAndroid Build Coastguard Worker {GL_DEPTH_ATTACHMENT, "depth", "Tests for depth attachments"},
877*35238bceSAndroid Build Coastguard Worker };
878*35238bceSAndroid Build Coastguard Worker
879*35238bceSAndroid Build Coastguard Worker // At each attachment point, iterate through all the possible formats to
880*35238bceSAndroid Build Coastguard Worker // detect both false positives and false negatives.
881*35238bceSAndroid Build Coastguard Worker const Formats rboFmts = m_allFormats.getFormats(ANY_FORMAT);
882*35238bceSAndroid Build Coastguard Worker const Formats texFmts = m_allFormats.getFormats(ANY_FORMAT);
883*35238bceSAndroid Build Coastguard Worker
884*35238bceSAndroid Build Coastguard Worker for (const AttPoint *it = DE_ARRAY_BEGIN(attPoints); it != DE_ARRAY_END(attPoints); it++)
885*35238bceSAndroid Build Coastguard Worker {
886*35238bceSAndroid Build Coastguard Worker TestCaseGroup *const rbAttTests = new TestCaseGroup(m_testCtx, it->name, it->desc);
887*35238bceSAndroid Build Coastguard Worker TestCaseGroup *const texAttTests = new TestCaseGroup(m_testCtx, it->name, it->desc);
888*35238bceSAndroid Build Coastguard Worker
889*35238bceSAndroid Build Coastguard Worker for (Formats::const_iterator it2 = rboFmts.begin(); it2 != rboFmts.end(); it2++)
890*35238bceSAndroid Build Coastguard Worker {
891*35238bceSAndroid Build Coastguard Worker const RenderableParams params = {it->attPoint, GL_RENDERBUFFER, *it2};
892*35238bceSAndroid Build Coastguard Worker rbAttTests->addChild(new RenderableTest(*this, params));
893*35238bceSAndroid Build Coastguard Worker }
894*35238bceSAndroid Build Coastguard Worker rbRenderableTests->addChild(rbAttTests);
895*35238bceSAndroid Build Coastguard Worker
896*35238bceSAndroid Build Coastguard Worker for (Formats::const_iterator it2 = texFmts.begin(); it2 != texFmts.end(); it2++)
897*35238bceSAndroid Build Coastguard Worker {
898*35238bceSAndroid Build Coastguard Worker const RenderableParams params = {it->attPoint, GL_TEXTURE, *it2};
899*35238bceSAndroid Build Coastguard Worker texAttTests->addChild(new RenderableTest(*this, params));
900*35238bceSAndroid Build Coastguard Worker }
901*35238bceSAndroid Build Coastguard Worker texRenderableTests->addChild(texAttTests);
902*35238bceSAndroid Build Coastguard Worker }
903*35238bceSAndroid Build Coastguard Worker renderableTests->addChild(rbRenderableTests);
904*35238bceSAndroid Build Coastguard Worker renderableTests->addChild(texRenderableTests);
905*35238bceSAndroid Build Coastguard Worker
906*35238bceSAndroid Build Coastguard Worker return renderableTests;
907*35238bceSAndroid Build Coastguard Worker }
908*35238bceSAndroid Build Coastguard Worker
createAttachmentTests(void)909*35238bceSAndroid Build Coastguard Worker TestCaseGroup *Context::createAttachmentTests(void)
910*35238bceSAndroid Build Coastguard Worker {
911*35238bceSAndroid Build Coastguard Worker TestCaseGroup *const attCombTests =
912*35238bceSAndroid Build Coastguard Worker new TestCaseGroup(m_testCtx, "attachment_combinations", "Tests for attachment combinations");
913*35238bceSAndroid Build Coastguard Worker
914*35238bceSAndroid Build Coastguard Worker static const GLenum s_bufTypes[] = {GL_NONE, GL_RENDERBUFFER, GL_TEXTURE};
915*35238bceSAndroid Build Coastguard Worker static const Range<GLenum> s_kinds = GLS_ARRAY_RANGE(s_bufTypes);
916*35238bceSAndroid Build Coastguard Worker
917*35238bceSAndroid Build Coastguard Worker for (const GLenum *col0 = s_kinds.begin(); col0 != s_kinds.end(); ++col0)
918*35238bceSAndroid Build Coastguard Worker for (const GLenum *coln = s_kinds.begin(); coln != s_kinds.end(); ++coln)
919*35238bceSAndroid Build Coastguard Worker for (const GLenum *dep = s_kinds.begin(); dep != s_kinds.end(); ++dep)
920*35238bceSAndroid Build Coastguard Worker for (const GLenum *stc = s_kinds.begin(); stc != s_kinds.end(); ++stc)
921*35238bceSAndroid Build Coastguard Worker {
922*35238bceSAndroid Build Coastguard Worker AttachmentParams params = {*col0, *coln, *dep, *stc};
923*35238bceSAndroid Build Coastguard Worker attCombTests->addChild(new AttachmentTest(*this, params));
924*35238bceSAndroid Build Coastguard Worker }
925*35238bceSAndroid Build Coastguard Worker
926*35238bceSAndroid Build Coastguard Worker return attCombTests;
927*35238bceSAndroid Build Coastguard Worker }
928*35238bceSAndroid Build Coastguard Worker
createSizeTests(void)929*35238bceSAndroid Build Coastguard Worker TestCaseGroup *Context::createSizeTests(void)
930*35238bceSAndroid Build Coastguard Worker {
931*35238bceSAndroid Build Coastguard Worker TestCaseGroup *const sizeTests = new TestCaseGroup(m_testCtx, "size", "Tests for attachment sizes");
932*35238bceSAndroid Build Coastguard Worker sizeTests->addChild(new EmptyImageTest(*this, "zero", "Test for zero-sized image attachment"));
933*35238bceSAndroid Build Coastguard Worker sizeTests->addChild(new DistinctSizeTest(*this, "distinct", "Test for attachments with different sizes"));
934*35238bceSAndroid Build Coastguard Worker
935*35238bceSAndroid Build Coastguard Worker return sizeTests;
936*35238bceSAndroid Build Coastguard Worker }
937*35238bceSAndroid Build Coastguard Worker
938*35238bceSAndroid Build Coastguard Worker } // namespace details
939*35238bceSAndroid Build Coastguard Worker
940*35238bceSAndroid Build Coastguard Worker } // namespace fboc
941*35238bceSAndroid Build Coastguard Worker } // namespace gls
942*35238bceSAndroid Build Coastguard Worker } // namespace deqp
943