1*8975f5c5SAndroid Build Coastguard Worker // 2*8975f5c5SAndroid Build Coastguard Worker // Copyright 2018 The ANGLE Project Authors. All rights reserved. 3*8975f5c5SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be 4*8975f5c5SAndroid Build Coastguard Worker // found in the LICENSE file. 5*8975f5c5SAndroid Build Coastguard Worker // 6*8975f5c5SAndroid Build Coastguard Worker // WGLWindow: 7*8975f5c5SAndroid Build Coastguard Worker // Implements initializing a WGL rendering context. 8*8975f5c5SAndroid Build Coastguard Worker // 9*8975f5c5SAndroid Build Coastguard Worker 10*8975f5c5SAndroid Build Coastguard Worker #ifndef UTIL_WINDOWS_WGLWINDOW_H_ 11*8975f5c5SAndroid Build Coastguard Worker #define UTIL_WINDOWS_WGLWINDOW_H_ 12*8975f5c5SAndroid Build Coastguard Worker 13*8975f5c5SAndroid Build Coastguard Worker #include "common/angleutils.h" 14*8975f5c5SAndroid Build Coastguard Worker #include "export.h" 15*8975f5c5SAndroid Build Coastguard Worker #include "util/EGLWindow.h" 16*8975f5c5SAndroid Build Coastguard Worker 17*8975f5c5SAndroid Build Coastguard Worker class OSWindow; 18*8975f5c5SAndroid Build Coastguard Worker 19*8975f5c5SAndroid Build Coastguard Worker namespace angle 20*8975f5c5SAndroid Build Coastguard Worker { 21*8975f5c5SAndroid Build Coastguard Worker class Library; 22*8975f5c5SAndroid Build Coastguard Worker } // namespace angle 23*8975f5c5SAndroid Build Coastguard Worker 24*8975f5c5SAndroid Build Coastguard Worker class ANGLE_UTIL_EXPORT WGLWindow : public GLWindowBase 25*8975f5c5SAndroid Build Coastguard Worker { 26*8975f5c5SAndroid Build Coastguard Worker public: 27*8975f5c5SAndroid Build Coastguard Worker static WGLWindow *New(int majorVersion, int minorVersion); 28*8975f5c5SAndroid Build Coastguard Worker static void Delete(WGLWindow **window); 29*8975f5c5SAndroid Build Coastguard Worker 30*8975f5c5SAndroid Build Coastguard Worker // Internally initializes GL resources. 31*8975f5c5SAndroid Build Coastguard Worker bool initializeGL(OSWindow *osWindow, 32*8975f5c5SAndroid Build Coastguard Worker angle::Library *glWindowingLibrary, 33*8975f5c5SAndroid Build Coastguard Worker angle::GLESDriverType driverType, 34*8975f5c5SAndroid Build Coastguard Worker const EGLPlatformParameters &platformParams, 35*8975f5c5SAndroid Build Coastguard Worker const ConfigParameters &configParams) override; 36*8975f5c5SAndroid Build Coastguard Worker 37*8975f5c5SAndroid Build Coastguard Worker GLWindowResult initializeGLWithResult(OSWindow *osWindow, 38*8975f5c5SAndroid Build Coastguard Worker angle::Library *glWindowingLibrary, 39*8975f5c5SAndroid Build Coastguard Worker angle::GLESDriverType driverType, 40*8975f5c5SAndroid Build Coastguard Worker const EGLPlatformParameters &platformParams, 41*8975f5c5SAndroid Build Coastguard Worker const ConfigParameters &configParams) override; 42*8975f5c5SAndroid Build Coastguard Worker 43*8975f5c5SAndroid Build Coastguard Worker void destroyGL() override; 44*8975f5c5SAndroid Build Coastguard Worker bool isGLInitialized() const override; 45*8975f5c5SAndroid Build Coastguard Worker bool makeCurrent() override; 46*8975f5c5SAndroid Build Coastguard Worker void swap() override; 47*8975f5c5SAndroid Build Coastguard Worker bool hasError() const override; 48*8975f5c5SAndroid Build Coastguard Worker bool setSwapInterval(EGLint swapInterval) override; 49*8975f5c5SAndroid Build Coastguard Worker angle::GenericProc getProcAddress(const char *name) override; 50*8975f5c5SAndroid Build Coastguard Worker // Initializes WGL resources. 51*8975f5c5SAndroid Build Coastguard Worker GLWindowContext getCurrentContextGeneric() override; 52*8975f5c5SAndroid Build Coastguard Worker GLWindowContext createContextGeneric(GLWindowContext share) override; 53*8975f5c5SAndroid Build Coastguard Worker bool makeCurrentGeneric(GLWindowContext context) override; 54*8975f5c5SAndroid Build Coastguard Worker Image createImage(GLWindowContext context, 55*8975f5c5SAndroid Build Coastguard Worker Enum target, 56*8975f5c5SAndroid Build Coastguard Worker ClientBuffer buffer, 57*8975f5c5SAndroid Build Coastguard Worker const Attrib *attrib_list) override; 58*8975f5c5SAndroid Build Coastguard Worker Image createImageKHR(GLWindowContext context, 59*8975f5c5SAndroid Build Coastguard Worker Enum target, 60*8975f5c5SAndroid Build Coastguard Worker ClientBuffer buffer, 61*8975f5c5SAndroid Build Coastguard Worker const AttribKHR *attrib_list) override; 62*8975f5c5SAndroid Build Coastguard Worker EGLBoolean destroyImage(Image image) override; 63*8975f5c5SAndroid Build Coastguard Worker EGLBoolean destroyImageKHR(Image image) override; 64*8975f5c5SAndroid Build Coastguard Worker Sync createSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list) override; 65*8975f5c5SAndroid Build Coastguard Worker Sync createSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list) override; 66*8975f5c5SAndroid Build Coastguard Worker EGLBoolean destroySync(EGLDisplay dpy, Sync sync) override; 67*8975f5c5SAndroid Build Coastguard Worker EGLBoolean destroySyncKHR(EGLDisplay dpy, Sync sync) override; 68*8975f5c5SAndroid Build Coastguard Worker EGLint clientWaitSync(EGLDisplay dpy, Sync sync, EGLint flags, EGLTimeKHR timeout) override; 69*8975f5c5SAndroid Build Coastguard Worker EGLint clientWaitSyncKHR(EGLDisplay dpy, Sync sync, EGLint flags, EGLTimeKHR timeout) override; 70*8975f5c5SAndroid Build Coastguard Worker EGLint getEGLError() override; 71*8975f5c5SAndroid Build Coastguard Worker Display getCurrentDisplay() override; 72*8975f5c5SAndroid Build Coastguard Worker Surface createPbufferSurface(const EGLint *attrib_list) override; 73*8975f5c5SAndroid Build Coastguard Worker EGLBoolean destroySurface(Surface surface) override; 74*8975f5c5SAndroid Build Coastguard Worker 75*8975f5c5SAndroid Build Coastguard Worker EGLBoolean bindTexImage(EGLSurface surface, EGLint buffer) override; 76*8975f5c5SAndroid Build Coastguard Worker EGLBoolean releaseTexImage(EGLSurface surface, EGLint buffer) override; 77*8975f5c5SAndroid Build Coastguard Worker bool makeCurrent(EGLSurface draw, EGLSurface read, EGLContext context) override; 78*8975f5c5SAndroid Build Coastguard Worker 79*8975f5c5SAndroid Build Coastguard Worker // Create a WGL context with this window's configuration 80*8975f5c5SAndroid Build Coastguard Worker HGLRC createContext(const ConfigParameters &configParams, HGLRC shareContext); 81*8975f5c5SAndroid Build Coastguard Worker // Make the WGL context current 82*8975f5c5SAndroid Build Coastguard Worker bool makeCurrent(HGLRC context); 83*8975f5c5SAndroid Build Coastguard Worker 84*8975f5c5SAndroid Build Coastguard Worker private: 85*8975f5c5SAndroid Build Coastguard Worker WGLWindow(int majorVersion, int minorVersion); 86*8975f5c5SAndroid Build Coastguard Worker ~WGLWindow() override; 87*8975f5c5SAndroid Build Coastguard Worker 88*8975f5c5SAndroid Build Coastguard Worker // OS resources. 89*8975f5c5SAndroid Build Coastguard Worker HDC mDeviceContext; 90*8975f5c5SAndroid Build Coastguard Worker HGLRC mWGLContext; 91*8975f5c5SAndroid Build Coastguard Worker HWND mWindow; 92*8975f5c5SAndroid Build Coastguard Worker }; 93*8975f5c5SAndroid Build Coastguard Worker 94*8975f5c5SAndroid Build Coastguard Worker #endif // UTIL_WINDOWS_WGLWINDOW_H_ 95