michael@0: // michael@0: // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: // michael@0: michael@0: // Display.h: Defines the egl::Display class, representing the abstract michael@0: // display on which graphics are drawn. Implements EGLDisplay. michael@0: // [EGL 1.4] section 2.1.2 page 3. michael@0: michael@0: #ifndef LIBEGL_DISPLAY_H_ michael@0: #define LIBEGL_DISPLAY_H_ michael@0: michael@0: #include "common/system.h" michael@0: michael@0: #include michael@0: #include michael@0: michael@0: #include "libEGL/Config.h" michael@0: michael@0: namespace gl michael@0: { michael@0: class Context; michael@0: } michael@0: michael@0: namespace egl michael@0: { michael@0: class Surface; michael@0: michael@0: class Display michael@0: { michael@0: public: michael@0: ~Display(); michael@0: michael@0: bool initialize(); michael@0: void terminate(); michael@0: michael@0: static egl::Display *getDisplay(EGLNativeDisplayType displayId); michael@0: michael@0: bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig); michael@0: bool getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value); michael@0: michael@0: EGLSurface createWindowSurface(HWND window, EGLConfig config, const EGLint *attribList); michael@0: EGLSurface createOffscreenSurface(EGLConfig config, HANDLE shareHandle, const EGLint *attribList); michael@0: EGLContext createContext(EGLConfig configHandle, const gl::Context *shareContext, bool notifyResets, bool robustAccess); michael@0: michael@0: void destroySurface(egl::Surface *surface); michael@0: void destroyContext(gl::Context *context); michael@0: michael@0: bool isInitialized() const; michael@0: bool isValidConfig(EGLConfig config); michael@0: bool isValidContext(gl::Context *context); michael@0: bool isValidSurface(egl::Surface *surface); michael@0: bool hasExistingWindowSurface(HWND window); michael@0: michael@0: rx::Renderer *getRenderer() { return mRenderer; }; michael@0: michael@0: // exported methods must be virtual michael@0: virtual void notifyDeviceLost(); michael@0: virtual void recreateSwapChains(); michael@0: michael@0: const char *getExtensionString() const; michael@0: const char *getVendorString() const; michael@0: michael@0: private: michael@0: DISALLOW_COPY_AND_ASSIGN(Display); michael@0: michael@0: Display(EGLNativeDisplayType displayId, HDC deviceContext); michael@0: michael@0: bool restoreLostDevice(); michael@0: michael@0: EGLNativeDisplayType mDisplayId; michael@0: const HDC mDc; michael@0: michael@0: bool mSoftwareDevice; michael@0: michael@0: typedef std::set SurfaceSet; michael@0: SurfaceSet mSurfaceSet; michael@0: michael@0: ConfigSet mConfigSet; michael@0: michael@0: typedef std::set ContextSet; michael@0: ContextSet mContextSet; michael@0: michael@0: rx::Renderer *mRenderer; michael@0: michael@0: void initExtensionString(); michael@0: void initVendorString(); michael@0: std::string mExtensionString; michael@0: std::string mVendorString; michael@0: }; michael@0: } michael@0: michael@0: #endif // LIBEGL_DISPLAY_H_