1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 2.0 Module
3 * -------------------------------------------------
5 * Copyright 2014 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief Capability Tests.
22 *//*--------------------------------------------------------------------*/
24 #include "tes2CapabilityTests.hpp"
25 #include "gluStrUtil.hpp"
26 #include "tcuTestLog.hpp"
27 #include "deStringUtil.hpp"
28 #include "gluContextInfo.hpp"
44 class GetIntCase : public tcu::TestCase
47 GetIntCase (Context& context, const char* name, const char* description, GLenum param)
48 : tcu::TestCase (context.getTestContext(), tcu::NODETYPE_CAPABILITY, name, description)
53 IterateResult iterate (void)
56 GLU_CHECK_CALL(glGetIntegerv(m_param, &value));
58 m_testCtx.getLog() << TestLog::Message << glu::getParamQueryStr(m_param) << " = " << value << TestLog::EndMessage;
60 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, de::toString(value).c_str());
68 class LimitTests : public TestCaseGroup
71 LimitTests (Context& context)
72 : TestCaseGroup(context, "limits", "Implementation-defined limits")
81 const char* description;
85 { "vertex_attribs", "Number of vertex attributes supported", GL_MAX_VERTEX_ATTRIBS },
86 { "varying_vectors", "Number of varying vectors supported", GL_MAX_VARYING_VECTORS },
87 { "vertex_uniform_vectors", "Number of vertex uniform vectors supported", GL_MAX_VERTEX_UNIFORM_VECTORS },
88 { "fragment_uniform_vectors", "Number of fragment uniform vectors supported", GL_MAX_FRAGMENT_UNIFORM_VECTORS },
89 { "texture_image_units", "Number of fragment texture units supported", GL_MAX_TEXTURE_IMAGE_UNITS },
90 { "vertex_texture_image_units", "Number of vertex texture units supported", GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS },
91 { "combined_texture_image_units", "Number of vertex and fragment combined texture units supported", GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS },
92 { "texture_2d_size", "Maximum 2D texture size", GL_MAX_TEXTURE_SIZE },
93 { "texture_cube_size", "Maximum cubemap texture size", GL_MAX_CUBE_MAP_TEXTURE_SIZE },
94 { "renderbuffer_size", "Maximum renderbuffer size", GL_MAX_RENDERBUFFER_SIZE },
97 for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(getIntCases); ndx++)
98 addChild(new GetIntCase(m_context, getIntCases[ndx].name, getIntCases[ndx].description, getIntCases[ndx].param));
102 class ExtensionCase : public tcu::TestCase
105 ExtensionCase (tcu::TestContext& testCtx, const glu::ContextInfo& ctxInfo, const char* name, const char* desc, const char* extName);
107 IterateResult iterate (void);
110 const glu::ContextInfo& m_ctxInfo;
111 std::string m_extName;
114 ExtensionCase::ExtensionCase (tcu::TestContext& testCtx, const glu::ContextInfo& ctxInfo, const char* name, const char* desc, const char* extName)
115 : tcu::TestCase (testCtx, tcu::NODETYPE_CAPABILITY, name, desc)
116 , m_ctxInfo (ctxInfo)
117 , m_extName (extName)
121 ExtensionCase::IterateResult ExtensionCase::iterate (void)
123 bool isSupported = std::find(m_ctxInfo.getExtensions().begin(), m_ctxInfo.getExtensions().end(), m_extName) != m_ctxInfo.getExtensions().end();
124 m_testCtx.setTestResult(isSupported ? QP_TEST_RESULT_PASS : QP_TEST_RESULT_NOT_SUPPORTED,
125 isSupported ? "Supported" : "Not supported");
129 class ExtensionTests : public TestCaseGroup
132 ExtensionTests (Context& context)
133 : TestCaseGroup(context, "extensions", "Supported extensions")
141 tcu::TestCaseGroup* group;
142 const glu::ContextInfo& ctxInfo;
144 ExtGroup (TestCaseGroup* parent, const char* name, const char* desc)
146 , ctxInfo (parent->getContext().getContextInfo())
148 group = new tcu::TestCaseGroup(parent->getTestContext(), name, desc);
149 parent->addChild(group);
152 ExtGroup& operator<< (const char* extName)
154 group->addChild(new ExtensionCase(group->getTestContext(), ctxInfo, extName, "", extName));
159 // Uncompressed formats.
160 ExtGroup(this, "uncompressed_texture_formats", "Uncompressed texture formats")
161 << "GL_OES_texture_float_linear"
162 << "GL_OES_texture_half_float_linear"
163 << "GL_OES_texture_float"
164 << "GL_OES_texture_half_float"
165 << "GL_OES_texture_npot"
166 << "GL_EXT_texture_format_BGRA8888"
167 << "GL_EXT_texture_rg"
168 << "GL_EXT_texture_type_2_10_10_10_REV"
170 << "GL_APPLE_rgb_422"
171 << "GL_APPLE_texture_format_BGRA8888";
173 // Compressed formats.
174 ExtGroup(this, "compressed_texture_formats", "Compressed texture formats")
175 << "GL_OES_compressed_ETC1_RGB8_texture"
176 << "GL_OES_compressed_paletted_texture"
177 << "GL_EXT_texture_compression_dxt1"
178 << "GL_AMD_compressed_3DC_texture"
179 << "GL_AMD_compressed_ATC_texture"
180 << "GL_IMG_texture_compression_pvrtc"
181 << "GL_NV_texture_compression_s3tc_update";
184 ExtGroup(this, "texture", "Texturing features")
185 << "GL_OES_texture_3D"
186 << "GL_OES_depth_texture"
187 << "GL_EXT_texture_filter_anisotropic"
188 << "GL_EXT_texture_lod_bias"
189 << "GL_EXT_shadow_samplers"
190 << "GL_EXT_texture_storage"
191 << "GL_NV_texture_npot_2D_mipmap"
192 << "GL_APPLE_texture_max_level";
195 ExtGroup(this, "fbo", "FBO features")
198 << "GL_OES_packed_depth_stencil"
199 << "GL_OES_fbo_render_mipmap"
200 << "GL_OES_rgb8_rgba8"
204 << "GL_EXT_color_buffer_half_float"
205 << "GL_EXT_multisampled_render_to_texture"
206 << "GL_IMG_multisampled_render_to_texture"
208 << "GL_NV_depth_nonlinear"
209 << "GL_NV_draw_buffers"
210 << "GL_NV_fbo_color_attachments"
211 << "GL_NV_read_buffer"
212 << "GL_APPLE_framebuffer_multisample";
214 // Vertex data formats.
215 ExtGroup(this, "vertex_data_formats", "Vertex data formats")
216 << "GL_OES_element_index_uint"
217 << "GL_OES_vertex_half_float"
218 << "GL_OES_vertex_type_10_10_10_2";
220 // Shader functionality.
221 ExtGroup(this, "shaders", "Shader features")
222 << "GL_OES_fragment_precision_high"
223 << "GL_OES_standard_derivatives"
224 << "GL_EXT_shader_texture_lod"
225 << "GL_EXT_frag_depth"
226 << "GL_EXT_separate_shader_objects";
228 // Shader binary formats.
229 ExtGroup(this, "shader_binary_formats", "Shader binary formats")
230 << "GL_OES_get_program_binary"
231 << "GL_AMD_program_binary_Z400"
232 << "GL_IMG_shader_binary"
233 << "GL_IMG_program_binary"
234 << "GL_ARM_mali_shader_binary"
235 << "GL_VIV_shader_binary"
236 << "GL_DMP_shader_binary";
238 // Development features.
239 ExtGroup(this, "development", "Development aids")
240 << "GL_EXT_debug_label"
241 << "GL_EXT_debug_marker"
242 << "GL_AMD_performance_monitor"
243 << "GL_QCOM_performance_monitor_global_mode"
244 << "GL_QCOM_extended_get"
245 << "GL_QCOM_extended_get2";
248 ExtGroup(this, "other", "Other extensions")
249 << "GL_OES_draw_texture"
250 << "GL_OES_mapbuffer"
251 << "GL_OES_vertex_array_object"
252 << "GL_EXT_occlusion_query_boolean"
253 << "GL_EXT_robustness"
254 << "GL_EXT_discard_framebuffer"
255 << "GL_EXT_read_format_bgra"
256 << "GL_EXT_multi_draw_arrays"
257 << "GL_EXT_unpack_subimage"
258 << "GL_EXT_blend_minmax"
259 << "GL_IMG_read_format"
260 << "GL_NV_coverage_sample"
261 << "GL_NV_read_depth_stencil"
262 << "GL_SUN_multi_draw_arrays";
266 CapabilityTests::CapabilityTests (Context& context)
267 : TestCaseGroup(context, "capability", "Capability Tests")
271 CapabilityTests::~CapabilityTests (void)
275 void CapabilityTests::init (void)
277 addChild(new LimitTests (m_context));
278 addChild(new ExtensionTests (m_context));