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.
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.
11 #ifndef LIBEGL_DISPLAY_H_
12 #define LIBEGL_DISPLAY_H_
17 #include "libEGL/Config.h"
36 static egl::Display *getDisplay(EGLNativeDisplayType displayId, EGLint displayType);
38 static const char *getExtensionString(egl::Display *display);
40 static bool supportsPlatformD3D();
41 static bool supportsPlatformOpenGL();
43 bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig);
44 bool getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value);
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);
50 void destroySurface(egl::Surface *surface);
51 void destroyContext(gl::Context *context);
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);
59 rx::Renderer *getRenderer() { return mRenderer; };
61 // exported methods must be virtual
62 virtual void notifyDeviceLost();
63 virtual void recreateSwapChains();
65 const char *getExtensionString() const;
66 const char *getVendorString() const;
69 DISALLOW_COPY_AND_ASSIGN(Display);
71 Display(EGLNativeDisplayType displayId, EGLint displayType);
73 bool restoreLostDevice();
75 EGLNativeDisplayType mDisplayId;
76 EGLint mRequestedDisplayType;
78 typedef std::set<Surface*> SurfaceSet;
79 SurfaceSet mSurfaceSet;
83 typedef std::set<gl::Context*> ContextSet;
84 ContextSet mContextSet;
86 rx::Renderer *mRenderer;
88 static std::string generateClientExtensionString();
90 void initDisplayExtensionString();
91 std::string mDisplayExtensionString;
93 void initVendorString();
94 std::string mVendorString;
98 #endif // LIBEGL_DISPLAY_H_