1 /*------------------------------------------------------------------------- 2 * drawElements Quality Program Tester Core 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 X11 Platform. 22 *//*--------------------------------------------------------------------*/ 23 24 #include "tcuX11Platform.hpp" 25 26 #include "deUniquePtr.hpp" 27 #include "gluPlatform.hpp" 28 #include "tcuX11.hpp" 29 30 #if defined (DEQP_SUPPORT_GLX) 31 # include "tcuX11GlxPlatform.hpp" 32 #endif 33 #if defined (DEQP_SUPPORT_EGL) 34 # include "tcuX11EglPlatform.hpp" 35 #endif 36 37 38 namespace tcu 39 { 40 namespace x11 41 { 42 43 class X11GLPlatform : public glu::Platform 44 { 45 public: registerFactory(de::MovePtr<glu::ContextFactory> factory)46 void registerFactory (de::MovePtr<glu::ContextFactory> factory) 47 { 48 m_contextFactoryRegistry.registerFactory(factory.release()); 49 } 50 }; 51 52 class X11Platform : public tcu::Platform 53 { 54 public: 55 X11Platform (void); processEvents(void)56 bool processEvents (void) { return !m_eventState.getQuitFlag(); } getGLPlatform(void) const57 const glu::Platform& getGLPlatform (void) const { return m_glPlatform; } 58 59 #if defined (DEQP_SUPPORT_EGL) getEGLPlatform(void) const60 const eglu::Platform& getEGLPlatform (void) const { return m_eglPlatform; } 61 #endif // DEQP_SUPPORT_EGL 62 63 private: 64 EventState m_eventState; 65 #if defined (DEQP_SUPPORT_EGL) 66 x11::egl::Platform m_eglPlatform; 67 #endif // DEQP_SPPORT_EGL 68 X11GLPlatform m_glPlatform; 69 }; 70 X11Platform(void)71X11Platform::X11Platform (void) 72 #if defined (DEQP_SUPPORT_EGL) 73 : m_eglPlatform (m_eventState) 74 #endif // DEQP_SUPPORT_EGL 75 { 76 #if defined (DEQP_SUPPORT_GLX) 77 m_glPlatform.registerFactory(glx::createContextFactory(m_eventState)); 78 #endif // DEQP_SUPPORT_GLX 79 #if defined (DEQP_SUPPORT_EGL) 80 m_glPlatform.registerFactory(m_eglPlatform.createContextFactory()); 81 #endif // DEQP_SUPPORT_EGL 82 } 83 84 } // x11 85 } // tcu 86 createPlatform(void)87tcu::Platform* createPlatform (void) 88 { 89 return new tcu::x11::X11Platform(); 90 } 91