1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program Tester Core
3 * ----------------------------------------
5 * Copyright 2014 The Android Open Source Project
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * \brief X11 Platform.
22 *//*--------------------------------------------------------------------*/
24 #include "tcuX11Platform.hpp"
26 #include "deUniquePtr.hpp"
27 #include "gluPlatform.hpp"
30 #if defined (DEQP_SUPPORT_GLX)
31 # include "tcuX11GlxPlatform.hpp"
33 #if defined (DEQP_SUPPORT_EGL)
34 # include "tcuX11EglPlatform.hpp"
43 class X11GLPlatform : public glu::Platform
46 void registerFactory (de::MovePtr<glu::ContextFactory> factory)
48 m_contextFactoryRegistry.registerFactory(factory.release());
52 class X11Platform : public tcu::Platform
56 bool processEvents (void) { return !m_eventState.getQuitFlag(); }
57 const glu::Platform& getGLPlatform (void) const { return m_glPlatform; }
59 #if defined (DEQP_SUPPORT_EGL)
60 const eglu::Platform& getEGLPlatform (void) const { return m_eglPlatform; }
61 #endif // DEQP_SUPPORT_EGL
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;
71 X11Platform::X11Platform (void)
72 #if defined (DEQP_SUPPORT_EGL)
73 : m_eglPlatform (m_eventState)
74 #endif // DEQP_SUPPORT_EGL
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
87 tcu::Platform* createPlatform (void)
89 return new tcu::x11::X11Platform();