• 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 ES 3 Test Package.
23  */ /*-------------------------------------------------------------------*/
24 
25 #include "es3cTestPackage.hpp"
26 #include "es3cCopyTexImageConversionsTests.hpp"
27 #include "es3cNumberParsingTests.hpp"
28 #include "glcAggressiveShaderOptimizationsTests.hpp"
29 #include "glcExposedExtensionsTests.hpp"
30 #include "glcFragDepthTests.hpp"
31 #include "glcGLSLVectorConstructorTests.hpp"
32 #include "glcInfoTests.hpp"
33 #include "glcInternalformatTests.hpp"
34 #include "glcPackedDepthStencilTests.hpp"
35 #include "glcPackedPixelsTests.hpp"
36 #include "glcParallelShaderCompileTests.hpp"
37 #include "glcShaderConstExprTests.hpp"
38 #include "glcShaderFunctionTests.hpp"
39 #include "glcShaderIndexingTests.hpp"
40 #include "glcShaderIntegerMixTests.hpp"
41 #include "glcShaderLibrary.hpp"
42 #include "glcShaderLoopTests.hpp"
43 #include "glcShaderMacroTests.hpp"
44 #include "glcShaderNegativeTests.hpp"
45 #include "glcShaderStructTests.hpp"
46 #include "glcTextureFilterAnisotropicTests.hpp"
47 #include "glcTextureRepeatModeTests.hpp"
48 #include "glcUniformBlockTests.hpp"
49 #include "glcNearestEdgeTests.hpp"
50 #include "glcFramebufferCompleteness.hpp"
51 #include "gluStateReset.hpp"
52 #include "glwEnums.hpp"
53 #include "glwFunctions.hpp"
54 #include "tcuTestLog.hpp"
55 #include "tcuWaiverUtil.hpp"
56 
57 namespace es3cts
58 {
59 
60 class TestCaseWrapper : public tcu::TestCaseExecutor
61 {
62 public:
63 	TestCaseWrapper(ES30TestPackage& package, de::SharedPtr<tcu::WaiverUtil> waiverMechanism);
64 	~TestCaseWrapper(void);
65 
66 	void init(tcu::TestCase* testCase, const std::string& path);
67 	void deinit(tcu::TestCase* testCase);
68 	tcu::TestNode::IterateResult iterate(tcu::TestCase* testCase);
69 
70 private:
71 	ES30TestPackage& m_testPackage;
72 	de::SharedPtr<tcu::WaiverUtil> m_waiverMechanism;
73 };
74 
TestCaseWrapper(ES30TestPackage & package,de::SharedPtr<tcu::WaiverUtil> waiverMechanism)75 TestCaseWrapper::TestCaseWrapper(ES30TestPackage& package, de::SharedPtr<tcu::WaiverUtil> waiverMechanism)
76 	: m_testPackage(package), m_waiverMechanism(waiverMechanism)
77 {
78 }
79 
~TestCaseWrapper(void)80 TestCaseWrapper::~TestCaseWrapper(void)
81 {
82 }
83 
init(tcu::TestCase * testCase,const std::string & path)84 void TestCaseWrapper::init(tcu::TestCase* testCase, const std::string& path)
85 {
86 	if (m_waiverMechanism->isOnWaiverList(path))
87 		throw tcu::TestException("Waived test", QP_TEST_RESULT_WAIVER);
88 
89 	glu::resetState(m_testPackage.getContext().getRenderContext(), m_testPackage.getContext().getContextInfo());
90 
91 	testCase->init();
92 }
93 
deinit(tcu::TestCase * testCase)94 void TestCaseWrapper::deinit(tcu::TestCase* testCase)
95 {
96 	testCase->deinit();
97 
98 	glu::resetState(m_testPackage.getContext().getRenderContext(), m_testPackage.getContext().getContextInfo());
99 }
100 
iterate(tcu::TestCase * testCase)101 tcu::TestNode::IterateResult TestCaseWrapper::iterate(tcu::TestCase* testCase)
102 {
103 	tcu::TestContext&			 testCtx   = m_testPackage.getContext().getTestContext();
104 	glu::RenderContext&			 renderCtx = m_testPackage.getContext().getRenderContext();
105 	tcu::TestCase::IterateResult result;
106 
107 	// Clear to black
108 	{
109 		const glw::Functions& gl = renderCtx.getFunctions();
110 		gl.clearColor(0.0f, 0.0f, 0.0f, 1.f);
111 		gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
112 	}
113 
114 	result = testCase->iterate();
115 
116 	// Call implementation specific post-iterate routine (usually handles native events and swaps buffers)
117 	try
118 	{
119 		renderCtx.postIterate();
120 		return result;
121 	}
122 	catch (const tcu::ResourceError&)
123 	{
124 		testCtx.getLog().endCase(QP_TEST_RESULT_RESOURCE_ERROR, "Resource error in context post-iteration routine");
125 		testCtx.setTerminateAfter(true);
126 		return tcu::TestNode::STOP;
127 	}
128 	catch (const std::exception&)
129 	{
130 		testCtx.getLog().endCase(QP_TEST_RESULT_FAIL, "Error in context post-iteration routine");
131 		return tcu::TestNode::STOP;
132 	}
133 }
134 
135 class ShaderTests : public deqp::TestCaseGroup
136 {
137 public:
ShaderTests(deqp::Context & context)138 	ShaderTests(deqp::Context& context) : TestCaseGroup(context, "shaders", "Shading Language Tests")
139 	{
140 	}
141 
init(void)142 	void init(void)
143 	{
144 		addChild(new deqp::ShaderLibraryGroup(m_context, "declarations", "Declaration Tests", "declarations.test"));
145 		addChild(new deqp::FragDepthTests(m_context, glu::GLSL_VERSION_300_ES));
146 		addChild(new deqp::ShaderFunctionTests(m_context, glu::GLSL_VERSION_300_ES));
147 		addChild(new deqp::ShaderIndexingTests(m_context, glu::GLSL_VERSION_300_ES));
148 		addChild(new deqp::ShaderLoopTests(m_context, glu::GLSL_VERSION_300_ES));
149 		addChild(new deqp::ShaderLibraryGroup(m_context, "preprocessor", "Preprocessor Tests", "preprocessor.test"));
150 		addChild(new deqp::ShaderLibraryGroup(m_context, "literal_parsing", "Literal Parsing Tests",
151 											  "literal_parsing.test"));
152 		addChild(new deqp::ShaderLibraryGroup(m_context, "name_hiding", "Name Hiding Tests", "name_hiding.test"));
153 		addChild(new deqp::ShaderStructTests(m_context, glu::GLSL_VERSION_300_ES));
154 		addChild(new deqp::UniformBlockTests(m_context, glu::GLSL_VERSION_300_ES));
155 		addChild(new deqp::GLSLVectorConstructorTests(m_context, glu::GLSL_VERSION_300_ES));
156 		addChild(new deqp::ShaderIntegerMixTests(m_context, glu::GLSL_VERSION_300_ES));
157 		addChild(new deqp::ShaderNegativeTests(m_context, glu::GLSL_VERSION_300_ES));
158 		addChild(new glcts::AggressiveShaderOptimizationsTests(m_context));
159 	}
160 };
161 
ES30TestPackage(tcu::TestContext & testCtx,const char * packageName)162 ES30TestPackage::ES30TestPackage(tcu::TestContext& testCtx, const char* packageName)
163 	: deqp::TestPackage(testCtx, packageName, "OpenGL ES 3 Conformance Tests", glu::ContextType(glu::ApiType::es(3, 0)),
164 						"gl_cts/data/gles3/")
165 {
166 }
167 
~ES30TestPackage(void)168 ES30TestPackage::~ES30TestPackage(void)
169 {
170 }
171 
init(void)172 void ES30TestPackage::init(void)
173 {
174 	// Call init() in parent - this creates context.
175 	deqp::TestPackage::init();
176 
177 	try
178 	{
179 		addChild(new ShaderTests(getContext()));
180 		addChild(new glcts::TextureFilterAnisotropicTests(getContext()));
181 		addChild(new glcts::TextureRepeatModeTests(getContext()));
182 		addChild(new glcts::ExposedExtensionsTests(getContext()));
183 		tcu::TestCaseGroup* coreGroup = new tcu::TestCaseGroup(getTestContext(), "core", "core tests");
184 		coreGroup->addChild(new glcts::ShaderConstExprTests(getContext()));
185 		coreGroup->addChild(new glcts::ShaderMacroTests(getContext()));
186 		coreGroup->addChild(new glcts::InternalformatTests(getContext()));
187 		coreGroup->addChild(new glcts::NearestEdgeCases(getContext()));
188 		addChild(coreGroup);
189 		addChild(new glcts::ParallelShaderCompileTests(getContext()));
190 		addChild(new glcts::PackedPixelsTests(getContext()));
191 		addChild(new glcts::PackedDepthStencilTests(getContext()));
192 		addChild(new glcts::FramebufferCompletenessTests(getContext()));
193 		addChild(new es3cts::CopyTexImageConversionsTests(getContext()));
194 		addChild(new es3cts::NumberParsingTests(getContext()));
195 	}
196 	catch (...)
197 	{
198 		// Destroy context.
199 		deqp::TestPackage::deinit();
200 		throw;
201 	}
202 }
203 
createExecutor(void) const204 tcu::TestCaseExecutor* ES30TestPackage::createExecutor(void) const
205 {
206 	return new TestCaseWrapper(const_cast<ES30TestPackage&>(*this), m_waiverMechanism);
207 }
208 
209 } // es3cts
210