13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _TCUIOSPLATFORM_HPP 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _TCUIOSPLATFORM_HPP 33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*------------------------------------------------------------------------- 43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program Tester Core 53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ---------------------------------------- 63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project 83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License"); 103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License. 113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at 123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * http://www.apache.org/licenses/LICENSE-2.0 143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software 163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS, 173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and 193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License. 203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*! 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief iOS Platform implementation. 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuDefs.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuPlatform.hpp" 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluPlatform.hpp" 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluRenderContext.hpp" 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluContextFactory.hpp" 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluObjectWrapper.hpp" 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuRenderTarget.hpp" 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwFunctions.hpp" 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deMutex.hpp" 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#import "tcuEAGLView.h" 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#import <OpenGLES/EAGL.h> 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace tcu 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace ios 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ScreenManager 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ScreenManager (tcuEAGLView* view); 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~ScreenManager (void); 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry CAEAGLLayer* acquireScreen (void); 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void releaseScreen (CAEAGLLayer* layer); 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ScreenManager (const ScreenManager&); 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ScreenManager& operator= (const ScreenManager&); 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcuEAGLView* m_view; 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry de::Mutex m_viewLock; 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ContextFactory : public glu::ContextFactory 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ContextFactory (ScreenManager* screenManager); 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~ContextFactory (void); 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::RenderContext* createContext (const glu::RenderConfig& config, const tcu::CommandLine& cmdLine) const; 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ScreenManager* const m_screenManager; 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Platform : public tcu::Platform, private glu::Platform 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Platform (ScreenManager* screenManager); 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual ~Platform (void); 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glu::Platform& getGLPlatform (void) const { return static_cast<const glu::Platform&>(*this); } 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry//! EAGLContext-backed rendering context. Doesn't have default framebuffer. 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass RawContext : public glu::RenderContext 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry RawContext (glu::ContextType type); 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual ~RawContext (void); 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual glu::ContextType getType (void) const { return m_type; } 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual const glw::Functions& getFunctions (void) const { return m_functions; } 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual const RenderTarget& getRenderTarget (void) const { return m_emptyTarget; } 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual deUint32 getDefaultFramebuffer (void) const { DE_ASSERT(!"No framebuffer"); return 0; } 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void postIterate (void); 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected: 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EAGLContext* getEAGLContext (void) const { return m_context; } 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::ContextType m_type; 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EAGLContext* m_context; 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glw::Functions m_functions; 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::RenderTarget m_emptyTarget; 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ScreenContext : public RawContext 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ScreenContext (ScreenManager* screenManager, const glu::RenderConfig& config); 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~ScreenContext (void); 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual const RenderTarget& getRenderTarget (void) const { return m_renderTarget; } 1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual deUint32 getDefaultFramebuffer (void) const { return *m_framebuffer; } 1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void postIterate (void); 1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void createFramebuffer (const glu::RenderConfig& config); 1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ScreenManager* m_screenManager; 1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry CAEAGLLayer* m_layer; 1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::Framebuffer m_framebuffer; 1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::Renderbuffer m_colorBuffer; 1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::Renderbuffer m_depthStencilBuffer; 1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::RenderTarget m_renderTarget; 1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // ios 1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // tcu 1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif // _TCUIOSPLATFORM_H 132