1*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
2*35238bceSAndroid Build Coastguard Worker * drawElements Quality Program OpenGL ES 2.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 Capability Tests.
22*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker
24*35238bceSAndroid Build Coastguard Worker #include "tes2CapabilityTests.hpp"
25*35238bceSAndroid Build Coastguard Worker #include "gluStrUtil.hpp"
26*35238bceSAndroid Build Coastguard Worker #include "tcuTestLog.hpp"
27*35238bceSAndroid Build Coastguard Worker #include "deStringUtil.hpp"
28*35238bceSAndroid Build Coastguard Worker #include "gluContextInfo.hpp"
29*35238bceSAndroid Build Coastguard Worker
30*35238bceSAndroid Build Coastguard Worker #include <algorithm>
31*35238bceSAndroid Build Coastguard Worker #include <iterator>
32*35238bceSAndroid Build Coastguard Worker
33*35238bceSAndroid Build Coastguard Worker #include "glw.h"
34*35238bceSAndroid Build Coastguard Worker
35*35238bceSAndroid Build Coastguard Worker using std::string;
36*35238bceSAndroid Build Coastguard Worker using std::vector;
37*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
38*35238bceSAndroid Build Coastguard Worker
39*35238bceSAndroid Build Coastguard Worker namespace deqp
40*35238bceSAndroid Build Coastguard Worker {
41*35238bceSAndroid Build Coastguard Worker namespace gles2
42*35238bceSAndroid Build Coastguard Worker {
43*35238bceSAndroid Build Coastguard Worker
44*35238bceSAndroid Build Coastguard Worker class GetIntCase : public tcu::TestCase
45*35238bceSAndroid Build Coastguard Worker {
46*35238bceSAndroid Build Coastguard Worker public:
GetIntCase(Context & context,const char * name,const char * description,GLenum param)47*35238bceSAndroid Build Coastguard Worker GetIntCase(Context &context, const char *name, const char *description, GLenum param)
48*35238bceSAndroid Build Coastguard Worker : tcu::TestCase(context.getTestContext(), tcu::NODETYPE_CAPABILITY, name, description)
49*35238bceSAndroid Build Coastguard Worker , m_param(param)
50*35238bceSAndroid Build Coastguard Worker {
51*35238bceSAndroid Build Coastguard Worker }
52*35238bceSAndroid Build Coastguard Worker
iterate(void)53*35238bceSAndroid Build Coastguard Worker IterateResult iterate(void)
54*35238bceSAndroid Build Coastguard Worker {
55*35238bceSAndroid Build Coastguard Worker GLint value = 0;
56*35238bceSAndroid Build Coastguard Worker GLU_CHECK_CALL(glGetIntegerv(m_param, &value));
57*35238bceSAndroid Build Coastguard Worker
58*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << glu::getParamQueryStr(m_param) << " = " << value
59*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
60*35238bceSAndroid Build Coastguard Worker
61*35238bceSAndroid Build Coastguard Worker m_testCtx.setTestResult(QP_TEST_RESULT_PASS, de::toString(value).c_str());
62*35238bceSAndroid Build Coastguard Worker return STOP;
63*35238bceSAndroid Build Coastguard Worker }
64*35238bceSAndroid Build Coastguard Worker
65*35238bceSAndroid Build Coastguard Worker private:
66*35238bceSAndroid Build Coastguard Worker GLenum m_param;
67*35238bceSAndroid Build Coastguard Worker };
68*35238bceSAndroid Build Coastguard Worker
69*35238bceSAndroid Build Coastguard Worker class LimitTests : public TestCaseGroup
70*35238bceSAndroid Build Coastguard Worker {
71*35238bceSAndroid Build Coastguard Worker public:
LimitTests(Context & context)72*35238bceSAndroid Build Coastguard Worker LimitTests(Context &context) : TestCaseGroup(context, "limits", "Implementation-defined limits")
73*35238bceSAndroid Build Coastguard Worker {
74*35238bceSAndroid Build Coastguard Worker }
75*35238bceSAndroid Build Coastguard Worker
init(void)76*35238bceSAndroid Build Coastguard Worker void init(void)
77*35238bceSAndroid Build Coastguard Worker {
78*35238bceSAndroid Build Coastguard Worker static const struct
79*35238bceSAndroid Build Coastguard Worker {
80*35238bceSAndroid Build Coastguard Worker const char *name;
81*35238bceSAndroid Build Coastguard Worker const char *description;
82*35238bceSAndroid Build Coastguard Worker GLenum param;
83*35238bceSAndroid Build Coastguard Worker } getIntCases[] = {
84*35238bceSAndroid Build Coastguard Worker {"vertex_attribs", "Number of vertex attributes supported", GL_MAX_VERTEX_ATTRIBS},
85*35238bceSAndroid Build Coastguard Worker {"varying_vectors", "Number of varying vectors supported", GL_MAX_VARYING_VECTORS},
86*35238bceSAndroid Build Coastguard Worker {"vertex_uniform_vectors", "Number of vertex uniform vectors supported", GL_MAX_VERTEX_UNIFORM_VECTORS},
87*35238bceSAndroid Build Coastguard Worker {"fragment_uniform_vectors", "Number of fragment uniform vectors supported",
88*35238bceSAndroid Build Coastguard Worker GL_MAX_FRAGMENT_UNIFORM_VECTORS},
89*35238bceSAndroid Build Coastguard Worker {"texture_image_units", "Number of fragment texture units supported", GL_MAX_TEXTURE_IMAGE_UNITS},
90*35238bceSAndroid Build Coastguard Worker {"vertex_texture_image_units", "Number of vertex texture units supported",
91*35238bceSAndroid Build Coastguard Worker GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS},
92*35238bceSAndroid Build Coastguard Worker {"combined_texture_image_units", "Number of vertex and fragment combined texture units supported",
93*35238bceSAndroid Build Coastguard Worker GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS},
94*35238bceSAndroid Build Coastguard Worker {"texture_2d_size", "Maximum 2D texture size", GL_MAX_TEXTURE_SIZE},
95*35238bceSAndroid Build Coastguard Worker {"texture_cube_size", "Maximum cubemap texture size", GL_MAX_CUBE_MAP_TEXTURE_SIZE},
96*35238bceSAndroid Build Coastguard Worker {"renderbuffer_size", "Maximum renderbuffer size", GL_MAX_RENDERBUFFER_SIZE},
97*35238bceSAndroid Build Coastguard Worker };
98*35238bceSAndroid Build Coastguard Worker
99*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(getIntCases); ndx++)
100*35238bceSAndroid Build Coastguard Worker addChild(
101*35238bceSAndroid Build Coastguard Worker new GetIntCase(m_context, getIntCases[ndx].name, getIntCases[ndx].description, getIntCases[ndx].param));
102*35238bceSAndroid Build Coastguard Worker }
103*35238bceSAndroid Build Coastguard Worker };
104*35238bceSAndroid Build Coastguard Worker
105*35238bceSAndroid Build Coastguard Worker class ExtensionCase : public tcu::TestCase
106*35238bceSAndroid Build Coastguard Worker {
107*35238bceSAndroid Build Coastguard Worker public:
108*35238bceSAndroid Build Coastguard Worker ExtensionCase(tcu::TestContext &testCtx, const glu::ContextInfo &ctxInfo, const char *name, const char *desc,
109*35238bceSAndroid Build Coastguard Worker const char *extName);
110*35238bceSAndroid Build Coastguard Worker
111*35238bceSAndroid Build Coastguard Worker IterateResult iterate(void);
112*35238bceSAndroid Build Coastguard Worker
113*35238bceSAndroid Build Coastguard Worker private:
114*35238bceSAndroid Build Coastguard Worker const glu::ContextInfo &m_ctxInfo;
115*35238bceSAndroid Build Coastguard Worker std::string m_extName;
116*35238bceSAndroid Build Coastguard Worker };
117*35238bceSAndroid Build Coastguard Worker
ExtensionCase(tcu::TestContext & testCtx,const glu::ContextInfo & ctxInfo,const char * name,const char * desc,const char * extName)118*35238bceSAndroid Build Coastguard Worker ExtensionCase::ExtensionCase(tcu::TestContext &testCtx, const glu::ContextInfo &ctxInfo, const char *name,
119*35238bceSAndroid Build Coastguard Worker const char *desc, const char *extName)
120*35238bceSAndroid Build Coastguard Worker : tcu::TestCase(testCtx, tcu::NODETYPE_CAPABILITY, name, desc)
121*35238bceSAndroid Build Coastguard Worker , m_ctxInfo(ctxInfo)
122*35238bceSAndroid Build Coastguard Worker , m_extName(extName)
123*35238bceSAndroid Build Coastguard Worker {
124*35238bceSAndroid Build Coastguard Worker }
125*35238bceSAndroid Build Coastguard Worker
iterate(void)126*35238bceSAndroid Build Coastguard Worker ExtensionCase::IterateResult ExtensionCase::iterate(void)
127*35238bceSAndroid Build Coastguard Worker {
128*35238bceSAndroid Build Coastguard Worker bool isSupported = std::find(m_ctxInfo.getExtensions().begin(), m_ctxInfo.getExtensions().end(), m_extName) !=
129*35238bceSAndroid Build Coastguard Worker m_ctxInfo.getExtensions().end();
130*35238bceSAndroid Build Coastguard Worker m_testCtx.setTestResult(isSupported ? QP_TEST_RESULT_PASS : QP_TEST_RESULT_NOT_SUPPORTED,
131*35238bceSAndroid Build Coastguard Worker isSupported ? "Supported" : "Not supported");
132*35238bceSAndroid Build Coastguard Worker return STOP;
133*35238bceSAndroid Build Coastguard Worker }
134*35238bceSAndroid Build Coastguard Worker
135*35238bceSAndroid Build Coastguard Worker class ExtensionTests : public TestCaseGroup
136*35238bceSAndroid Build Coastguard Worker {
137*35238bceSAndroid Build Coastguard Worker public:
ExtensionTests(Context & context)138*35238bceSAndroid Build Coastguard Worker ExtensionTests(Context &context) : TestCaseGroup(context, "extensions", "Supported extensions")
139*35238bceSAndroid Build Coastguard Worker {
140*35238bceSAndroid Build Coastguard Worker }
141*35238bceSAndroid Build Coastguard Worker
init(void)142*35238bceSAndroid Build Coastguard Worker void init(void)
143*35238bceSAndroid Build Coastguard Worker {
144*35238bceSAndroid Build Coastguard Worker struct ExtGroup
145*35238bceSAndroid Build Coastguard Worker {
146*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *group;
147*35238bceSAndroid Build Coastguard Worker const glu::ContextInfo &ctxInfo;
148*35238bceSAndroid Build Coastguard Worker
149*35238bceSAndroid Build Coastguard Worker ExtGroup(TestCaseGroup *parent, const char *name, const char *desc)
150*35238bceSAndroid Build Coastguard Worker : group(DE_NULL)
151*35238bceSAndroid Build Coastguard Worker , ctxInfo(parent->getContext().getContextInfo())
152*35238bceSAndroid Build Coastguard Worker {
153*35238bceSAndroid Build Coastguard Worker group = new tcu::TestCaseGroup(parent->getTestContext(), name, desc);
154*35238bceSAndroid Build Coastguard Worker parent->addChild(group);
155*35238bceSAndroid Build Coastguard Worker }
156*35238bceSAndroid Build Coastguard Worker
157*35238bceSAndroid Build Coastguard Worker ExtGroup &operator<<(const char *extName)
158*35238bceSAndroid Build Coastguard Worker {
159*35238bceSAndroid Build Coastguard Worker group->addChild(new ExtensionCase(group->getTestContext(), ctxInfo, extName, "", extName));
160*35238bceSAndroid Build Coastguard Worker return *this;
161*35238bceSAndroid Build Coastguard Worker }
162*35238bceSAndroid Build Coastguard Worker };
163*35238bceSAndroid Build Coastguard Worker
164*35238bceSAndroid Build Coastguard Worker // Uncompressed formats.
165*35238bceSAndroid Build Coastguard Worker ExtGroup(this, "uncompressed_texture_formats", "Uncompressed texture formats")
166*35238bceSAndroid Build Coastguard Worker << "GL_OES_texture_float_linear"
167*35238bceSAndroid Build Coastguard Worker << "GL_OES_texture_half_float_linear"
168*35238bceSAndroid Build Coastguard Worker << "GL_OES_texture_float"
169*35238bceSAndroid Build Coastguard Worker << "GL_OES_texture_half_float"
170*35238bceSAndroid Build Coastguard Worker << "GL_OES_texture_npot"
171*35238bceSAndroid Build Coastguard Worker << "GL_EXT_texture_format_BGRA8888"
172*35238bceSAndroid Build Coastguard Worker << "GL_EXT_texture_rg"
173*35238bceSAndroid Build Coastguard Worker << "GL_EXT_texture_type_2_10_10_10_REV"
174*35238bceSAndroid Build Coastguard Worker << "GL_EXT_sRGB"
175*35238bceSAndroid Build Coastguard Worker << "GL_APPLE_rgb_422"
176*35238bceSAndroid Build Coastguard Worker << "GL_APPLE_texture_format_BGRA8888";
177*35238bceSAndroid Build Coastguard Worker
178*35238bceSAndroid Build Coastguard Worker // Compressed formats.
179*35238bceSAndroid Build Coastguard Worker ExtGroup(this, "compressed_texture_formats", "Compressed texture formats")
180*35238bceSAndroid Build Coastguard Worker << "GL_OES_compressed_ETC1_RGB8_texture"
181*35238bceSAndroid Build Coastguard Worker << "GL_OES_compressed_paletted_texture"
182*35238bceSAndroid Build Coastguard Worker << "GL_EXT_texture_compression_dxt1"
183*35238bceSAndroid Build Coastguard Worker << "GL_AMD_compressed_3DC_texture"
184*35238bceSAndroid Build Coastguard Worker << "GL_AMD_compressed_ATC_texture"
185*35238bceSAndroid Build Coastguard Worker << "GL_IMG_texture_compression_pvrtc"
186*35238bceSAndroid Build Coastguard Worker << "GL_NV_texture_compression_s3tc_update";
187*35238bceSAndroid Build Coastguard Worker
188*35238bceSAndroid Build Coastguard Worker // Texture features.
189*35238bceSAndroid Build Coastguard Worker ExtGroup(this, "texture", "Texturing features") << "GL_OES_texture_3D"
190*35238bceSAndroid Build Coastguard Worker << "GL_OES_depth_texture"
191*35238bceSAndroid Build Coastguard Worker << "GL_EXT_texture_filter_anisotropic"
192*35238bceSAndroid Build Coastguard Worker << "GL_EXT_texture_lod_bias"
193*35238bceSAndroid Build Coastguard Worker << "GL_EXT_shadow_samplers"
194*35238bceSAndroid Build Coastguard Worker << "GL_EXT_texture_storage"
195*35238bceSAndroid Build Coastguard Worker << "GL_NV_texture_npot_2D_mipmap"
196*35238bceSAndroid Build Coastguard Worker << "GL_APPLE_texture_max_level";
197*35238bceSAndroid Build Coastguard Worker
198*35238bceSAndroid Build Coastguard Worker // FBO features
199*35238bceSAndroid Build Coastguard Worker ExtGroup(this, "fbo", "FBO features") << "GL_OES_depth24"
200*35238bceSAndroid Build Coastguard Worker << "GL_OES_depth32"
201*35238bceSAndroid Build Coastguard Worker << "GL_OES_packed_depth_stencil"
202*35238bceSAndroid Build Coastguard Worker << "GL_OES_fbo_render_mipmap"
203*35238bceSAndroid Build Coastguard Worker << "GL_OES_rgb8_rgba8"
204*35238bceSAndroid Build Coastguard Worker << "GL_OES_stencil1"
205*35238bceSAndroid Build Coastguard Worker << "GL_OES_stencil4"
206*35238bceSAndroid Build Coastguard Worker << "GL_OES_stencil8"
207*35238bceSAndroid Build Coastguard Worker << "GL_EXT_color_buffer_half_float"
208*35238bceSAndroid Build Coastguard Worker << "GL_EXT_multisampled_render_to_texture"
209*35238bceSAndroid Build Coastguard Worker << "GL_IMG_multisampled_render_to_texture"
210*35238bceSAndroid Build Coastguard Worker << "GL_ARM_rgba8"
211*35238bceSAndroid Build Coastguard Worker << "GL_NV_depth_nonlinear"
212*35238bceSAndroid Build Coastguard Worker << "GL_NV_draw_buffers"
213*35238bceSAndroid Build Coastguard Worker << "GL_NV_fbo_color_attachments"
214*35238bceSAndroid Build Coastguard Worker << "GL_NV_read_buffer"
215*35238bceSAndroid Build Coastguard Worker << "GL_APPLE_framebuffer_multisample";
216*35238bceSAndroid Build Coastguard Worker
217*35238bceSAndroid Build Coastguard Worker // Vertex data formats.
218*35238bceSAndroid Build Coastguard Worker ExtGroup(this, "vertex_data_formats", "Vertex data formats") << "GL_OES_element_index_uint"
219*35238bceSAndroid Build Coastguard Worker << "GL_OES_vertex_half_float"
220*35238bceSAndroid Build Coastguard Worker << "GL_OES_vertex_type_10_10_10_2";
221*35238bceSAndroid Build Coastguard Worker
222*35238bceSAndroid Build Coastguard Worker // Shader functionality.
223*35238bceSAndroid Build Coastguard Worker ExtGroup(this, "shaders", "Shader features") << "GL_OES_fragment_precision_high"
224*35238bceSAndroid Build Coastguard Worker << "GL_OES_standard_derivatives"
225*35238bceSAndroid Build Coastguard Worker << "GL_EXT_shader_texture_lod"
226*35238bceSAndroid Build Coastguard Worker << "GL_EXT_frag_depth"
227*35238bceSAndroid Build Coastguard Worker << "GL_EXT_separate_shader_objects";
228*35238bceSAndroid Build Coastguard Worker
229*35238bceSAndroid Build Coastguard Worker // Shader binary formats.
230*35238bceSAndroid Build Coastguard Worker ExtGroup(this, "shader_binary_formats", "Shader binary formats") << "GL_OES_get_program_binary"
231*35238bceSAndroid Build Coastguard Worker << "GL_AMD_program_binary_Z400"
232*35238bceSAndroid Build Coastguard Worker << "GL_IMG_shader_binary"
233*35238bceSAndroid Build Coastguard Worker << "GL_IMG_program_binary"
234*35238bceSAndroid Build Coastguard Worker << "GL_ARM_mali_shader_binary"
235*35238bceSAndroid Build Coastguard Worker << "GL_VIV_shader_binary"
236*35238bceSAndroid Build Coastguard Worker << "GL_DMP_shader_binary";
237*35238bceSAndroid Build Coastguard Worker
238*35238bceSAndroid Build Coastguard Worker // Development features.
239*35238bceSAndroid Build Coastguard Worker ExtGroup(this, "development", "Development aids") << "GL_EXT_debug_label"
240*35238bceSAndroid Build Coastguard Worker << "GL_EXT_debug_marker"
241*35238bceSAndroid Build Coastguard Worker << "GL_AMD_performance_monitor"
242*35238bceSAndroid Build Coastguard Worker << "GL_QCOM_performance_monitor_global_mode"
243*35238bceSAndroid Build Coastguard Worker << "GL_QCOM_extended_get"
244*35238bceSAndroid Build Coastguard Worker << "GL_QCOM_extended_get2";
245*35238bceSAndroid Build Coastguard Worker
246*35238bceSAndroid Build Coastguard Worker // Other extensions.
247*35238bceSAndroid Build Coastguard Worker ExtGroup(this, "other", "Other extensions") << "GL_OES_draw_texture"
248*35238bceSAndroid Build Coastguard Worker << "GL_OES_mapbuffer"
249*35238bceSAndroid Build Coastguard Worker << "GL_OES_vertex_array_object"
250*35238bceSAndroid Build Coastguard Worker << "GL_EXT_occlusion_query_boolean"
251*35238bceSAndroid Build Coastguard Worker << "GL_EXT_robustness"
252*35238bceSAndroid Build Coastguard Worker << "GL_EXT_discard_framebuffer"
253*35238bceSAndroid Build Coastguard Worker << "GL_EXT_read_format_bgra"
254*35238bceSAndroid Build Coastguard Worker << "GL_EXT_multi_draw_arrays"
255*35238bceSAndroid Build Coastguard Worker << "GL_EXT_unpack_subimage"
256*35238bceSAndroid Build Coastguard Worker << "GL_EXT_blend_minmax"
257*35238bceSAndroid Build Coastguard Worker << "GL_IMG_read_format"
258*35238bceSAndroid Build Coastguard Worker << "GL_NV_coverage_sample"
259*35238bceSAndroid Build Coastguard Worker << "GL_NV_read_depth_stencil"
260*35238bceSAndroid Build Coastguard Worker << "GL_SUN_multi_draw_arrays";
261*35238bceSAndroid Build Coastguard Worker }
262*35238bceSAndroid Build Coastguard Worker };
263*35238bceSAndroid Build Coastguard Worker
CapabilityTests(Context & context)264*35238bceSAndroid Build Coastguard Worker CapabilityTests::CapabilityTests(Context &context) : TestCaseGroup(context, "capability", "Capability Tests")
265*35238bceSAndroid Build Coastguard Worker {
266*35238bceSAndroid Build Coastguard Worker }
267*35238bceSAndroid Build Coastguard Worker
~CapabilityTests(void)268*35238bceSAndroid Build Coastguard Worker CapabilityTests::~CapabilityTests(void)
269*35238bceSAndroid Build Coastguard Worker {
270*35238bceSAndroid Build Coastguard Worker }
271*35238bceSAndroid Build Coastguard Worker
init(void)272*35238bceSAndroid Build Coastguard Worker void CapabilityTests::init(void)
273*35238bceSAndroid Build Coastguard Worker {
274*35238bceSAndroid Build Coastguard Worker addChild(new LimitTests(m_context));
275*35238bceSAndroid Build Coastguard Worker addChild(new ExtensionTests(m_context));
276*35238bceSAndroid Build Coastguard Worker }
277*35238bceSAndroid Build Coastguard Worker
278*35238bceSAndroid Build Coastguard Worker } // namespace gles2
279*35238bceSAndroid Build Coastguard Worker } // namespace deqp
280