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