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 // SurfaceImpl.h: Implementation methods of egl::Surface
8 
9 #ifndef LIBANGLE_RENDERER_SURFACEIMPL_H_
10 #define LIBANGLE_RENDERER_SURFACEIMPL_H_
11 
12 #include <EGL/egl.h>
13 #include <EGL/eglext.h>
14 
15 #include "common/angleutils.h"
16 #include "libANGLE/Error.h"
17 #include "libANGLE/FramebufferAttachment.h"
18 #include "libANGLE/renderer/FramebufferAttachmentObjectImpl.h"
19 
20 namespace gl
21 {
22 class FramebufferState;
23 }
24 
25 namespace egl
26 {
27 class Display;
28 struct Config;
29 struct SurfaceState;
30 class Thread;
31 }
32 
33 namespace rx
34 {
35 class FramebufferImpl;
36 
37 class SurfaceImpl : public FramebufferAttachmentObjectImpl
38 {
39   public:
40     SurfaceImpl(const egl::SurfaceState &surfaceState);
41     ~SurfaceImpl() override;
destroy(const egl::Display * display)42     virtual void destroy(const egl::Display *display) {}
43 
44     virtual egl::Error initialize(const egl::Display *display)                           = 0;
45     virtual FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &state) = 0;
46     virtual egl::Error swap(const gl::Context *context)                                  = 0;
47     virtual egl::Error swapWithDamage(const gl::Context *context, EGLint *rects, EGLint n_rects);
48     virtual egl::Error postSubBuffer(const gl::Context *context,
49                                      EGLint x,
50                                      EGLint y,
51                                      EGLint width,
52                                      EGLint height) = 0;
53     virtual egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) = 0;
54     virtual egl::Error bindTexImage(gl::Texture *texture, EGLint buffer) = 0;
55     virtual egl::Error releaseTexImage(EGLint buffer) = 0;
56     virtual egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) = 0;
57     virtual void setSwapInterval(EGLint interval) = 0;
58 
59     // width and height can change with client window resizing
60     virtual EGLint getWidth() const = 0;
61     virtual EGLint getHeight() const = 0;
62 
63     virtual EGLint isPostSubBufferSupported() const = 0;
64     virtual EGLint getSwapBehavior() const = 0;
65 
66   protected:
67     const egl::SurfaceState &mState;
68 };
69 
70 }
71 
72 #endif // LIBANGLE_RENDERER_SURFACEIMPL_H_
73 
74