xref: /aosp_15_r20/external/angle/src/libANGLE/renderer/gl/wgl/WindowSurfaceWGL.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
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 // WindowSurfaceWGL.h: WGL implementation of egl::Surface for windows
8 
9 #ifndef LIBANGLE_RENDERER_GL_WGL_WINDOWSURFACEWGL_H_
10 #define LIBANGLE_RENDERER_GL_WGL_WINDOWSURFACEWGL_H_
11 
12 #include "libANGLE/renderer/gl/wgl/SurfaceWGL.h"
13 
14 #include <GL/wglext.h>
15 
16 namespace rx
17 {
18 
19 class FunctionsWGL;
20 
21 class WindowSurfaceWGL : public SurfaceWGL
22 {
23   public:
24     WindowSurfaceWGL(const egl::SurfaceState &state,
25                      EGLNativeWindowType window,
26                      int pixelFormat,
27                      const FunctionsWGL *functions,
28                      EGLint orientation);
29     ~WindowSurfaceWGL() override;
30 
31     egl::Error initialize(const egl::Display *display) override;
32     egl::Error makeCurrent(const gl::Context *context) override;
33 
34     egl::Error swap(const gl::Context *context) override;
35     egl::Error postSubBuffer(const gl::Context *context,
36                              EGLint x,
37                              EGLint y,
38                              EGLint width,
39                              EGLint height) override;
40     egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override;
41     egl::Error bindTexImage(const gl::Context *context,
42                             gl::Texture *texture,
43                             EGLint buffer) override;
44     egl::Error releaseTexImage(const gl::Context *context, EGLint buffer) override;
45     void setSwapInterval(const egl::Display *display, EGLint interval) override;
46 
47     EGLint getWidth() const override;
48     EGLint getHeight() const override;
49 
50     EGLint isPostSubBufferSupported() const override;
51     EGLint getSwapBehavior() const override;
52 
53     HDC getDC() const override;
54 
55   private:
56     int mPixelFormat;
57 
58     HWND mWindow;
59     HDC mDeviceContext;
60 
61     const FunctionsWGL *mFunctionsWGL;
62 
63     EGLint mSwapBehavior;
64 };
65 
66 }  // namespace rx
67 
68 #endif  // LIBANGLE_RENDERER_GL_WGL_WINDOWSURFACEWGL_H_
69