Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 1 | #include "precompiled.h" |
| 2 | // |
| 3 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. |
| 4 | // Use of this source code is governed by a BSD-style license that can be |
| 5 | // found in the LICENSE file. |
| 6 | // |
| 7 | |
| 8 | // FramebufferAttachment.cpp: the gl::FramebufferAttachment class and its derived classes |
| 9 | // objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108. |
| 10 | |
| 11 | #include "libGLESv2/FramebufferAttachment.h" |
| 12 | #include "libGLESv2/renderer/RenderTarget.h" |
| 13 | |
| 14 | #include "libGLESv2/Texture.h" |
| 15 | #include "libGLESv2/renderer/Renderer.h" |
| 16 | #include "libGLESv2/renderer/TextureStorage.h" |
| 17 | #include "common/utilities.h" |
| 18 | #include "libGLESv2/formatutils.h" |
| 19 | #include "libGLESv2/Renderbuffer.h" |
| 20 | |
| 21 | namespace gl |
| 22 | { |
| 23 | |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 24 | ////// FramebufferAttachment Implementation ////// |
| 25 | |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame^] | 26 | FramebufferAttachment::FramebufferAttachment() |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 27 | { |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | FramebufferAttachment::~FramebufferAttachment() |
| 31 | { |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 32 | } |
| 33 | |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 34 | GLuint FramebufferAttachment::getRedSize(int clientVersion) const |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 35 | { |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 36 | if (gl::GetRedBits(getInternalFormat(), clientVersion) > 0) |
Geoff Lang | b6a673a | 2014-06-05 14:19:16 -0400 | [diff] [blame] | 37 | { |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 38 | return gl::GetRedBits(getActualFormat(), clientVersion); |
Geoff Lang | b6a673a | 2014-06-05 14:19:16 -0400 | [diff] [blame] | 39 | } |
| 40 | else |
| 41 | { |
| 42 | return 0; |
| 43 | } |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 44 | } |
| 45 | |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 46 | GLuint FramebufferAttachment::getGreenSize(int clientVersion) const |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 47 | { |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 48 | if (gl::GetGreenBits(getInternalFormat(), clientVersion) > 0) |
Geoff Lang | b6a673a | 2014-06-05 14:19:16 -0400 | [diff] [blame] | 49 | { |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 50 | return gl::GetGreenBits(getActualFormat(), clientVersion); |
Geoff Lang | b6a673a | 2014-06-05 14:19:16 -0400 | [diff] [blame] | 51 | } |
| 52 | else |
| 53 | { |
| 54 | return 0; |
| 55 | } |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 56 | } |
| 57 | |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 58 | GLuint FramebufferAttachment::getBlueSize(int clientVersion) const |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 59 | { |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 60 | if (gl::GetBlueBits(getInternalFormat(), clientVersion) > 0) |
Geoff Lang | b6a673a | 2014-06-05 14:19:16 -0400 | [diff] [blame] | 61 | { |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 62 | return gl::GetBlueBits(getActualFormat(), clientVersion); |
Geoff Lang | b6a673a | 2014-06-05 14:19:16 -0400 | [diff] [blame] | 63 | } |
| 64 | else |
| 65 | { |
| 66 | return 0; |
| 67 | } |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 68 | } |
| 69 | |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 70 | GLuint FramebufferAttachment::getAlphaSize(int clientVersion) const |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 71 | { |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 72 | if (gl::GetAlphaBits(getInternalFormat(), clientVersion) > 0) |
Geoff Lang | b6a673a | 2014-06-05 14:19:16 -0400 | [diff] [blame] | 73 | { |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 74 | return gl::GetAlphaBits(getActualFormat(), clientVersion); |
Geoff Lang | b6a673a | 2014-06-05 14:19:16 -0400 | [diff] [blame] | 75 | } |
| 76 | else |
| 77 | { |
| 78 | return 0; |
| 79 | } |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 80 | } |
| 81 | |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 82 | GLuint FramebufferAttachment::getDepthSize(int clientVersion) const |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 83 | { |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 84 | if (gl::GetDepthBits(getInternalFormat(), clientVersion) > 0) |
Geoff Lang | b6a673a | 2014-06-05 14:19:16 -0400 | [diff] [blame] | 85 | { |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 86 | return gl::GetDepthBits(getActualFormat(), clientVersion); |
Geoff Lang | b6a673a | 2014-06-05 14:19:16 -0400 | [diff] [blame] | 87 | } |
| 88 | else |
| 89 | { |
| 90 | return 0; |
| 91 | } |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 92 | } |
| 93 | |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 94 | GLuint FramebufferAttachment::getStencilSize(int clientVersion) const |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 95 | { |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 96 | if (gl::GetStencilBits(getInternalFormat(), clientVersion) > 0) |
Geoff Lang | b6a673a | 2014-06-05 14:19:16 -0400 | [diff] [blame] | 97 | { |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 98 | return gl::GetStencilBits(getActualFormat(), clientVersion); |
Geoff Lang | b6a673a | 2014-06-05 14:19:16 -0400 | [diff] [blame] | 99 | } |
| 100 | else |
| 101 | { |
| 102 | return 0; |
| 103 | } |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 104 | } |
| 105 | |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 106 | GLenum FramebufferAttachment::getComponentType(int clientVersion) const |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 107 | { |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 108 | return gl::GetComponentType(getActualFormat(), clientVersion); |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 109 | } |
| 110 | |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 111 | GLenum FramebufferAttachment::getColorEncoding(int clientVersion) const |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 112 | { |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 113 | return gl::GetColorEncoding(getActualFormat(), clientVersion); |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 114 | } |
| 115 | |
Jamie Madill | 218b6ed | 2014-06-16 10:34:01 -0400 | [diff] [blame] | 116 | bool FramebufferAttachment::isTexture() const |
| 117 | { |
| 118 | return (type() != GL_RENDERBUFFER); |
| 119 | } |
| 120 | |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame^] | 121 | ///// Texture2DAttachment Implementation //////// |
| 122 | |
| 123 | Texture2DAttachment::Texture2DAttachment(Texture2D *texture, GLint level) : mLevel(level) |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 124 | { |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame^] | 125 | mTexture2D.set(texture); |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 126 | } |
| 127 | |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame^] | 128 | Texture2DAttachment::~Texture2DAttachment() |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 129 | { |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame^] | 130 | mTexture2D.set(NULL); |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 131 | } |
| 132 | |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame^] | 133 | rx::RenderTarget *Texture2DAttachment::getRenderTarget() |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 134 | { |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame^] | 135 | return mTexture2D->getRenderTarget(mLevel); |
Jamie Madill | 218b6ed | 2014-06-16 10:34:01 -0400 | [diff] [blame] | 136 | } |
| 137 | |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame^] | 138 | rx::RenderTarget *Texture2DAttachment::getDepthStencil() |
Jamie Madill | 218b6ed | 2014-06-16 10:34:01 -0400 | [diff] [blame] | 139 | { |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame^] | 140 | return mTexture2D->getDepthSencil(mLevel); |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 141 | } |
| 142 | |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame^] | 143 | rx::TextureStorage *Texture2DAttachment::getTextureStorage() |
Jamie Madill | 9c074a3 | 2014-06-16 10:34:02 -0400 | [diff] [blame] | 144 | { |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame^] | 145 | return mTexture2D->getNativeTexture()->getStorageInstance(); |
Jamie Madill | 9c074a3 | 2014-06-16 10:34:02 -0400 | [diff] [blame] | 146 | } |
| 147 | |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame^] | 148 | GLsizei Texture2DAttachment::getWidth() const |
Jamie Madill | 9c074a3 | 2014-06-16 10:34:02 -0400 | [diff] [blame] | 149 | { |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame^] | 150 | return mTexture2D->getWidth(mLevel); |
Jamie Madill | 9c074a3 | 2014-06-16 10:34:02 -0400 | [diff] [blame] | 151 | } |
| 152 | |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame^] | 153 | GLsizei Texture2DAttachment::getHeight() const |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 154 | { |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame^] | 155 | return mTexture2D->getHeight(mLevel); |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 156 | } |
| 157 | |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame^] | 158 | GLenum Texture2DAttachment::getInternalFormat() const |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 159 | { |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame^] | 160 | return mTexture2D->getInternalFormat(mLevel); |
Jamie Madill | 6c7b4ad | 2014-06-16 10:33:59 -0400 | [diff] [blame] | 161 | } |
| 162 | |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame^] | 163 | GLenum Texture2DAttachment::getActualFormat() const |
| 164 | { |
| 165 | return mTexture2D->getActualFormat(mLevel); |
| 166 | } |
| 167 | |
| 168 | GLsizei Texture2DAttachment::getSamples() const |
| 169 | { |
| 170 | return 0; |
| 171 | } |
| 172 | |
| 173 | unsigned int Texture2DAttachment::getSerial() const |
| 174 | { |
| 175 | return mTexture2D->getRenderTargetSerial(mLevel); |
| 176 | } |
| 177 | |
| 178 | GLuint Texture2DAttachment::id() const |
| 179 | { |
| 180 | return mTexture2D->id(); |
| 181 | } |
| 182 | |
| 183 | GLenum Texture2DAttachment::type() const |
| 184 | { |
| 185 | return GL_TEXTURE_2D; |
| 186 | } |
| 187 | |
| 188 | GLint Texture2DAttachment::mipLevel() const |
| 189 | { |
| 190 | return mLevel; |
| 191 | } |
| 192 | |
| 193 | GLint Texture2DAttachment::layer() const |
| 194 | { |
| 195 | return 0; |
| 196 | } |
| 197 | |
| 198 | unsigned int Texture2DAttachment::getTextureSerial() const |
| 199 | { |
| 200 | return mTexture2D->getTextureSerial(); |
| 201 | } |
| 202 | |
| 203 | ///// TextureCubeMapAttachment Implementation //////// |
| 204 | |
| 205 | TextureCubeMapAttachment::TextureCubeMapAttachment(TextureCubeMap *texture, GLenum faceTarget, GLint level) |
| 206 | : mFaceTarget(faceTarget), mLevel(level) |
| 207 | { |
| 208 | mTextureCubeMap.set(texture); |
| 209 | } |
| 210 | |
| 211 | TextureCubeMapAttachment::~TextureCubeMapAttachment() |
| 212 | { |
| 213 | mTextureCubeMap.set(NULL); |
| 214 | } |
| 215 | |
| 216 | rx::RenderTarget *TextureCubeMapAttachment::getRenderTarget() |
| 217 | { |
| 218 | return mTextureCubeMap->getRenderTarget(mFaceTarget, mLevel); |
| 219 | } |
| 220 | |
| 221 | rx::RenderTarget *TextureCubeMapAttachment::getDepthStencil() |
| 222 | { |
| 223 | return mTextureCubeMap->getDepthStencil(mFaceTarget, mLevel); |
| 224 | } |
| 225 | |
| 226 | rx::TextureStorage *TextureCubeMapAttachment::getTextureStorage() |
| 227 | { |
| 228 | return mTextureCubeMap->getNativeTexture()->getStorageInstance(); |
| 229 | } |
| 230 | |
| 231 | GLsizei TextureCubeMapAttachment::getWidth() const |
| 232 | { |
| 233 | return mTextureCubeMap->getWidth(mFaceTarget, mLevel); |
| 234 | } |
| 235 | |
| 236 | GLsizei TextureCubeMapAttachment::getHeight() const |
| 237 | { |
| 238 | return mTextureCubeMap->getHeight(mFaceTarget, mLevel); |
| 239 | } |
| 240 | |
| 241 | GLenum TextureCubeMapAttachment::getInternalFormat() const |
| 242 | { |
| 243 | return mTextureCubeMap->getInternalFormat(mFaceTarget, mLevel); |
| 244 | } |
| 245 | |
| 246 | GLenum TextureCubeMapAttachment::getActualFormat() const |
| 247 | { |
| 248 | return mTextureCubeMap->getActualFormat(mFaceTarget, mLevel); |
| 249 | } |
| 250 | |
| 251 | GLsizei TextureCubeMapAttachment::getSamples() const |
| 252 | { |
| 253 | return 0; |
| 254 | } |
| 255 | |
| 256 | unsigned int TextureCubeMapAttachment::getSerial() const |
| 257 | { |
| 258 | return mTextureCubeMap->getRenderTargetSerial(mFaceTarget, mLevel); |
| 259 | } |
| 260 | |
| 261 | GLuint TextureCubeMapAttachment::id() const |
| 262 | { |
| 263 | return mTextureCubeMap->id(); |
| 264 | } |
| 265 | |
| 266 | GLenum TextureCubeMapAttachment::type() const |
| 267 | { |
| 268 | return mFaceTarget; |
| 269 | } |
| 270 | |
| 271 | GLint TextureCubeMapAttachment::mipLevel() const |
| 272 | { |
| 273 | return mLevel; |
| 274 | } |
| 275 | |
| 276 | GLint TextureCubeMapAttachment::layer() const |
| 277 | { |
| 278 | return 0; |
| 279 | } |
| 280 | |
| 281 | unsigned int TextureCubeMapAttachment::getTextureSerial() const |
| 282 | { |
| 283 | return mTextureCubeMap->getTextureSerial(); |
| 284 | } |
| 285 | |
| 286 | ///// Texture3DAttachment Implementation //////// |
| 287 | |
| 288 | Texture3DAttachment::Texture3DAttachment(Texture3D *texture, GLint level, GLint layer) |
| 289 | : mLevel(level), mLayer(layer) |
| 290 | { |
| 291 | mTexture3D.set(texture); |
| 292 | } |
| 293 | |
| 294 | Texture3DAttachment::~Texture3DAttachment() |
| 295 | { |
| 296 | mTexture3D.set(NULL); |
| 297 | } |
| 298 | |
| 299 | rx::RenderTarget *Texture3DAttachment::getRenderTarget() |
| 300 | { |
| 301 | return mTexture3D->getRenderTarget(mLevel, mLayer); |
| 302 | } |
| 303 | |
| 304 | rx::RenderTarget *Texture3DAttachment::getDepthStencil() |
| 305 | { |
| 306 | return mTexture3D->getDepthStencil(mLevel, mLayer); |
| 307 | } |
| 308 | |
| 309 | rx::TextureStorage *Texture3DAttachment::getTextureStorage() |
| 310 | { |
| 311 | return mTexture3D->getNativeTexture()->getStorageInstance(); |
| 312 | } |
| 313 | |
| 314 | GLsizei Texture3DAttachment::getWidth() const |
| 315 | { |
| 316 | return mTexture3D->getWidth(mLevel); |
| 317 | } |
| 318 | |
| 319 | GLsizei Texture3DAttachment::getHeight() const |
| 320 | { |
| 321 | return mTexture3D->getHeight(mLevel); |
| 322 | } |
| 323 | |
| 324 | GLenum Texture3DAttachment::getInternalFormat() const |
| 325 | { |
| 326 | return mTexture3D->getInternalFormat(mLevel); |
| 327 | } |
| 328 | |
| 329 | GLenum Texture3DAttachment::getActualFormat() const |
| 330 | { |
| 331 | return mTexture3D->getActualFormat(mLevel); |
| 332 | } |
| 333 | |
| 334 | GLsizei Texture3DAttachment::getSamples() const |
| 335 | { |
| 336 | return 0; |
| 337 | } |
| 338 | |
| 339 | unsigned int Texture3DAttachment::getSerial() const |
| 340 | { |
| 341 | return mTexture3D->getRenderTargetSerial(mLevel, mLayer); |
| 342 | } |
| 343 | |
| 344 | GLuint Texture3DAttachment::id() const |
| 345 | { |
| 346 | return mTexture3D->id(); |
| 347 | } |
| 348 | |
| 349 | GLenum Texture3DAttachment::type() const |
| 350 | { |
| 351 | return GL_TEXTURE_3D; |
| 352 | } |
| 353 | |
| 354 | GLint Texture3DAttachment::mipLevel() const |
| 355 | { |
| 356 | return mLevel; |
| 357 | } |
| 358 | |
| 359 | GLint Texture3DAttachment::layer() const |
| 360 | { |
| 361 | return mLayer; |
| 362 | } |
| 363 | |
| 364 | unsigned int Texture3DAttachment::getTextureSerial() const |
| 365 | { |
| 366 | return mTexture3D->getTextureSerial(); |
| 367 | } |
| 368 | |
| 369 | ////// Texture2DArrayAttachment Implementation ////// |
| 370 | |
| 371 | Texture2DArrayAttachment::Texture2DArrayAttachment(Texture2DArray *texture, GLint level, GLint layer) |
| 372 | : mLevel(level), mLayer(layer) |
| 373 | { |
| 374 | mTexture2DArray.set(texture); |
| 375 | } |
| 376 | |
| 377 | Texture2DArrayAttachment::~Texture2DArrayAttachment() |
| 378 | { |
| 379 | mTexture2DArray.set(NULL); |
| 380 | } |
| 381 | |
| 382 | rx::RenderTarget *Texture2DArrayAttachment::getRenderTarget() |
| 383 | { |
| 384 | return mTexture2DArray->getRenderTarget(mLevel, mLayer); |
| 385 | } |
| 386 | |
| 387 | rx::RenderTarget *Texture2DArrayAttachment::getDepthStencil() |
| 388 | { |
| 389 | return mTexture2DArray->getDepthStencil(mLevel, mLayer); |
| 390 | } |
| 391 | |
| 392 | rx::TextureStorage *Texture2DArrayAttachment::getTextureStorage() |
| 393 | { |
| 394 | return mTexture2DArray->getNativeTexture()->getStorageInstance(); |
| 395 | } |
| 396 | |
| 397 | GLsizei Texture2DArrayAttachment::getWidth() const |
| 398 | { |
| 399 | return mTexture2DArray->getWidth(mLevel); |
| 400 | } |
| 401 | |
| 402 | GLsizei Texture2DArrayAttachment::getHeight() const |
| 403 | { |
| 404 | return mTexture2DArray->getHeight(mLevel); |
| 405 | } |
| 406 | |
| 407 | GLenum Texture2DArrayAttachment::getInternalFormat() const |
| 408 | { |
| 409 | return mTexture2DArray->getInternalFormat(mLevel); |
| 410 | } |
| 411 | |
| 412 | GLenum Texture2DArrayAttachment::getActualFormat() const |
| 413 | { |
| 414 | return mTexture2DArray->getActualFormat(mLevel); |
| 415 | } |
| 416 | |
| 417 | GLsizei Texture2DArrayAttachment::getSamples() const |
| 418 | { |
| 419 | return 0; |
| 420 | } |
| 421 | |
| 422 | unsigned int Texture2DArrayAttachment::getSerial() const |
| 423 | { |
| 424 | return mTexture2DArray->getRenderTargetSerial(mLevel, mLayer); |
| 425 | } |
| 426 | |
| 427 | GLuint Texture2DArrayAttachment::id() const |
| 428 | { |
| 429 | return mTexture2DArray->id(); |
| 430 | } |
| 431 | |
| 432 | GLenum Texture2DArrayAttachment::type() const |
| 433 | { |
| 434 | return GL_TEXTURE_2D_ARRAY; |
| 435 | } |
| 436 | |
| 437 | GLint Texture2DArrayAttachment::mipLevel() const |
| 438 | { |
| 439 | return mLevel; |
| 440 | } |
| 441 | |
| 442 | GLint Texture2DArrayAttachment::layer() const |
| 443 | { |
| 444 | return mLayer; |
| 445 | } |
| 446 | |
| 447 | unsigned int Texture2DArrayAttachment::getTextureSerial() const |
| 448 | { |
| 449 | return mTexture2DArray->getTextureSerial(); |
| 450 | } |
| 451 | |
| 452 | ////// RenderbufferAttachment Implementation ////// |
| 453 | |
Jamie Madill | 6c7b4ad | 2014-06-16 10:33:59 -0400 | [diff] [blame] | 454 | RenderbufferAttachment::RenderbufferAttachment(Renderbuffer *renderbuffer) |
| 455 | { |
| 456 | ASSERT(renderbuffer); |
| 457 | mRenderbuffer.set(renderbuffer); |
| 458 | } |
| 459 | |
| 460 | RenderbufferAttachment::~RenderbufferAttachment() |
| 461 | { |
| 462 | mRenderbuffer.set(NULL); |
| 463 | } |
| 464 | |
| 465 | rx::RenderTarget *RenderbufferAttachment::getRenderTarget() |
| 466 | { |
| 467 | return mRenderbuffer->getStorage()->getRenderTarget(); |
| 468 | } |
| 469 | |
| 470 | rx::RenderTarget *RenderbufferAttachment::getDepthStencil() |
| 471 | { |
| 472 | return mRenderbuffer->getStorage()->getDepthStencil(); |
| 473 | } |
| 474 | |
| 475 | rx::TextureStorage *RenderbufferAttachment::getTextureStorage() |
| 476 | { |
| 477 | UNREACHABLE(); |
| 478 | return NULL; |
| 479 | } |
| 480 | |
| 481 | GLsizei RenderbufferAttachment::getWidth() const |
| 482 | { |
| 483 | return mRenderbuffer->getWidth(); |
| 484 | } |
| 485 | |
| 486 | GLsizei RenderbufferAttachment::getHeight() const |
| 487 | { |
| 488 | return mRenderbuffer->getHeight(); |
| 489 | } |
| 490 | |
| 491 | GLenum RenderbufferAttachment::getInternalFormat() const |
| 492 | { |
| 493 | return mRenderbuffer->getInternalFormat(); |
| 494 | } |
| 495 | |
| 496 | GLenum RenderbufferAttachment::getActualFormat() const |
| 497 | { |
| 498 | return mRenderbuffer->getActualFormat(); |
| 499 | } |
| 500 | |
| 501 | GLsizei RenderbufferAttachment::getSamples() const |
| 502 | { |
| 503 | return mRenderbuffer->getStorage()->getSamples(); |
| 504 | } |
| 505 | |
| 506 | unsigned int RenderbufferAttachment::getSerial() const |
| 507 | { |
| 508 | return mRenderbuffer->getStorage()->getSerial(); |
| 509 | } |
| 510 | |
Jamie Madill | 218b6ed | 2014-06-16 10:34:01 -0400 | [diff] [blame] | 511 | GLuint RenderbufferAttachment::id() const |
Jamie Madill | 6c7b4ad | 2014-06-16 10:33:59 -0400 | [diff] [blame] | 512 | { |
Jamie Madill | 218b6ed | 2014-06-16 10:34:01 -0400 | [diff] [blame] | 513 | return mRenderbuffer->id(); |
| 514 | } |
| 515 | |
| 516 | GLenum RenderbufferAttachment::type() const |
| 517 | { |
| 518 | return GL_RENDERBUFFER; |
Jamie Madill | 6c7b4ad | 2014-06-16 10:33:59 -0400 | [diff] [blame] | 519 | } |
| 520 | |
Jamie Madill | 9c074a3 | 2014-06-16 10:34:02 -0400 | [diff] [blame] | 521 | GLint RenderbufferAttachment::mipLevel() const |
| 522 | { |
| 523 | return 0; |
| 524 | } |
| 525 | |
| 526 | GLint RenderbufferAttachment::layer() const |
| 527 | { |
| 528 | return 0; |
| 529 | } |
| 530 | |
Jamie Madill | 6c7b4ad | 2014-06-16 10:33:59 -0400 | [diff] [blame] | 531 | unsigned int RenderbufferAttachment::getTextureSerial() const |
| 532 | { |
| 533 | UNREACHABLE(); |
| 534 | return 0; |
Jamie Madill | afc21c0 | 2014-06-04 15:29:47 -0400 | [diff] [blame] | 535 | } |
| 536 | |
| 537 | } |