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.1 Test Package.
23 */ /*-------------------------------------------------------------------*/
24
25 #include "es31cTestPackage.hpp"
26
27 #include "es31cArrayOfArraysTests.hpp"
28 #include "es31cComputeShaderTests.hpp"
29 #include "es31cDrawIndirectTests.hpp"
30 #include "es31cExplicitUniformLocationTest.hpp"
31 #include "es31cFramebufferNoAttachmentsTests.hpp"
32 #include "es31cLayoutBindingTests.hpp"
33 #include "es31cProgramInterfaceQueryTests.hpp"
34 #include "es31cSampleShadingTests.hpp"
35
36 #include "es31cSeparateShaderObjsTests.hpp"
37 #include "es31cShaderAtomicCountersTests.hpp"
38 #include "es31cShaderBitfieldOperationTests.hpp"
39 #include "es31cShaderImageLoadStoreTests.hpp"
40 #include "es31cShaderImageSizeTests.hpp"
41 #include "es31cShaderStorageBufferObjectTests.hpp"
42 #include "es31cTextureGatherTests.hpp"
43 #include "es31cTextureStorageMultisampleTests.hpp"
44 #include "es31cVertexAttribBindingTests.hpp"
45 #include "glcAggressiveShaderOptimizationsTests.hpp"
46 #include "glcBlendEquationAdvancedTests.hpp"
47 #include "glcInfoTests.hpp"
48 #include "glcInternalformatTests.hpp"
49 #include "glcLayoutLocationTests.hpp"
50 #include "glcPolygonOffsetClampTests.hpp"
51 #include "glcSampleVariablesTests.hpp"
52 #include "glcShaderConstExprTests.hpp"
53 #include "glcShaderGroupVoteTests.hpp"
54 #include "glcShaderIntegerMixTests.hpp"
55 #include "glcShaderMacroTests.hpp"
56 #include "glcShaderMultisampleInterpolationTests.hpp"
57 #include "glcShaderNegativeTests.hpp"
58 #include "glcNearestEdgeTests.hpp"
59 #include "glcFramebufferCompleteness.hpp"
60 #include "glcCompressedFormatTests.hpp"
61
62 #include "gluStateReset.hpp"
63 #include "gluContextInfo.hpp"
64 #include "tcuCommandLine.hpp"
65 #include "tcuWaiverUtil.hpp"
66 #include "glwEnums.hpp"
67
68 #include "../glesext/draw_buffers_indexed/esextcDrawBuffersIndexedTests.hpp"
69 #include "../glesext/geometry_shader/esextcGeometryShaderTests.hpp"
70 #include "../glesext/gpu_shader5/esextcGPUShader5Tests.hpp"
71 #include "../glesext/tessellation_shader/esextcTessellationShaderTests.hpp"
72 #include "../glesext/texture_border_clamp/esextcTextureBorderClampTests.hpp"
73 #include "../glesext/texture_buffer/esextcTextureBufferTests.hpp"
74 #include "../glesext/texture_cube_map_array/esextcTextureCubeMapArrayTests.hpp"
75 #include "glcViewportArrayTests.hpp"
76 #include "glcPixelStorageModesTests.hpp"
77
78 namespace es31cts
79 {
80
81 class TestCaseWrapper : public tcu::TestCaseExecutor
82 {
83 public:
84 TestCaseWrapper(ES31TestPackage &package, de::SharedPtr<tcu::WaiverUtil> waiverMechanism);
85 ~TestCaseWrapper(void);
86
87 void init(tcu::TestCase *testCase, const std::string &path);
88 void deinit(tcu::TestCase *testCase);
89 tcu::TestNode::IterateResult iterate(tcu::TestCase *testCase);
90
91 private:
92 ES31TestPackage &m_testPackage;
93 de::SharedPtr<tcu::WaiverUtil> m_waiverMechanism;
94 };
95
TestCaseWrapper(ES31TestPackage & package,de::SharedPtr<tcu::WaiverUtil> waiverMechanism)96 TestCaseWrapper::TestCaseWrapper(ES31TestPackage &package, de::SharedPtr<tcu::WaiverUtil> waiverMechanism)
97 : m_testPackage(package)
98 , m_waiverMechanism(waiverMechanism)
99 {
100 }
101
~TestCaseWrapper(void)102 TestCaseWrapper::~TestCaseWrapper(void)
103 {
104 }
105
init(tcu::TestCase * testCase,const std::string & path)106 void TestCaseWrapper::init(tcu::TestCase *testCase, const std::string &path)
107 {
108 if (m_waiverMechanism->isOnWaiverList(path))
109 throw tcu::TestException("Waived test", QP_TEST_RESULT_WAIVER);
110
111 glu::resetState(m_testPackage.getContext().getRenderContext(), m_testPackage.getContext().getContextInfo());
112
113 testCase->init();
114 }
115
deinit(tcu::TestCase * testCase)116 void TestCaseWrapper::deinit(tcu::TestCase *testCase)
117 {
118 testCase->deinit();
119
120 glu::resetState(m_testPackage.getContext().getRenderContext(), m_testPackage.getContext().getContextInfo());
121 }
122
iterate(tcu::TestCase * testCase)123 tcu::TestNode::IterateResult TestCaseWrapper::iterate(tcu::TestCase *testCase)
124 {
125 tcu::TestContext &testCtx = m_testPackage.getContext().getTestContext();
126 glu::RenderContext &renderCtx = m_testPackage.getContext().getRenderContext();
127
128 // Clear to black
129 {
130 const glw::Functions &gl = renderCtx.getFunctions();
131 gl.clearColor(0.0f, 0.0f, 0.0f, 1.f);
132 gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
133 }
134
135 const tcu::TestCase::IterateResult result = testCase->iterate();
136
137 // Call implementation specific post-iterate routine (usually handles native events and swaps buffers)
138 try
139 {
140 m_testPackage.getContext().getRenderContext().postIterate();
141 return result;
142 }
143 catch (const tcu::ResourceError &e)
144 {
145 testCtx.getLog() << e;
146 testCtx.setTestResult(QP_TEST_RESULT_RESOURCE_ERROR, "Resource error in context post-iteration routine");
147 testCtx.setTerminateAfter(true);
148 return tcu::TestNode::STOP;
149 }
150 catch (const std::exception &e)
151 {
152 testCtx.getLog() << e;
153 testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Error in context post-iteration routine");
154 return tcu::TestNode::STOP;
155 }
156 }
157
ES31TestPackage(tcu::TestContext & testCtx,const char * packageName)158 ES31TestPackage::ES31TestPackage(tcu::TestContext &testCtx, const char *packageName)
159 : deqp::TestPackage(testCtx, packageName, "OpenGL ES 3.1 Conformance Tests",
160 glu::ContextType(glu::ApiType::es(3, 1)), "gl_cts/data/gles31/")
161 {
162 }
163
~ES31TestPackage(void)164 ES31TestPackage::~ES31TestPackage(void)
165 {
166 deqp::TestPackage::deinit();
167 }
168
169 class ShaderTests : public deqp::TestCaseGroup
170 {
171 public:
ShaderTests(deqp::Context & context)172 ShaderTests(deqp::Context &context) : TestCaseGroup(context, "shaders", "Shading Language Tests")
173 {
174 }
175
init(void)176 void init(void)
177 {
178 addChild(new deqp::ShaderNegativeTests(m_context, glu::GLSL_VERSION_310_ES));
179 addChild(new glcts::AggressiveShaderOptimizationsTests(m_context));
180 addChild(new glcts::LayoutLocationTests(m_context));
181 }
182 };
183
init(void)184 void ES31TestPackage::init(void)
185 {
186 // Call init() in parent - this creates context.
187 deqp::TestPackage::init();
188
189 try
190 {
191 tcu::TestCaseGroup *coreGroup = new tcu::TestCaseGroup(getTestContext(), "core", "core tests");
192
193 coreGroup->addChild(new glcts::TextureStorageMultisampleTests(getContext()));
194 coreGroup->addChild(new glcts::ShaderAtomicCountersTests(getContext()));
195 coreGroup->addChild(new glcts::TextureGatherTests(getContext()));
196 coreGroup->addChild(new glcts::SampleShadingTests(getContext(), glu::GLSL_VERSION_310_ES));
197 coreGroup->addChild(new deqp::SampleVariablesTests(getContext(), glu::GLSL_VERSION_310_ES));
198 coreGroup->addChild(new glcts::SeparateShaderObjsTests(getContext(), glu::GLSL_VERSION_310_ES));
199 coreGroup->addChild(new glcts::ShaderBitfieldOperationTests(getContext(), glu::GLSL_VERSION_310_ES));
200 coreGroup->addChild(new deqp::ShaderMultisampleInterpolationTests(getContext(), glu::GLSL_VERSION_310_ES));
201 coreGroup->addChild(new glcts::LayoutBindingTests(getContext(), glu::GLSL_VERSION_310_ES));
202 coreGroup->addChild(new deqp::ShaderIntegerMixTests(getContext(), glu::GLSL_VERSION_310_ES));
203 coreGroup->addChild(new glcts::ShaderConstExprTests(getContext()));
204 coreGroup->addChild(new glcts::BlendEquationAdvancedTests(getContext(), glu::GLSL_VERSION_310_ES));
205 coreGroup->addChild(new glcts::VertexAttribBindingTests(getContext()));
206 coreGroup->addChild(new glcts::ShaderMacroTests(getContext()));
207 coreGroup->addChild(new glcts::ShaderStorageBufferObjectTests(getContext()));
208 coreGroup->addChild(new glcts::ComputeShaderTests(getContext()));
209 coreGroup->addChild(new glcts::ShaderImageLoadStoreTests(getContext()));
210 coreGroup->addChild(new glcts::ShaderImageSizeTests(getContext()));
211 coreGroup->addChild(new glcts::DrawIndirectTestsES31(getContext()));
212 coreGroup->addChild(new glcts::ExplicitUniformLocationES31Tests(getContext()));
213 coreGroup->addChild(new glcts::ProgramInterfaceQueryTests(getContext()));
214 coreGroup->addChild(new glcts::FramebufferNoAttachmentsTests(getContext()));
215 coreGroup->addChild(new glcts::ArrayOfArraysTestGroup(getContext()));
216 coreGroup->addChild(new glcts::PolygonOffsetClamp(getContext()));
217 coreGroup->addChild(new glcts::ShaderGroupVote(getContext()));
218 coreGroup->addChild(new glcts::InternalformatTests(getContext()));
219 coreGroup->addChild(new glcts::NearestEdgeCases(getContext()));
220 coreGroup->addChild(new glcts::FramebufferCompletenessTests(getContext()));
221 coreGroup->addChild(new glcts::CompressedFormatTests(getContext()));
222
223 glcts::ExtParameters extParams(glu::GLSL_VERSION_310_ES, glcts::EXTENSIONTYPE_OES);
224 coreGroup->addChild(new glcts::GeometryShaderTests(getContext(), extParams));
225 coreGroup->addChild(new glcts::GPUShader5Tests(getContext(), extParams));
226 coreGroup->addChild(new glcts::TessellationShaderTests(getContext(), extParams));
227 coreGroup->addChild(new glcts::TextureCubeMapArrayTests(getContext(), extParams));
228 coreGroup->addChild(new glcts::TextureBorderClampTests(getContext(), extParams));
229 coreGroup->addChild(new glcts::TextureBufferTests(getContext(), extParams));
230 coreGroup->addChild(new glcts::DrawBuffersIndexedTests(getContext(), extParams));
231 coreGroup->addChild(new glcts::ViewportArrayTests(getContext(), extParams));
232 coreGroup->addChild(new glcts::PixelStorageModesTests(getContext(), glu::GLSL_VERSION_310_ES));
233
234 addChild(coreGroup);
235
236 addChild(new ShaderTests(getContext()));
237 }
238 catch (...)
239 {
240 // Destroy context.
241 deqp::TestPackage::deinit();
242 throw;
243 }
244 }
245
createExecutor(void) const246 tcu::TestCaseExecutor *ES31TestPackage::createExecutor(void) const
247 {
248 return new TestCaseWrapper(const_cast<ES31TestPackage &>(*this), m_waiverMechanism);
249 }
250
251 } // namespace es31cts
252