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 OpenGL 3.x Test Packages.
23 */ /*-------------------------------------------------------------------*/
24
25 #include "gl3cTestPackages.hpp"
26 #include "gl3cClipDistance.hpp"
27 #include "gl3cCommonBugsTests.hpp"
28 #include "gl3cCullDistanceTests.hpp"
29 #include "gl3cGLSLnoperspectiveTests.hpp"
30 #include "gl3cGPUShader5Tests.hpp"
31 #include "gl3cTextureSizePromotion.hpp"
32 #include "gl3cTextureSwizzleTests.hpp"
33 #include "gl3cTransformFeedbackOverflowQueryTests.hpp"
34 #include "gl3cTransformFeedbackTests.hpp"
35 #include "gl4cPipelineStatisticsQueryTests.hpp"
36 #include "glcPixelStorageModesTests.hpp"
37 #include "glcFragDepthTests.hpp"
38 #include "glcInfoTests.hpp"
39 #include "glcPackedDepthStencilTests.hpp"
40 #include "glcPackedPixelsTests.hpp"
41 #include "glcShaderFunctionTests.hpp"
42 #include "glcShaderIndexingTests.hpp"
43 #include "glcShaderIntegerMixTests.hpp"
44 #include "glcShaderLibrary.hpp"
45 #include "glcShaderLoopTests.hpp"
46 #include "glcShaderNegativeTests.hpp"
47 #include "glcShaderStructTests.hpp"
48 #include "glcTextureRepeatModeTests.hpp"
49 #include "glcUniformBlockTests.hpp"
50 #include "glcNearestEdgeTests.hpp"
51 #include "glcGLSLVectorConstructorTests.hpp"
52 #include "gluStateReset.hpp"
53 #include "tcuTestLog.hpp"
54 #include "tcuWaiverUtil.hpp"
55
56 #include "../glesext/texture_shadow_lod/esextcTextureShadowLodFunctionsTest.hpp"
57
58 namespace gl3cts
59 {
60
TestCaseWrapper(deqp::TestPackage & package,de::SharedPtr<tcu::WaiverUtil> waiverMechanism)61 TestCaseWrapper::TestCaseWrapper(deqp::TestPackage& package, de::SharedPtr<tcu::WaiverUtil> waiverMechanism)
62 : m_testPackage (package)
63 , m_waiverMechanism (waiverMechanism)
64 {
65 }
66
~TestCaseWrapper(void)67 TestCaseWrapper::~TestCaseWrapper(void)
68 {
69 }
70
init(tcu::TestCase * testCase,const std::string & path)71 void TestCaseWrapper::init(tcu::TestCase* testCase, const std::string& path)
72 {
73 if (m_waiverMechanism->isOnWaiverList(path))
74 throw tcu::TestException("Waived test", QP_TEST_RESULT_WAIVER);
75
76 testCase->init();
77 }
78
deinit(tcu::TestCase * testCase)79 void TestCaseWrapper::deinit(tcu::TestCase* testCase)
80 {
81 testCase->deinit();
82
83 deqp::Context& context = m_testPackage.getContext();
84 glu::resetState(context.getRenderContext(), context.getContextInfo());
85 }
86
iterate(tcu::TestCase * testCase)87 tcu::TestNode::IterateResult TestCaseWrapper::iterate(tcu::TestCase* testCase)
88 {
89 tcu::TestContext& testCtx = m_testPackage.getTestContext();
90 glu::RenderContext& renderCtx = m_testPackage.getContext().getRenderContext();
91
92 // Clear to black
93 {
94 const glw::Functions& gl = renderCtx.getFunctions();
95 gl.clearColor(0.0, 0.0f, 0.0f, 1.0f);
96 gl.clear(GL_COLOR_BUFFER_BIT);
97 }
98
99 const tcu::TestCase::IterateResult result = testCase->iterate();
100
101 // Call implementation specific post-iterate routine (usually handles native events and swaps buffers)
102 try
103 {
104 deqp::Context& context = m_testPackage.getContext();
105 context.getRenderContext().postIterate();
106 return result;
107 }
108 catch (const tcu::ResourceError&)
109 {
110 throw tcu::ResourceError(std::string("Resource error in context post-iteration routine"));
111 testCtx.setTerminateAfter(true);
112 return tcu::TestNode::STOP;
113 }
114 catch (const std::exception&)
115 {
116 testCtx.getLog().endCase(QP_TEST_RESULT_FAIL, "Error in context post-iteration routine");
117 return tcu::TestNode::STOP;
118 }
119 }
120
121 // GL30TestPackage
122
123 class GL30ShaderTests : public glcts::TestCaseGroup
124 {
125 public:
GL30ShaderTests(deqp::Context & context)126 GL30ShaderTests(deqp::Context& context) : TestCaseGroup(context, "shaders30", "Shading Language Tests")
127 {
128 }
129
init(void)130 void init(void)
131 {
132 addChild(new deqp::ShaderLibraryGroup(m_context, "declarations", "Declaration Tests", "gl30/declarations.test"));
133 addChild(new deqp::GLSLVectorConstructorTests(m_context, glu::GLSL_VERSION_130));
134 }
135 };
136
GL30TestPackage(tcu::TestContext & testCtx,const char * packageName,const char * description,glu::ContextType renderContextType)137 GL30TestPackage::GL30TestPackage(tcu::TestContext& testCtx, const char* packageName, const char* description,
138 glu::ContextType renderContextType)
139 : TestPackage(testCtx, packageName, packageName, renderContextType, "gl_cts/data/")
140 {
141 (void)description;
142 }
143
~GL30TestPackage(void)144 GL30TestPackage::~GL30TestPackage(void)
145 {
146 }
147
init(void)148 void GL30TestPackage::init(void)
149 {
150 // Call init() in parent - this creates context.
151 TestPackage::init();
152
153 try
154 {
155 addChild(new deqp::InfoTests(getContext()));
156 addChild(new gl3cts::ClipDistance::Tests(getContext()));
157 addChild(new gl3cts::GLSLnoperspectiveTests(getContext()));
158 addChild(new gl3cts::TransformFeedback::Tests(getContext()));
159 addChild(new glcts::TextureRepeatModeTests(getContext()));
160 addChild(new GL30ShaderTests(getContext()));
161 addChild(new deqp::Functional::TextureShadowLodTest(getContext()));
162 }
163 catch (...)
164 {
165 // Destroy context.
166 TestPackage::deinit();
167 throw;
168 }
169 }
170
createExecutor(void) const171 tcu::TestCaseExecutor* GL30TestPackage::createExecutor(void) const
172 {
173 return new TestCaseWrapper(const_cast<GL30TestPackage&>(*this), m_waiverMechanism);
174 }
175
176 // GL31TestPackage
177
GL31TestPackage(tcu::TestContext & testCtx,const char * packageName,const char * description,glu::ContextType renderContextType)178 GL31TestPackage::GL31TestPackage(tcu::TestContext& testCtx, const char* packageName, const char* description,
179 glu::ContextType renderContextType)
180 : GL30TestPackage(testCtx, packageName, packageName, renderContextType)
181 {
182 (void)description;
183 }
184
~GL31TestPackage(void)185 GL31TestPackage::~GL31TestPackage(void)
186 {
187 }
188
init(void)189 void GL31TestPackage::init(void)
190 {
191 // Call init() in parent - this creates context.
192 GL30TestPackage::init();
193
194 try
195 {
196 addChild(new gl3cts::CommonBugsTests(getContext()));
197 addChild(new gl3cts::TextureSizePromotion::Tests(getContext()));
198 }
199 catch (...)
200 {
201 // Destroy context.
202 TestPackage::deinit();
203 throw;
204 }
205 }
206
207 // GL32TestPackage
208
GL32TestPackage(tcu::TestContext & testCtx,const char * packageName,const char * description,glu::ContextType renderContextType)209 GL32TestPackage::GL32TestPackage(tcu::TestContext& testCtx, const char* packageName, const char* description,
210 glu::ContextType renderContextType)
211 : GL31TestPackage(testCtx, packageName, packageName, renderContextType)
212 {
213 (void)description;
214 }
215
~GL32TestPackage(void)216 GL32TestPackage::~GL32TestPackage(void)
217 {
218 }
219
init(void)220 void GL32TestPackage::init(void)
221 {
222 // Call init() in parent - this creates context.
223 GL31TestPackage::init();
224
225 try
226 {
227 addChild(new gl3cts::GPUShader5Tests(getContext()));
228 addChild(new gl3cts::TransformFeedbackOverflowQueryTests(
229 getContext(), gl3cts::TransformFeedbackOverflowQueryTests::API_GL_ARB_transform_feedback_overflow_query));
230 addChild(new glcts::PackedPixelsTests(getContext()));
231 addChild(new glcts::PackedDepthStencilTests(getContext()));
232 }
233 catch (...)
234 {
235 // Destroy context.
236 TestPackage::deinit();
237 throw;
238 }
239 }
240
241 // OpenGL 3.3 test groups
242
243 class GL33ShaderTests : public glcts::TestCaseGroup
244 {
245 public:
GL33ShaderTests(deqp::Context & context)246 GL33ShaderTests(deqp::Context& context) : TestCaseGroup(context, "shaders", "Shading Language Tests")
247 {
248 }
249
init(void)250 void init(void)
251 {
252 addChild(new deqp::ShaderLibraryGroup(m_context, "arrays", "Array Tests", "gl33/arrays.test"));
253 addChild(
254 new deqp::ShaderLibraryGroup(m_context, "declarations", "Declaration Tests", "gl33/declarations.test"));
255 addChild(new deqp::FragDepthTests(m_context, glu::GLSL_VERSION_330));
256 addChild(new deqp::ShaderIndexingTests(m_context, glu::GLSL_VERSION_330));
257 addChild(new deqp::ShaderLoopTests(m_context, glu::GLSL_VERSION_330));
258 addChild(
259 new deqp::ShaderLibraryGroup(m_context, "preprocessor", "Preprocessor Tests", "gl33/preprocessor.test"));
260 addChild(new deqp::ShaderFunctionTests(m_context, glu::GLSL_VERSION_330));
261 addChild(new deqp::ShaderStructTests(m_context, glu::GLSL_VERSION_330));
262 addChild(new deqp::UniformBlockTests(m_context, glu::GLSL_VERSION_330));
263 addChild(new deqp::ShaderIntegerMixTests(m_context, glu::GLSL_VERSION_330));
264 addChild(new deqp::ShaderNegativeTests(m_context, glu::GLSL_VERSION_330));
265 }
266 };
267
268 // GL33TestPackage
269
GL33TestPackage(tcu::TestContext & testCtx,const char * packageName,const char * description,glu::ContextType renderContextType)270 GL33TestPackage::GL33TestPackage(tcu::TestContext& testCtx, const char* packageName, const char* description,
271 glu::ContextType renderContextType)
272 : GL32TestPackage(testCtx, packageName, packageName, renderContextType)
273 {
274 (void)description;
275 }
276
~GL33TestPackage(void)277 GL33TestPackage::~GL33TestPackage(void)
278 {
279 }
280
init(void)281 void GL33TestPackage::init(void)
282 {
283 // Call init() in parent - this creates context.
284 GL32TestPackage::init();
285
286 try
287 {
288 addChild(new GL33ShaderTests(getContext()));
289 addChild(new glcts::PipelineStatisticsQueryTests(getContext()));
290 addChild(new glcts::CullDistance::Tests(getContext()));
291 addChild(new gl3cts::TextureSwizzleTests(getContext()));
292 addChild(new glcts::NearestEdgeCases(getContext()));
293 addChild(new glcts::PixelStorageModesTests(getContext(), glu::GLSL_VERSION_330));
294 }
295 catch (...)
296 {
297 // Destroy context.
298 TestPackage::deinit();
299 throw;
300 }
301 }
302
303 } // gl3cts
304