1/*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 3.1 Module
3 * -------------------------------------------------
4 *
5 * Copyright 2019 The Android Open Source Project
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *      http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 *//*!
20 * \file
21 * \brief OpenGL ES 3 Test Package that runs on GL4.5 context
22 *//*--------------------------------------------------------------------*/
23
24#include "tgl45es3TestPackage.hpp"
25#include "tes3TestCaseWrapper.hpp"
26#include "tes3InfoTests.hpp"
27#include "es3fFunctionalTests.hpp"
28#include "es3sStressTests.hpp"
29#include "gluStateReset.hpp"
30#include "gluRenderContext.hpp"
31#include "gluContextInfo.hpp"
32#include "tcuTestLog.hpp"
33#include "tcuCommandLine.hpp"
34#include "tcuWaiverUtil.hpp"
35#include "glwEnums.hpp"
36
37namespace deqp
38{
39namespace gles3
40{
41
42TestPackageGL45ES3::TestPackageGL45ES3 (tcu::TestContext& testCtx)
43	: tcu::TestPackage	(testCtx, "dEQP-GL45-ES3", "dEQP OpenGL ES 3 Tests On GL4.5 Context")
44	, m_archive			(testCtx.getRootArchive(), "gles3/")
45	, m_context			(DE_NULL)
46	, m_waiverMechanism (new tcu::WaiverUtil)
47{
48}
49
50TestPackageGL45ES3::~TestPackageGL45ES3 (void)
51{
52	// Destroy children first since destructors may access context.
53	TestNode::deinit();
54	delete m_context;
55}
56
57void TestPackageGL45ES3::init (void)
58{
59	try
60	{
61		// Create context
62		m_context = new Context(m_testCtx, glu::ApiType::core(4, 5));
63
64		// Setup waiver mechanism
65		if (m_testCtx.getCommandLine().getRunMode() == tcu::RUNMODE_EXECUTE)
66		{
67			const glu::ContextInfo&	contextInfo = m_context->getContextInfo();
68			std::string				vendor		= contextInfo.getString(GL_VENDOR);
69			std::string				renderer	= contextInfo.getString(GL_RENDERER);
70			const tcu::CommandLine&	commandLine	= m_context->getTestContext().getCommandLine();
71			tcu::SessionInfo		sessionInfo	(vendor, renderer, commandLine.getInitialCmdLine());
72			m_waiverMechanism->setup(commandLine.getWaiverFileName(), m_name, vendor, renderer, sessionInfo);
73			m_context->getTestContext().getLog().writeSessionInfo(sessionInfo.get());
74		}
75
76		// Add main test groups
77		addChild(new InfoTests							(*m_context));
78		addChild(new Functional::GL45ES3FunctionalTests	(*m_context));
79	}
80	catch (...)
81	{
82		delete m_context;
83		m_context = DE_NULL;
84
85		throw;
86	}
87}
88
89void TestPackageGL45ES3::deinit (void)
90{
91	TestNode::deinit();
92	delete m_context;
93	m_context = DE_NULL;
94}
95
96tcu::TestCaseExecutor* TestPackageGL45ES3::createExecutor (void) const
97{
98	return new TestCaseWrapper<TestPackageGL45ES3>(const_cast<TestPackageGL45ES3&>(*this), m_waiverMechanism);
99}
100
101} // gles3
102} // deqp
103