daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1 | // |
shannonwoods@chromium.org | eff3a12 | 2013-05-30 00:10:04 +0000 | [diff] [blame] | 2 | // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 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 | |
apatrick@chromium.org | 3cfd722 | 2012-07-13 22:36:58 +0000 | [diff] [blame] | 11 | #ifndef LIBEGL_DISPLAY_H_ |
| 12 | #define LIBEGL_DISPLAY_H_ |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 13 | |
daniel@transgaming.com | e684229 | 2010-04-20 18:52:50 +0000 | [diff] [blame] | 14 | #include <set> |
apatrick@chromium.org | f289ee8 | 2012-01-11 20:03:29 +0000 | [diff] [blame] | 15 | #include <vector> |
daniel@transgaming.com | e684229 | 2010-04-20 18:52:50 +0000 | [diff] [blame] | 16 | |
daniel@transgaming.com | e684229 | 2010-04-20 18:52:50 +0000 | [diff] [blame] | 17 | #include "libEGL/Config.h" |
shannon.woods@transgaming.com | 486d9e9 | 2013-02-28 23:15:41 +0000 | [diff] [blame] | 18 | |
| 19 | namespace gl |
| 20 | { |
| 21 | class Context; |
| 22 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 23 | |
| 24 | namespace egl |
| 25 | { |
shannon.woods@transgaming.com | 486d9e9 | 2013-02-28 23:15:41 +0000 | [diff] [blame] | 26 | class Surface; |
| 27 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 28 | class Display |
| 29 | { |
| 30 | public: |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 31 | ~Display(); |
| 32 | |
| 33 | bool initialize(); |
| 34 | void terminate(); |
| 35 | |
Geoff Lang | 591e6af | 2014-06-18 18:08:57 -0400 | [diff] [blame] | 36 | static egl::Display *getDisplay(EGLNativeDisplayType displayId, EGLint displayType); |
jbauman@chromium.org | 84d7cbc | 2011-07-14 22:53:19 +0000 | [diff] [blame] | 37 | |
Geoff Lang | 2b5f3b3 | 2014-06-18 18:07:49 -0400 | [diff] [blame] | 38 | static const char *getExtensionString(egl::Display *display); |
| 39 | |
Geoff Lang | 591e6af | 2014-06-18 18:08:57 -0400 | [diff] [blame] | 40 | static bool supportsPlatformD3D(); |
| 41 | static bool supportsPlatformOpenGL(); |
| 42 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 43 | bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig); |
| 44 | bool getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value); |
| 45 | |
jbauman@chromium.org | 06d7a75 | 2011-04-30 01:02:52 +0000 | [diff] [blame] | 46 | EGLSurface createWindowSurface(HWND window, EGLConfig config, const EGLint *attribList); |
jbauman@chromium.org | 4e29770 | 2011-05-12 23:04:07 +0000 | [diff] [blame] | 47 | EGLSurface createOffscreenSurface(EGLConfig config, HANDLE shareHandle, const EGLint *attribList); |
shannon.woods%transgaming.com@gtempaccount.com | daea4b4 | 2013-04-13 03:28:54 +0000 | [diff] [blame] | 48 | EGLContext createContext(EGLConfig configHandle, EGLint clientVersion, const gl::Context *shareContext, bool notifyResets, bool robustAccess); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 49 | |
| 50 | void destroySurface(egl::Surface *surface); |
| 51 | void destroyContext(gl::Context *context); |
| 52 | |
daniel@transgaming.com | 3b1703f | 2011-05-11 15:36:26 +0000 | [diff] [blame] | 53 | bool isInitialized() const; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 54 | bool isValidConfig(EGLConfig config); |
| 55 | bool isValidContext(gl::Context *context); |
| 56 | bool isValidSurface(egl::Surface *surface); |
| 57 | bool hasExistingWindowSurface(HWND window); |
| 58 | |
daniel@transgaming.com | 76d3e6e | 2012-10-31 19:55:33 +0000 | [diff] [blame] | 59 | rx::Renderer *getRenderer() { return mRenderer; }; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 60 | |
shannon.woods%transgaming.com@gtempaccount.com | 8bce3f5 | 2013-04-13 03:35:32 +0000 | [diff] [blame] | 61 | // exported methods must be virtual |
daniel@transgaming.com | 09fcc9f | 2011-11-09 17:46:47 +0000 | [diff] [blame] | 62 | virtual void notifyDeviceLost(); |
shannon.woods%transgaming.com@gtempaccount.com | 8bce3f5 | 2013-04-13 03:35:32 +0000 | [diff] [blame] | 63 | virtual void recreateSwapChains(); |
daniel@transgaming.com | 09fcc9f | 2011-11-09 17:46:47 +0000 | [diff] [blame] | 64 | |
vladimirv@gmail.com | 721b7f2 | 2011-02-11 00:54:47 +0000 | [diff] [blame] | 65 | const char *getExtensionString() const; |
shannonwoods@chromium.org | 6e4f2a6 | 2013-05-30 00:15:19 +0000 | [diff] [blame] | 66 | const char *getVendorString() const; |
vladimirv@gmail.com | 721b7f2 | 2011-02-11 00:54:47 +0000 | [diff] [blame] | 67 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 68 | private: |
| 69 | DISALLOW_COPY_AND_ASSIGN(Display); |
daniel@transgaming.com | d36c6a0 | 2010-08-31 12:15:09 +0000 | [diff] [blame] | 70 | |
Geoff Lang | 591e6af | 2014-06-18 18:08:57 -0400 | [diff] [blame] | 71 | Display(EGLNativeDisplayType displayId, EGLint displayType); |
jbauman@chromium.org | 84d7cbc | 2011-07-14 22:53:19 +0000 | [diff] [blame] | 72 | |
vangelis@google.com | 8c9c452 | 2011-09-09 18:22:28 +0000 | [diff] [blame] | 73 | bool restoreLostDevice(); |
| 74 | |
jbauman@chromium.org | 84d7cbc | 2011-07-14 22:53:19 +0000 | [diff] [blame] | 75 | EGLNativeDisplayType mDisplayId; |
Geoff Lang | 591e6af | 2014-06-18 18:08:57 -0400 | [diff] [blame] | 76 | EGLint mRequestedDisplayType; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 77 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 78 | typedef std::set<Surface*> SurfaceSet; |
| 79 | SurfaceSet mSurfaceSet; |
| 80 | |
| 81 | ConfigSet mConfigSet; |
| 82 | |
| 83 | typedef std::set<gl::Context*> ContextSet; |
| 84 | ContextSet mContextSet; |
daniel@transgaming.com | da6e263 | 2010-07-28 19:21:18 +0000 | [diff] [blame] | 85 | |
daniel@transgaming.com | 76d3e6e | 2012-10-31 19:55:33 +0000 | [diff] [blame] | 86 | rx::Renderer *mRenderer; |
vladimirv@gmail.com | 721b7f2 | 2011-02-11 00:54:47 +0000 | [diff] [blame] | 87 | |
Geoff Lang | 2b5f3b3 | 2014-06-18 18:07:49 -0400 | [diff] [blame] | 88 | static std::string generateClientExtensionString(); |
| 89 | |
| 90 | void initDisplayExtensionString(); |
| 91 | std::string mDisplayExtensionString; |
| 92 | |
shannonwoods@chromium.org | 6e4f2a6 | 2013-05-30 00:15:19 +0000 | [diff] [blame] | 93 | void initVendorString(); |
shannonwoods@chromium.org | 6e4f2a6 | 2013-05-30 00:15:19 +0000 | [diff] [blame] | 94 | std::string mVendorString; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 95 | }; |
| 96 | } |
| 97 | |
apatrick@chromium.org | 3cfd722 | 2012-07-13 22:36:58 +0000 | [diff] [blame] | 98 | #endif // LIBEGL_DISPLAY_H_ |