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 "es32cTestPackage.hpp"
26 #include "es32cCopyImageTests.hpp"
27 #include "esextcTestPackage.hpp"
28 #include "glcAggressiveShaderOptimizationsTests.hpp"
29 #include "glcFragDepthTests.hpp"
30 #include "glcInfoTests.hpp"
31 #include "glcInternalformatTests.hpp"
32 #include "glcSeparableProgramsTransformFeedbackTests.hpp"
33 #include "glcShaderConstExprTests.hpp"
34 #include "glcShaderIndexingTests.hpp"
35 #include "glcShaderIntegerMixTests.hpp"
36 #include "glcShaderLibrary.hpp"
37 #include "glcShaderLoopTests.hpp"
38 #include "glcShaderMacroTests.hpp"
39 #include "glcShaderNegativeTests.hpp"
40 #include "glcShaderStructTests.hpp"
41 #include "glcTextureCompatibilityTests.hpp"
42 #include "glcUniformBlockTests.hpp"
43 #include "glcNearestEdgeTests.hpp"
44 #include "glcFramebufferCompleteness.hpp"
45 #include "glcCompressedFormatTests.hpp"
46 #include "gluStateReset.hpp"
47 #include "glwEnums.hpp"
48 #include "glwFunctions.hpp"
49 #include "tcuTestLog.hpp"
50 #include "tcuWaiverUtil.hpp"
51
52 #include "../glesext/draw_buffers_indexed/esextcDrawBuffersIndexedTests.hpp"
53 #include "../glesext/geometry_shader/esextcGeometryShaderTests.hpp"
54 #include "../glesext/gpu_shader5/esextcGPUShader5Tests.hpp"
55 #include "../glesext/tessellation_shader/esextcTessellationShaderTests.hpp"
56 #include "../glesext/texture_border_clamp/esextcTextureBorderClampTests.hpp"
57 #include "../glesext/texture_buffer/esextcTextureBufferTests.hpp"
58 #include "../glesext/texture_cube_map_array/esextcTextureCubeMapArrayTests.hpp"
59 #include "../glesext/texture_shadow_lod/esextcTextureShadowLodFunctionsTest.hpp"
60
61 namespace es32cts
62 {
63
64 class TestCaseWrapper : public tcu::TestCaseExecutor
65 {
66 public:
67 TestCaseWrapper(ES32TestPackage& package, de::SharedPtr<tcu::WaiverUtil> waiverMechanism);
68 ~TestCaseWrapper(void);
69
70 void init(tcu::TestCase* testCase, const std::string& path);
71 void deinit(tcu::TestCase* testCase);
72 tcu::TestNode::IterateResult iterate(tcu::TestCase* testCase);
73
74 private:
75 ES32TestPackage& m_testPackage;
76 de::SharedPtr<tcu::WaiverUtil> m_waiverMechanism;
77 };
78
TestCaseWrapper(ES32TestPackage & package,de::SharedPtr<tcu::WaiverUtil> waiverMechanism)79 TestCaseWrapper::TestCaseWrapper(ES32TestPackage& package, de::SharedPtr<tcu::WaiverUtil> waiverMechanism)
80 : m_testPackage (package)
81 , m_waiverMechanism (waiverMechanism)
82 {
83 }
84
~TestCaseWrapper(void)85 TestCaseWrapper::~TestCaseWrapper(void)
86 {
87 }
88
init(tcu::TestCase * testCase,const std::string & path)89 void TestCaseWrapper::init(tcu::TestCase* testCase, const std::string& path)
90 {
91 if (m_waiverMechanism->isOnWaiverList(path))
92 throw tcu::TestException("Waived test", QP_TEST_RESULT_WAIVER);
93
94 glu::resetState(m_testPackage.getContext().getRenderContext(), m_testPackage.getContext().getContextInfo());
95
96 testCase->init();
97 }
98
deinit(tcu::TestCase * testCase)99 void TestCaseWrapper::deinit(tcu::TestCase* testCase)
100 {
101 testCase->deinit();
102
103 glu::resetState(m_testPackage.getContext().getRenderContext(), m_testPackage.getContext().getContextInfo());
104 }
105
iterate(tcu::TestCase * testCase)106 tcu::TestNode::IterateResult TestCaseWrapper::iterate(tcu::TestCase* testCase)
107 {
108 tcu::TestContext& testCtx = m_testPackage.getContext().getTestContext();
109 glu::RenderContext& renderCtx = m_testPackage.getContext().getRenderContext();
110 tcu::TestCase::IterateResult result;
111
112 // Clear to black
113 {
114 const glw::Functions& gl = renderCtx.getFunctions();
115 gl.clearColor(0.0f, 0.0f, 0.0f, 1.f);
116 gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
117 }
118
119 result = testCase->iterate();
120
121 // Call implementation specific post-iterate routine (usually handles native events and swaps buffers)
122 try
123 {
124 renderCtx.postIterate();
125 return result;
126 }
127 catch (const tcu::ResourceError&)
128 {
129 testCtx.getLog().endCase(QP_TEST_RESULT_RESOURCE_ERROR, "Resource error in context post-iteration routine");
130 testCtx.setTerminateAfter(true);
131 return tcu::TestNode::STOP;
132 }
133 catch (const std::exception&)
134 {
135 testCtx.getLog().endCase(QP_TEST_RESULT_FAIL, "Error in context post-iteration routine");
136 return tcu::TestNode::STOP;
137 }
138 }
139
ES32TestPackage(tcu::TestContext & testCtx,const char * packageName)140 ES32TestPackage::ES32TestPackage(tcu::TestContext& testCtx, const char* packageName)
141 : deqp::TestPackage(testCtx, packageName, "OpenGL ES 3.2 Conformance Tests",
142 glu::ContextType(glu::ApiType::es(3, 2)), "gl_cts/data/gles32/")
143 {
144 }
145
~ES32TestPackage(void)146 ES32TestPackage::~ES32TestPackage(void)
147 {
148 deqp::TestPackage::deinit();
149 }
150
init(void)151 void ES32TestPackage::init(void)
152 {
153 // Call init() in parent - this creates context.
154 deqp::TestPackage::init();
155
156 try
157 {
158 // Add main test groups
159 addChild(new deqp::InfoTests(getContext()));
160
161 tcu::TestCaseGroup* shadersGroup = new tcu::TestCaseGroup(getTestContext(), "shaders", "");
162 shadersGroup->addChild(new deqp::ShaderIntegerMixTests(getContext(), glu::GLSL_VERSION_320_ES));
163 shadersGroup->addChild(new deqp::ShaderNegativeTests(getContext(), glu::GLSL_VERSION_320_ES));
164 shadersGroup->addChild(new glcts::AggressiveShaderOptimizationsTests(getContext()));
165 addChild(shadersGroup);
166
167 tcu::TestCaseGroup* coreGroup = new tcu::TestCaseGroup(getTestContext(), "core", "");
168 glcts::ExtParameters extParams(glu::GLSL_VERSION_320_ES, glcts::EXTENSIONTYPE_NONE);
169 coreGroup->addChild(new glcts::GeometryShaderTests(getContext(), extParams));
170 coreGroup->addChild(new glcts::GPUShader5Tests(getContext(), extParams));
171 coreGroup->addChild(new glcts::TessellationShaderTests(getContext(), extParams));
172 coreGroup->addChild(new glcts::TextureCubeMapArrayTests(getContext(), extParams));
173 coreGroup->addChild(new glcts::TextureBorderClampTests(getContext(), extParams));
174 coreGroup->addChild(new glcts::TextureBufferTests(getContext(), extParams));
175 coreGroup->addChild(new glcts::DrawBuffersIndexedTests(getContext(), extParams));
176 coreGroup->addChild(new glcts::ShaderConstExprTests(getContext()));
177 coreGroup->addChild(new glcts::ShaderMacroTests(getContext()));
178 coreGroup->addChild(new glcts::SeparableProgramsTransformFeedbackTests(getContext()));
179 coreGroup->addChild(new glcts::CopyImageTests(getContext()));
180 coreGroup->addChild(new glcts::InternalformatTests(getContext()));
181 coreGroup->addChild(new deqp::Functional::TextureShadowLodTest(getContext()));
182 coreGroup->addChild(new glcts::NearestEdgeCases(getContext()));
183 coreGroup->addChild(new glcts::FramebufferCompletenessTests(getContext()));
184 coreGroup->addChild(new glcts::TextureCompatibilityTests(getContext()));
185 coreGroup->addChild(new glcts::CompressedFormatTests(getContext()));
186 addChild(coreGroup);
187 }
188 catch (...)
189 {
190 // Destroy context.
191 deqp::TestPackage::deinit();
192 throw;
193 }
194 }
195
createExecutor(void) const196 tcu::TestCaseExecutor* ES32TestPackage::createExecutor(void) const
197 {
198 return new TestCaseWrapper(const_cast<ES32TestPackage&>(*this), m_waiverMechanism);
199 }
200
201 } // es32cts
202