1*35238bceSAndroid Build Coastguard Worker /*------------------------------------------------------------------------- 2*35238bceSAndroid Build Coastguard Worker * drawElements Quality Program OpenGL ES 2.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 2.0 test context. 22*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/ 23*35238bceSAndroid Build Coastguard Worker 24*35238bceSAndroid Build Coastguard Worker #include "tes2Context.hpp" 25*35238bceSAndroid Build Coastguard Worker #include "gluContextFactory.hpp" 26*35238bceSAndroid Build Coastguard Worker #include "gluRenderContext.hpp" 27*35238bceSAndroid Build Coastguard Worker #include "gluRenderConfig.hpp" 28*35238bceSAndroid Build Coastguard Worker #include "gluFboRenderContext.hpp" 29*35238bceSAndroid Build Coastguard Worker #include "gluContextInfo.hpp" 30*35238bceSAndroid Build Coastguard Worker #include "tcuCommandLine.hpp" 31*35238bceSAndroid Build Coastguard Worker #include "glwWrapper.hpp" 32*35238bceSAndroid Build Coastguard Worker 33*35238bceSAndroid Build Coastguard Worker #include "gluDefs.hpp" 34*35238bceSAndroid Build Coastguard Worker 35*35238bceSAndroid Build Coastguard Worker namespace deqp 36*35238bceSAndroid Build Coastguard Worker { 37*35238bceSAndroid Build Coastguard Worker namespace gles2 38*35238bceSAndroid Build Coastguard Worker { 39*35238bceSAndroid Build Coastguard Worker Context(tcu::TestContext & testCtx)40*35238bceSAndroid Build Coastguard WorkerContext::Context(tcu::TestContext &testCtx) : m_testCtx(testCtx), m_renderCtx(DE_NULL), m_contextInfo(DE_NULL) 41*35238bceSAndroid Build Coastguard Worker { 42*35238bceSAndroid Build Coastguard Worker try 43*35238bceSAndroid Build Coastguard Worker { 44*35238bceSAndroid Build Coastguard Worker m_renderCtx = glu::createDefaultRenderContext(m_testCtx.getPlatform(), m_testCtx.getCommandLine(), 45*35238bceSAndroid Build Coastguard Worker glu::ApiType::es(2, 0)); 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 WorkerContext::~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 Workerconst 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 gles2 77*35238bceSAndroid Build Coastguard Worker } // namespace deqp 78