Mask compared bits in atomic operation tests. am: b2ed9fbe1a am: 4d1d6446da am: b78f9...
[platform/upstream/VK-GL-CTS.git] / modules / gles31 / tes31Context.cpp
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 context.
22  *//*--------------------------------------------------------------------*/
23
24 #include "tes31Context.hpp"
25 #include "gluRenderContext.hpp"
26 #include "gluRenderConfig.hpp"
27 #include "gluFboRenderContext.hpp"
28 #include "gluES3PlusWrapperContext.hpp"
29 #include "gluContextInfo.hpp"
30 #include "gluDummyRenderContext.hpp"
31 #include "tcuCommandLine.hpp"
32
33 namespace deqp
34 {
35 namespace gles31
36 {
37
38 Context::Context (tcu::TestContext& testCtx)
39         : m_testCtx             (testCtx)
40         , m_renderCtx   (DE_NULL)
41         , m_contextInfo (DE_NULL)
42 {
43         if (m_testCtx.getCommandLine().getRunMode() == tcu::RUNMODE_EXECUTE)
44                 createRenderContext();
45         else
46         {
47                 // \todo [2016-11-15 pyry] Many tests (erroneously) inspect context type
48                 //                                                 during test hierarchy construction. We should fix that
49                 //                                                 and revert dummy context to advertise unknown context type.
50                 m_renderCtx = new glu::DummyRenderContext(glu::ContextType(glu::ApiType::es(3,1)));
51         }
52 }
53
54 Context::~Context (void)
55 {
56         destroyRenderContext();
57 }
58
59 void Context::createRenderContext (void)
60 {
61         DE_ASSERT(!m_renderCtx && !m_contextInfo);
62
63         try
64         {
65                 try
66                 {
67                         m_renderCtx             = glu::createDefaultRenderContext(m_testCtx.getPlatform(), m_testCtx.getCommandLine(), glu::ApiType::es(3, 2));
68                 }
69                 catch (...)
70                 {
71                         m_renderCtx             = glu::createDefaultRenderContext(m_testCtx.getPlatform(), m_testCtx.getCommandLine(), glu::ApiType::es(3, 1));
72                 }
73                 m_contextInfo   = glu::ContextInfo::create(*m_renderCtx);
74         }
75         catch (...)
76         {
77                 destroyRenderContext();
78                 throw;
79         }
80 }
81
82 void Context::destroyRenderContext (void)
83 {
84         delete m_contextInfo;
85         delete m_renderCtx;
86
87         m_contextInfo   = DE_NULL;
88         m_renderCtx             = DE_NULL;
89 }
90
91 const tcu::RenderTarget& Context::getRenderTarget (void) const
92 {
93         return m_renderCtx->getRenderTarget();
94 }
95
96 } // gles31
97 } // deqp