summaryrefslogtreecommitdiffstats
path: root/gfx/gl/GLContextProvider.h
blob: 12d1a497b960f5c971c58de6279b66874d750e60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef GLCONTEXTPROVIDER_H_
#define GLCONTEXTPROVIDER_H_

#include "mozilla/AlreadyAddRefed.h"

#include "GLContextTypes.h"
#include "SurfaceTypes.h"

#include "nsSize.h"  // for gfx::IntSize (needed by GLContextProviderImpl.h below)
#include "nsStringFwd.h"  // needed by GLContextProviderImpl.h below

class nsIWidget;

namespace mozilla {
namespace widget {
class CompositorWidget;
}
namespace gl {

#define IN_GL_CONTEXT_PROVIDER_H

// Null is always there
#define GL_CONTEXT_PROVIDER_NAME GLContextProviderNull
#include "GLContextProviderImpl.h"
#undef GL_CONTEXT_PROVIDER_NAME

#ifdef XP_WIN
#  define GL_CONTEXT_PROVIDER_NAME GLContextProviderWGL
#  include "GLContextProviderImpl.h"
#  undef GL_CONTEXT_PROVIDER_NAME
#  define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderWGL
#  define DEFAULT_IMPL WGL
#endif

#ifdef XP_MACOSX
#  define GL_CONTEXT_PROVIDER_NAME GLContextProviderCGL
#  include "GLContextProviderImpl.h"
#  undef GL_CONTEXT_PROVIDER_NAME
#  define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderCGL
#endif

#define GL_CONTEXT_PROVIDER_NAME GLContextProviderEGL
#include "GLContextProviderImpl.h"
#undef GL_CONTEXT_PROVIDER_NAME

#if defined(MOZ_X11)
#  define GL_CONTEXT_PROVIDER_NAME GLContextProviderGLX
#  include "GLContextProviderImpl.h"
#  undef GL_CONTEXT_PROVIDER_NAME
#  define GL_CONTEXT_PROVIDER_NAME GLContextProviderX11
#  include "GLContextProviderImpl.h"
#  undef GL_CONTEXT_PROVIDER_NAME
#  if defined(MOZ_WAYLAND)
#    define GL_CONTEXT_PROVIDER_NAME GLContextProviderWayland
#    include "GLContextProviderImpl.h"
#    undef GL_CONTEXT_PROVIDER_NAME
#    define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderWayland
#  endif
#  ifndef GL_CONTEXT_PROVIDER_DEFAULT
#    define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderX11
#  endif
#endif

#ifndef GL_CONTEXT_PROVIDER_DEFAULT
#  define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderEGL
#endif

#if defined(MOZ_WIDGET_UIKIT)
#  define GL_CONTEXT_PROVIDER_NAME GLContextProviderEAGL
#  include "GLContextProviderImpl.h"
#  undef GL_CONTEXT_PROVIDER_NAME
#  ifndef GL_CONTEXT_PROVIDER_DEFAULT
#    define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderEAGL
#  endif
#endif

#ifdef MOZ_GL_PROVIDER
#  define GL_CONTEXT_PROVIDER_NAME MOZ_GL_PROVIDER
#  include "GLContextProviderImpl.h"
#  undef GL_CONTEXT_PROVIDER_NAME
#  define GL_CONTEXT_PROVIDER_DEFAULT MOZ_GL_PROVIDER
#endif

#ifdef GL_CONTEXT_PROVIDER_DEFAULT
typedef GL_CONTEXT_PROVIDER_DEFAULT GLContextProvider;
#else
typedef GLContextProviderNull GLContextProvider;
#endif

#undef IN_GL_CONTEXT_PROVIDER_H

}  // namespace gl
}  // namespace mozilla

#endif