Home | History | Annotate | Download | only in gles2
      1 /*-------------------------------------------------------------------------
      2  * drawElements Quality Program OpenGL ES 2.0 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 2.0 test context.
     22  *//*--------------------------------------------------------------------*/
     23 
     24 #include "tes2Context.hpp"
     25 #include "gluContextFactory.hpp"
     26 #include "gluRenderContext.hpp"
     27 #include "gluRenderConfig.hpp"
     28 #include "gluFboRenderContext.hpp"
     29 #include "gluContextInfo.hpp"
     30 #include "tcuCommandLine.hpp"
     31 #include "glwWrapper.hpp"
     32 
     33 #include "gluDefs.hpp"
     34 
     35 namespace deqp
     36 {
     37 namespace gles2
     38 {
     39 
     40 Context::Context (tcu::TestContext& testCtx)
     41 	: m_testCtx		(testCtx)
     42 	, m_renderCtx	(DE_NULL)
     43 	, m_contextInfo	(DE_NULL)
     44 {
     45 	try
     46 	{
     47 		m_renderCtx		= glu::createDefaultRenderContext(m_testCtx.getPlatform(), m_testCtx.getCommandLine(), glu::ApiType::es(2,0));
     48 		m_contextInfo	= glu::ContextInfo::create(*m_renderCtx);
     49 
     50 		// Set up function table for transparent wrapper.
     51 		glw::setCurrentThreadFunctions(&m_renderCtx->getFunctions());
     52 	}
     53 	catch (...)
     54 	{
     55 		glw::setCurrentThreadFunctions(DE_NULL);
     56 
     57 		delete m_contextInfo;
     58 		delete m_renderCtx;
     59 
     60 		throw;
     61 	}
     62 }
     63 
     64 Context::~Context (void)
     65 {
     66 	// Remove functions from wrapper.
     67 	glw::setCurrentThreadFunctions(DE_NULL);
     68 
     69 	delete m_contextInfo;
     70 	delete m_renderCtx;
     71 }
     72 
     73 const tcu::RenderTarget& Context::getRenderTarget (void) const
     74 {
     75 	return m_renderCtx->getRenderTarget();
     76 }
     77 
     78 } // gles2
     79 } // deqp
     80