xref: /aosp_15_r20/external/deqp/modules/gles31/tes31TestPackage.cpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1 /*-------------------------------------------------------------------------
2  * drawElements Quality Program OpenGL ES 3.1 Module
3  * -------------------------------------------------
4  *
5  * Copyright 2014 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.1 Test Package
22  *//*--------------------------------------------------------------------*/
23 
24 #include "tes31TestPackage.hpp"
25 #include "tes31TestCaseWrapper.hpp"
26 #include "tes31InfoTests.hpp"
27 #include "es31fFunctionalTests.hpp"
28 #include "es31sStressTests.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 
37 namespace deqp
38 {
39 namespace gles31
40 {
41 
TestPackage(tcu::TestContext & testCtx)42 TestPackage::TestPackage(tcu::TestContext &testCtx)
43     : tcu::TestPackage(testCtx, "dEQP-GLES31", "dEQP OpenGL ES 3.1 Tests")
44     , m_archive(testCtx.getRootArchive(), "gles31/")
45     , m_context(DE_NULL)
46     , m_waiverMechanism(new tcu::WaiverUtil)
47 {
48 }
49 
~TestPackage(void)50 TestPackage::~TestPackage(void)
51 {
52     // Destroy children first since destructors may access context.
53     TestNode::deinit();
54     delete m_context;
55 }
56 
init(void)57 void TestPackage::init(void)
58 {
59     try
60     {
61         // Create context
62         // Some of the tests will test ES3.2 functionality if supported so try to create a 3.2 context
63         // first. If that doesn't work then create an ES3.1 context.
64         try
65         {
66             m_context = new Context(m_testCtx, glu::ApiType::es(3, 2));
67         }
68         catch (...)
69         {
70             m_context = new Context(m_testCtx, glu::ApiType::es(3, 1));
71         }
72 
73         // Setup waiver mechanism
74         if (m_testCtx.getCommandLine().getRunMode() == tcu::RUNMODE_EXECUTE)
75         {
76             const glu::ContextInfo &contextInfo = m_context->getContextInfo();
77             std::string vendor                  = contextInfo.getString(GL_VENDOR);
78             std::string renderer                = contextInfo.getString(GL_RENDERER);
79             const tcu::CommandLine &commandLine = m_context->getTestContext().getCommandLine();
80             tcu::SessionInfo sessionInfo(vendor, renderer, commandLine.getInitialCmdLine());
81             m_waiverMechanism->setup(commandLine.getWaiverFileName(), m_name, vendor, renderer, sessionInfo);
82             m_context->getTestContext().getLog().writeSessionInfo(sessionInfo.get());
83         }
84 
85         // Add main test groups
86         addChild(new InfoTests(*m_context));
87         addChild(new Functional::GLES31FunctionalTests(*m_context));
88         addChild(new Stress::StressTests(*m_context));
89     }
90     catch (...)
91     {
92         delete m_context;
93         m_context = DE_NULL;
94 
95         throw;
96     }
97 }
98 
deinit(void)99 void TestPackage::deinit(void)
100 {
101     TestNode::deinit();
102     delete m_context;
103     m_context = DE_NULL;
104 }
105 
createExecutor(void) const106 tcu::TestCaseExecutor *TestPackage::createExecutor(void) const
107 {
108     return new TestCaseWrapper<TestPackage>(const_cast<TestPackage &>(*this), m_waiverMechanism);
109 }
110 
111 } // namespace gles31
112 } // namespace deqp
113