|
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 "common/system.h" |
|
15 |
|
16 #include <set> |
|
17 #include <vector> |
|
18 |
|
19 #include "libEGL/Config.h" |
|
20 |
|
21 namespace gl |
|
22 { |
|
23 class Context; |
|
24 } |
|
25 |
|
26 namespace egl |
|
27 { |
|
28 class Surface; |
|
29 |
|
30 class Display |
|
31 { |
|
32 public: |
|
33 ~Display(); |
|
34 |
|
35 bool initialize(); |
|
36 void terminate(); |
|
37 |
|
38 static egl::Display *getDisplay(EGLNativeDisplayType displayId); |
|
39 |
|
40 bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig); |
|
41 bool getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value); |
|
42 |
|
43 EGLSurface createWindowSurface(HWND window, EGLConfig config, const EGLint *attribList); |
|
44 EGLSurface createOffscreenSurface(EGLConfig config, HANDLE shareHandle, const EGLint *attribList); |
|
45 EGLContext createContext(EGLConfig configHandle, const gl::Context *shareContext, bool notifyResets, bool robustAccess); |
|
46 |
|
47 void destroySurface(egl::Surface *surface); |
|
48 void destroyContext(gl::Context *context); |
|
49 |
|
50 bool isInitialized() const; |
|
51 bool isValidConfig(EGLConfig config); |
|
52 bool isValidContext(gl::Context *context); |
|
53 bool isValidSurface(egl::Surface *surface); |
|
54 bool hasExistingWindowSurface(HWND window); |
|
55 |
|
56 rx::Renderer *getRenderer() { return mRenderer; }; |
|
57 |
|
58 // exported methods must be virtual |
|
59 virtual void notifyDeviceLost(); |
|
60 virtual void recreateSwapChains(); |
|
61 |
|
62 const char *getExtensionString() const; |
|
63 const char *getVendorString() const; |
|
64 |
|
65 private: |
|
66 DISALLOW_COPY_AND_ASSIGN(Display); |
|
67 |
|
68 Display(EGLNativeDisplayType displayId, HDC deviceContext); |
|
69 |
|
70 bool restoreLostDevice(); |
|
71 |
|
72 EGLNativeDisplayType mDisplayId; |
|
73 const HDC mDc; |
|
74 |
|
75 bool mSoftwareDevice; |
|
76 |
|
77 typedef std::set<Surface*> SurfaceSet; |
|
78 SurfaceSet mSurfaceSet; |
|
79 |
|
80 ConfigSet mConfigSet; |
|
81 |
|
82 typedef std::set<gl::Context*> ContextSet; |
|
83 ContextSet mContextSet; |
|
84 |
|
85 rx::Renderer *mRenderer; |
|
86 |
|
87 void initExtensionString(); |
|
88 void initVendorString(); |
|
89 std::string mExtensionString; |
|
90 std::string mVendorString; |
|
91 }; |
|
92 } |
|
93 |
|
94 #endif // LIBEGL_DISPLAY_H_ |