daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1 | // |
daniel@transgaming.com | bdfb391 | 2012-10-31 19:55:21 +0000 | [diff] [blame^] | 2 | // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 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 | // Renderbuffer.cpp: the gl::Renderbuffer class and its derived classes |
| 8 | // Colorbuffer, Depthbuffer and Stencilbuffer. Implements GL renderbuffer |
| 9 | // objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108. |
| 10 | |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 11 | #include "libGLESv2/Renderbuffer.h" |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 12 | |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 13 | #include "libGLESv2/main.h" |
enne@chromium.org | 0fa7463 | 2010-09-21 16:18:52 +0000 | [diff] [blame] | 14 | #include "libGLESv2/Texture.h" |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 15 | #include "libGLESv2/utilities.h" |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 16 | |
daniel@transgaming.com | d8e3656 | 2012-10-31 19:52:19 +0000 | [diff] [blame] | 17 | #include "libGLESv2/renderer/renderer9_utils.h" // D3D9_REPLACE |
| 18 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 19 | namespace gl |
| 20 | { |
daniel@transgaming.com | fbc3952 | 2011-11-11 04:10:28 +0000 | [diff] [blame] | 21 | unsigned int RenderbufferStorage::mCurrentSerial = 1; |
daniel@transgaming.com | 092bd48 | 2010-05-12 03:39:36 +0000 | [diff] [blame] | 22 | |
daniel@transgaming.com | fbc3952 | 2011-11-11 04:10:28 +0000 | [diff] [blame] | 23 | RenderbufferInterface::RenderbufferInterface() |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 24 | { |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 25 | } |
| 26 | |
daniel@transgaming.com | 2678b34 | 2012-01-18 16:29:40 +0000 | [diff] [blame] | 27 | // The default case for classes inherited from RenderbufferInterface is not to |
| 28 | // need to do anything upon the reference count to the parent Renderbuffer incrementing |
| 29 | // or decrementing. |
| 30 | void RenderbufferInterface::addProxyRef(const Renderbuffer *proxy) |
| 31 | { |
| 32 | } |
| 33 | |
| 34 | void RenderbufferInterface::releaseProxy(const Renderbuffer *proxy) |
| 35 | { |
| 36 | } |
| 37 | |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 38 | GLuint RenderbufferInterface::getRedSize() const |
| 39 | { |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 40 | return gl::GetRedSize(getActualFormat()); |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | GLuint RenderbufferInterface::getGreenSize() const |
| 44 | { |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 45 | return gl::GetGreenSize(getActualFormat()); |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | GLuint RenderbufferInterface::getBlueSize() const |
| 49 | { |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 50 | return gl::GetBlueSize(getActualFormat()); |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | GLuint RenderbufferInterface::getAlphaSize() const |
| 54 | { |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 55 | return gl::GetAlphaSize(getActualFormat()); |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 56 | } |
| 57 | |
| 58 | GLuint RenderbufferInterface::getDepthSize() const |
| 59 | { |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 60 | return gl::GetDepthSize(getActualFormat()); |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | GLuint RenderbufferInterface::getStencilSize() const |
| 64 | { |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 65 | return gl::GetStencilSize(getActualFormat()); |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 66 | } |
| 67 | |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 68 | ///// RenderbufferTexture2D Implementation //////// |
| 69 | |
| 70 | RenderbufferTexture2D::RenderbufferTexture2D(Texture2D *texture, GLenum target) : mTarget(target) |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 71 | { |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 72 | mTexture2D.set(texture); |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 73 | } |
| 74 | |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 75 | RenderbufferTexture2D::~RenderbufferTexture2D() |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 76 | { |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 77 | mTexture2D.set(NULL); |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 78 | } |
| 79 | |
daniel@transgaming.com | 2678b34 | 2012-01-18 16:29:40 +0000 | [diff] [blame] | 80 | // Textures need to maintain their own reference count for references via |
| 81 | // Renderbuffers acting as proxies. Here, we notify the texture of a reference. |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 82 | void RenderbufferTexture2D::addProxyRef(const Renderbuffer *proxy) |
daniel@transgaming.com | 2678b34 | 2012-01-18 16:29:40 +0000 | [diff] [blame] | 83 | { |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 84 | mTexture2D->addProxyRef(proxy); |
daniel@transgaming.com | 2678b34 | 2012-01-18 16:29:40 +0000 | [diff] [blame] | 85 | } |
| 86 | |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 87 | void RenderbufferTexture2D::releaseProxy(const Renderbuffer *proxy) |
daniel@transgaming.com | 2678b34 | 2012-01-18 16:29:40 +0000 | [diff] [blame] | 88 | { |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 89 | mTexture2D->releaseProxy(proxy); |
daniel@transgaming.com | 2678b34 | 2012-01-18 16:29:40 +0000 | [diff] [blame] | 90 | } |
| 91 | |
daniel@transgaming.com | 63e6afe | 2012-05-31 01:14:42 +0000 | [diff] [blame] | 92 | // Increments refcount on surface. |
| 93 | // caller must Release() the returned surface |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 94 | IDirect3DSurface9 *RenderbufferTexture2D::getRenderTarget() |
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 | return mTexture2D->getRenderTarget(mTarget); |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 97 | } |
| 98 | |
daniel@transgaming.com | 63e6afe | 2012-05-31 01:14:42 +0000 | [diff] [blame] | 99 | // Increments refcount on surface. |
| 100 | // caller must Release() the returned surface |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 101 | IDirect3DSurface9 *RenderbufferTexture2D::getDepthStencil() |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 102 | { |
daniel@transgaming.com | 68145c6 | 2012-05-31 01:14:46 +0000 | [diff] [blame] | 103 | return mTexture2D->getDepthStencil(mTarget); |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 104 | } |
| 105 | |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 106 | GLsizei RenderbufferTexture2D::getWidth() const |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 107 | { |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 108 | return mTexture2D->getWidth(0); |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 109 | } |
daniel@transgaming.com | fbc3952 | 2011-11-11 04:10:28 +0000 | [diff] [blame] | 110 | |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 111 | GLsizei RenderbufferTexture2D::getHeight() const |
daniel@transgaming.com | fbc3952 | 2011-11-11 04:10:28 +0000 | [diff] [blame] | 112 | { |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 113 | return mTexture2D->getHeight(0); |
daniel@transgaming.com | fbc3952 | 2011-11-11 04:10:28 +0000 | [diff] [blame] | 114 | } |
| 115 | |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 116 | GLenum RenderbufferTexture2D::getInternalFormat() const |
| 117 | { |
daniel@transgaming.com | 92f4992 | 2012-05-09 15:49:19 +0000 | [diff] [blame] | 118 | return mTexture2D->getInternalFormat(0); |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 119 | } |
| 120 | |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 121 | GLenum RenderbufferTexture2D::getActualFormat() const |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 122 | { |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 123 | return mTexture2D->getActualFormat(0); |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 124 | } |
| 125 | |
| 126 | GLsizei RenderbufferTexture2D::getSamples() const |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 127 | { |
| 128 | return 0; |
| 129 | } |
| 130 | |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 131 | unsigned int RenderbufferTexture2D::getSerial() const |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 132 | { |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 133 | return mTexture2D->getRenderTargetSerial(mTarget); |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 134 | } |
| 135 | |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 136 | ///// RenderbufferTextureCubeMap Implementation //////// |
| 137 | |
| 138 | RenderbufferTextureCubeMap::RenderbufferTextureCubeMap(TextureCubeMap *texture, GLenum target) : mTarget(target) |
| 139 | { |
| 140 | mTextureCubeMap.set(texture); |
| 141 | } |
| 142 | |
| 143 | RenderbufferTextureCubeMap::~RenderbufferTextureCubeMap() |
| 144 | { |
| 145 | mTextureCubeMap.set(NULL); |
| 146 | } |
| 147 | |
| 148 | // Textures need to maintain their own reference count for references via |
| 149 | // Renderbuffers acting as proxies. Here, we notify the texture of a reference. |
| 150 | void RenderbufferTextureCubeMap::addProxyRef(const Renderbuffer *proxy) |
| 151 | { |
| 152 | mTextureCubeMap->addProxyRef(proxy); |
| 153 | } |
| 154 | |
| 155 | void RenderbufferTextureCubeMap::releaseProxy(const Renderbuffer *proxy) |
| 156 | { |
| 157 | mTextureCubeMap->releaseProxy(proxy); |
| 158 | } |
| 159 | |
daniel@transgaming.com | 63e6afe | 2012-05-31 01:14:42 +0000 | [diff] [blame] | 160 | // Increments refcount on surface. |
| 161 | // caller must Release() the returned surface |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 162 | IDirect3DSurface9 *RenderbufferTextureCubeMap::getRenderTarget() |
| 163 | { |
| 164 | return mTextureCubeMap->getRenderTarget(mTarget); |
| 165 | } |
| 166 | |
daniel@transgaming.com | 63e6afe | 2012-05-31 01:14:42 +0000 | [diff] [blame] | 167 | // Increments refcount on surface. |
| 168 | // caller must Release() the returned surface |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 169 | IDirect3DSurface9 *RenderbufferTextureCubeMap::getDepthStencil() |
| 170 | { |
| 171 | return NULL; |
| 172 | } |
| 173 | |
| 174 | GLsizei RenderbufferTextureCubeMap::getWidth() const |
| 175 | { |
daniel@transgaming.com | 4df88e8 | 2012-05-09 15:49:24 +0000 | [diff] [blame] | 176 | return mTextureCubeMap->getWidth(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0); |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | GLsizei RenderbufferTextureCubeMap::getHeight() const |
| 180 | { |
daniel@transgaming.com | 4df88e8 | 2012-05-09 15:49:24 +0000 | [diff] [blame] | 181 | return mTextureCubeMap->getHeight(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0); |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | GLenum RenderbufferTextureCubeMap::getInternalFormat() const |
| 185 | { |
daniel@transgaming.com | 4df88e8 | 2012-05-09 15:49:24 +0000 | [diff] [blame] | 186 | return mTextureCubeMap->getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0); |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 187 | } |
| 188 | |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 189 | GLenum RenderbufferTextureCubeMap::getActualFormat() const |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 190 | { |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 191 | return mTextureCubeMap->getActualFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0); |
daniel@transgaming.com | 46f2d0a | 2012-05-09 15:49:06 +0000 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | GLsizei RenderbufferTextureCubeMap::getSamples() const |
| 195 | { |
| 196 | return 0; |
| 197 | } |
| 198 | |
| 199 | unsigned int RenderbufferTextureCubeMap::getSerial() const |
| 200 | { |
| 201 | return mTextureCubeMap->getRenderTargetSerial(mTarget); |
| 202 | } |
| 203 | |
| 204 | ////// Renderbuffer Implementation ////// |
| 205 | |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 206 | Renderbuffer::Renderbuffer(GLuint id, RenderbufferInterface *instance) : RefCountObject(id) |
| 207 | { |
| 208 | ASSERT(instance != NULL); |
| 209 | mInstance = instance; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | Renderbuffer::~Renderbuffer() |
| 213 | { |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 214 | delete mInstance; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 215 | } |
| 216 | |
daniel@transgaming.com | 2678b34 | 2012-01-18 16:29:40 +0000 | [diff] [blame] | 217 | // The RenderbufferInterface contained in this Renderbuffer may need to maintain |
| 218 | // its own reference count, so we pass it on here. |
| 219 | void Renderbuffer::addRef() const |
| 220 | { |
| 221 | mInstance->addProxyRef(this); |
| 222 | |
| 223 | RefCountObject::addRef(); |
| 224 | } |
| 225 | |
| 226 | void Renderbuffer::release() const |
| 227 | { |
| 228 | mInstance->releaseProxy(this); |
| 229 | |
| 230 | RefCountObject::release(); |
| 231 | } |
| 232 | |
daniel@transgaming.com | 63e6afe | 2012-05-31 01:14:42 +0000 | [diff] [blame] | 233 | // Increments refcount on surface. |
| 234 | // caller must Release() the returned surface |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 235 | IDirect3DSurface9 *Renderbuffer::getRenderTarget() |
| 236 | { |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 237 | return mInstance->getRenderTarget(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 238 | } |
| 239 | |
daniel@transgaming.com | 63e6afe | 2012-05-31 01:14:42 +0000 | [diff] [blame] | 240 | // Increments refcount on surface. |
| 241 | // caller must Release() the returned surface |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 242 | IDirect3DSurface9 *Renderbuffer::getDepthStencil() |
| 243 | { |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 244 | return mInstance->getDepthStencil(); |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 245 | } |
| 246 | |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 247 | GLsizei Renderbuffer::getWidth() const |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 248 | { |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 249 | return mInstance->getWidth(); |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 250 | } |
| 251 | |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 252 | GLsizei Renderbuffer::getHeight() const |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 253 | { |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 254 | return mInstance->getHeight(); |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 255 | } |
| 256 | |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 257 | GLenum Renderbuffer::getInternalFormat() const |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 258 | { |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 259 | return mInstance->getInternalFormat(); |
| 260 | } |
| 261 | |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 262 | GLenum Renderbuffer::getActualFormat() const |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 263 | { |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 264 | return mInstance->getActualFormat(); |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 265 | } |
| 266 | |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 267 | GLuint Renderbuffer::getRedSize() const |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 268 | { |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 269 | return mInstance->getRedSize(); |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 270 | } |
| 271 | |
| 272 | GLuint Renderbuffer::getGreenSize() const |
| 273 | { |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 274 | return mInstance->getGreenSize(); |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 275 | } |
| 276 | |
| 277 | GLuint Renderbuffer::getBlueSize() const |
| 278 | { |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 279 | return mInstance->getBlueSize(); |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 280 | } |
| 281 | |
| 282 | GLuint Renderbuffer::getAlphaSize() const |
| 283 | { |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 284 | return mInstance->getAlphaSize(); |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 285 | } |
| 286 | |
| 287 | GLuint Renderbuffer::getDepthSize() const |
| 288 | { |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 289 | return mInstance->getDepthSize(); |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 290 | } |
| 291 | |
| 292 | GLuint Renderbuffer::getStencilSize() const |
| 293 | { |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 294 | return mInstance->getStencilSize(); |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 295 | } |
| 296 | |
| 297 | GLsizei Renderbuffer::getSamples() const |
| 298 | { |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 299 | return mInstance->getSamples(); |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 300 | } |
| 301 | |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 302 | unsigned int Renderbuffer::getSerial() const |
| 303 | { |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 304 | return mInstance->getSerial(); |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | void Renderbuffer::setStorage(RenderbufferStorage *newStorage) |
| 308 | { |
| 309 | ASSERT(newStorage != NULL); |
| 310 | |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 311 | delete mInstance; |
| 312 | mInstance = newStorage; |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 313 | } |
| 314 | |
daniel@transgaming.com | fbc3952 | 2011-11-11 04:10:28 +0000 | [diff] [blame] | 315 | RenderbufferStorage::RenderbufferStorage() : mSerial(issueSerial()) |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 316 | { |
daniel@transgaming.com | 73a5db6 | 2010-10-15 17:58:13 +0000 | [diff] [blame] | 317 | mWidth = 0; |
| 318 | mHeight = 0; |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 319 | mInternalFormat = GL_RGBA4; |
daniel@transgaming.com | 73a5db6 | 2010-10-15 17:58:13 +0000 | [diff] [blame] | 320 | mD3DFormat = D3DFMT_A8R8G8B8; |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 321 | mActualFormat = GL_RGBA8_OES; |
daniel@transgaming.com | 73a5db6 | 2010-10-15 17:58:13 +0000 | [diff] [blame] | 322 | mSamples = 0; |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 323 | } |
| 324 | |
| 325 | RenderbufferStorage::~RenderbufferStorage() |
| 326 | { |
| 327 | } |
| 328 | |
daniel@transgaming.com | 63e6afe | 2012-05-31 01:14:42 +0000 | [diff] [blame] | 329 | // Increments refcount on surface. |
| 330 | // caller must Release() the returned surface |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 331 | IDirect3DSurface9 *RenderbufferStorage::getRenderTarget() |
| 332 | { |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 333 | return NULL; |
| 334 | } |
| 335 | |
daniel@transgaming.com | 63e6afe | 2012-05-31 01:14:42 +0000 | [diff] [blame] | 336 | // Increments refcount on surface. |
| 337 | // caller must Release() the returned surface |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 338 | IDirect3DSurface9 *RenderbufferStorage::getDepthStencil() |
| 339 | { |
| 340 | return NULL; |
| 341 | } |
| 342 | |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 343 | GLsizei RenderbufferStorage::getWidth() const |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 344 | { |
| 345 | return mWidth; |
| 346 | } |
| 347 | |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 348 | GLsizei RenderbufferStorage::getHeight() const |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 349 | { |
| 350 | return mHeight; |
| 351 | } |
| 352 | |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 353 | GLenum RenderbufferStorage::getInternalFormat() const |
daniel@transgaming.com | 866f318 | 2010-05-20 19:28:22 +0000 | [diff] [blame] | 354 | { |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 355 | return mInternalFormat; |
daniel@transgaming.com | 866f318 | 2010-05-20 19:28:22 +0000 | [diff] [blame] | 356 | } |
| 357 | |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 358 | GLenum RenderbufferStorage::getActualFormat() const |
daniel@transgaming.com | fbc3952 | 2011-11-11 04:10:28 +0000 | [diff] [blame] | 359 | { |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 360 | return mActualFormat; |
daniel@transgaming.com | fbc3952 | 2011-11-11 04:10:28 +0000 | [diff] [blame] | 361 | } |
| 362 | |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 363 | GLsizei RenderbufferStorage::getSamples() const |
| 364 | { |
| 365 | return mSamples; |
| 366 | } |
| 367 | |
daniel@transgaming.com | fbc3952 | 2011-11-11 04:10:28 +0000 | [diff] [blame] | 368 | unsigned int RenderbufferStorage::getSerial() const |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 369 | { |
daniel@transgaming.com | fbc3952 | 2011-11-11 04:10:28 +0000 | [diff] [blame] | 370 | return mSerial; |
| 371 | } |
| 372 | |
| 373 | unsigned int RenderbufferStorage::issueSerial() |
| 374 | { |
| 375 | return mCurrentSerial++; |
| 376 | } |
| 377 | |
| 378 | unsigned int RenderbufferStorage::issueCubeSerials() |
| 379 | { |
| 380 | unsigned int firstSerial = mCurrentSerial; |
| 381 | mCurrentSerial += 6; |
| 382 | return firstSerial; |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 383 | } |
| 384 | |
daniel@transgaming.com | 96c3893 | 2012-10-31 18:42:52 +0000 | [diff] [blame] | 385 | Colorbuffer::Colorbuffer(renderer::SwapChain *swapChain) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 386 | { |
daniel@transgaming.com | 96c3893 | 2012-10-31 18:42:52 +0000 | [diff] [blame] | 387 | mRenderTarget = swapChain->getRenderTarget(); |
| 388 | if (mRenderTarget) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 389 | { |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 390 | D3DSURFACE_DESC description; |
daniel@transgaming.com | 96c3893 | 2012-10-31 18:42:52 +0000 | [diff] [blame] | 391 | mRenderTarget->GetDesc(&description); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 392 | |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 393 | mWidth = description.Width; |
| 394 | mHeight = description.Height; |
| 395 | mInternalFormat = dx2es::ConvertBackBufferFormat(description.Format); |
daniel@transgaming.com | ca7c008 | 2010-08-24 19:20:20 +0000 | [diff] [blame] | 396 | mD3DFormat = description.Format; |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 397 | mActualFormat = dx2es::GetEquivalentFormat(mD3DFormat); |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 398 | mSamples = dx2es::GetSamplesFromMultisampleType(description.MultiSampleType); |
daniel@transgaming.com | ca7c008 | 2010-08-24 19:20:20 +0000 | [diff] [blame] | 399 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 400 | } |
| 401 | |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 402 | Colorbuffer::Colorbuffer(int width, int height, GLenum format, GLsizei samples) : mRenderTarget(NULL) |
daniel@transgaming.com | 70d312a | 2010-04-20 18:52:38 +0000 | [diff] [blame] | 403 | { |
daniel@transgaming.com | bdfb391 | 2012-10-31 19:55:21 +0000 | [diff] [blame^] | 404 | renderer::Renderer9 *renderer = getDisplay()->getRenderer9(); |
daniel@transgaming.com | 06eef17 | 2012-10-31 18:31:50 +0000 | [diff] [blame] | 405 | IDirect3DDevice9 *device = renderer->getDevice(); // D3D9_REPLACE |
daniel@transgaming.com | 70d312a | 2010-04-20 18:52:38 +0000 | [diff] [blame] | 406 | |
daniel@transgaming.com | ca7c008 | 2010-08-24 19:20:20 +0000 | [diff] [blame] | 407 | D3DFORMAT requestedFormat = es2dx::ConvertRenderbufferFormat(format); |
daniel@transgaming.com | 06eef17 | 2012-10-31 18:31:50 +0000 | [diff] [blame] | 408 | int supportedSamples = renderer->getNearestSupportedSamples(requestedFormat, samples); |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 409 | |
| 410 | if (supportedSamples == -1) |
| 411 | { |
| 412 | error(GL_OUT_OF_MEMORY); |
| 413 | |
| 414 | return; |
| 415 | } |
daniel@transgaming.com | 70d312a | 2010-04-20 18:52:38 +0000 | [diff] [blame] | 416 | |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 417 | if (width > 0 && height > 0) |
daniel@transgaming.com | 70d312a | 2010-04-20 18:52:38 +0000 | [diff] [blame] | 418 | { |
daniel@transgaming.com | ca7c008 | 2010-08-24 19:20:20 +0000 | [diff] [blame] | 419 | HRESULT result = device->CreateRenderTarget(width, height, requestedFormat, |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 420 | es2dx::GetMultisampleTypeFromSamples(supportedSamples), 0, FALSE, &mRenderTarget, NULL); |
daniel@transgaming.com | 70d312a | 2010-04-20 18:52:38 +0000 | [diff] [blame] | 421 | |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 422 | if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY) |
| 423 | { |
| 424 | error(GL_OUT_OF_MEMORY); |
| 425 | |
| 426 | return; |
| 427 | } |
| 428 | |
| 429 | ASSERT(SUCCEEDED(result)); |
daniel@transgaming.com | 70d312a | 2010-04-20 18:52:38 +0000 | [diff] [blame] | 430 | } |
| 431 | |
apatrick@chromium.org | 831fe2a | 2011-03-17 18:44:29 +0000 | [diff] [blame] | 432 | mWidth = width; |
| 433 | mHeight = height; |
| 434 | mInternalFormat = format; |
| 435 | mD3DFormat = requestedFormat; |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 436 | mActualFormat = dx2es::GetEquivalentFormat(mD3DFormat); |
apatrick@chromium.org | 831fe2a | 2011-03-17 18:44:29 +0000 | [diff] [blame] | 437 | mSamples = supportedSamples; |
daniel@transgaming.com | 70d312a | 2010-04-20 18:52:38 +0000 | [diff] [blame] | 438 | } |
| 439 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 440 | Colorbuffer::~Colorbuffer() |
| 441 | { |
| 442 | if (mRenderTarget) |
| 443 | { |
| 444 | mRenderTarget->Release(); |
| 445 | } |
| 446 | } |
| 447 | |
daniel@transgaming.com | 63e6afe | 2012-05-31 01:14:42 +0000 | [diff] [blame] | 448 | // Increments refcount on surface. |
| 449 | // caller must Release() the returned surface |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 450 | IDirect3DSurface9 *Colorbuffer::getRenderTarget() |
| 451 | { |
daniel@transgaming.com | 5e4dbb3 | 2011-11-11 04:10:18 +0000 | [diff] [blame] | 452 | if (mRenderTarget) |
| 453 | { |
| 454 | mRenderTarget->AddRef(); |
| 455 | } |
| 456 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 457 | return mRenderTarget; |
| 458 | } |
| 459 | |
daniel@transgaming.com | 024786d | 2012-10-31 18:42:55 +0000 | [diff] [blame] | 460 | DepthStencilbuffer::DepthStencilbuffer(renderer::SwapChain *swapChain) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 461 | { |
daniel@transgaming.com | 024786d | 2012-10-31 18:42:55 +0000 | [diff] [blame] | 462 | mDepthStencil = swapChain->getDepthStencil(); |
| 463 | if (mDepthStencil) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 464 | { |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 465 | D3DSURFACE_DESC description; |
daniel@transgaming.com | 024786d | 2012-10-31 18:42:55 +0000 | [diff] [blame] | 466 | mDepthStencil->GetDesc(&description); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 467 | |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 468 | mWidth = description.Width; |
| 469 | mHeight = description.Height; |
| 470 | mInternalFormat = dx2es::ConvertDepthStencilFormat(description.Format); |
| 471 | mSamples = dx2es::GetSamplesFromMultisampleType(description.MultiSampleType); |
daniel@transgaming.com | ca7c008 | 2010-08-24 19:20:20 +0000 | [diff] [blame] | 472 | mD3DFormat = description.Format; |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 473 | mActualFormat = dx2es::GetEquivalentFormat(mD3DFormat); |
daniel@transgaming.com | ca7c008 | 2010-08-24 19:20:20 +0000 | [diff] [blame] | 474 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 475 | } |
| 476 | |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 477 | DepthStencilbuffer::DepthStencilbuffer(int width, int height, GLsizei samples) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 478 | { |
daniel@transgaming.com | bdfb391 | 2012-10-31 19:55:21 +0000 | [diff] [blame^] | 479 | renderer::Renderer9 *renderer = getDisplay()->getRenderer9(); |
daniel@transgaming.com | 06eef17 | 2012-10-31 18:31:50 +0000 | [diff] [blame] | 480 | IDirect3DDevice9 *device = renderer->getDevice(); // D3D9_REPLACE |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 481 | |
| 482 | mDepthStencil = NULL; |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 483 | |
daniel@transgaming.com | 06eef17 | 2012-10-31 18:31:50 +0000 | [diff] [blame] | 484 | int supportedSamples = renderer->getNearestSupportedSamples(D3DFMT_D24S8, samples); |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 485 | |
| 486 | if (supportedSamples == -1) |
| 487 | { |
| 488 | error(GL_OUT_OF_MEMORY); |
| 489 | |
| 490 | return; |
| 491 | } |
| 492 | |
apatrick@chromium.org | 831fe2a | 2011-03-17 18:44:29 +0000 | [diff] [blame] | 493 | if (width > 0 && height > 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 494 | { |
apatrick@chromium.org | 831fe2a | 2011-03-17 18:44:29 +0000 | [diff] [blame] | 495 | HRESULT result = device->CreateDepthStencilSurface(width, height, D3DFMT_D24S8, es2dx::GetMultisampleTypeFromSamples(supportedSamples), |
| 496 | 0, FALSE, &mDepthStencil, 0); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 497 | |
apatrick@chromium.org | 831fe2a | 2011-03-17 18:44:29 +0000 | [diff] [blame] | 498 | if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY) |
| 499 | { |
| 500 | error(GL_OUT_OF_MEMORY); |
| 501 | |
| 502 | return; |
| 503 | } |
| 504 | |
| 505 | ASSERT(SUCCEEDED(result)); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 506 | } |
| 507 | |
apatrick@chromium.org | 831fe2a | 2011-03-17 18:44:29 +0000 | [diff] [blame] | 508 | mWidth = width; |
| 509 | mHeight = height; |
| 510 | mInternalFormat = GL_DEPTH24_STENCIL8_OES; |
| 511 | mD3DFormat = D3DFMT_D24S8; |
daniel@transgaming.com | 20d3666 | 2012-10-31 19:51:43 +0000 | [diff] [blame] | 512 | mActualFormat = GL_DEPTH24_STENCIL8_OES; |
apatrick@chromium.org | 831fe2a | 2011-03-17 18:44:29 +0000 | [diff] [blame] | 513 | mSamples = supportedSamples; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 514 | } |
| 515 | |
daniel@transgaming.com | cdacc8e | 2010-07-28 19:20:50 +0000 | [diff] [blame] | 516 | DepthStencilbuffer::~DepthStencilbuffer() |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 517 | { |
| 518 | if (mDepthStencil) |
| 519 | { |
| 520 | mDepthStencil->Release(); |
| 521 | } |
| 522 | } |
| 523 | |
daniel@transgaming.com | 63e6afe | 2012-05-31 01:14:42 +0000 | [diff] [blame] | 524 | // Increments refcount on surface. |
| 525 | // caller must Release() the returned surface |
daniel@transgaming.com | cdacc8e | 2010-07-28 19:20:50 +0000 | [diff] [blame] | 526 | IDirect3DSurface9 *DepthStencilbuffer::getDepthStencil() |
| 527 | { |
daniel@transgaming.com | 63e6afe | 2012-05-31 01:14:42 +0000 | [diff] [blame] | 528 | if (mDepthStencil) |
| 529 | { |
| 530 | mDepthStencil->AddRef(); |
| 531 | } |
| 532 | |
daniel@transgaming.com | cdacc8e | 2010-07-28 19:20:50 +0000 | [diff] [blame] | 533 | return mDepthStencil; |
| 534 | } |
| 535 | |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 536 | Depthbuffer::Depthbuffer(int width, int height, GLsizei samples) : DepthStencilbuffer(width, height, samples) |
daniel@transgaming.com | cdacc8e | 2010-07-28 19:20:50 +0000 | [diff] [blame] | 537 | { |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 538 | if (mDepthStencil) |
daniel@transgaming.com | cdacc8e | 2010-07-28 19:20:50 +0000 | [diff] [blame] | 539 | { |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 540 | mInternalFormat = GL_DEPTH_COMPONENT16; // If the renderbuffer parameters are queried, the calling function |
| 541 | // will expect one of the valid renderbuffer formats for use in |
| 542 | // glRenderbufferStorage |
daniel@transgaming.com | cdacc8e | 2010-07-28 19:20:50 +0000 | [diff] [blame] | 543 | } |
| 544 | } |
| 545 | |
| 546 | Depthbuffer::~Depthbuffer() |
| 547 | { |
| 548 | } |
| 549 | |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 550 | Stencilbuffer::Stencilbuffer(int width, int height, GLsizei samples) : DepthStencilbuffer(width, height, samples) |
daniel@transgaming.com | cdacc8e | 2010-07-28 19:20:50 +0000 | [diff] [blame] | 551 | { |
daniel@transgaming.com | d14558a | 2011-11-09 17:46:18 +0000 | [diff] [blame] | 552 | if (mDepthStencil) |
daniel@transgaming.com | cdacc8e | 2010-07-28 19:20:50 +0000 | [diff] [blame] | 553 | { |
daniel@transgaming.com | d2fd4f2 | 2011-02-01 18:49:11 +0000 | [diff] [blame] | 554 | mInternalFormat = GL_STENCIL_INDEX8; // If the renderbuffer parameters are queried, the calling function |
| 555 | // will expect one of the valid renderbuffer formats for use in |
| 556 | // glRenderbufferStorage |
daniel@transgaming.com | cdacc8e | 2010-07-28 19:20:50 +0000 | [diff] [blame] | 557 | } |
| 558 | } |
| 559 | |
| 560 | Stencilbuffer::~Stencilbuffer() |
| 561 | { |
| 562 | } |
| 563 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 564 | } |