• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // RenderbufferImpl.h: Defines the abstract class gl::RenderbufferImpl
8 
9 #ifndef LIBANGLE_RENDERER_RENDERBUFFERIMPL_H_
10 #define LIBANGLE_RENDERER_RENDERBUFFERIMPL_H_
11 
12 #include "angle_gl.h"
13 #include "common/angleutils.h"
14 #include "libANGLE/Error.h"
15 #include "libANGLE/renderer/FramebufferAttachmentObjectImpl.h"
16 
17 namespace gl
18 {
19 struct PixelPackState;
20 class RenderbufferState;
21 }  // namespace gl
22 
23 namespace egl
24 {
25 class Image;
26 }  // namespace egl
27 
28 namespace rx
29 {
30 
31 class RenderbufferImpl : public FramebufferAttachmentObjectImpl
32 {
33   public:
RenderbufferImpl(const gl::RenderbufferState & state)34     RenderbufferImpl(const gl::RenderbufferState &state) : mState(state) {}
~RenderbufferImpl()35     ~RenderbufferImpl() override {}
onDestroy(const gl::Context * context)36     virtual void onDestroy(const gl::Context *context) {}
37 
38     virtual angle::Result setStorage(const gl::Context *context,
39                                      GLenum internalformat,
40                                      size_t width,
41                                      size_t height)                   = 0;
42     virtual angle::Result setStorageMultisample(const gl::Context *context,
43                                                 size_t samples,
44                                                 GLenum internalformat,
45                                                 size_t width,
46                                                 size_t height)        = 0;
47     virtual angle::Result setStorageEGLImageTarget(const gl::Context *context,
48                                                    egl::Image *image) = 0;
49 
50     virtual GLenum getColorReadFormat(const gl::Context *context);
51     virtual GLenum getColorReadType(const gl::Context *context);
52 
53     virtual angle::Result getRenderbufferImage(const gl::Context *context,
54                                                const gl::PixelPackState &packState,
55                                                gl::Buffer *packBuffer,
56                                                GLenum format,
57                                                GLenum type,
58                                                void *pixels);
59 
60     // Override if accurate native memory size information is available
61     virtual GLint getMemorySize() const;
62 
63   protected:
64     const gl::RenderbufferState &mState;
65 };
66 
getMemorySize()67 inline GLint RenderbufferImpl::getMemorySize() const
68 {
69     return 0;
70 }
71 
getColorReadFormat(const gl::Context * context)72 inline GLenum RenderbufferImpl::getColorReadFormat(const gl::Context *context)
73 {
74     UNREACHABLE();
75     return GL_NONE;
76 }
77 
getColorReadType(const gl::Context * context)78 inline GLenum RenderbufferImpl::getColorReadType(const gl::Context *context)
79 {
80     UNREACHABLE();
81     return GL_NONE;
82 }
83 
getRenderbufferImage(const gl::Context * context,const gl::PixelPackState & packState,gl::Buffer * packBuffer,GLenum format,GLenum type,void * pixels)84 inline angle::Result RenderbufferImpl::getRenderbufferImage(const gl::Context *context,
85                                                             const gl::PixelPackState &packState,
86                                                             gl::Buffer *packBuffer,
87                                                             GLenum format,
88                                                             GLenum type,
89                                                             void *pixels)
90 {
91     UNREACHABLE();
92     return angle::Result::Stop;
93 }
94 }  // namespace rx
95 
96 #endif  // LIBANGLE_RENDERER_RENDERBUFFERIMPL_H_
97