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