1 /*-------------------------------------------------------------------------
2 * OpenGL Conformance Test Suite
3 * -----------------------------
4 *
5 * Copyright (c) 2016 Google Inc.
6 * Copyright (c) 2016-2019 The Khronos Group Inc.
7 * Copyright (c) 2019 NVIDIA Corporation.
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 *
21 */ /*!
22 * \file
23 * \brief OpenGL/OpenGL ES Test Package that only gets run in a single config
24 */ /*-------------------------------------------------------------------*/
25
26 #include "glcSingleConfigTestPackage.hpp"
27 #include "gluStateReset.hpp"
28 #include "glwEnums.hpp"
29 #include "glwFunctions.hpp"
30 #include "tcuTestLog.hpp"
31 #include "tcuWaiverUtil.hpp"
32
33 #include "glcSubgroupsTests.hpp"
34 #include "gl4cEnhancedLayoutsTests.hpp"
35 #include "../gles31/es31cArrayOfArraysTests.hpp"
36
37 namespace glcts
38 {
39
40 class TestCaseWrapper : public tcu::TestCaseExecutor
41 {
42 public:
43 TestCaseWrapper(deqp::TestPackage& package, de::SharedPtr<tcu::WaiverUtil> waiverMechanism);
44 ~TestCaseWrapper(void);
45
46 void init(tcu::TestCase* testCase, const std::string& path);
47 void deinit(tcu::TestCase* testCase);
48 tcu::TestNode::IterateResult iterate(tcu::TestCase* testCase);
49
50 private:
51 deqp::TestPackage& m_testPackage;
52 de::SharedPtr<tcu::WaiverUtil> m_waiverMechanism;
53 };
54
TestCaseWrapper(deqp::TestPackage & package,de::SharedPtr<tcu::WaiverUtil> waiverMechanism)55 TestCaseWrapper::TestCaseWrapper(deqp::TestPackage& package, de::SharedPtr<tcu::WaiverUtil> waiverMechanism)
56 : m_testPackage(package)
57 , m_waiverMechanism(waiverMechanism)
58 {
59 }
60
~TestCaseWrapper(void)61 TestCaseWrapper::~TestCaseWrapper(void)
62 {
63 }
64
init(tcu::TestCase * testCase,const std::string & path)65 void TestCaseWrapper::init(tcu::TestCase* testCase, const std::string& path)
66 {
67 if (m_waiverMechanism->isOnWaiverList(path))
68 throw tcu::TestException("Waived test", QP_TEST_RESULT_WAIVER);
69
70 testCase->init();
71 }
72
deinit(tcu::TestCase * testCase)73 void TestCaseWrapper::deinit(tcu::TestCase* testCase)
74 {
75 testCase->deinit();
76
77 glu::resetState(m_testPackage.getContext().getRenderContext(), m_testPackage.getContext().getContextInfo());
78 }
79
iterate(tcu::TestCase * testCase)80 tcu::TestNode::IterateResult TestCaseWrapper::iterate(tcu::TestCase* testCase)
81 {
82 tcu::TestContext& testCtx = m_testPackage.getContext().getTestContext();
83 glu::RenderContext& renderCtx = m_testPackage.getContext().getRenderContext();
84 tcu::TestCase::IterateResult result;
85
86 // Clear to surrender-blue
87 {
88 const glw::Functions& gl = renderCtx.getFunctions();
89 gl.clearColor(0.0f, 0.0f, 0.0f, 1.f);
90 gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
91 }
92
93 result = testCase->iterate();
94
95 // Call implementation specific post-iterate routine (usually handles native events and swaps buffers)
96 try
97 {
98 renderCtx.postIterate();
99 return result;
100 }
101 catch (const tcu::ResourceError&)
102 {
103 testCtx.getLog().endCase(QP_TEST_RESULT_RESOURCE_ERROR, "Resource error in context post-iteration routine");
104 testCtx.setTerminateAfter(true);
105 return tcu::TestNode::STOP;
106 }
107 catch (const std::exception&)
108 {
109 testCtx.getLog().endCase(QP_TEST_RESULT_FAIL, "Error in context post-iteration routine");
110 return tcu::TestNode::STOP;
111 }
112 }
113
SingleConfigGL43TestPackage(tcu::TestContext & testCtx,const char * packageName,const char * description,glu::ContextType renderContextType)114 SingleConfigGL43TestPackage::SingleConfigGL43TestPackage(tcu::TestContext& testCtx, const char* packageName, const char* description,
115 glu::ContextType renderContextType)
116 : deqp::TestPackage(testCtx, packageName, description, renderContextType, "gl_cts/data/")
117 {
118 }
119
~SingleConfigGL43TestPackage(void)120 SingleConfigGL43TestPackage::~SingleConfigGL43TestPackage(void)
121 {
122
123 }
124
init(void)125 void SingleConfigGL43TestPackage::init(void)
126 {
127 // Call init() in parent - this creates context.
128 deqp::TestPackage::init();
129
130 try
131 {
132 // Add main test groups
133 addChild(new glcts::ArrayOfArraysTestGroupGL(getContext()));
134 }
135 catch (...)
136 {
137 // Destroy context.
138 deqp::TestPackage::deinit();
139 throw;
140 }
141 }
142
createExecutor(void) const143 tcu::TestCaseExecutor* SingleConfigGL43TestPackage::createExecutor(void) const
144 {
145 return new TestCaseWrapper(const_cast<SingleConfigGL43TestPackage&>(*this), m_waiverMechanism);
146 }
147
SingleConfigGL44TestPackage(tcu::TestContext & testCtx,const char * packageName,const char * description,glu::ContextType renderContextType)148 SingleConfigGL44TestPackage::SingleConfigGL44TestPackage(tcu::TestContext& testCtx, const char* packageName, const char* description,
149 glu::ContextType renderContextType)
150 : SingleConfigGL43TestPackage(testCtx, packageName, description, renderContextType)
151 {
152 }
153
~SingleConfigGL44TestPackage(void)154 SingleConfigGL44TestPackage::~SingleConfigGL44TestPackage(void)
155 {
156
157 }
158
init(void)159 void SingleConfigGL44TestPackage::init(void)
160 {
161 // Call init() in parent - this creates context.
162 SingleConfigGL43TestPackage::init();
163
164 try
165 {
166 // Add main test groups
167 addChild(new gl4cts::EnhancedLayoutsTests(getContext()));
168 }
169 catch (...)
170 {
171 // Destroy context.
172 deqp::TestPackage::deinit();
173 throw;
174 }
175 }
176
SingleConfigGL45TestPackage(tcu::TestContext & testCtx,const char * packageName,const char * description,glu::ContextType renderContextType)177 SingleConfigGL45TestPackage::SingleConfigGL45TestPackage(tcu::TestContext& testCtx, const char* packageName, const char* description,
178 glu::ContextType renderContextType)
179 : SingleConfigGL44TestPackage(testCtx, packageName, description, renderContextType)
180 {
181 }
182
~SingleConfigGL45TestPackage(void)183 SingleConfigGL45TestPackage::~SingleConfigGL45TestPackage(void)
184 {
185
186 }
187
init(void)188 void SingleConfigGL45TestPackage::init(void)
189 {
190 // Call init() in parent - this creates context.
191 SingleConfigGL44TestPackage::init();
192
193 try
194 {
195 // Add main test groups
196 addChild(new glc::subgroups::GlSubgroupTests(getContext()));
197 }
198 catch (...)
199 {
200 // Destroy context.
201 deqp::TestPackage::deinit();
202 throw;
203 }
204 }
205
SingleConfigGL46TestPackage(tcu::TestContext & testCtx,const char * packageName,const char * description,glu::ContextType renderContextType)206 SingleConfigGL46TestPackage::SingleConfigGL46TestPackage(tcu::TestContext& testCtx, const char* packageName, const char* description,
207 glu::ContextType renderContextType)
208 : SingleConfigGL45TestPackage(testCtx, packageName, description, renderContextType)
209 {
210 }
211
~SingleConfigGL46TestPackage(void)212 SingleConfigGL46TestPackage::~SingleConfigGL46TestPackage(void)
213 {
214
215 }
216
init(void)217 void SingleConfigGL46TestPackage::init(void)
218 {
219 // Call init() in parent - this creates context.
220 SingleConfigGL45TestPackage::init();
221
222 try
223 {
224 // Add main test groups
225 }
226 catch (...)
227 {
228 // Destroy context.
229 deqp::TestPackage::deinit();
230 throw;
231 }
232 }
233
SingleConfigES32TestPackage(tcu::TestContext & testCtx,const char * packageName,const char * description,glu::ContextType renderContextType)234 SingleConfigES32TestPackage::SingleConfigES32TestPackage(tcu::TestContext& testCtx, const char* packageName, const char* description,
235 glu::ContextType renderContextType)
236 : deqp::TestPackage(testCtx, packageName, description, renderContextType, "gl_cts/data/")
237 {
238 }
239
~SingleConfigES32TestPackage(void)240 SingleConfigES32TestPackage::~SingleConfigES32TestPackage(void)
241 {
242
243 }
244
init(void)245 void SingleConfigES32TestPackage::init(void)
246 {
247 // Call init() in parent - this creates context.
248 deqp::TestPackage::init();
249
250 try
251 {
252 // Add main test groups
253 addChild(new glc::subgroups::GlSubgroupTests(getContext()));
254 }
255 catch (...)
256 {
257 // Destroy context.
258 deqp::TestPackage::deinit();
259 throw;
260 }
261 }
262
createExecutor(void) const263 tcu::TestCaseExecutor* SingleConfigES32TestPackage::createExecutor(void) const
264 {
265 return new TestCaseWrapper(const_cast<SingleConfigES32TestPackage&>(*this), m_waiverMechanism);
266 }
267
268 } // glcts
269