1e5c31af7Sopenharmony_ci/*-------------------------------------------------------------------------
2e5c31af7Sopenharmony_ci * OpenGL Conformance Test Suite
3e5c31af7Sopenharmony_ci * -----------------------------
4e5c31af7Sopenharmony_ci *
5e5c31af7Sopenharmony_ci * Copyright (c) 2016 Google Inc.
6e5c31af7Sopenharmony_ci * Copyright (c) 2016 The Khronos Group Inc.
7e5c31af7Sopenharmony_ci *
8e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
9e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License.
10e5c31af7Sopenharmony_ci * You may obtain a copy of the License at
11e5c31af7Sopenharmony_ci *
12e5c31af7Sopenharmony_ci *      http://www.apache.org/licenses/LICENSE-2.0
13e5c31af7Sopenharmony_ci *
14e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
15e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
16e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and
18e5c31af7Sopenharmony_ci * limitations under the License.
19e5c31af7Sopenharmony_ci *
20e5c31af7Sopenharmony_ci */ /*!
21e5c31af7Sopenharmony_ci * \file
22e5c31af7Sopenharmony_ci * \brief OpenGL ES 3 Test Package.
23e5c31af7Sopenharmony_ci */ /*-------------------------------------------------------------------*/
24e5c31af7Sopenharmony_ci
25e5c31af7Sopenharmony_ci#include "es32cTestPackage.hpp"
26e5c31af7Sopenharmony_ci#include "es32cCopyImageTests.hpp"
27e5c31af7Sopenharmony_ci#include "esextcTestPackage.hpp"
28e5c31af7Sopenharmony_ci#include "glcAggressiveShaderOptimizationsTests.hpp"
29e5c31af7Sopenharmony_ci#include "glcFragDepthTests.hpp"
30e5c31af7Sopenharmony_ci#include "glcInfoTests.hpp"
31e5c31af7Sopenharmony_ci#include "glcInternalformatTests.hpp"
32e5c31af7Sopenharmony_ci#include "glcSeparableProgramsTransformFeedbackTests.hpp"
33e5c31af7Sopenharmony_ci#include "glcShaderConstExprTests.hpp"
34e5c31af7Sopenharmony_ci#include "glcShaderFunctionTests.hpp"
35e5c31af7Sopenharmony_ci#include "glcShaderIndexingTests.hpp"
36e5c31af7Sopenharmony_ci#include "glcShaderIntegerMixTests.hpp"
37e5c31af7Sopenharmony_ci#include "glcShaderLibrary.hpp"
38e5c31af7Sopenharmony_ci#include "glcShaderLoopTests.hpp"
39e5c31af7Sopenharmony_ci#include "glcShaderMacroTests.hpp"
40e5c31af7Sopenharmony_ci#include "glcShaderNegativeTests.hpp"
41e5c31af7Sopenharmony_ci#include "glcShaderStructTests.hpp"
42e5c31af7Sopenharmony_ci#include "glcTextureCompatibilityTests.hpp"
43e5c31af7Sopenharmony_ci#include "glcUniformBlockTests.hpp"
44e5c31af7Sopenharmony_ci#include "glcNearestEdgeTests.hpp"
45e5c31af7Sopenharmony_ci#include "glcFramebufferCompleteness.hpp"
46e5c31af7Sopenharmony_ci#include "glcCompressedFormatTests.hpp"
47e5c31af7Sopenharmony_ci#include "gluStateReset.hpp"
48e5c31af7Sopenharmony_ci#include "glwEnums.hpp"
49e5c31af7Sopenharmony_ci#include "glwFunctions.hpp"
50e5c31af7Sopenharmony_ci#include "tcuTestLog.hpp"
51e5c31af7Sopenharmony_ci#include "tcuWaiverUtil.hpp"
52e5c31af7Sopenharmony_ci
53e5c31af7Sopenharmony_ci#include "../glesext/draw_buffers_indexed/esextcDrawBuffersIndexedTests.hpp"
54e5c31af7Sopenharmony_ci#include "../glesext/geometry_shader/esextcGeometryShaderTests.hpp"
55e5c31af7Sopenharmony_ci#include "../glesext/gpu_shader5/esextcGPUShader5Tests.hpp"
56e5c31af7Sopenharmony_ci#include "../glesext/tessellation_shader/esextcTessellationShaderTests.hpp"
57e5c31af7Sopenharmony_ci#include "../glesext/texture_border_clamp/esextcTextureBorderClampTests.hpp"
58e5c31af7Sopenharmony_ci#include "../glesext/texture_buffer/esextcTextureBufferTests.hpp"
59e5c31af7Sopenharmony_ci#include "../glesext/texture_cube_map_array/esextcTextureCubeMapArrayTests.hpp"
60e5c31af7Sopenharmony_ci#include "../glesext/texture_shadow_lod/esextcTextureShadowLodFunctionsTest.hpp"
61e5c31af7Sopenharmony_ci
62e5c31af7Sopenharmony_cinamespace es32cts
63e5c31af7Sopenharmony_ci{
64e5c31af7Sopenharmony_ci
65e5c31af7Sopenharmony_ciclass TestCaseWrapper : public tcu::TestCaseExecutor
66e5c31af7Sopenharmony_ci{
67e5c31af7Sopenharmony_cipublic:
68e5c31af7Sopenharmony_ci	TestCaseWrapper(ES32TestPackage& package, de::SharedPtr<tcu::WaiverUtil> waiverMechanism);
69e5c31af7Sopenharmony_ci	~TestCaseWrapper(void);
70e5c31af7Sopenharmony_ci
71e5c31af7Sopenharmony_ci	void init(tcu::TestCase* testCase, const std::string& path);
72e5c31af7Sopenharmony_ci	void deinit(tcu::TestCase* testCase);
73e5c31af7Sopenharmony_ci	tcu::TestNode::IterateResult iterate(tcu::TestCase* testCase);
74e5c31af7Sopenharmony_ci
75e5c31af7Sopenharmony_ciprivate:
76e5c31af7Sopenharmony_ci	ES32TestPackage&				m_testPackage;
77e5c31af7Sopenharmony_ci	de::SharedPtr<tcu::WaiverUtil>	m_waiverMechanism;
78e5c31af7Sopenharmony_ci};
79e5c31af7Sopenharmony_ci
80e5c31af7Sopenharmony_ciTestCaseWrapper::TestCaseWrapper(ES32TestPackage& package, de::SharedPtr<tcu::WaiverUtil> waiverMechanism)
81e5c31af7Sopenharmony_ci	: m_testPackage		(package)
82e5c31af7Sopenharmony_ci	, m_waiverMechanism	(waiverMechanism)
83e5c31af7Sopenharmony_ci{
84e5c31af7Sopenharmony_ci}
85e5c31af7Sopenharmony_ci
86e5c31af7Sopenharmony_ciTestCaseWrapper::~TestCaseWrapper(void)
87e5c31af7Sopenharmony_ci{
88e5c31af7Sopenharmony_ci}
89e5c31af7Sopenharmony_ci
90e5c31af7Sopenharmony_civoid TestCaseWrapper::init(tcu::TestCase* testCase, const std::string& path)
91e5c31af7Sopenharmony_ci{
92e5c31af7Sopenharmony_ci	if (m_waiverMechanism->isOnWaiverList(path))
93e5c31af7Sopenharmony_ci		throw tcu::TestException("Waived test", QP_TEST_RESULT_WAIVER);
94e5c31af7Sopenharmony_ci
95e5c31af7Sopenharmony_ci	glu::resetState(m_testPackage.getContext().getRenderContext(), m_testPackage.getContext().getContextInfo());
96e5c31af7Sopenharmony_ci
97e5c31af7Sopenharmony_ci	testCase->init();
98e5c31af7Sopenharmony_ci}
99e5c31af7Sopenharmony_ci
100e5c31af7Sopenharmony_civoid TestCaseWrapper::deinit(tcu::TestCase* testCase)
101e5c31af7Sopenharmony_ci{
102e5c31af7Sopenharmony_ci	testCase->deinit();
103e5c31af7Sopenharmony_ci
104e5c31af7Sopenharmony_ci	glu::resetState(m_testPackage.getContext().getRenderContext(), m_testPackage.getContext().getContextInfo());
105e5c31af7Sopenharmony_ci}
106e5c31af7Sopenharmony_ci
107e5c31af7Sopenharmony_citcu::TestNode::IterateResult TestCaseWrapper::iterate(tcu::TestCase* testCase)
108e5c31af7Sopenharmony_ci{
109e5c31af7Sopenharmony_ci	tcu::TestContext&			 testCtx   = m_testPackage.getContext().getTestContext();
110e5c31af7Sopenharmony_ci	glu::RenderContext&			 renderCtx = m_testPackage.getContext().getRenderContext();
111e5c31af7Sopenharmony_ci	tcu::TestCase::IterateResult result;
112e5c31af7Sopenharmony_ci
113e5c31af7Sopenharmony_ci	// Clear to black
114e5c31af7Sopenharmony_ci	{
115e5c31af7Sopenharmony_ci		const glw::Functions& gl = renderCtx.getFunctions();
116e5c31af7Sopenharmony_ci		gl.clearColor(0.0f, 0.0f, 0.0f, 1.f);
117e5c31af7Sopenharmony_ci		gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
118e5c31af7Sopenharmony_ci	}
119e5c31af7Sopenharmony_ci
120e5c31af7Sopenharmony_ci	result = testCase->iterate();
121e5c31af7Sopenharmony_ci
122e5c31af7Sopenharmony_ci	// Call implementation specific post-iterate routine (usually handles native events and swaps buffers)
123e5c31af7Sopenharmony_ci	try
124e5c31af7Sopenharmony_ci	{
125e5c31af7Sopenharmony_ci		renderCtx.postIterate();
126e5c31af7Sopenharmony_ci		return result;
127e5c31af7Sopenharmony_ci	}
128e5c31af7Sopenharmony_ci	catch (const tcu::ResourceError&)
129e5c31af7Sopenharmony_ci	{
130e5c31af7Sopenharmony_ci		testCtx.getLog().endCase(QP_TEST_RESULT_RESOURCE_ERROR, "Resource error in context post-iteration routine");
131e5c31af7Sopenharmony_ci		testCtx.setTerminateAfter(true);
132e5c31af7Sopenharmony_ci		return tcu::TestNode::STOP;
133e5c31af7Sopenharmony_ci	}
134e5c31af7Sopenharmony_ci	catch (const std::exception&)
135e5c31af7Sopenharmony_ci	{
136e5c31af7Sopenharmony_ci		testCtx.getLog().endCase(QP_TEST_RESULT_FAIL, "Error in context post-iteration routine");
137e5c31af7Sopenharmony_ci		return tcu::TestNode::STOP;
138e5c31af7Sopenharmony_ci	}
139e5c31af7Sopenharmony_ci}
140e5c31af7Sopenharmony_ci
141e5c31af7Sopenharmony_ciES32TestPackage::ES32TestPackage(tcu::TestContext& testCtx, const char* packageName)
142e5c31af7Sopenharmony_ci	: deqp::TestPackage(testCtx, packageName, "OpenGL ES 3.2 Conformance Tests",
143e5c31af7Sopenharmony_ci						glu::ContextType(glu::ApiType::es(3, 2)), "gl_cts/data/gles32/")
144e5c31af7Sopenharmony_ci{
145e5c31af7Sopenharmony_ci}
146e5c31af7Sopenharmony_ci
147e5c31af7Sopenharmony_ciES32TestPackage::~ES32TestPackage(void)
148e5c31af7Sopenharmony_ci{
149e5c31af7Sopenharmony_ci	deqp::TestPackage::deinit();
150e5c31af7Sopenharmony_ci}
151e5c31af7Sopenharmony_ci
152e5c31af7Sopenharmony_civoid ES32TestPackage::init(void)
153e5c31af7Sopenharmony_ci{
154e5c31af7Sopenharmony_ci	// Call init() in parent - this creates context.
155e5c31af7Sopenharmony_ci	deqp::TestPackage::init();
156e5c31af7Sopenharmony_ci
157e5c31af7Sopenharmony_ci	try
158e5c31af7Sopenharmony_ci	{
159e5c31af7Sopenharmony_ci		// Add main test groups
160e5c31af7Sopenharmony_ci		addChild(new deqp::InfoTests(getContext()));
161e5c31af7Sopenharmony_ci
162e5c31af7Sopenharmony_ci		tcu::TestCaseGroup* shadersGroup = new tcu::TestCaseGroup(getTestContext(), "shaders", "");
163e5c31af7Sopenharmony_ci		shadersGroup->addChild(new deqp::ShaderFunctionTests(getContext(), glu::GLSL_VERSION_320_ES));
164e5c31af7Sopenharmony_ci		shadersGroup->addChild(new deqp::ShaderIntegerMixTests(getContext(), glu::GLSL_VERSION_320_ES));
165e5c31af7Sopenharmony_ci		shadersGroup->addChild(new deqp::ShaderNegativeTests(getContext(), glu::GLSL_VERSION_320_ES));
166e5c31af7Sopenharmony_ci		shadersGroup->addChild(new deqp::ShaderStructTests(getContext(), glu::GLSL_VERSION_320_ES));
167e5c31af7Sopenharmony_ci		shadersGroup->addChild(new glcts::AggressiveShaderOptimizationsTests(getContext()));
168e5c31af7Sopenharmony_ci		addChild(shadersGroup);
169e5c31af7Sopenharmony_ci
170e5c31af7Sopenharmony_ci		tcu::TestCaseGroup*  coreGroup = new tcu::TestCaseGroup(getTestContext(), "core", "");
171e5c31af7Sopenharmony_ci		glcts::ExtParameters extParams(glu::GLSL_VERSION_320_ES, glcts::EXTENSIONTYPE_NONE);
172e5c31af7Sopenharmony_ci		coreGroup->addChild(new glcts::GeometryShaderTests(getContext(), extParams));
173e5c31af7Sopenharmony_ci		coreGroup->addChild(new glcts::GPUShader5Tests(getContext(), extParams));
174e5c31af7Sopenharmony_ci		coreGroup->addChild(new glcts::TessellationShaderTests(getContext(), extParams));
175e5c31af7Sopenharmony_ci		coreGroup->addChild(new glcts::TextureCubeMapArrayTests(getContext(), extParams));
176e5c31af7Sopenharmony_ci		coreGroup->addChild(new glcts::TextureBorderClampTests(getContext(), extParams));
177e5c31af7Sopenharmony_ci		coreGroup->addChild(new glcts::TextureBufferTests(getContext(), extParams));
178e5c31af7Sopenharmony_ci		coreGroup->addChild(new glcts::DrawBuffersIndexedTests(getContext(), extParams));
179e5c31af7Sopenharmony_ci		coreGroup->addChild(new glcts::ShaderConstExprTests(getContext()));
180e5c31af7Sopenharmony_ci		coreGroup->addChild(new glcts::ShaderMacroTests(getContext()));
181e5c31af7Sopenharmony_ci		coreGroup->addChild(new glcts::SeparableProgramsTransformFeedbackTests(getContext()));
182e5c31af7Sopenharmony_ci		coreGroup->addChild(new glcts::CopyImageTests(getContext()));
183e5c31af7Sopenharmony_ci		coreGroup->addChild(new glcts::InternalformatTests(getContext()));
184e5c31af7Sopenharmony_ci		coreGroup->addChild(new deqp::Functional::TextureShadowLodTest(getContext()));
185e5c31af7Sopenharmony_ci		coreGroup->addChild(new glcts::NearestEdgeCases(getContext()));
186e5c31af7Sopenharmony_ci		coreGroup->addChild(new glcts::FramebufferCompletenessTests(getContext()));
187e5c31af7Sopenharmony_ci		coreGroup->addChild(new glcts::TextureCompatibilityTests(getContext()));
188e5c31af7Sopenharmony_ci		coreGroup->addChild(new glcts::CompressedFormatTests(getContext()));
189e5c31af7Sopenharmony_ci		addChild(coreGroup);
190e5c31af7Sopenharmony_ci	}
191e5c31af7Sopenharmony_ci	catch (...)
192e5c31af7Sopenharmony_ci	{
193e5c31af7Sopenharmony_ci		// Destroy context.
194e5c31af7Sopenharmony_ci		deqp::TestPackage::deinit();
195e5c31af7Sopenharmony_ci		throw;
196e5c31af7Sopenharmony_ci	}
197e5c31af7Sopenharmony_ci}
198e5c31af7Sopenharmony_ci
199e5c31af7Sopenharmony_citcu::TestCaseExecutor* ES32TestPackage::createExecutor(void) const
200e5c31af7Sopenharmony_ci{
201e5c31af7Sopenharmony_ci	return new TestCaseWrapper(const_cast<ES32TestPackage&>(*this), m_waiverMechanism);
202e5c31af7Sopenharmony_ci}
203e5c31af7Sopenharmony_ci
204e5c31af7Sopenharmony_ci} // es32cts
205