1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/angle/src/libEGL/Display.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,94 @@ 1.4 +// 1.5 +// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. 1.6 +// Use of this source code is governed by a BSD-style license that can be 1.7 +// found in the LICENSE file. 1.8 +// 1.9 + 1.10 +// Display.h: Defines the egl::Display class, representing the abstract 1.11 +// display on which graphics are drawn. Implements EGLDisplay. 1.12 +// [EGL 1.4] section 2.1.2 page 3. 1.13 + 1.14 +#ifndef LIBEGL_DISPLAY_H_ 1.15 +#define LIBEGL_DISPLAY_H_ 1.16 + 1.17 +#include "common/system.h" 1.18 + 1.19 +#include <set> 1.20 +#include <vector> 1.21 + 1.22 +#include "libEGL/Config.h" 1.23 + 1.24 +namespace gl 1.25 +{ 1.26 +class Context; 1.27 +} 1.28 + 1.29 +namespace egl 1.30 +{ 1.31 +class Surface; 1.32 + 1.33 +class Display 1.34 +{ 1.35 + public: 1.36 + ~Display(); 1.37 + 1.38 + bool initialize(); 1.39 + void terminate(); 1.40 + 1.41 + static egl::Display *getDisplay(EGLNativeDisplayType displayId); 1.42 + 1.43 + bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig); 1.44 + bool getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value); 1.45 + 1.46 + EGLSurface createWindowSurface(HWND window, EGLConfig config, const EGLint *attribList); 1.47 + EGLSurface createOffscreenSurface(EGLConfig config, HANDLE shareHandle, const EGLint *attribList); 1.48 + EGLContext createContext(EGLConfig configHandle, const gl::Context *shareContext, bool notifyResets, bool robustAccess); 1.49 + 1.50 + void destroySurface(egl::Surface *surface); 1.51 + void destroyContext(gl::Context *context); 1.52 + 1.53 + bool isInitialized() const; 1.54 + bool isValidConfig(EGLConfig config); 1.55 + bool isValidContext(gl::Context *context); 1.56 + bool isValidSurface(egl::Surface *surface); 1.57 + bool hasExistingWindowSurface(HWND window); 1.58 + 1.59 + rx::Renderer *getRenderer() { return mRenderer; }; 1.60 + 1.61 + // exported methods must be virtual 1.62 + virtual void notifyDeviceLost(); 1.63 + virtual void recreateSwapChains(); 1.64 + 1.65 + const char *getExtensionString() const; 1.66 + const char *getVendorString() const; 1.67 + 1.68 + private: 1.69 + DISALLOW_COPY_AND_ASSIGN(Display); 1.70 + 1.71 + Display(EGLNativeDisplayType displayId, HDC deviceContext); 1.72 + 1.73 + bool restoreLostDevice(); 1.74 + 1.75 + EGLNativeDisplayType mDisplayId; 1.76 + const HDC mDc; 1.77 + 1.78 + bool mSoftwareDevice; 1.79 + 1.80 + typedef std::set<Surface*> SurfaceSet; 1.81 + SurfaceSet mSurfaceSet; 1.82 + 1.83 + ConfigSet mConfigSet; 1.84 + 1.85 + typedef std::set<gl::Context*> ContextSet; 1.86 + ContextSet mContextSet; 1.87 + 1.88 + rx::Renderer *mRenderer; 1.89 + 1.90 + void initExtensionString(); 1.91 + void initVendorString(); 1.92 + std::string mExtensionString; 1.93 + std::string mVendorString; 1.94 +}; 1.95 +} 1.96 + 1.97 +#endif // LIBEGL_DISPLAY_H_