1 /*-------------------------------------------------------------------------
2 * OpenGL Conformance Test Suite
3 * -----------------------------
5 * Copyright (c) 2016 Google Inc.
6 * Copyright (c) 2016 The Khronos Group Inc.
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 * \brief Platform Information Tests.
23 */ /*-------------------------------------------------------------------*/
25 #include "glcInfoTests.hpp"
26 #include "gluContextInfo.hpp"
27 #include "gluDefs.hpp"
28 #include "glwEnums.hpp"
29 #include "glwFunctions.hpp"
30 #include "tcuRenderTarget.hpp"
31 #include "tcuTestLog.hpp"
43 class QueryStringCase : public TestCase
46 QueryStringCase(Context& context, const char* name, const char* description, deUint32 query)
47 : TestCase(context, name, description), m_query(query)
51 IterateResult iterate(void)
53 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
55 const char* result = (const char*)gl.getString(m_query);
56 GLU_EXPECT_NO_ERROR(gl.getError(), "glGetString() failed");
58 m_testCtx.getLog() << tcu::TestLog::Message << result << tcu::TestLog::EndMessage;
59 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
68 class QueryExtensionsCase : public TestCase
71 QueryExtensionsCase(Context& context) : TestCase(context, "extensions", "Supported Extensions")
75 IterateResult iterate(void)
77 const vector<string> extensions = m_context.getContextInfo().getExtensions();
79 for (vector<string>::const_iterator i = extensions.begin(); i != extensions.end(); i++)
80 m_testCtx.getLog() << tcu::TestLog::Message << *i << tcu::TestLog::EndMessage;
82 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
88 class RenderTargetInfoCase : public TestCase
91 RenderTargetInfoCase(Context& context) : TestCase(context, "render_target", "Render Target Information")
95 IterateResult iterate(void)
97 const tcu::RenderTarget& renderTarget = m_context.getRenderContext().getRenderTarget();
98 const tcu::PixelFormat& pixelFormat = renderTarget.getPixelFormat();
100 m_testCtx.getLog() << TestLog::Integer("Width", "Width", "px", QP_KEY_TAG_NONE, renderTarget.getWidth())
101 << TestLog::Integer("Height", "Height", "px", QP_KEY_TAG_NONE, renderTarget.getHeight())
102 << TestLog::Integer("RedBits", "Red bits", "", QP_KEY_TAG_NONE, pixelFormat.redBits)
103 << TestLog::Integer("GreenBits", "Green bits", "", QP_KEY_TAG_NONE, pixelFormat.greenBits)
104 << TestLog::Integer("BlueBits", "Blue bits", "", QP_KEY_TAG_NONE, pixelFormat.blueBits)
105 << TestLog::Integer("AlphaBits", "Alpha bits", "", QP_KEY_TAG_NONE, pixelFormat.alphaBits)
106 << TestLog::Integer("DepthBits", "Depth bits", "", QP_KEY_TAG_NONE,
107 renderTarget.getDepthBits())
108 << TestLog::Integer("StencilBits", "Stencil bits", "", QP_KEY_TAG_NONE,
109 renderTarget.getStencilBits())
110 << TestLog::Integer("SampleCount", "Sample count", "", QP_KEY_TAG_NONE,
111 renderTarget.getNumSamples());
113 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
118 InfoTests::InfoTests(Context& context) : TestCaseGroup(context, "info", "Platform information queries")
122 InfoTests::~InfoTests(void)
126 void InfoTests::init(void)
128 addChild(new QueryStringCase(m_context, "vendor", "Vendor String", GL_VENDOR));
129 addChild(new QueryStringCase(m_context, "renderer", "Renderer String", GL_RENDERER));
130 addChild(new QueryStringCase(m_context, "version", "Version String", GL_VERSION));
131 addChild(new QueryStringCase(m_context, "shading_language_version", "Shading Language Version String",
132 GL_SHADING_LANGUAGE_VERSION));
133 addChild(new QueryExtensionsCase(m_context));
134 addChild(new RenderTargetInfoCase(m_context));