Remove tests affected by NV/OES_viewport_array extension am: 267c765690 am: e4ed95024...
[platform/upstream/VK-GL-CTS.git] / external / openglcts / modules / common / glcInfoTests.cpp
1 /*-------------------------------------------------------------------------
2  * OpenGL Conformance Test Suite
3  * -----------------------------
4  *
5  * Copyright (c) 2016 Google Inc.
6  * Copyright (c) 2016 The Khronos Group Inc.
7  *
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
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
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.
19  *
20  */ /*!
21  * \file
22  * \brief Platform Information Tests.
23  */ /*-------------------------------------------------------------------*/
24
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"
32
33 #include <string>
34 #include <vector>
35
36 namespace deqp
37 {
38
39 using std::string;
40 using std::vector;
41 using tcu::TestLog;
42
43 class QueryStringCase : public TestCase
44 {
45 public:
46         QueryStringCase(Context& context, const char* name, const char* description, deUint32 query)
47                 : TestCase(context, name, description), m_query(query)
48         {
49         }
50
51         IterateResult iterate(void)
52         {
53                 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
54
55                 const char* result = (const char*)gl.getString(m_query);
56                 GLU_EXPECT_NO_ERROR(gl.getError(), "glGetString() failed");
57
58                 m_testCtx.getLog() << tcu::TestLog::Message << result << tcu::TestLog::EndMessage;
59                 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
60
61                 return STOP;
62         }
63
64 private:
65         deUint32 m_query;
66 };
67
68 class QueryExtensionsCase : public TestCase
69 {
70 public:
71         QueryExtensionsCase(Context& context) : TestCase(context, "extensions", "Supported Extensions")
72         {
73         }
74
75         IterateResult iterate(void)
76         {
77                 const vector<string> extensions = m_context.getContextInfo().getExtensions();
78
79                 for (vector<string>::const_iterator i = extensions.begin(); i != extensions.end(); i++)
80                         m_testCtx.getLog() << tcu::TestLog::Message << *i << tcu::TestLog::EndMessage;
81
82                 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
83
84                 return STOP;
85         }
86 };
87
88 class RenderTargetInfoCase : public TestCase
89 {
90 public:
91         RenderTargetInfoCase(Context& context) : TestCase(context, "render_target", "Render Target Information")
92         {
93         }
94
95         IterateResult iterate(void)
96         {
97                 const tcu::RenderTarget& renderTarget = m_context.getRenderContext().getRenderTarget();
98                 const tcu::PixelFormat&  pixelFormat  = renderTarget.getPixelFormat();
99
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());
112
113                 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
114                 return STOP;
115         }
116 };
117
118 InfoTests::InfoTests(Context& context) : TestCaseGroup(context, "info", "Platform information queries")
119 {
120 }
121
122 InfoTests::~InfoTests(void)
123 {
124 }
125
126 void InfoTests::init(void)
127 {
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));
135 }
136
137 } // deqp