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