• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // PBufferSurfaceCGL.h: an implementation of egl::Surface for PBuffers for the CLG backend,
8 //                      currently implemented using renderbuffers
9 
10 #ifndef LIBANGLE_RENDERER_GL_CGL_PBUFFERSURFACECGL_H_
11 #define LIBANGLE_RENDERER_GL_CGL_PBUFFERSURFACECGL_H_
12 
13 #include "libANGLE/renderer/gl/SurfaceGL.h"
14 
15 namespace rx
16 {
17 
18 class FunctionsGL;
19 class RendererGL;
20 class StateManagerGL;
21 
22 class PbufferSurfaceCGL : public SurfaceGL
23 {
24   public:
25     PbufferSurfaceCGL(const egl::SurfaceState &state,
26                       RendererGL *renderer,
27                       EGLint width,
28                       EGLint height);
29     ~PbufferSurfaceCGL() 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(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     FramebufferImpl *createDefaultFramebuffer(const gl::Context *context,
54                                               const gl::FramebufferState &state) override;
55 
56   private:
57     unsigned mWidth;
58     unsigned mHeight;
59 
60     // TODO(geofflang): Don't store these, they are potentially specific to a single GL context.
61     // http://anglebug.com/2464
62     const FunctionsGL *mFunctions;
63     StateManagerGL *mStateManager;
64 
65     GLuint mColorRenderbuffer;
66     GLuint mDSRenderbuffer;
67 };
68 
69 }  // namespace rx
70 
71 #endif  // LIBANGLE_RENDERER_GL_CGL_PBUFFERSURFACECGL_H_
72