1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef GLCONTEXTPROVIDER_H_ 7 #define GLCONTEXTPROVIDER_H_ 8 9 #include "GLContextTypes.h" 10 #include "SurfaceTypes.h" 11 12 #include "nsSize.h" // for gfx::IntSize (needed by GLContextProviderImpl.h below) 13 14 class nsIWidget; 15 16 namespace mozilla { 17 namespace widget { 18 class CompositorWidget; 19 } 20 namespace gl { 21 22 #define IN_GL_CONTEXT_PROVIDER_H 23 24 // Null is always there 25 #define GL_CONTEXT_PROVIDER_NAME GLContextProviderNull 26 #include "GLContextProviderImpl.h" 27 #undef GL_CONTEXT_PROVIDER_NAME 28 29 #ifdef XP_WIN 30 # define GL_CONTEXT_PROVIDER_NAME GLContextProviderWGL 31 # include "GLContextProviderImpl.h" 32 # undef GL_CONTEXT_PROVIDER_NAME 33 # define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderWGL 34 # define DEFAULT_IMPL WGL 35 #endif 36 37 #ifdef XP_MACOSX 38 # define GL_CONTEXT_PROVIDER_NAME GLContextProviderCGL 39 # include "GLContextProviderImpl.h" 40 # undef GL_CONTEXT_PROVIDER_NAME 41 # define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderCGL 42 #endif 43 44 #if defined(MOZ_X11) 45 # define GL_CONTEXT_PROVIDER_NAME GLContextProviderGLX 46 # include "GLContextProviderImpl.h" 47 # undef GL_CONTEXT_PROVIDER_NAME 48 # define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderGLX 49 #endif 50 51 #define GL_CONTEXT_PROVIDER_NAME GLContextProviderEGL 52 #include "GLContextProviderImpl.h" 53 #undef GL_CONTEXT_PROVIDER_NAME 54 #ifndef GL_CONTEXT_PROVIDER_DEFAULT 55 # define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderEGL 56 #endif 57 58 #if defined(MOZ_WAYLAND) 59 # define GL_CONTEXT_PROVIDER_NAME GLContextProviderWayland 60 # include "GLContextProviderImpl.h" 61 # undef GL_CONTEXT_PROVIDER_NAME 62 # undef GL_CONTEXT_PROVIDER_DEFAULT 63 # define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderWayland 64 #endif 65 66 #if defined(MOZ_WIDGET_UIKIT) 67 # define GL_CONTEXT_PROVIDER_NAME GLContextProviderEAGL 68 # include "GLContextProviderImpl.h" 69 # undef GL_CONTEXT_PROVIDER_NAME 70 # ifndef GL_CONTEXT_PROVIDER_DEFAULT 71 # define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderEAGL 72 # endif 73 #endif 74 75 #ifdef MOZ_GL_PROVIDER 76 # define GL_CONTEXT_PROVIDER_NAME MOZ_GL_PROVIDER 77 # include "GLContextProviderImpl.h" 78 # undef GL_CONTEXT_PROVIDER_NAME 79 # define GL_CONTEXT_PROVIDER_DEFAULT MOZ_GL_PROVIDER 80 #endif 81 82 #ifdef GL_CONTEXT_PROVIDER_DEFAULT 83 typedef GL_CONTEXT_PROVIDER_DEFAULT GLContextProvider; 84 #else 85 typedef GLContextProviderNull GLContextProvider; 86 #endif 87 88 #undef IN_GL_CONTEXT_PROVIDER_H 89 90 } // namespace gl 91 } // namespace mozilla 92 93 #endif 94