Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / angle / src / libEGL / Display.h
1 //
2 // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6
7 // Display.h: Defines the egl::Display class, representing the abstract
8 // display on which graphics are drawn. Implements EGLDisplay.
9 // [EGL 1.4] section 2.1.2 page 3.
10
11 #ifndef LIBEGL_DISPLAY_H_
12 #define LIBEGL_DISPLAY_H_
13
14 #include <set>
15 #include <vector>
16
17 #include "libEGL/Config.h"
18
19 namespace gl
20 {
21 class Context;
22 }
23
24 namespace egl
25 {
26 class Surface;
27
28 class Display
29 {
30   public:
31     ~Display();
32
33     bool initialize();
34     void terminate();
35
36     static egl::Display *getDisplay(EGLNativeDisplayType displayId, EGLint displayType);
37
38     static const char *getExtensionString(egl::Display *display);
39
40     static bool supportsPlatformD3D();
41     static bool supportsPlatformOpenGL();
42
43     bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig);
44     bool getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value);
45
46     EGLSurface createWindowSurface(HWND window, EGLConfig config, const EGLint *attribList);
47     EGLSurface createOffscreenSurface(EGLConfig config, HANDLE shareHandle, const EGLint *attribList);
48     EGLContext createContext(EGLConfig configHandle, EGLint clientVersion, const gl::Context *shareContext, bool notifyResets, bool robustAccess);
49
50     void destroySurface(egl::Surface *surface);
51     void destroyContext(gl::Context *context);
52
53     bool isInitialized() const;
54     bool isValidConfig(EGLConfig config);
55     bool isValidContext(gl::Context *context);
56     bool isValidSurface(egl::Surface *surface);
57     bool hasExistingWindowSurface(HWND window);
58
59     rx::Renderer *getRenderer() { return mRenderer; };
60
61     // exported methods must be virtual
62     virtual void notifyDeviceLost();
63     virtual void recreateSwapChains();
64
65     const char *getExtensionString() const;
66     const char *getVendorString() const;
67
68   private:
69     DISALLOW_COPY_AND_ASSIGN(Display);
70
71     Display(EGLNativeDisplayType displayId, EGLint displayType);
72
73     bool restoreLostDevice();
74
75     EGLNativeDisplayType mDisplayId;
76     EGLint mRequestedDisplayType;
77
78     typedef std::set<Surface*> SurfaceSet;
79     SurfaceSet mSurfaceSet;
80
81     ConfigSet mConfigSet;
82
83     typedef std::set<gl::Context*> ContextSet;
84     ContextSet mContextSet;
85
86     rx::Renderer *mRenderer;
87
88     static std::string generateClientExtensionString();
89
90     void initDisplayExtensionString();
91     std::string mDisplayExtensionString;
92
93     void initVendorString();
94     std::string mVendorString;
95 };
96 }
97
98 #endif   // LIBEGL_DISPLAY_H_