xref: /aosp_15_r20/external/deqp/modules/gles3/tes3InfoTests.cpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
2*35238bceSAndroid Build Coastguard Worker  * drawElements Quality Program OpenGL ES 3.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 Platform Information and Capability Tests.
22*35238bceSAndroid Build Coastguard Worker  *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker 
24*35238bceSAndroid Build Coastguard Worker #include "tes3InfoTests.hpp"
25*35238bceSAndroid Build Coastguard Worker #include "tcuTestLog.hpp"
26*35238bceSAndroid Build Coastguard Worker #include "gluDefs.hpp"
27*35238bceSAndroid Build Coastguard Worker #include "gluContextInfo.hpp"
28*35238bceSAndroid Build Coastguard Worker #include "gluRenderContext.hpp"
29*35238bceSAndroid Build Coastguard Worker #include "tcuRenderTarget.hpp"
30*35238bceSAndroid Build Coastguard Worker 
31*35238bceSAndroid Build Coastguard Worker #include "glwFunctions.hpp"
32*35238bceSAndroid Build Coastguard Worker #include "glwEnums.hpp"
33*35238bceSAndroid Build Coastguard Worker 
34*35238bceSAndroid Build Coastguard Worker #include <string>
35*35238bceSAndroid Build Coastguard Worker #include <vector>
36*35238bceSAndroid Build Coastguard Worker 
37*35238bceSAndroid Build Coastguard Worker using std::string;
38*35238bceSAndroid Build Coastguard Worker using std::vector;
39*35238bceSAndroid Build Coastguard Worker 
40*35238bceSAndroid Build Coastguard Worker namespace deqp
41*35238bceSAndroid Build Coastguard Worker {
42*35238bceSAndroid Build Coastguard Worker namespace gles3
43*35238bceSAndroid Build Coastguard Worker {
44*35238bceSAndroid Build Coastguard Worker 
45*35238bceSAndroid Build Coastguard Worker class QueryStringCase : public TestCase
46*35238bceSAndroid Build Coastguard Worker {
47*35238bceSAndroid Build Coastguard Worker public:
QueryStringCase(Context & context,const char * name,const char * description,uint32_t query)48*35238bceSAndroid Build Coastguard Worker     QueryStringCase(Context &context, const char *name, const char *description, uint32_t query)
49*35238bceSAndroid Build Coastguard Worker         : TestCase(context, name, description)
50*35238bceSAndroid Build Coastguard Worker         , m_query(query)
51*35238bceSAndroid Build Coastguard Worker     {
52*35238bceSAndroid Build Coastguard Worker     }
53*35238bceSAndroid Build Coastguard Worker 
iterate(void)54*35238bceSAndroid Build Coastguard Worker     IterateResult iterate(void)
55*35238bceSAndroid Build Coastguard Worker     {
56*35238bceSAndroid Build Coastguard Worker         const glw::Functions &gl = m_context.getRenderContext().getFunctions();
57*35238bceSAndroid Build Coastguard Worker         const char *result       = (const char *)gl.getString(m_query);
58*35238bceSAndroid Build Coastguard Worker 
59*35238bceSAndroid Build Coastguard Worker         GLU_EXPECT_NO_ERROR(gl.getError(), "glGetString() failed");
60*35238bceSAndroid Build Coastguard Worker 
61*35238bceSAndroid Build Coastguard Worker         m_testCtx.getLog() << tcu::TestLog::Message << result << tcu::TestLog::EndMessage;
62*35238bceSAndroid Build Coastguard Worker         m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
63*35238bceSAndroid Build Coastguard Worker 
64*35238bceSAndroid Build Coastguard Worker         return STOP;
65*35238bceSAndroid Build Coastguard Worker     }
66*35238bceSAndroid Build Coastguard Worker 
67*35238bceSAndroid Build Coastguard Worker private:
68*35238bceSAndroid Build Coastguard Worker     uint32_t m_query;
69*35238bceSAndroid Build Coastguard Worker };
70*35238bceSAndroid Build Coastguard Worker 
71*35238bceSAndroid Build Coastguard Worker class QueryExtensionsCase : public TestCase
72*35238bceSAndroid Build Coastguard Worker {
73*35238bceSAndroid Build Coastguard Worker public:
QueryExtensionsCase(Context & context)74*35238bceSAndroid Build Coastguard Worker     QueryExtensionsCase(Context &context) : TestCase(context, "extensions", "Supported Extensions")
75*35238bceSAndroid Build Coastguard Worker     {
76*35238bceSAndroid Build Coastguard Worker     }
77*35238bceSAndroid Build Coastguard Worker 
iterate(void)78*35238bceSAndroid Build Coastguard Worker     IterateResult iterate(void)
79*35238bceSAndroid Build Coastguard Worker     {
80*35238bceSAndroid Build Coastguard Worker         const vector<string> extensions = m_context.getContextInfo().getExtensions();
81*35238bceSAndroid Build Coastguard Worker 
82*35238bceSAndroid Build Coastguard Worker         for (vector<string>::const_iterator i = extensions.begin(); i != extensions.end(); i++)
83*35238bceSAndroid Build Coastguard Worker             m_testCtx.getLog() << tcu::TestLog::Message << *i << tcu::TestLog::EndMessage;
84*35238bceSAndroid Build Coastguard Worker 
85*35238bceSAndroid Build Coastguard Worker         m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
86*35238bceSAndroid Build Coastguard Worker 
87*35238bceSAndroid Build Coastguard Worker         return STOP;
88*35238bceSAndroid Build Coastguard Worker     }
89*35238bceSAndroid Build Coastguard Worker };
90*35238bceSAndroid Build Coastguard Worker 
91*35238bceSAndroid Build Coastguard Worker class RenderTargetInfoCase : public TestCase
92*35238bceSAndroid Build Coastguard Worker {
93*35238bceSAndroid Build Coastguard Worker public:
RenderTargetInfoCase(Context & context)94*35238bceSAndroid Build Coastguard Worker     RenderTargetInfoCase(Context &context) : TestCase(context, "render_target", "Render Target Info")
95*35238bceSAndroid Build Coastguard Worker     {
96*35238bceSAndroid Build Coastguard Worker     }
97*35238bceSAndroid Build Coastguard Worker 
iterate(void)98*35238bceSAndroid Build Coastguard Worker     IterateResult iterate(void)
99*35238bceSAndroid Build Coastguard Worker     {
100*35238bceSAndroid Build Coastguard Worker         const tcu::RenderTarget &rt = m_context.getRenderTarget();
101*35238bceSAndroid Build Coastguard Worker         const tcu::PixelFormat &pf  = rt.getPixelFormat();
102*35238bceSAndroid Build Coastguard Worker 
103*35238bceSAndroid Build Coastguard Worker         m_testCtx.getLog() << tcu::TestLog::Integer("RedBits", "Red channel bits", "", QP_KEY_TAG_NONE, pf.redBits)
104*35238bceSAndroid Build Coastguard Worker                            << tcu::TestLog::Integer("GreenBits", "Green channel bits", "", QP_KEY_TAG_NONE,
105*35238bceSAndroid Build Coastguard Worker                                                     pf.greenBits)
106*35238bceSAndroid Build Coastguard Worker                            << tcu::TestLog::Integer("BlueBits", "Blue channel bits", "", QP_KEY_TAG_NONE, pf.blueBits)
107*35238bceSAndroid Build Coastguard Worker                            << tcu::TestLog::Integer("AlphaBits", "Alpha channel bits", "", QP_KEY_TAG_NONE,
108*35238bceSAndroid Build Coastguard Worker                                                     pf.alphaBits)
109*35238bceSAndroid Build Coastguard Worker                            << tcu::TestLog::Integer("DepthBits", "Depth bits", "", QP_KEY_TAG_NONE, rt.getDepthBits())
110*35238bceSAndroid Build Coastguard Worker                            << tcu::TestLog::Integer("StencilBits", "Stencil bits", "", QP_KEY_TAG_NONE,
111*35238bceSAndroid Build Coastguard Worker                                                     rt.getStencilBits())
112*35238bceSAndroid Build Coastguard Worker                            << tcu::TestLog::Integer("NumSamples", "Number of samples", "", QP_KEY_TAG_NONE,
113*35238bceSAndroid Build Coastguard Worker                                                     rt.getNumSamples())
114*35238bceSAndroid Build Coastguard Worker                            << tcu::TestLog::Integer("Width", "Width", "", QP_KEY_TAG_NONE, rt.getWidth())
115*35238bceSAndroid Build Coastguard Worker                            << tcu::TestLog::Integer("Height", "Height", "", QP_KEY_TAG_NONE, rt.getHeight());
116*35238bceSAndroid Build Coastguard Worker 
117*35238bceSAndroid Build Coastguard Worker         m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
118*35238bceSAndroid Build Coastguard Worker         return STOP;
119*35238bceSAndroid Build Coastguard Worker     }
120*35238bceSAndroid Build Coastguard Worker };
121*35238bceSAndroid Build Coastguard Worker 
InfoTests(Context & context)122*35238bceSAndroid Build Coastguard Worker InfoTests::InfoTests(Context &context) : TestCaseGroup(context, "info", "Platform information queries")
123*35238bceSAndroid Build Coastguard Worker {
124*35238bceSAndroid Build Coastguard Worker }
125*35238bceSAndroid Build Coastguard Worker 
~InfoTests(void)126*35238bceSAndroid Build Coastguard Worker InfoTests::~InfoTests(void)
127*35238bceSAndroid Build Coastguard Worker {
128*35238bceSAndroid Build Coastguard Worker }
129*35238bceSAndroid Build Coastguard Worker 
init(void)130*35238bceSAndroid Build Coastguard Worker void InfoTests::init(void)
131*35238bceSAndroid Build Coastguard Worker {
132*35238bceSAndroid Build Coastguard Worker     addChild(new QueryStringCase(m_context, "vendor", "Vendor String", GL_VENDOR));
133*35238bceSAndroid Build Coastguard Worker     addChild(new QueryStringCase(m_context, "renderer", "Renderer String", GL_RENDERER));
134*35238bceSAndroid Build Coastguard Worker     addChild(new QueryStringCase(m_context, "version", "Version String", GL_VERSION));
135*35238bceSAndroid Build Coastguard Worker     addChild(new QueryStringCase(m_context, "shading_language_version", "Shading Language Version String",
136*35238bceSAndroid Build Coastguard Worker                                  GL_SHADING_LANGUAGE_VERSION));
137*35238bceSAndroid Build Coastguard Worker     addChild(new QueryExtensionsCase(m_context));
138*35238bceSAndroid Build Coastguard Worker     addChild(new RenderTargetInfoCase(m_context));
139*35238bceSAndroid Build Coastguard Worker }
140*35238bceSAndroid Build Coastguard Worker 
141*35238bceSAndroid Build Coastguard Worker } // namespace gles3
142*35238bceSAndroid Build Coastguard Worker } // namespace deqp
143