xref: /aosp_15_r20/external/deqp/modules/gles3/tes3Context.cpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
2*35238bceSAndroid Build Coastguard Worker  * drawElements Quality Program OpenGL ES 3.0 Module
3*35238bceSAndroid Build Coastguard Worker  * -------------------------------------------------
4*35238bceSAndroid Build Coastguard Worker  *
5*35238bceSAndroid Build Coastguard Worker  * Copyright 2014 The Android Open Source Project
6*35238bceSAndroid Build Coastguard Worker  *
7*35238bceSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
8*35238bceSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
9*35238bceSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
10*35238bceSAndroid Build Coastguard Worker  *
11*35238bceSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
12*35238bceSAndroid Build Coastguard Worker  *
13*35238bceSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
14*35238bceSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
15*35238bceSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16*35238bceSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
17*35238bceSAndroid Build Coastguard Worker  * limitations under the License.
18*35238bceSAndroid Build Coastguard Worker  *
19*35238bceSAndroid Build Coastguard Worker  *//*!
20*35238bceSAndroid Build Coastguard Worker  * \file
21*35238bceSAndroid Build Coastguard Worker  * \brief OpenGL ES 3.0 test context.
22*35238bceSAndroid Build Coastguard Worker  *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker 
24*35238bceSAndroid Build Coastguard Worker #include "tes3Context.hpp"
25*35238bceSAndroid Build Coastguard Worker #include "gluRenderContext.hpp"
26*35238bceSAndroid Build Coastguard Worker #include "gluRenderConfig.hpp"
27*35238bceSAndroid Build Coastguard Worker #include "gluFboRenderContext.hpp"
28*35238bceSAndroid Build Coastguard Worker #include "gluContextInfo.hpp"
29*35238bceSAndroid Build Coastguard Worker #include "tcuCommandLine.hpp"
30*35238bceSAndroid Build Coastguard Worker #include "glwWrapper.hpp"
31*35238bceSAndroid Build Coastguard Worker 
32*35238bceSAndroid Build Coastguard Worker namespace deqp
33*35238bceSAndroid Build Coastguard Worker {
34*35238bceSAndroid Build Coastguard Worker namespace gles3
35*35238bceSAndroid Build Coastguard Worker {
36*35238bceSAndroid Build Coastguard Worker 
Context(tcu::TestContext & testCtx,glu::ApiType apiType)37*35238bceSAndroid Build Coastguard Worker Context::Context(tcu::TestContext &testCtx, glu::ApiType apiType)
38*35238bceSAndroid Build Coastguard Worker     : m_testCtx(testCtx)
39*35238bceSAndroid Build Coastguard Worker     , m_renderCtx(DE_NULL)
40*35238bceSAndroid Build Coastguard Worker     , m_contextInfo(DE_NULL)
41*35238bceSAndroid Build Coastguard Worker     , m_apiType(apiType)
42*35238bceSAndroid Build Coastguard Worker {
43*35238bceSAndroid Build Coastguard Worker     try
44*35238bceSAndroid Build Coastguard Worker     {
45*35238bceSAndroid Build Coastguard Worker         m_renderCtx   = glu::createDefaultRenderContext(m_testCtx.getPlatform(), m_testCtx.getCommandLine(), m_apiType);
46*35238bceSAndroid Build Coastguard Worker         m_contextInfo = glu::ContextInfo::create(*m_renderCtx);
47*35238bceSAndroid Build Coastguard Worker 
48*35238bceSAndroid Build Coastguard Worker         // Set up function table for transparent wrapper.
49*35238bceSAndroid Build Coastguard Worker         glw::setCurrentThreadFunctions(&m_renderCtx->getFunctions());
50*35238bceSAndroid Build Coastguard Worker     }
51*35238bceSAndroid Build Coastguard Worker     catch (...)
52*35238bceSAndroid Build Coastguard Worker     {
53*35238bceSAndroid Build Coastguard Worker         glw::setCurrentThreadFunctions(DE_NULL);
54*35238bceSAndroid Build Coastguard Worker 
55*35238bceSAndroid Build Coastguard Worker         delete m_contextInfo;
56*35238bceSAndroid Build Coastguard Worker         delete m_renderCtx;
57*35238bceSAndroid Build Coastguard Worker 
58*35238bceSAndroid Build Coastguard Worker         throw;
59*35238bceSAndroid Build Coastguard Worker     }
60*35238bceSAndroid Build Coastguard Worker }
61*35238bceSAndroid Build Coastguard Worker 
~Context(void)62*35238bceSAndroid Build Coastguard Worker Context::~Context(void)
63*35238bceSAndroid Build Coastguard Worker {
64*35238bceSAndroid Build Coastguard Worker     // Remove functions from wrapper.
65*35238bceSAndroid Build Coastguard Worker     glw::setCurrentThreadFunctions(DE_NULL);
66*35238bceSAndroid Build Coastguard Worker 
67*35238bceSAndroid Build Coastguard Worker     delete m_contextInfo;
68*35238bceSAndroid Build Coastguard Worker     delete m_renderCtx;
69*35238bceSAndroid Build Coastguard Worker }
70*35238bceSAndroid Build Coastguard Worker 
getRenderTarget(void) const71*35238bceSAndroid Build Coastguard Worker const tcu::RenderTarget &Context::getRenderTarget(void) const
72*35238bceSAndroid Build Coastguard Worker {
73*35238bceSAndroid Build Coastguard Worker     return m_renderCtx->getRenderTarget();
74*35238bceSAndroid Build Coastguard Worker }
75*35238bceSAndroid Build Coastguard Worker 
76*35238bceSAndroid Build Coastguard Worker } // namespace gles3
77*35238bceSAndroid Build Coastguard Worker } // namespace deqp
78