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/angletypes.h"
16 #include "libANGLE/renderer/FramebufferAttachmentObjectImpl.h"
17
18 namespace gl
19 {
20 struct PixelPackState;
21 class RenderbufferState;
22 } // namespace gl
23
24 namespace egl
25 {
26 class Image;
27 } // namespace egl
28
29 namespace rx
30 {
31
32 class RenderbufferImpl : public FramebufferAttachmentObjectImpl
33 {
34 public:
RenderbufferImpl(const gl::RenderbufferState & state)35 RenderbufferImpl(const gl::RenderbufferState &state) : mState(state) {}
~RenderbufferImpl()36 ~RenderbufferImpl() override {}
onDestroy(const gl::Context * context)37 virtual void onDestroy(const gl::Context *context) {}
38
39 virtual angle::Result setStorage(const gl::Context *context,
40 GLenum internalformat,
41 GLsizei width,
42 GLsizei height) = 0;
43 virtual angle::Result setStorageMultisample(const gl::Context *context,
44 GLsizei samples,
45 GLenum internalformat,
46 GLsizei width,
47 GLsizei height,
48 gl::MultisamplingMode mode) = 0;
49 virtual angle::Result setStorageEGLImageTarget(const gl::Context *context,
50 egl::Image *image) = 0;
51
52 virtual angle::Result copyRenderbufferSubData(const gl::Context *context,
53 const gl::Renderbuffer *srcBuffer,
54 GLint srcLevel,
55 GLint srcX,
56 GLint srcY,
57 GLint srcZ,
58 GLint dstLevel,
59 GLint dstX,
60 GLint dstY,
61 GLint dstZ,
62 GLsizei srcWidth,
63 GLsizei srcHeight,
64 GLsizei srcDepth);
65
66 virtual angle::Result copyTextureSubData(const gl::Context *context,
67 const gl::Texture *srcTexture,
68 GLint srcLevel,
69 GLint srcX,
70 GLint srcY,
71 GLint srcZ,
72 GLint dstLevel,
73 GLint dstX,
74 GLint dstY,
75 GLint dstZ,
76 GLsizei srcWidth,
77 GLsizei srcHeight,
78 GLsizei srcDepth);
79
80 virtual GLenum getColorReadFormat(const gl::Context *context);
81 virtual GLenum getColorReadType(const gl::Context *context);
82
83 virtual angle::Result getRenderbufferImage(const gl::Context *context,
84 const gl::PixelPackState &packState,
85 gl::Buffer *packBuffer,
86 GLenum format,
87 GLenum type,
88 void *pixels);
89
90 // Override if accurate native memory size information is available
91 virtual GLint getMemorySize() const;
92
93 protected:
94 const gl::RenderbufferState &mState;
95 };
96
copyRenderbufferSubData(const gl::Context * context,const gl::Renderbuffer * srcBuffer,GLint srcLevel,GLint srcX,GLint srcY,GLint srcZ,GLint dstLevel,GLint dstX,GLint dstY,GLint dstZ,GLsizei srcWidth,GLsizei srcHeight,GLsizei srcDepth)97 inline angle::Result RenderbufferImpl::copyRenderbufferSubData(const gl::Context *context,
98 const gl::Renderbuffer *srcBuffer,
99 GLint srcLevel,
100 GLint srcX,
101 GLint srcY,
102 GLint srcZ,
103 GLint dstLevel,
104 GLint dstX,
105 GLint dstY,
106 GLint dstZ,
107 GLsizei srcWidth,
108 GLsizei srcHeight,
109 GLsizei srcDepth)
110 {
111 UNREACHABLE();
112 return angle::Result::Stop;
113 }
114
copyTextureSubData(const gl::Context * context,const gl::Texture * srcTexture,GLint srcLevel,GLint srcX,GLint srcY,GLint srcZ,GLint dstLevel,GLint dstX,GLint dstY,GLint dstZ,GLsizei srcWidth,GLsizei srcHeight,GLsizei srcDepth)115 inline angle::Result RenderbufferImpl::copyTextureSubData(const gl::Context *context,
116 const gl::Texture *srcTexture,
117 GLint srcLevel,
118 GLint srcX,
119 GLint srcY,
120 GLint srcZ,
121 GLint dstLevel,
122 GLint dstX,
123 GLint dstY,
124 GLint dstZ,
125 GLsizei srcWidth,
126 GLsizei srcHeight,
127 GLsizei srcDepth)
128 {
129 UNREACHABLE();
130 return angle::Result::Stop;
131 }
132
getMemorySize()133 inline GLint RenderbufferImpl::getMemorySize() const
134 {
135 return 0;
136 }
137
getColorReadFormat(const gl::Context * context)138 inline GLenum RenderbufferImpl::getColorReadFormat(const gl::Context *context)
139 {
140 UNREACHABLE();
141 return GL_NONE;
142 }
143
getColorReadType(const gl::Context * context)144 inline GLenum RenderbufferImpl::getColorReadType(const gl::Context *context)
145 {
146 UNREACHABLE();
147 return GL_NONE;
148 }
149
getRenderbufferImage(const gl::Context * context,const gl::PixelPackState & packState,gl::Buffer * packBuffer,GLenum format,GLenum type,void * pixels)150 inline angle::Result RenderbufferImpl::getRenderbufferImage(const gl::Context *context,
151 const gl::PixelPackState &packState,
152 gl::Buffer *packBuffer,
153 GLenum format,
154 GLenum type,
155 void *pixels)
156 {
157 UNREACHABLE();
158 return angle::Result::Stop;
159 }
160 } // namespace rx
161
162 #endif // LIBANGLE_RENDERER_RENDERBUFFERIMPL_H_
163