1 //
2 // Copyright 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 // FramebufferImpl.h: Defines the abstract rx::FramebufferImpl class.
8 
9 #ifndef LIBANGLE_RENDERER_FRAMEBUFFERIMPL_H_
10 #define LIBANGLE_RENDERER_FRAMEBUFFERIMPL_H_
11 
12 #include "angle_gl.h"
13 #include "common/angleutils.h"
14 #include "libANGLE/Error.h"
15 #include "libANGLE/Framebuffer.h"
16 
17 namespace gl
18 {
19 class State;
20 class Framebuffer;
21 class FramebufferAttachment;
22 struct Rectangle;
23 }
24 
25 namespace rx
26 {
27 class DisplayImpl;
28 
29 class FramebufferImpl : angle::NonCopyable
30 {
31   public:
FramebufferImpl(const gl::FramebufferState & state)32     explicit FramebufferImpl(const gl::FramebufferState &state) : mState(state) {}
~FramebufferImpl()33     virtual ~FramebufferImpl() {}
destroy(const gl::Context * context)34     virtual void destroy(const gl::Context *context) {}
destroyDefault(const egl::Display * display)35     virtual void destroyDefault(const egl::Display *display) {}
36 
37     virtual gl::Error discard(const gl::Context *context,
38                               size_t count,
39                               const GLenum *attachments) = 0;
40     virtual gl::Error invalidate(const gl::Context *context,
41                                  size_t count,
42                                  const GLenum *attachments) = 0;
43     virtual gl::Error invalidateSub(const gl::Context *context,
44                                     size_t count,
45                                     const GLenum *attachments,
46                                     const gl::Rectangle &area) = 0;
47 
48     virtual gl::Error clear(const gl::Context *context, GLbitfield mask) = 0;
49     virtual gl::Error clearBufferfv(const gl::Context *context,
50                                     GLenum buffer,
51                                     GLint drawbuffer,
52                                     const GLfloat *values) = 0;
53     virtual gl::Error clearBufferuiv(const gl::Context *context,
54                                      GLenum buffer,
55                                      GLint drawbuffer,
56                                      const GLuint *values) = 0;
57     virtual gl::Error clearBufferiv(const gl::Context *context,
58                                     GLenum buffer,
59                                     GLint drawbuffer,
60                                     const GLint *values) = 0;
61     virtual gl::Error clearBufferfi(const gl::Context *context,
62                                     GLenum buffer,
63                                     GLint drawbuffer,
64                                     GLfloat depth,
65                                     GLint stencil) = 0;
66 
67     virtual GLenum getImplementationColorReadFormat(const gl::Context *context) const = 0;
68     virtual GLenum getImplementationColorReadType(const gl::Context *context) const   = 0;
69     virtual gl::Error readPixels(const gl::Context *context,
70                                  const gl::Rectangle &area,
71                                  GLenum format,
72                                  GLenum type,
73                                  void *pixels) = 0;
74 
75     virtual gl::Error blit(const gl::Context *context,
76                            const gl::Rectangle &sourceArea,
77                            const gl::Rectangle &destArea,
78                            GLbitfield mask,
79                            GLenum filter) = 0;
80 
81     virtual bool checkStatus(const gl::Context *context) const = 0;
82 
83     virtual void syncState(const gl::Context *context,
84                            const gl::Framebuffer::DirtyBits &dirtyBits) = 0;
85 
86     virtual gl::Error getSamplePosition(size_t index, GLfloat *xy) const = 0;
87 
getState()88     const gl::FramebufferState &getState() const { return mState; }
89 
90   protected:
91     const gl::FramebufferState &mState;
92 };
93 }
94 
95 #endif  // LIBANGLE_RENDERER_FRAMEBUFFERIMPL_H_
96