daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 2002-2010 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 | |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 7 | // Renderbuffer.h: Defines the wrapper class gl::Renderbuffer, as well as the |
| 8 | // class hierarchy used to store its contents: RenderbufferStorage, Colorbuffer, |
| 9 | // DepthStencilbuffer, Depthbuffer and Stencilbuffer. Implements GL renderbuffer |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 10 | // objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108. |
| 11 | |
| 12 | #ifndef LIBGLESV2_RENDERBUFFER_H_ |
| 13 | #define LIBGLESV2_RENDERBUFFER_H_ |
| 14 | |
shannon.woods%transgaming.com@gtempaccount.com | f26ddae | 2013-04-13 03:29:13 +0000 | [diff] [blame] | 15 | #include <GLES3/gl3.h> |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 16 | #include <GLES2/gl2.h> |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 17 | |
alokp@chromium.org | ea0e1af | 2010-03-22 19:33:14 +0000 | [diff] [blame] | 18 | #include "common/angleutils.h" |
apatrick@chromium.org | b66a701 | 2012-01-23 20:04:48 +0000 | [diff] [blame] | 19 | #include "common/RefCountObject.h" |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 20 | |
daniel@transgaming.com | 70062c9 | 2012-11-28 19:32:30 +0000 | [diff] [blame] | 21 | namespace rx |
| 22 | { |
| 23 | class Renderer; |
shannon.woods@transgaming.com | d2811d6 | 2013-02-28 23:11:19 +0000 | [diff] [blame] | 24 | class SwapChain; |
| 25 | class RenderTarget; |
Geoff Lang | 391c8c5 | 2013-09-17 17:05:51 -0400 | [diff] [blame] | 26 | class TextureStorage; |
daniel@transgaming.com | 70062c9 | 2012-11-28 19:32:30 +0000 | [diff] [blame] | 27 | } |
| 28 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 29 | namespace gl |
| 30 | { |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 31 | class Texture2D; |
| 32 | class TextureCubeMap; |
Geoff Lang | d5d8e39 | 2013-07-25 16:53:03 -0400 | [diff] [blame] | 33 | class Texture3D; |
| 34 | class Texture2DArray; |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 35 | class FramebufferAttachment; |
daniel@transgaming.com | f45e81d | 2011-11-09 17:46:02 +0000 | [diff] [blame] | 36 | class Colorbuffer; |
| 37 | class DepthStencilbuffer; |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 38 | |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 39 | class FramebufferAttachmentInterface |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 40 | { |
| 41 | public: |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 42 | FramebufferAttachmentInterface(); |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 43 | |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 44 | virtual ~FramebufferAttachmentInterface() {}; |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 45 | |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 46 | virtual void addProxyRef(const FramebufferAttachment *proxy); |
| 47 | virtual void releaseProxy(const FramebufferAttachment *proxy); |
daniel@transgaming.com | 2678b34 | 2012-01-18 16:29:40 +0000 | [diff] [blame] | 48 | |
daniel@transgaming.com | d186dc7 | 2012-11-28 19:40:16 +0000 | [diff] [blame] | 49 | virtual rx::RenderTarget *getRenderTarget() = 0; |
| 50 | virtual rx::RenderTarget *getDepthStencil() = 0; |
Geoff Lang | 391c8c5 | 2013-09-17 17:05:51 -0400 | [diff] [blame] | 51 | virtual rx::TextureStorage *getTextureStorage() = 0; |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 52 | |
| 53 | virtual GLsizei getWidth() const = 0; |
| 54 | virtual GLsizei getHeight() const = 0; |
| 55 | virtual GLenum getInternalFormat() const = 0; |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 56 | virtual GLenum getActualFormat() const = 0; |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 57 | virtual GLsizei getSamples() const = 0; |
| 58 | |
daniel@transgaming.com | fbc3952 | 2011-11-11 04:10:28 +0000 | [diff] [blame] | 59 | virtual unsigned int getSerial() const = 0; |
Geoff Lang | 784371d | 2014-05-16 12:39:04 -0400 | [diff] [blame] | 60 | |
| 61 | virtual bool isTexture() const = 0; |
Jamie Madill | bfcda81 | 2013-10-22 13:07:33 -0400 | [diff] [blame] | 62 | virtual unsigned int getTextureSerial() const = 0; |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 63 | |
| 64 | private: |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 65 | DISALLOW_COPY_AND_ASSIGN(FramebufferAttachmentInterface); |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 66 | }; |
| 67 | |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 68 | class Texture2DAttachment : public FramebufferAttachmentInterface |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 69 | { |
| 70 | public: |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 71 | Texture2DAttachment(Texture2D *texture, GLint level); |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 72 | |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 73 | virtual ~Texture2DAttachment(); |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 74 | |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 75 | void addProxyRef(const FramebufferAttachment *proxy); |
| 76 | void releaseProxy(const FramebufferAttachment *proxy); |
daniel@transgaming.com | 2678b34 | 2012-01-18 16:29:40 +0000 | [diff] [blame] | 77 | |
daniel@transgaming.com | d186dc7 | 2012-11-28 19:40:16 +0000 | [diff] [blame] | 78 | rx::RenderTarget *getRenderTarget(); |
| 79 | rx::RenderTarget *getDepthStencil(); |
Geoff Lang | 391c8c5 | 2013-09-17 17:05:51 -0400 | [diff] [blame] | 80 | rx::TextureStorage *getTextureStorage(); |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 81 | |
daniel@transgaming.com | fbc3952 | 2011-11-11 04:10:28 +0000 | [diff] [blame] | 82 | virtual GLsizei getWidth() const; |
| 83 | virtual GLsizei getHeight() const; |
| 84 | virtual GLenum getInternalFormat() const; |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 85 | virtual GLenum getActualFormat() const; |
daniel@transgaming.com | fbc3952 | 2011-11-11 04:10:28 +0000 | [diff] [blame] | 86 | virtual GLsizei getSamples() const; |
| 87 | |
| 88 | virtual unsigned int getSerial() const; |
Geoff Lang | 784371d | 2014-05-16 12:39:04 -0400 | [diff] [blame] | 89 | |
| 90 | virtual bool isTexture() const; |
Jamie Madill | bfcda81 | 2013-10-22 13:07:33 -0400 | [diff] [blame] | 91 | virtual unsigned int getTextureSerial() const; |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 92 | |
| 93 | private: |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 94 | DISALLOW_COPY_AND_ASSIGN(Texture2DAttachment); |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 95 | |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 96 | BindingPointer <Texture2D> mTexture2D; |
Geoff Lang | 8040f57 | 2013-07-25 16:49:54 -0400 | [diff] [blame] | 97 | const GLint mLevel; |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 98 | }; |
| 99 | |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 100 | class TextureCubeMapAttachment : public FramebufferAttachmentInterface |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 101 | { |
| 102 | public: |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 103 | TextureCubeMapAttachment(TextureCubeMap *texture, GLenum faceTarget, GLint level); |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 104 | |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 105 | virtual ~TextureCubeMapAttachment(); |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 106 | |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 107 | void addProxyRef(const FramebufferAttachment *proxy); |
| 108 | void releaseProxy(const FramebufferAttachment *proxy); |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 109 | |
daniel@transgaming.com | d186dc7 | 2012-11-28 19:40:16 +0000 | [diff] [blame] | 110 | rx::RenderTarget *getRenderTarget(); |
| 111 | rx::RenderTarget *getDepthStencil(); |
Geoff Lang | 391c8c5 | 2013-09-17 17:05:51 -0400 | [diff] [blame] | 112 | rx::TextureStorage *getTextureStorage(); |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 113 | |
| 114 | virtual GLsizei getWidth() const; |
| 115 | virtual GLsizei getHeight() const; |
| 116 | virtual GLenum getInternalFormat() const; |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 117 | virtual GLenum getActualFormat() const; |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 118 | virtual GLsizei getSamples() const; |
| 119 | |
| 120 | virtual unsigned int getSerial() const; |
Geoff Lang | 784371d | 2014-05-16 12:39:04 -0400 | [diff] [blame] | 121 | |
| 122 | virtual bool isTexture() const; |
Jamie Madill | bfcda81 | 2013-10-22 13:07:33 -0400 | [diff] [blame] | 123 | virtual unsigned int getTextureSerial() const; |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 124 | |
| 125 | private: |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 126 | DISALLOW_COPY_AND_ASSIGN(TextureCubeMapAttachment); |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 127 | |
| 128 | BindingPointer <TextureCubeMap> mTextureCubeMap; |
Geoff Lang | 8040f57 | 2013-07-25 16:49:54 -0400 | [diff] [blame] | 129 | const GLint mLevel; |
| 130 | const GLenum mFaceTarget; |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 131 | }; |
| 132 | |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 133 | class Texture3DAttachment : public FramebufferAttachmentInterface |
Geoff Lang | d5d8e39 | 2013-07-25 16:53:03 -0400 | [diff] [blame] | 134 | { |
| 135 | public: |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 136 | Texture3DAttachment(Texture3D *texture, GLint level, GLint layer); |
Geoff Lang | d5d8e39 | 2013-07-25 16:53:03 -0400 | [diff] [blame] | 137 | |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 138 | virtual ~Texture3DAttachment(); |
Geoff Lang | d5d8e39 | 2013-07-25 16:53:03 -0400 | [diff] [blame] | 139 | |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 140 | void addProxyRef(const FramebufferAttachment *proxy); |
| 141 | void releaseProxy(const FramebufferAttachment *proxy); |
Geoff Lang | d5d8e39 | 2013-07-25 16:53:03 -0400 | [diff] [blame] | 142 | |
| 143 | rx::RenderTarget *getRenderTarget(); |
| 144 | rx::RenderTarget *getDepthStencil(); |
Geoff Lang | 391c8c5 | 2013-09-17 17:05:51 -0400 | [diff] [blame] | 145 | rx::TextureStorage *getTextureStorage(); |
Geoff Lang | d5d8e39 | 2013-07-25 16:53:03 -0400 | [diff] [blame] | 146 | |
| 147 | virtual GLsizei getWidth() const; |
| 148 | virtual GLsizei getHeight() const; |
| 149 | virtual GLenum getInternalFormat() const; |
| 150 | virtual GLenum getActualFormat() const; |
| 151 | virtual GLsizei getSamples() const; |
| 152 | |
| 153 | virtual unsigned int getSerial() const; |
Geoff Lang | 784371d | 2014-05-16 12:39:04 -0400 | [diff] [blame] | 154 | |
| 155 | virtual bool isTexture() const; |
Jamie Madill | bfcda81 | 2013-10-22 13:07:33 -0400 | [diff] [blame] | 156 | virtual unsigned int getTextureSerial() const; |
Geoff Lang | d5d8e39 | 2013-07-25 16:53:03 -0400 | [diff] [blame] | 157 | |
| 158 | private: |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 159 | DISALLOW_COPY_AND_ASSIGN(Texture3DAttachment); |
Geoff Lang | d5d8e39 | 2013-07-25 16:53:03 -0400 | [diff] [blame] | 160 | |
| 161 | BindingPointer<Texture3D> mTexture3D; |
| 162 | const GLint mLevel; |
| 163 | const GLint mLayer; |
| 164 | }; |
| 165 | |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 166 | class Texture2DArrayAttachment : public FramebufferAttachmentInterface |
Geoff Lang | d5d8e39 | 2013-07-25 16:53:03 -0400 | [diff] [blame] | 167 | { |
| 168 | public: |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 169 | Texture2DArrayAttachment(Texture2DArray *texture, GLint level, GLint layer); |
Geoff Lang | d5d8e39 | 2013-07-25 16:53:03 -0400 | [diff] [blame] | 170 | |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 171 | virtual ~Texture2DArrayAttachment(); |
Geoff Lang | d5d8e39 | 2013-07-25 16:53:03 -0400 | [diff] [blame] | 172 | |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 173 | void addProxyRef(const FramebufferAttachment *proxy); |
| 174 | void releaseProxy(const FramebufferAttachment *proxy); |
Geoff Lang | d5d8e39 | 2013-07-25 16:53:03 -0400 | [diff] [blame] | 175 | |
| 176 | rx::RenderTarget *getRenderTarget(); |
| 177 | rx::RenderTarget *getDepthStencil(); |
Geoff Lang | 391c8c5 | 2013-09-17 17:05:51 -0400 | [diff] [blame] | 178 | rx::TextureStorage *getTextureStorage(); |
Geoff Lang | d5d8e39 | 2013-07-25 16:53:03 -0400 | [diff] [blame] | 179 | |
| 180 | virtual GLsizei getWidth() const; |
| 181 | virtual GLsizei getHeight() const; |
| 182 | virtual GLenum getInternalFormat() const; |
| 183 | virtual GLenum getActualFormat() const; |
| 184 | virtual GLsizei getSamples() const; |
| 185 | |
| 186 | virtual unsigned int getSerial() const; |
Geoff Lang | 784371d | 2014-05-16 12:39:04 -0400 | [diff] [blame] | 187 | |
| 188 | virtual bool isTexture() const; |
Jamie Madill | bfcda81 | 2013-10-22 13:07:33 -0400 | [diff] [blame] | 189 | virtual unsigned int getTextureSerial() const; |
Geoff Lang | d5d8e39 | 2013-07-25 16:53:03 -0400 | [diff] [blame] | 190 | |
| 191 | private: |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 192 | DISALLOW_COPY_AND_ASSIGN(Texture2DArrayAttachment); |
Geoff Lang | d5d8e39 | 2013-07-25 16:53:03 -0400 | [diff] [blame] | 193 | |
| 194 | BindingPointer<Texture2DArray> mTexture2DArray; |
| 195 | const GLint mLevel; |
| 196 | const GLint mLayer; |
| 197 | }; |
| 198 | |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 199 | // A class derived from RenderbufferStorage is created whenever glRenderbufferStorage |
| 200 | // is called. The specific concrete type depends on whether the internal format is |
| 201 | // colour depth, stencil or packed depth/stencil. |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 202 | class RenderbufferStorage : public FramebufferAttachmentInterface |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 203 | { |
| 204 | public: |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 205 | RenderbufferStorage(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 206 | |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 207 | virtual ~RenderbufferStorage() = 0; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 208 | |
daniel@transgaming.com | d186dc7 | 2012-11-28 19:40:16 +0000 | [diff] [blame] | 209 | virtual rx::RenderTarget *getRenderTarget(); |
| 210 | virtual rx::RenderTarget *getDepthStencil(); |
Geoff Lang | 391c8c5 | 2013-09-17 17:05:51 -0400 | [diff] [blame] | 211 | virtual rx::TextureStorage *getTextureStorage(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 212 | |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 213 | virtual GLsizei getWidth() const; |
| 214 | virtual GLsizei getHeight() const; |
| 215 | virtual GLenum getInternalFormat() const; |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 216 | virtual GLenum getActualFormat() const; |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 217 | virtual GLsizei getSamples() const; |
daniel@transgaming.com | 092bd48 | 2010-05-12 03:39:36 +0000 | [diff] [blame] | 218 | |
daniel@transgaming.com | fbc3952 | 2011-11-11 04:10:28 +0000 | [diff] [blame] | 219 | virtual unsigned int getSerial() const; |
Geoff Lang | 784371d | 2014-05-16 12:39:04 -0400 | [diff] [blame] | 220 | |
| 221 | virtual bool isTexture() const; |
| 222 | virtual unsigned int getTextureSerial() const; |
daniel@transgaming.com | fbc3952 | 2011-11-11 04:10:28 +0000 | [diff] [blame] | 223 | |
Geoff Lang | 8040f57 | 2013-07-25 16:49:54 -0400 | [diff] [blame] | 224 | static unsigned int issueSerials(GLuint count); |
daniel@transgaming.com | fbc3952 | 2011-11-11 04:10:28 +0000 | [diff] [blame] | 225 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 226 | protected: |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 227 | GLsizei mWidth; |
| 228 | GLsizei mHeight; |
| 229 | GLenum mInternalFormat; |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 230 | GLenum mActualFormat; |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 231 | GLsizei mSamples; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 232 | |
| 233 | private: |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 234 | DISALLOW_COPY_AND_ASSIGN(RenderbufferStorage); |
daniel@transgaming.com | fbc3952 | 2011-11-11 04:10:28 +0000 | [diff] [blame] | 235 | |
| 236 | const unsigned int mSerial; |
| 237 | |
| 238 | static unsigned int mCurrentSerial; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 239 | }; |
| 240 | |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 241 | // FramebufferAttachment implements the GL renderbuffer object. |
| 242 | // It's only a proxy for a FramebufferAttachmentInterface instance; the internal object |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 243 | // can change whenever glRenderbufferStorage is called. |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 244 | class FramebufferAttachment : public RefCountObject |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 245 | { |
| 246 | public: |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 247 | FramebufferAttachment(rx::Renderer *renderer, GLuint id, FramebufferAttachmentInterface *storage); |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 248 | |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 249 | virtual ~FramebufferAttachment(); |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 250 | |
daniel@transgaming.com | 2678b34 | 2012-01-18 16:29:40 +0000 | [diff] [blame] | 251 | // These functions from RefCountObject are overloaded here because |
| 252 | // Textures need to maintain their own count of references to them via |
| 253 | // Renderbuffers/RenderbufferTextures. These functions invoke those |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 254 | // reference counting functions on the FramebufferAttachmentInterface. |
daniel@transgaming.com | 2678b34 | 2012-01-18 16:29:40 +0000 | [diff] [blame] | 255 | void addRef() const; |
| 256 | void release() const; |
| 257 | |
daniel@transgaming.com | d186dc7 | 2012-11-28 19:40:16 +0000 | [diff] [blame] | 258 | rx::RenderTarget *getRenderTarget(); |
| 259 | rx::RenderTarget *getDepthStencil(); |
Geoff Lang | 391c8c5 | 2013-09-17 17:05:51 -0400 | [diff] [blame] | 260 | rx::TextureStorage *getTextureStorage(); |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 261 | |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 262 | GLsizei getWidth() const; |
| 263 | GLsizei getHeight() const; |
| 264 | GLenum getInternalFormat() const; |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 265 | GLenum getActualFormat() const; |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 266 | GLuint getRedSize() const; |
| 267 | GLuint getGreenSize() const; |
| 268 | GLuint getBlueSize() const; |
| 269 | GLuint getAlphaSize() const; |
| 270 | GLuint getDepthSize() const; |
| 271 | GLuint getStencilSize() const; |
Geoff Lang | 0a80479 | 2013-08-13 13:09:43 -0400 | [diff] [blame] | 272 | GLenum getComponentType() const; |
| 273 | GLenum getColorEncoding() const; |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 274 | GLsizei getSamples() const; |
| 275 | |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 276 | unsigned int getSerial() const; |
Geoff Lang | 784371d | 2014-05-16 12:39:04 -0400 | [diff] [blame] | 277 | |
| 278 | bool isTexture() const; |
Jamie Madill | bfcda81 | 2013-10-22 13:07:33 -0400 | [diff] [blame] | 279 | unsigned int getTextureSerial() const; |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 280 | |
| 281 | void setStorage(RenderbufferStorage *newStorage); |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 282 | |
| 283 | private: |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 284 | DISALLOW_COPY_AND_ASSIGN(FramebufferAttachment); |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 285 | |
shannonwoods@chromium.org | f6fb959 | 2013-05-30 00:09:40 +0000 | [diff] [blame] | 286 | rx::Renderer const *mRenderer; |
Jamie Madill | 3c7fa22 | 2014-06-05 13:08:51 -0400 | [diff] [blame^] | 287 | FramebufferAttachmentInterface *mInstance; |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 288 | }; |
| 289 | |
| 290 | class Colorbuffer : public RenderbufferStorage |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 291 | { |
| 292 | public: |
daniel@transgaming.com | 70062c9 | 2012-11-28 19:32:30 +0000 | [diff] [blame] | 293 | Colorbuffer(rx::Renderer *renderer, rx::SwapChain *swapChain); |
| 294 | Colorbuffer(rx::Renderer *renderer, GLsizei width, GLsizei height, GLenum format, GLsizei samples); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 295 | |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 296 | virtual ~Colorbuffer(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 297 | |
daniel@transgaming.com | d186dc7 | 2012-11-28 19:40:16 +0000 | [diff] [blame] | 298 | virtual rx::RenderTarget *getRenderTarget(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 299 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 300 | private: |
| 301 | DISALLOW_COPY_AND_ASSIGN(Colorbuffer); |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 302 | |
daniel@transgaming.com | 042d1b4 | 2012-11-28 19:37:09 +0000 | [diff] [blame] | 303 | rx::RenderTarget *mRenderTarget; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 304 | }; |
| 305 | |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 306 | class DepthStencilbuffer : public RenderbufferStorage |
daniel@transgaming.com | cdacc8e | 2010-07-28 19:20:50 +0000 | [diff] [blame] | 307 | { |
| 308 | public: |
daniel@transgaming.com | 70062c9 | 2012-11-28 19:32:30 +0000 | [diff] [blame] | 309 | DepthStencilbuffer(rx::Renderer *renderer, rx::SwapChain *swapChain); |
| 310 | DepthStencilbuffer(rx::Renderer *renderer, GLsizei width, GLsizei height, GLsizei samples); |
daniel@transgaming.com | cdacc8e | 2010-07-28 19:20:50 +0000 | [diff] [blame] | 311 | |
| 312 | ~DepthStencilbuffer(); |
| 313 | |
daniel@transgaming.com | d186dc7 | 2012-11-28 19:40:16 +0000 | [diff] [blame] | 314 | virtual rx::RenderTarget *getDepthStencil(); |
daniel@transgaming.com | cdacc8e | 2010-07-28 19:20:50 +0000 | [diff] [blame] | 315 | |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 316 | protected: |
daniel@transgaming.com | 042d1b4 | 2012-11-28 19:37:09 +0000 | [diff] [blame] | 317 | rx::RenderTarget *mDepthStencil; |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 318 | |
daniel@transgaming.com | cdacc8e | 2010-07-28 19:20:50 +0000 | [diff] [blame] | 319 | private: |
| 320 | DISALLOW_COPY_AND_ASSIGN(DepthStencilbuffer); |
daniel@transgaming.com | cdacc8e | 2010-07-28 19:20:50 +0000 | [diff] [blame] | 321 | }; |
| 322 | |
| 323 | class Depthbuffer : public DepthStencilbuffer |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 324 | { |
| 325 | public: |
daniel@transgaming.com | 70062c9 | 2012-11-28 19:32:30 +0000 | [diff] [blame] | 326 | Depthbuffer(rx::Renderer *renderer, GLsizei width, GLsizei height, GLsizei samples); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 327 | |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 328 | virtual ~Depthbuffer(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 329 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 330 | private: |
| 331 | DISALLOW_COPY_AND_ASSIGN(Depthbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 332 | }; |
| 333 | |
daniel@transgaming.com | cdacc8e | 2010-07-28 19:20:50 +0000 | [diff] [blame] | 334 | class Stencilbuffer : public DepthStencilbuffer |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 335 | { |
| 336 | public: |
daniel@transgaming.com | 70062c9 | 2012-11-28 19:32:30 +0000 | [diff] [blame] | 337 | Stencilbuffer(rx::Renderer *renderer, GLsizei width, GLsizei height, GLsizei samples); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 338 | |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 339 | virtual ~Stencilbuffer(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 340 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 341 | private: |
| 342 | DISALLOW_COPY_AND_ASSIGN(Stencilbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 343 | }; |
| 344 | } |
| 345 | |
| 346 | #endif // LIBGLESV2_RENDERBUFFER_H_ |