1/*------------------------------------------------------------------------- 2 * OpenGL Conformance Test Suite 3 * ----------------------------- 4 * 5 * Copyright (c) 2016 Google Inc. 6 * Copyright (c) 2016 The Khronos Group Inc. 7 * 8 * Licensed under the Apache License, Version 2.0 (the "License"); 9 * you may not use this file except in compliance with the License. 10 * You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 * 20 *//*! 21 * \file 22 * \brief 23 *//*--------------------------------------------------------------------*/ 24 25#include "tcuNullWSPlatform.hpp" 26#include "eglwEnums.hpp" 27#include "eglwLibrary.hpp" 28#include "egluGLContextFactory.hpp" 29 30namespace tcu 31{ 32namespace nullws 33{ 34 35class Window: public eglu::NativeWindow 36{ 37public: 38 static const Capability CAPABILITIES = CAPABILITY_CREATE_SURFACE_LEGACY; 39 40 Window(eglu::NativeDisplay* nativeDisplay, const eglu::WindowParams& params) 41 : NativeWindow(CAPABILITIES) 42 { 43 } 44 45 eglw::EGLNativeWindowType getLegacyNative () 46 { 47 return DE_NULL; 48 } 49}; 50 51class WindowFactory: public eglu::NativeWindowFactory 52{ 53public: 54 WindowFactory() 55 : NativeWindowFactory("nullws", "NullWS Window", Window::CAPABILITIES) 56 { 57 } 58 59 eglu::NativeWindow* createWindow(eglu::NativeDisplay* nativeDisplay, const eglu::WindowParams& params) const 60 { 61 return new Window(nativeDisplay, params); 62 } 63}; 64 65class Pixmap: public eglu::NativePixmap 66{ 67public: 68 static const Capability CAPABILITIES = CAPABILITY_CREATE_SURFACE_LEGACY; 69 70 Pixmap() 71 : NativePixmap(CAPABILITIES) 72 { 73 } 74 75 eglw::EGLNativePixmapType getLegacyNative () 76 { 77 return DE_NULL; 78 } 79}; 80 81class PixmapFactory: public eglu::NativePixmapFactory 82{ 83public: 84 PixmapFactory() 85 : NativePixmapFactory("nullws", "NullWS Pixmap", Pixmap::CAPABILITIES) 86 { 87 } 88 89 eglu::NativePixmap* createPixmap (eglu::NativeDisplay*, int, int) const 90 { 91 return new Pixmap(); 92 } 93}; 94 95class Display: public eglu::NativeDisplay 96{ 97public: 98 static const Capability CAPABILITIES = CAPABILITY_GET_DISPLAY_LEGACY; 99 100 Display() 101 : eglu::NativeDisplay(CAPABILITIES) 102 { 103 } 104 105 eglw::EGLNativeDisplayType getLegacyNative() 106 { 107 return EGL_DEFAULT_DISPLAY; 108 } 109 110 const eglw::Library& getLibrary() const 111 { 112 return m_library; 113 } 114 115private: 116 eglw::DefaultLibrary m_library; 117}; 118 119 120class DisplayFactory: public eglu::NativeDisplayFactory 121{ 122public: 123 DisplayFactory() 124 : eglu::NativeDisplayFactory ("nullws", "NullWS Display", Display::CAPABILITIES) 125 { 126 m_nativeWindowRegistry.registerFactory(new WindowFactory()); 127 m_nativePixmapRegistry.registerFactory(new PixmapFactory()); 128 } 129 130 eglu::NativeDisplay* createDisplay (const eglw::EGLAttrib* attribList = DE_NULL) const 131 { 132 return new Display(); 133 } 134}; 135 136Platform::Platform () 137{ 138 m_nativeDisplayFactoryRegistry.registerFactory(new DisplayFactory()); 139 m_contextFactoryRegistry.registerFactory(new eglu::GLContextFactory(m_nativeDisplayFactoryRegistry)); 140} 141 142Platform::~Platform () 143{ 144} 145 146} // nullws 147} // tcu 148 149tcu::Platform* createPlatform () 150{ 151 return new tcu::nullws::Platform(); 152} 153