• 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.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), m_waiverMechanism(waiverMechanism)
98 {
99 }
100 
~TestCaseWrapper(void)101 TestCaseWrapper::~TestCaseWrapper(void)
102 {
103 }
104 
init(tcu::TestCase * testCase,const std::string & path)105 void TestCaseWrapper::init(tcu::TestCase* testCase, const std::string& path)
106 {
107 	if (m_waiverMechanism->isOnWaiverList(path))
108 		throw tcu::TestException("Waived test", QP_TEST_RESULT_WAIVER);
109 
110 	glu::resetState(m_testPackage.getContext().getRenderContext(), m_testPackage.getContext().getContextInfo());
111 
112 	testCase->init();
113 }
114 
deinit(tcu::TestCase * testCase)115 void TestCaseWrapper::deinit(tcu::TestCase* testCase)
116 {
117 	testCase->deinit();
118 
119 	glu::resetState(m_testPackage.getContext().getRenderContext(), m_testPackage.getContext().getContextInfo());
120 }
121 
iterate(tcu::TestCase * testCase)122 tcu::TestNode::IterateResult TestCaseWrapper::iterate(tcu::TestCase* testCase)
123 {
124 	tcu::TestContext&   testCtx   = m_testPackage.getContext().getTestContext();
125 	glu::RenderContext& renderCtx = m_testPackage.getContext().getRenderContext();
126 
127 	// Clear to black
128 	{
129 		const glw::Functions& gl = renderCtx.getFunctions();
130 		gl.clearColor(0.0f, 0.0f, 0.0f, 1.f);
131 		gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
132 	}
133 
134 	const tcu::TestCase::IterateResult result = testCase->iterate();
135 
136 	// Call implementation specific post-iterate routine (usually handles native events and swaps buffers)
137 	try
138 	{
139 		m_testPackage.getContext().getRenderContext().postIterate();
140 		return result;
141 	}
142 	catch (const tcu::ResourceError& e)
143 	{
144 		testCtx.getLog() << e;
145 		testCtx.setTestResult(QP_TEST_RESULT_RESOURCE_ERROR, "Resource error in context post-iteration routine");
146 		testCtx.setTerminateAfter(true);
147 		return tcu::TestNode::STOP;
148 	}
149 	catch (const std::exception& e)
150 	{
151 		testCtx.getLog() << e;
152 		testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Error in context post-iteration routine");
153 		return tcu::TestNode::STOP;
154 	}
155 }
156 
ES31TestPackage(tcu::TestContext & testCtx,const char * packageName)157 ES31TestPackage::ES31TestPackage(tcu::TestContext& testCtx, const char* packageName)
158 	: deqp::TestPackage(testCtx, packageName, "OpenGL ES 3.1 Conformance Tests",
159 						glu::ContextType(glu::ApiType::es(3, 1)), "gl_cts/data/gles31/")
160 {
161 }
162 
~ES31TestPackage(void)163 ES31TestPackage::~ES31TestPackage(void)
164 {
165 	deqp::TestPackage::deinit();
166 }
167 
168 class ShaderTests : public deqp::TestCaseGroup
169 {
170 public:
ShaderTests(deqp::Context & context)171 	ShaderTests(deqp::Context& context) : TestCaseGroup(context, "shaders", "Shading Language Tests")
172 	{
173 	}
174 
init(void)175 	void init(void)
176 	{
177 		addChild(new deqp::ShaderNegativeTests(m_context, glu::GLSL_VERSION_310_ES));
178 		addChild(new glcts::AggressiveShaderOptimizationsTests(m_context));
179 		addChild(new glcts::LayoutLocationTests(m_context));
180 	}
181 };
182 
init(void)183 void ES31TestPackage::init(void)
184 {
185 	// Call init() in parent - this creates context.
186 	deqp::TestPackage::init();
187 
188 	try
189 	{
190 		tcu::TestCaseGroup* coreGroup = new tcu::TestCaseGroup(getTestContext(), "core", "core tests");
191 
192 		coreGroup->addChild(new glcts::TextureStorageMultisampleTests(getContext()));
193 		coreGroup->addChild(new glcts::ShaderAtomicCountersTests(getContext()));
194 		coreGroup->addChild(new glcts::TextureGatherTests(getContext()));
195 		coreGroup->addChild(new glcts::SampleShadingTests(getContext(), glu::GLSL_VERSION_310_ES));
196 		coreGroup->addChild(new deqp::SampleVariablesTests(getContext(), glu::GLSL_VERSION_310_ES));
197 		coreGroup->addChild(new glcts::SeparateShaderObjsTests(getContext(), glu::GLSL_VERSION_310_ES));
198 		coreGroup->addChild(new glcts::ShaderBitfieldOperationTests(getContext(), glu::GLSL_VERSION_310_ES));
199 		coreGroup->addChild(new deqp::ShaderMultisampleInterpolationTests(getContext(), glu::GLSL_VERSION_310_ES));
200 		coreGroup->addChild(new glcts::LayoutBindingTests(getContext(), glu::GLSL_VERSION_310_ES));
201 		coreGroup->addChild(new deqp::ShaderIntegerMixTests(getContext(), glu::GLSL_VERSION_310_ES));
202 		coreGroup->addChild(new glcts::ShaderConstExprTests(getContext()));
203 		coreGroup->addChild(new glcts::BlendEquationAdvancedTests(getContext(), glu::GLSL_VERSION_310_ES));
204 		coreGroup->addChild(new glcts::VertexAttribBindingTests(getContext()));
205 		coreGroup->addChild(new glcts::ShaderMacroTests(getContext()));
206 		coreGroup->addChild(new glcts::ShaderStorageBufferObjectTests(getContext()));
207 		coreGroup->addChild(new glcts::ComputeShaderTests(getContext()));
208 		coreGroup->addChild(new glcts::ShaderImageLoadStoreTests(getContext()));
209 		coreGroup->addChild(new glcts::ShaderImageSizeTests(getContext()));
210 		coreGroup->addChild(new glcts::DrawIndirectTestsES31(getContext()));
211 		coreGroup->addChild(new glcts::ExplicitUniformLocationES31Tests(getContext()));
212 		coreGroup->addChild(new glcts::ProgramInterfaceQueryTests(getContext()));
213 		coreGroup->addChild(new glcts::FramebufferNoAttachmentsTests(getContext()));
214 		coreGroup->addChild(new glcts::ArrayOfArraysTestGroup(getContext()));
215 		coreGroup->addChild(new glcts::PolygonOffsetClamp(getContext()));
216 		coreGroup->addChild(new glcts::ShaderGroupVote(getContext()));
217 		coreGroup->addChild(new glcts::InternalformatTests(getContext()));
218 		coreGroup->addChild(new glcts::NearestEdgeCases(getContext()));
219 		coreGroup->addChild(new glcts::FramebufferCompletenessTests(getContext()));
220 		coreGroup->addChild(new glcts::CompressedFormatTests(getContext()));
221 
222 		glcts::ExtParameters extParams(glu::GLSL_VERSION_310_ES, glcts::EXTENSIONTYPE_OES);
223 		coreGroup->addChild(new glcts::GeometryShaderTests(getContext(), extParams));
224 		coreGroup->addChild(new glcts::GPUShader5Tests(getContext(), extParams));
225 		coreGroup->addChild(new glcts::TessellationShaderTests(getContext(), extParams));
226 		coreGroup->addChild(new glcts::TextureCubeMapArrayTests(getContext(), extParams));
227 		coreGroup->addChild(new glcts::TextureBorderClampTests(getContext(), extParams));
228 		coreGroup->addChild(new glcts::TextureBufferTests(getContext(), extParams));
229 		coreGroup->addChild(new glcts::DrawBuffersIndexedTests(getContext(), extParams));
230 		coreGroup->addChild(new glcts::ViewportArrayTests(getContext(), extParams));
231 		coreGroup->addChild(new glcts::PixelStorageModesTests(getContext(), glu::GLSL_VERSION_310_ES));
232 
233 		addChild(coreGroup);
234 
235 		addChild(new ShaderTests(getContext()));
236 	}
237 	catch (...)
238 	{
239 		// Destroy context.
240 		deqp::TestPackage::deinit();
241 		throw;
242 	}
243 }
244 
createExecutor(void) const245 tcu::TestCaseExecutor* ES31TestPackage::createExecutor(void) const
246 {
247 	return new TestCaseWrapper(const_cast<ES31TestPackage&>(*this), m_waiverMechanism);
248 }
249 
250 } // es31cts
251