1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 3.1 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 Platform Information and Capability Tests.
22 *//*--------------------------------------------------------------------*/
24 #include "tes31InfoTests.hpp"
25 #include "tcuTestLog.hpp"
26 #include "gluDefs.hpp"
27 #include "gluContextInfo.hpp"
28 #include "gluRenderContext.hpp"
29 #include "tcuRenderTarget.hpp"
31 #include "glwFunctions.hpp"
32 #include "glwEnums.hpp"
45 class QueryStringCase : public TestCase
48 QueryStringCase (Context& context, const char* name, const char* description, deUint32 query)
49 : TestCase (context, name, description)
54 IterateResult iterate (void)
56 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
57 const char* result = (const char*)gl.getString(m_query);
59 GLU_EXPECT_NO_ERROR(gl.getError(), "glGetString() failed");
61 m_testCtx.getLog() << tcu::TestLog::Message << result << tcu::TestLog::EndMessage;
62 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
71 class QueryExtensionsCase : public TestCase
74 QueryExtensionsCase (Context& context)
75 : TestCase (context, "extensions", "Supported Extensions")
79 IterateResult iterate (void)
81 const vector<string> extensions = m_context.getContextInfo().getExtensions();
83 for (vector<string>::const_iterator i = extensions.begin(); i != extensions.end(); i++)
84 m_testCtx.getLog() << tcu::TestLog::Message << *i << tcu::TestLog::EndMessage;
86 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
92 class RenderTargetInfoCase : public TestCase
95 RenderTargetInfoCase (Context& context)
96 : TestCase (context, "render_target", "Render Target Info")
100 IterateResult iterate (void)
102 const tcu::RenderTarget& rt = m_context.getRenderTarget();
103 const tcu::PixelFormat& pf = rt.getPixelFormat();
106 << tcu::TestLog::Integer("RedBits", "Red channel bits", "", QP_KEY_TAG_NONE, pf.redBits)
107 << tcu::TestLog::Integer("GreenBits", "Green channel bits", "", QP_KEY_TAG_NONE, pf.greenBits)
108 << tcu::TestLog::Integer("BlueBits", "Blue channel bits", "", QP_KEY_TAG_NONE, pf.blueBits)
109 << tcu::TestLog::Integer("AlphaBits", "Alpha channel bits", "", QP_KEY_TAG_NONE, pf.alphaBits)
110 << tcu::TestLog::Integer("DepthBits", "Depth bits", "", QP_KEY_TAG_NONE, rt.getDepthBits())
111 << tcu::TestLog::Integer("StencilBits", "Stencil bits", "", QP_KEY_TAG_NONE, rt.getStencilBits())
112 << tcu::TestLog::Integer("NumSamples", "Number of samples", "", QP_KEY_TAG_NONE, rt.getNumSamples())
113 << tcu::TestLog::Integer("Width", "Width", "", QP_KEY_TAG_NONE, rt.getWidth())
114 << tcu::TestLog::Integer("Height", "Height", "", QP_KEY_TAG_NONE, rt.getHeight());
116 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
121 InfoTests::InfoTests (Context& context)
122 : TestCaseGroup(context, "info", "Platform information queries")
126 InfoTests::~InfoTests (void)
130 void InfoTests::init (void)
132 addChild(new QueryStringCase(m_context, "vendor", "Vendor String", GL_VENDOR));
133 addChild(new QueryStringCase(m_context, "renderer", "Renderer String", GL_RENDERER));
134 addChild(new QueryStringCase(m_context, "version", "Version String", GL_VERSION));
135 addChild(new QueryStringCase(m_context, "shading_language_version", "Shading Language Version String", GL_SHADING_LANGUAGE_VERSION));
136 addChild(new QueryExtensionsCase(m_context));
137 addChild(new RenderTargetInfoCase(m_context));