Merge vk-gl-cts/vulkan-cts-1.3.1 into vk-gl-cts/vulkan-cts-1.3.2
[platform/upstream/VK-GL-CTS.git] / modules / gles31 / tgl45es31TestPackage.cpp
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.1 Test Package that runs on GL4.5 context
22  *//*--------------------------------------------------------------------*/
23
24 #include "tgl45es31TestPackage.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
42 TestPackageGL45ES31::TestPackageGL45ES31 (tcu::TestContext& testCtx)
43         : tcu::TestPackage      (testCtx, "dEQP-GL45-ES31", "dEQP OpenGL ES 3.1 Tests On GL4.5 Context")
44         , m_archive                     (testCtx.getRootArchive(), "gles31/")
45         , m_context                     (DE_NULL)
46         , m_waiverMechanism (new tcu::WaiverUtil)
47 {
48 }
49
50 TestPackageGL45ES31::~TestPackageGL45ES31 (void)
51 {
52         // Destroy children first since destructors may access context.
53         TestNode::deinit();
54         delete m_context;
55 }
56
57 void TestPackageGL45ES31::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::GL45ES31FunctionalTests        (*m_context));
79         }
80         catch (...)
81         {
82                 delete m_context;
83                 m_context = DE_NULL;
84
85                 throw;
86         }
87 }
88
89 void TestPackageGL45ES31::deinit (void)
90 {
91         TestNode::deinit();
92         delete m_context;
93         m_context = DE_NULL;
94 }
95
96 tcu::TestCaseExecutor* TestPackageGL45ES31::createExecutor (void) const
97 {
98         return new TestCaseWrapper<TestPackageGL45ES31>(const_cast<TestPackageGL45ES31&>(*this), m_waiverMechanism);
99 }
100
101 } // gles31
102 } // deqp