1 // 2 // Copyright 2015 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 // WindowSurfaceGLX.h: GLX implementation of egl::Surface for windows 8 9 #ifndef LIBANGLE_RENDERER_GL_GLX_WINDOWSURFACEGLX_H_ 10 #define LIBANGLE_RENDERER_GL_GLX_WINDOWSURFACEGLX_H_ 11 12 #include "libANGLE/renderer/gl/glx/DisplayGLX.h" 13 #include "libANGLE/renderer/gl/glx/SurfaceGLX.h" 14 #include "libANGLE/renderer/gl/glx/platform_glx.h" 15 16 namespace rx 17 { 18 19 class DisplayGLX; 20 class FunctionsGLX; 21 22 class WindowSurfaceGLX : public SurfaceGLX 23 { 24 public: 25 WindowSurfaceGLX(const egl::SurfaceState &state, 26 const FunctionsGLX &glx, 27 DisplayGLX *glxDisplay, 28 Window window, 29 Display *display, 30 glx::FBConfig fbConfig); 31 ~WindowSurfaceGLX() override; 32 33 egl::Error initialize(const egl::Display *display) override; 34 egl::Error makeCurrent(const gl::Context *context) override; 35 36 egl::Error swap(const gl::Context *context) override; 37 egl::Error postSubBuffer(const gl::Context *context, 38 EGLint x, 39 EGLint y, 40 EGLint width, 41 EGLint height) override; 42 egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override; 43 egl::Error bindTexImage(const gl::Context *context, 44 gl::Texture *texture, 45 EGLint buffer) override; 46 egl::Error releaseTexImage(const gl::Context *context, EGLint buffer) override; 47 void setSwapInterval(EGLint interval) override; 48 49 EGLint getWidth() const override; 50 EGLint getHeight() const override; 51 52 EGLint isPostSubBufferSupported() const override; 53 EGLint getSwapBehavior() const override; 54 55 egl::Error checkForResize() override; 56 glx::Drawable getDrawable() const override; 57 58 egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) override; 59 egl::Error getMscRate(EGLint *numerator, EGLint *denominator) override; 60 61 private: 62 bool getWindowDimensions(Window window, unsigned int *width, unsigned int *height) const; 63 64 Window mParent; 65 unsigned int mParentWidth, mParentHeight; 66 Window mWindow; 67 Display *mDisplay; 68 69 const FunctionsGLX &mGLX; 70 DisplayGLX *mGLXDisplay; 71 72 glx::FBConfig mFBConfig; 73 glx::Window mGLXWindow; 74 75 SwapControlData mSwapControl; 76 }; 77 78 } // namespace rx 79 80 #endif // LIBANGLE_RENDERER_GL_GLX_WINDOWSURFACEGLX_H_ 81