1*35238bceSAndroid Build Coastguard Worker #ifndef _GLUFBORENDERCONTEXT_HPP 2*35238bceSAndroid Build Coastguard Worker #define _GLUFBORENDERCONTEXT_HPP 3*35238bceSAndroid Build Coastguard Worker /*------------------------------------------------------------------------- 4*35238bceSAndroid Build Coastguard Worker * drawElements Quality Program OpenGL ES Utilities 5*35238bceSAndroid Build Coastguard Worker * ------------------------------------------------ 6*35238bceSAndroid Build Coastguard Worker * 7*35238bceSAndroid Build Coastguard Worker * Copyright 2014 The Android Open Source Project 8*35238bceSAndroid Build Coastguard Worker * 9*35238bceSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 10*35238bceSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 11*35238bceSAndroid Build Coastguard Worker * You may obtain a copy of the License at 12*35238bceSAndroid Build Coastguard Worker * 13*35238bceSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 14*35238bceSAndroid Build Coastguard Worker * 15*35238bceSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 16*35238bceSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 17*35238bceSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18*35238bceSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 19*35238bceSAndroid Build Coastguard Worker * limitations under the License. 20*35238bceSAndroid Build Coastguard Worker * 21*35238bceSAndroid Build Coastguard Worker *//*! 22*35238bceSAndroid Build Coastguard Worker * \file 23*35238bceSAndroid Build Coastguard Worker * \brief OpenGL ES context wrapper that uses FBO as default framebuffer. 24*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/ 25*35238bceSAndroid Build Coastguard Worker 26*35238bceSAndroid Build Coastguard Worker #include "tcuDefs.hpp" 27*35238bceSAndroid Build Coastguard Worker #include "gluRenderContext.hpp" 28*35238bceSAndroid Build Coastguard Worker #include "tcuRenderTarget.hpp" 29*35238bceSAndroid Build Coastguard Worker 30*35238bceSAndroid Build Coastguard Worker namespace tcu 31*35238bceSAndroid Build Coastguard Worker { 32*35238bceSAndroid Build Coastguard Worker class CommandLine; 33*35238bceSAndroid Build Coastguard Worker } 34*35238bceSAndroid Build Coastguard Worker 35*35238bceSAndroid Build Coastguard Worker namespace glu 36*35238bceSAndroid Build Coastguard Worker { 37*35238bceSAndroid Build Coastguard Worker 38*35238bceSAndroid Build Coastguard Worker class ContextFactory; 39*35238bceSAndroid Build Coastguard Worker struct RenderConfig; 40*35238bceSAndroid Build Coastguard Worker 41*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*! 42*35238bceSAndroid Build Coastguard Worker * \brief OpenGL ES context wrapper that uses FBO as default framebuffer. 43*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/ 44*35238bceSAndroid Build Coastguard Worker class FboRenderContext : public RenderContext 45*35238bceSAndroid Build Coastguard Worker { 46*35238bceSAndroid Build Coastguard Worker public: 47*35238bceSAndroid Build Coastguard Worker FboRenderContext(RenderContext *context, const RenderConfig &config); 48*35238bceSAndroid Build Coastguard Worker FboRenderContext(const ContextFactory &factory, const RenderConfig &config, const tcu::CommandLine &cmdLine); 49*35238bceSAndroid Build Coastguard Worker virtual ~FboRenderContext(void); 50*35238bceSAndroid Build Coastguard Worker getType(void) const51*35238bceSAndroid Build Coastguard Worker virtual ContextType getType(void) const 52*35238bceSAndroid Build Coastguard Worker { 53*35238bceSAndroid Build Coastguard Worker return m_context->getType(); 54*35238bceSAndroid Build Coastguard Worker } getFunctions(void) const55*35238bceSAndroid Build Coastguard Worker virtual const glw::Functions &getFunctions(void) const 56*35238bceSAndroid Build Coastguard Worker { 57*35238bceSAndroid Build Coastguard Worker return m_context->getFunctions(); 58*35238bceSAndroid Build Coastguard Worker } getRenderTarget(void) const59*35238bceSAndroid Build Coastguard Worker virtual const tcu::RenderTarget &getRenderTarget(void) const 60*35238bceSAndroid Build Coastguard Worker { 61*35238bceSAndroid Build Coastguard Worker return m_renderTarget; 62*35238bceSAndroid Build Coastguard Worker } 63*35238bceSAndroid Build Coastguard Worker virtual void postIterate(void); 64*35238bceSAndroid Build Coastguard Worker getDefaultFramebuffer(void) const65*35238bceSAndroid Build Coastguard Worker virtual uint32_t getDefaultFramebuffer(void) const 66*35238bceSAndroid Build Coastguard Worker { 67*35238bceSAndroid Build Coastguard Worker return m_framebuffer; 68*35238bceSAndroid Build Coastguard Worker } getProcAddress(const char * name) const69*35238bceSAndroid Build Coastguard Worker virtual glw::GenericFuncType getProcAddress(const char *name) const 70*35238bceSAndroid Build Coastguard Worker { 71*35238bceSAndroid Build Coastguard Worker return m_context->getProcAddress(name); 72*35238bceSAndroid Build Coastguard Worker } 73*35238bceSAndroid Build Coastguard Worker 74*35238bceSAndroid Build Coastguard Worker virtual void makeCurrent(void); 75*35238bceSAndroid Build Coastguard Worker 76*35238bceSAndroid Build Coastguard Worker private: 77*35238bceSAndroid Build Coastguard Worker void createFramebuffer(const RenderConfig &config); 78*35238bceSAndroid Build Coastguard Worker void destroyFramebuffer(void); 79*35238bceSAndroid Build Coastguard Worker 80*35238bceSAndroid Build Coastguard Worker RenderContext *m_context; 81*35238bceSAndroid Build Coastguard Worker uint32_t m_framebuffer; 82*35238bceSAndroid Build Coastguard Worker uint32_t m_colorBuffer; 83*35238bceSAndroid Build Coastguard Worker uint32_t m_depthStencilBuffer; 84*35238bceSAndroid Build Coastguard Worker tcu::RenderTarget m_renderTarget; 85*35238bceSAndroid Build Coastguard Worker }; 86*35238bceSAndroid Build Coastguard Worker 87*35238bceSAndroid Build Coastguard Worker // RenderConfig to format mapping utilities, useful for platforms like iOS. 88*35238bceSAndroid Build Coastguard Worker uint32_t chooseColorFormat(const RenderConfig &config); 89*35238bceSAndroid Build Coastguard Worker uint32_t chooseDepthStencilFormat(const RenderConfig &config); 90*35238bceSAndroid Build Coastguard Worker 91*35238bceSAndroid Build Coastguard Worker } // namespace glu 92*35238bceSAndroid Build Coastguard Worker 93*35238bceSAndroid Build Coastguard Worker #endif // _GLUFBORENDERCONTEXT_HPP 94