• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (c) 2014 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 #ifndef UTIL_EGLWINDOW_H_
8 #define UTIL_EGLWINDOW_H_
9 
10 #define GL_GLEXT_PROTOTYPES
11 
12 #include <GLES3/gl3.h>
13 #include <GLES3/gl3ext.h>
14 #include <GLES2/gl2.h>
15 #include <GLES2/gl2ext.h>
16 #include <EGL/egl.h>
17 #include <EGL/eglext.h>
18 
19 #include <string>
20 #include <list>
21 #include <cstdint>
22 #include <memory>
23 
24 #include "shared_utils.h"
25 
26 class OSWindow;
27 
28 class EGLWindow
29 {
30   public:
31     EGLWindow(size_t width, size_t height,
32               EGLint glesMajorVersion = 2,
33               EGLint requestedRenderer = EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE);
34 
35     ~EGLWindow();
36 
setClientVersion(EGLint glesMajorVersion)37     void setClientVersion(EGLint glesMajorVersion) { mClientVersion = glesMajorVersion; }
setWidth(size_t width)38     void setWidth(size_t width) { mWidth = width; }
setHeight(size_t height)39     void setHeight(size_t height) { mHeight = height; }
setConfigRedBits(int bits)40     void setConfigRedBits(int bits) { mRedBits = bits; }
setConfigGreenBits(int bits)41     void setConfigGreenBits(int bits) { mGreenBits = bits; }
setConfigBlueBits(int bits)42     void setConfigBlueBits(int bits) { mBlueBits = bits; }
setConfigAlphaBits(int bits)43     void setConfigAlphaBits(int bits) { mAlphaBits = bits; }
setConfigDepthBits(int bits)44     void setConfigDepthBits(int bits) { mDepthBits = bits; }
setConfigStencilBits(int bits)45     void setConfigStencilBits(int bits) { mStencilBits = bits; }
setMultisample(bool multisample)46     void setMultisample(bool multisample) { mMultisample = multisample; }
setSwapInterval(EGLint swapInterval)47     void setSwapInterval(EGLint swapInterval) { mSwapInterval = swapInterval; }
48 
49     void swap();
50 
getClientVersion()51     GLuint getClientVersion() const { return mClientVersion; }
52     EGLConfig getConfig() const;
53     EGLDisplay getDisplay() const;
54     EGLSurface getSurface() const;
55     EGLContext getContext() const;
getWidth()56     size_t getWidth() const { return mWidth; }
getHeight()57     size_t getHeight() const { return mHeight; }
getConfigRedBits()58     int getConfigRedBits() const { return mRedBits; }
getConfigGreenBits()59     int getConfigGreenBits() const { return mGreenBits; }
getConfigBlueBits()60     int getConfigBlueBits() const { return mBlueBits; }
getConfigAlphaBits()61     int getConfigAlphaBits() const { return mAlphaBits; }
getConfigDepthBits()62     int getConfigDepthBits() const { return mDepthBits; }
getConfigStencilBits()63     int getConfigStencilBits() const { return mStencilBits; }
isMultisample()64     bool isMultisample() const { return mMultisample; }
getSwapInterval()65     EGLint getSwapInterval() const { return mSwapInterval; }
66 
67     bool initializeGL(const OSWindow *osWindow);
68     void destroyGL();
69 
70   private:
71     DISALLOW_COPY_AND_ASSIGN(EGLWindow);
72 
73     EGLConfig mConfig;
74     EGLDisplay mDisplay;
75     EGLSurface mSurface;
76     EGLContext mContext;
77 
78     GLuint mClientVersion;
79     EGLint mRequestedRenderer;
80     size_t mWidth;
81     size_t mHeight;
82     int mRedBits;
83     int mGreenBits;
84     int mBlueBits;
85     int mAlphaBits;
86     int mDepthBits;
87     int mStencilBits;
88     bool mMultisample;
89     EGLint mSwapInterval;
90 };
91 
92 #endif // UTIL_EGLWINDOW_H_
93