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