daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1 | // |
Geoff Lang | cec3590 | 2014-04-16 10:52:36 -0400 | [diff] [blame] | 2 | // Copyright (c) 2002-2014 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 | // Framebuffer.cpp: Implements the gl::Framebuffer class. Implements GL framebuffer |
| 8 | // objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105. |
| 9 | |
Geoff Lang | 2b5420c | 2014-11-19 14:20:15 -0500 | [diff] [blame] | 10 | #include "libANGLE/Framebuffer.h" |
Jamie Madill | c46f45d | 2015-03-31 13:20:55 -0400 | [diff] [blame] | 11 | |
Jamie Madill | cc86d64 | 2015-11-24 13:00:07 -0500 | [diff] [blame] | 12 | #include "common/Optional.h" |
Jamie Madill | c46f45d | 2015-03-31 13:20:55 -0400 | [diff] [blame] | 13 | #include "common/utilities.h" |
| 14 | #include "libANGLE/Config.h" |
Geoff Lang | 2b5420c | 2014-11-19 14:20:15 -0500 | [diff] [blame] | 15 | #include "libANGLE/Context.h" |
Geoff Lang | 2b5420c | 2014-11-19 14:20:15 -0500 | [diff] [blame] | 16 | #include "libANGLE/FramebufferAttachment.h" |
Jamie Madill | c46f45d | 2015-03-31 13:20:55 -0400 | [diff] [blame] | 17 | #include "libANGLE/Renderbuffer.h" |
| 18 | #include "libANGLE/Surface.h" |
| 19 | #include "libANGLE/Texture.h" |
| 20 | #include "libANGLE/formatutils.h" |
Geoff Lang | b5d8f23 | 2014-12-04 15:43:01 -0500 | [diff] [blame] | 21 | #include "libANGLE/renderer/FramebufferImpl.h" |
Jamie Madill | 48115b6 | 2015-03-16 10:46:57 -0400 | [diff] [blame] | 22 | #include "libANGLE/renderer/ImplFactory.h" |
Geoff Lang | 2b5420c | 2014-11-19 14:20:15 -0500 | [diff] [blame] | 23 | #include "libANGLE/renderer/RenderbufferImpl.h" |
Corentin Wallez | 37c3979 | 2015-08-20 14:19:46 -0400 | [diff] [blame] | 24 | #include "libANGLE/renderer/SurfaceImpl.h" |
Geoff Lang | 0b7eef7 | 2014-06-12 14:10:47 -0400 | [diff] [blame] | 25 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 26 | namespace gl |
| 27 | { |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 28 | |
Jamie Madill | d1405e5 | 2015-03-05 15:41:39 -0500 | [diff] [blame] | 29 | namespace |
| 30 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 31 | void DetachMatchingAttachment(FramebufferAttachment *attachment, GLenum matchType, GLuint matchId) |
Jamie Madill | d1405e5 | 2015-03-05 15:41:39 -0500 | [diff] [blame] | 32 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 33 | if (attachment->isAttached() && |
| 34 | attachment->type() == matchType && |
| 35 | attachment->id() == matchId) |
Jamie Madill | d1405e5 | 2015-03-05 15:41:39 -0500 | [diff] [blame] | 36 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 37 | attachment->detach(); |
Jamie Madill | d1405e5 | 2015-03-05 15:41:39 -0500 | [diff] [blame] | 38 | } |
| 39 | } |
| 40 | } |
| 41 | |
Corentin Wallez | 37c3979 | 2015-08-20 14:19:46 -0400 | [diff] [blame] | 42 | Framebuffer::Data::Data() |
Geoff Lang | 70d0f49 | 2015-12-10 17:45:46 -0500 | [diff] [blame] | 43 | : mLabel(), |
| 44 | mColorAttachments(1), |
Corentin Wallez | 37c3979 | 2015-08-20 14:19:46 -0400 | [diff] [blame] | 45 | mDrawBufferStates(1, GL_NONE), |
| 46 | mReadBufferState(GL_COLOR_ATTACHMENT0_EXT) |
| 47 | { |
| 48 | mDrawBufferStates[0] = GL_COLOR_ATTACHMENT0_EXT; |
| 49 | } |
| 50 | |
Jamie Madill | d1405e5 | 2015-03-05 15:41:39 -0500 | [diff] [blame] | 51 | Framebuffer::Data::Data(const Caps &caps) |
Geoff Lang | 70d0f49 | 2015-12-10 17:45:46 -0500 | [diff] [blame] | 52 | : mLabel(), |
| 53 | mColorAttachments(caps.maxColorAttachments), |
Jamie Madill | d1405e5 | 2015-03-05 15:41:39 -0500 | [diff] [blame] | 54 | mDrawBufferStates(caps.maxDrawBuffers, GL_NONE), |
| 55 | mReadBufferState(GL_COLOR_ATTACHMENT0_EXT) |
| 56 | { |
| 57 | mDrawBufferStates[0] = GL_COLOR_ATTACHMENT0_EXT; |
| 58 | } |
| 59 | |
| 60 | Framebuffer::Data::~Data() |
| 61 | { |
Jamie Madill | d1405e5 | 2015-03-05 15:41:39 -0500 | [diff] [blame] | 62 | } |
| 63 | |
Geoff Lang | 70d0f49 | 2015-12-10 17:45:46 -0500 | [diff] [blame] | 64 | const std::string &Framebuffer::Data::getLabel() |
| 65 | { |
| 66 | return mLabel; |
| 67 | } |
| 68 | |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 69 | const FramebufferAttachment *Framebuffer::Data::getReadAttachment() const |
Jamie Madill | 7147f01 | 2015-03-05 15:41:40 -0500 | [diff] [blame] | 70 | { |
| 71 | ASSERT(mReadBufferState == GL_BACK || (mReadBufferState >= GL_COLOR_ATTACHMENT0 && mReadBufferState <= GL_COLOR_ATTACHMENT15)); |
| 72 | size_t readIndex = (mReadBufferState == GL_BACK ? 0 : static_cast<size_t>(mReadBufferState - GL_COLOR_ATTACHMENT0)); |
| 73 | ASSERT(readIndex < mColorAttachments.size()); |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 74 | return mColorAttachments[readIndex].isAttached() ? &mColorAttachments[readIndex] : nullptr; |
Jamie Madill | 7147f01 | 2015-03-05 15:41:40 -0500 | [diff] [blame] | 75 | } |
| 76 | |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 77 | const FramebufferAttachment *Framebuffer::Data::getFirstColorAttachment() const |
Jamie Madill | 7147f01 | 2015-03-05 15:41:40 -0500 | [diff] [blame] | 78 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 79 | for (const FramebufferAttachment &colorAttachment : mColorAttachments) |
Jamie Madill | 7147f01 | 2015-03-05 15:41:40 -0500 | [diff] [blame] | 80 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 81 | if (colorAttachment.isAttached()) |
Jamie Madill | 7147f01 | 2015-03-05 15:41:40 -0500 | [diff] [blame] | 82 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 83 | return &colorAttachment; |
Jamie Madill | 7147f01 | 2015-03-05 15:41:40 -0500 | [diff] [blame] | 84 | } |
| 85 | } |
| 86 | |
| 87 | return nullptr; |
| 88 | } |
| 89 | |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 90 | const FramebufferAttachment *Framebuffer::Data::getDepthOrStencilAttachment() const |
Jamie Madill | 7147f01 | 2015-03-05 15:41:40 -0500 | [diff] [blame] | 91 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 92 | if (mDepthAttachment.isAttached()) |
| 93 | { |
| 94 | return &mDepthAttachment; |
| 95 | } |
| 96 | if (mStencilAttachment.isAttached()) |
| 97 | { |
| 98 | return &mStencilAttachment; |
| 99 | } |
| 100 | return nullptr; |
Jamie Madill | 7147f01 | 2015-03-05 15:41:40 -0500 | [diff] [blame] | 101 | } |
| 102 | |
Corentin Wallez | 37c3979 | 2015-08-20 14:19:46 -0400 | [diff] [blame] | 103 | const FramebufferAttachment *Framebuffer::Data::getColorAttachment(size_t colorAttachment) const |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 104 | { |
| 105 | ASSERT(colorAttachment < mColorAttachments.size()); |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 106 | return mColorAttachments[colorAttachment].isAttached() ? |
| 107 | &mColorAttachments[colorAttachment] : |
| 108 | nullptr; |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 109 | } |
| 110 | |
Jamie Madill | e3ef715 | 2015-04-28 16:55:17 +0000 | [diff] [blame] | 111 | const FramebufferAttachment *Framebuffer::Data::getDepthAttachment() const |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 112 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 113 | return mDepthAttachment.isAttached() ? &mDepthAttachment : nullptr; |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 114 | } |
| 115 | |
Jamie Madill | e3ef715 | 2015-04-28 16:55:17 +0000 | [diff] [blame] | 116 | const FramebufferAttachment *Framebuffer::Data::getStencilAttachment() const |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 117 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 118 | return mStencilAttachment.isAttached() ? &mStencilAttachment : nullptr; |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 119 | } |
| 120 | |
Jamie Madill | e3ef715 | 2015-04-28 16:55:17 +0000 | [diff] [blame] | 121 | const FramebufferAttachment *Framebuffer::Data::getDepthStencilAttachment() const |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 122 | { |
| 123 | // A valid depth-stencil attachment has the same resource bound to both the |
| 124 | // depth and stencil attachment points. |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 125 | if (mDepthAttachment.isAttached() && mStencilAttachment.isAttached() && |
| 126 | mDepthAttachment.type() == mStencilAttachment.type() && |
| 127 | mDepthAttachment.id() == mStencilAttachment.id()) |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 128 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 129 | return &mDepthAttachment; |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 130 | } |
| 131 | |
| 132 | return nullptr; |
| 133 | } |
| 134 | |
Jamie Madill | cc86d64 | 2015-11-24 13:00:07 -0500 | [diff] [blame] | 135 | bool Framebuffer::Data::attachmentsHaveSameDimensions() const |
| 136 | { |
| 137 | Optional<Extents> attachmentSize; |
| 138 | |
| 139 | auto hasMismatchedSize = [&attachmentSize](const FramebufferAttachment &attachment) |
| 140 | { |
| 141 | if (!attachment.isAttached()) |
| 142 | { |
| 143 | return false; |
| 144 | } |
| 145 | |
| 146 | if (!attachmentSize.valid()) |
| 147 | { |
| 148 | attachmentSize = attachment.getSize(); |
| 149 | return false; |
| 150 | } |
| 151 | |
| 152 | return (attachment.getSize() != attachmentSize.value()); |
| 153 | }; |
| 154 | |
| 155 | for (const auto &attachment : mColorAttachments) |
| 156 | { |
| 157 | if (hasMismatchedSize(attachment)) |
| 158 | { |
| 159 | return false; |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | if (hasMismatchedSize(mDepthAttachment)) |
| 164 | { |
| 165 | return false; |
| 166 | } |
| 167 | |
| 168 | return !hasMismatchedSize(mStencilAttachment); |
| 169 | } |
| 170 | |
Jamie Madill | 48115b6 | 2015-03-16 10:46:57 -0400 | [diff] [blame] | 171 | Framebuffer::Framebuffer(const Caps &caps, rx::ImplFactory *factory, GLuint id) |
Corentin Wallez | 37c3979 | 2015-08-20 14:19:46 -0400 | [diff] [blame] | 172 | : mData(caps), mImpl(factory->createFramebuffer(mData)), mId(id) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 173 | { |
Corentin Wallez | 37c3979 | 2015-08-20 14:19:46 -0400 | [diff] [blame] | 174 | ASSERT(mId != 0); |
| 175 | ASSERT(mImpl != nullptr); |
| 176 | } |
| 177 | |
| 178 | Framebuffer::Framebuffer(rx::SurfaceImpl *surface) |
| 179 | : mData(), mImpl(surface->createDefaultFramebuffer(mData)), mId(0) |
| 180 | { |
Geoff Lang | da88add | 2014-12-01 10:22:01 -0500 | [diff] [blame] | 181 | ASSERT(mImpl != nullptr); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | Framebuffer::~Framebuffer() |
| 185 | { |
Geoff Lang | da88add | 2014-12-01 10:22:01 -0500 | [diff] [blame] | 186 | SafeDelete(mImpl); |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 187 | } |
| 188 | |
Geoff Lang | 70d0f49 | 2015-12-10 17:45:46 -0500 | [diff] [blame] | 189 | void Framebuffer::setLabel(const std::string &label) |
| 190 | { |
| 191 | mData.mLabel = label; |
| 192 | } |
| 193 | |
| 194 | const std::string &Framebuffer::getLabel() const |
| 195 | { |
| 196 | return mData.mLabel; |
| 197 | } |
| 198 | |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame] | 199 | void Framebuffer::detachTexture(GLuint textureId) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 200 | { |
Jamie Madill | d1405e5 | 2015-03-05 15:41:39 -0500 | [diff] [blame] | 201 | detachResourceById(GL_TEXTURE, textureId); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 202 | } |
| 203 | |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame] | 204 | void Framebuffer::detachRenderbuffer(GLuint renderbufferId) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 205 | { |
Jamie Madill | d1405e5 | 2015-03-05 15:41:39 -0500 | [diff] [blame] | 206 | detachResourceById(GL_RENDERBUFFER, renderbufferId); |
| 207 | } |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame] | 208 | |
Jamie Madill | d1405e5 | 2015-03-05 15:41:39 -0500 | [diff] [blame] | 209 | void Framebuffer::detachResourceById(GLenum resourceType, GLuint resourceId) |
| 210 | { |
| 211 | for (auto &colorAttachment : mData.mColorAttachments) |
| 212 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 213 | DetachMatchingAttachment(&colorAttachment, resourceType, resourceId); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 214 | } |
| 215 | |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 216 | DetachMatchingAttachment(&mData.mDepthAttachment, resourceType, resourceId); |
| 217 | DetachMatchingAttachment(&mData.mStencilAttachment, resourceType, resourceId); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 218 | } |
| 219 | |
Corentin Wallez | 37c3979 | 2015-08-20 14:19:46 -0400 | [diff] [blame] | 220 | const FramebufferAttachment *Framebuffer::getColorbuffer(size_t colorAttachment) const |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 221 | { |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 222 | return mData.getColorAttachment(colorAttachment); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 223 | } |
| 224 | |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 225 | const FramebufferAttachment *Framebuffer::getDepthbuffer() const |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 226 | { |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 227 | return mData.getDepthAttachment(); |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 228 | } |
| 229 | |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 230 | const FramebufferAttachment *Framebuffer::getStencilbuffer() const |
| 231 | { |
| 232 | return mData.getStencilAttachment(); |
| 233 | } |
| 234 | |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 235 | const FramebufferAttachment *Framebuffer::getDepthStencilBuffer() const |
| 236 | { |
| 237 | return mData.getDepthStencilAttachment(); |
| 238 | } |
| 239 | |
| 240 | const FramebufferAttachment *Framebuffer::getDepthOrStencilbuffer() const |
daniel@transgaming.com | d2b4702 | 2012-11-28 19:40:10 +0000 | [diff] [blame] | 241 | { |
Jamie Madill | 7147f01 | 2015-03-05 15:41:40 -0500 | [diff] [blame] | 242 | return mData.getDepthOrStencilAttachment(); |
daniel@transgaming.com | d2b4702 | 2012-11-28 19:40:10 +0000 | [diff] [blame] | 243 | } |
| 244 | |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 245 | const FramebufferAttachment *Framebuffer::getReadColorbuffer() const |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 246 | { |
Jamie Madill | 7147f01 | 2015-03-05 15:41:40 -0500 | [diff] [blame] | 247 | return mData.getReadAttachment(); |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 248 | } |
| 249 | |
shannon.woods%transgaming.com@gtempaccount.com | f6863e0 | 2013-04-13 03:34:00 +0000 | [diff] [blame] | 250 | GLenum Framebuffer::getReadColorbufferType() const |
| 251 | { |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 252 | const FramebufferAttachment *readAttachment = mData.getReadAttachment(); |
| 253 | return (readAttachment != nullptr ? readAttachment->type() : GL_NONE); |
shannon.woods%transgaming.com@gtempaccount.com | f6863e0 | 2013-04-13 03:34:00 +0000 | [diff] [blame] | 254 | } |
| 255 | |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 256 | const FramebufferAttachment *Framebuffer::getFirstColorbuffer() const |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 257 | { |
Jamie Madill | 7147f01 | 2015-03-05 15:41:40 -0500 | [diff] [blame] | 258 | return mData.getFirstColorAttachment(); |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 259 | } |
| 260 | |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 261 | const FramebufferAttachment *Framebuffer::getAttachment(GLenum attachment) const |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 262 | { |
Jamie Madill | e92a354 | 2014-07-03 10:38:58 -0400 | [diff] [blame] | 263 | if (attachment >= GL_COLOR_ATTACHMENT0 && attachment <= GL_COLOR_ATTACHMENT15) |
| 264 | { |
Jamie Madill | e3ef715 | 2015-04-28 16:55:17 +0000 | [diff] [blame] | 265 | return mData.getColorAttachment(attachment - GL_COLOR_ATTACHMENT0); |
Jamie Madill | e92a354 | 2014-07-03 10:38:58 -0400 | [diff] [blame] | 266 | } |
| 267 | else |
| 268 | { |
| 269 | switch (attachment) |
| 270 | { |
Geoff Lang | 528ce3c | 2014-12-01 10:44:07 -0500 | [diff] [blame] | 271 | case GL_COLOR: |
| 272 | case GL_BACK: |
Jamie Madill | e3ef715 | 2015-04-28 16:55:17 +0000 | [diff] [blame] | 273 | return mData.getColorAttachment(0); |
Geoff Lang | 528ce3c | 2014-12-01 10:44:07 -0500 | [diff] [blame] | 274 | case GL_DEPTH: |
Jamie Madill | e92a354 | 2014-07-03 10:38:58 -0400 | [diff] [blame] | 275 | case GL_DEPTH_ATTACHMENT: |
Jamie Madill | e3ef715 | 2015-04-28 16:55:17 +0000 | [diff] [blame] | 276 | return mData.getDepthAttachment(); |
Geoff Lang | 528ce3c | 2014-12-01 10:44:07 -0500 | [diff] [blame] | 277 | case GL_STENCIL: |
Jamie Madill | e92a354 | 2014-07-03 10:38:58 -0400 | [diff] [blame] | 278 | case GL_STENCIL_ATTACHMENT: |
Jamie Madill | e3ef715 | 2015-04-28 16:55:17 +0000 | [diff] [blame] | 279 | return mData.getStencilAttachment(); |
Geoff Lang | 528ce3c | 2014-12-01 10:44:07 -0500 | [diff] [blame] | 280 | case GL_DEPTH_STENCIL: |
Jamie Madill | e92a354 | 2014-07-03 10:38:58 -0400 | [diff] [blame] | 281 | case GL_DEPTH_STENCIL_ATTACHMENT: |
| 282 | return getDepthStencilBuffer(); |
| 283 | default: |
| 284 | UNREACHABLE(); |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 285 | return nullptr; |
Jamie Madill | e92a354 | 2014-07-03 10:38:58 -0400 | [diff] [blame] | 286 | } |
| 287 | } |
Geoff Lang | 55ba29c | 2013-07-11 16:57:53 -0400 | [diff] [blame] | 288 | } |
| 289 | |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 290 | GLenum Framebuffer::getDrawBufferState(unsigned int colorAttachment) const |
| 291 | { |
Jamie Madill | d1405e5 | 2015-03-05 15:41:39 -0500 | [diff] [blame] | 292 | ASSERT(colorAttachment < mData.mDrawBufferStates.size()); |
| 293 | return mData.mDrawBufferStates[colorAttachment]; |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 294 | } |
| 295 | |
Geoff Lang | 164d54e | 2014-12-01 10:55:33 -0500 | [diff] [blame] | 296 | void Framebuffer::setDrawBuffers(size_t count, const GLenum *buffers) |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 297 | { |
Jamie Madill | d1405e5 | 2015-03-05 15:41:39 -0500 | [diff] [blame] | 298 | auto &drawStates = mData.mDrawBufferStates; |
| 299 | |
| 300 | ASSERT(count <= drawStates.size()); |
| 301 | std::copy(buffers, buffers + count, drawStates.begin()); |
| 302 | std::fill(drawStates.begin() + count, drawStates.end(), GL_NONE); |
Geoff Lang | 9dd9580 | 2014-12-01 11:12:59 -0500 | [diff] [blame] | 303 | mImpl->setDrawBuffers(count, buffers); |
| 304 | } |
| 305 | |
| 306 | GLenum Framebuffer::getReadBufferState() const |
| 307 | { |
Jamie Madill | d1405e5 | 2015-03-05 15:41:39 -0500 | [diff] [blame] | 308 | return mData.mReadBufferState; |
Geoff Lang | 9dd9580 | 2014-12-01 11:12:59 -0500 | [diff] [blame] | 309 | } |
| 310 | |
| 311 | void Framebuffer::setReadBuffer(GLenum buffer) |
| 312 | { |
Jamie Madill | b885e57 | 2015-02-03 16:16:04 -0500 | [diff] [blame] | 313 | ASSERT(buffer == GL_BACK || buffer == GL_NONE || |
| 314 | (buffer >= GL_COLOR_ATTACHMENT0 && |
Jamie Madill | d1405e5 | 2015-03-05 15:41:39 -0500 | [diff] [blame] | 315 | (buffer - GL_COLOR_ATTACHMENT0) < mData.mColorAttachments.size())); |
| 316 | mData.mReadBufferState = buffer; |
Geoff Lang | 9dd9580 | 2014-12-01 11:12:59 -0500 | [diff] [blame] | 317 | mImpl->setReadBuffer(buffer); |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 318 | } |
| 319 | |
Corentin Wallez | 37c3979 | 2015-08-20 14:19:46 -0400 | [diff] [blame] | 320 | bool Framebuffer::isEnabledColorAttachment(size_t colorAttachment) const |
shannon.woods%transgaming.com@gtempaccount.com | dae2409 | 2013-04-13 03:31:31 +0000 | [diff] [blame] | 321 | { |
Jamie Madill | d1405e5 | 2015-03-05 15:41:39 -0500 | [diff] [blame] | 322 | ASSERT(colorAttachment < mData.mColorAttachments.size()); |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 323 | return (mData.mColorAttachments[colorAttachment].isAttached() && |
Jamie Madill | d1405e5 | 2015-03-05 15:41:39 -0500 | [diff] [blame] | 324 | mData.mDrawBufferStates[colorAttachment] != GL_NONE); |
shannon.woods%transgaming.com@gtempaccount.com | dae2409 | 2013-04-13 03:31:31 +0000 | [diff] [blame] | 325 | } |
| 326 | |
| 327 | bool Framebuffer::hasEnabledColorAttachment() const |
| 328 | { |
Jamie Madill | d1405e5 | 2015-03-05 15:41:39 -0500 | [diff] [blame] | 329 | for (size_t colorAttachment = 0; colorAttachment < mData.mColorAttachments.size(); ++colorAttachment) |
shannon.woods%transgaming.com@gtempaccount.com | dae2409 | 2013-04-13 03:31:31 +0000 | [diff] [blame] | 330 | { |
Cooper Partin | 4d61f7e | 2015-08-12 10:56:50 -0700 | [diff] [blame] | 331 | if (isEnabledColorAttachment(static_cast<unsigned int>(colorAttachment))) |
shannon.woods%transgaming.com@gtempaccount.com | dae2409 | 2013-04-13 03:31:31 +0000 | [diff] [blame] | 332 | { |
| 333 | return true; |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | return false; |
| 338 | } |
| 339 | |
Corentin Wallez | 37c3979 | 2015-08-20 14:19:46 -0400 | [diff] [blame] | 340 | size_t Framebuffer::getNumColorBuffers() const |
| 341 | { |
| 342 | return mData.mColorAttachments.size(); |
| 343 | } |
| 344 | |
Jamie Madill | 0df8fe4 | 2015-11-24 16:10:24 -0500 | [diff] [blame] | 345 | bool Framebuffer::hasDepth() const |
| 346 | { |
| 347 | return (mData.mDepthAttachment.isAttached() && mData.mDepthAttachment.getDepthSize() > 0); |
| 348 | } |
| 349 | |
shannon.woods%transgaming.com@gtempaccount.com | 3b57b4f | 2013-04-13 03:28:29 +0000 | [diff] [blame] | 350 | bool Framebuffer::hasStencil() const |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 351 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 352 | return (mData.mStencilAttachment.isAttached() && mData.mStencilAttachment.getStencilSize() > 0); |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 353 | } |
| 354 | |
shannonwoods@chromium.org | 24ac850 | 2013-05-30 00:01:37 +0000 | [diff] [blame] | 355 | bool Framebuffer::usingExtendedDrawBuffers() const |
| 356 | { |
Jamie Madill | d1405e5 | 2015-03-05 15:41:39 -0500 | [diff] [blame] | 357 | for (size_t colorAttachment = 1; colorAttachment < mData.mColorAttachments.size(); ++colorAttachment) |
shannonwoods@chromium.org | 24ac850 | 2013-05-30 00:01:37 +0000 | [diff] [blame] | 358 | { |
Cooper Partin | 4d61f7e | 2015-08-12 10:56:50 -0700 | [diff] [blame] | 359 | if (isEnabledColorAttachment(static_cast<unsigned int>(colorAttachment))) |
shannonwoods@chromium.org | 24ac850 | 2013-05-30 00:01:37 +0000 | [diff] [blame] | 360 | { |
| 361 | return true; |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | return false; |
| 366 | } |
| 367 | |
Geoff Lang | 748f74e | 2014-12-01 11:25:34 -0500 | [diff] [blame] | 368 | GLenum Framebuffer::checkStatus(const gl::Data &data) const |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 369 | { |
Geoff Lang | 528ce3c | 2014-12-01 10:44:07 -0500 | [diff] [blame] | 370 | // The default framebuffer *must* always be complete, though it may not be |
| 371 | // subject to the same rules as application FBOs. ie, it could have 0x0 size. |
| 372 | if (mId == 0) |
| 373 | { |
| 374 | return GL_FRAMEBUFFER_COMPLETE; |
| 375 | } |
| 376 | |
shannonwoods@chromium.org | f6fb959 | 2013-05-30 00:09:40 +0000 | [diff] [blame] | 377 | unsigned int colorbufferSize = 0; |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 378 | int samples = -1; |
daniel@transgaming.com | 6b7c84c | 2012-05-31 01:14:39 +0000 | [diff] [blame] | 379 | bool missingAttachment = true; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 380 | |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 381 | for (const FramebufferAttachment &colorAttachment : mData.mColorAttachments) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 382 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 383 | if (colorAttachment.isAttached()) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 384 | { |
Jamie Madill | 6b120b9 | 2015-11-24 13:00:07 -0500 | [diff] [blame] | 385 | const Extents &size = colorAttachment.getSize(); |
| 386 | if (size.width == 0 || size.height == 0) |
daniel@transgaming.com | 6b7c84c | 2012-05-31 01:14:39 +0000 | [diff] [blame] | 387 | { |
| 388 | return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
| 389 | } |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 390 | |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 391 | GLenum internalformat = colorAttachment.getInternalFormat(); |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 392 | const TextureCaps &formatCaps = data.textureCaps->get(internalformat); |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 393 | const InternalFormat &formatInfo = GetInternalFormatInfo(internalformat); |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 394 | if (colorAttachment.type() == GL_TEXTURE) |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 395 | { |
Geoff Lang | 6cf8e1b | 2014-07-03 13:03:57 -0400 | [diff] [blame] | 396 | if (!formatCaps.renderable) |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 397 | { |
Jamie Madill | 8117678 | 2015-11-24 16:10:23 -0500 | [diff] [blame] | 398 | return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 399 | } |
| 400 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 401 | if (formatInfo.depthBits > 0 || formatInfo.stencilBits > 0) |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 402 | { |
| 403 | return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
| 404 | } |
Jamie Madill | 6b120b9 | 2015-11-24 13:00:07 -0500 | [diff] [blame] | 405 | |
| 406 | if (colorAttachment.layer() >= size.depth) |
| 407 | { |
| 408 | return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
| 409 | } |
Jamie Madill | 3215b20 | 2015-12-15 16:41:39 -0500 | [diff] [blame] | 410 | |
| 411 | // ES3 specifies that cube map texture attachments must be cube complete. |
| 412 | // This language is missing from the ES2 spec, but we enforce it here because some |
| 413 | // desktop OpenGL drivers also enforce this validation. |
| 414 | // TODO(jmadill): Check if OpenGL ES2 drivers enforce cube completeness. |
| 415 | const Texture *texture = colorAttachment.getTexture(); |
| 416 | ASSERT(texture); |
| 417 | if (texture->getTarget() == GL_TEXTURE_CUBE_MAP && !texture->isCubeComplete()) |
| 418 | { |
| 419 | return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
| 420 | } |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 421 | } |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 422 | else if (colorAttachment.type() == GL_RENDERBUFFER) |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 423 | { |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 424 | if (!formatCaps.renderable || formatInfo.depthBits > 0 || formatInfo.stencilBits > 0) |
Jamie Madill | bb94f34 | 2014-06-23 15:23:02 -0400 | [diff] [blame] | 425 | { |
| 426 | return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
| 427 | } |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 428 | } |
| 429 | |
| 430 | if (!missingAttachment) |
| 431 | { |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 432 | // APPLE_framebuffer_multisample, which EXT_draw_buffers refers to, requires that |
| 433 | // all color attachments have the same number of samples for the FBO to be complete. |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 434 | if (colorAttachment.getSamples() != samples) |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 435 | { |
| 436 | return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT; |
| 437 | } |
| 438 | |
shannon.woods%transgaming.com@gtempaccount.com | c347152 | 2013-04-13 03:34:52 +0000 | [diff] [blame] | 439 | // in GLES 2.0, all color attachments attachments must have the same number of bitplanes |
| 440 | // in GLES 3.0, there is no such restriction |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 441 | if (data.clientVersion < 3) |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 442 | { |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 443 | if (formatInfo.pixelBytes != colorbufferSize) |
shannon.woods%transgaming.com@gtempaccount.com | c347152 | 2013-04-13 03:34:52 +0000 | [diff] [blame] | 444 | { |
| 445 | return GL_FRAMEBUFFER_UNSUPPORTED; |
| 446 | } |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 447 | } |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 448 | } |
| 449 | else |
| 450 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 451 | samples = colorAttachment.getSamples(); |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 452 | colorbufferSize = formatInfo.pixelBytes; |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 453 | missingAttachment = false; |
| 454 | } |
| 455 | } |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 456 | } |
| 457 | |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 458 | const FramebufferAttachment &depthAttachment = mData.mDepthAttachment; |
| 459 | if (depthAttachment.isAttached()) |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 460 | { |
Jamie Madill | 6b120b9 | 2015-11-24 13:00:07 -0500 | [diff] [blame] | 461 | const Extents &size = depthAttachment.getSize(); |
| 462 | if (size.width == 0 || size.height == 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 463 | { |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 464 | return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 465 | } |
| 466 | |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 467 | GLenum internalformat = depthAttachment.getInternalFormat(); |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 468 | const TextureCaps &formatCaps = data.textureCaps->get(internalformat); |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 469 | const InternalFormat &formatInfo = GetInternalFormatInfo(internalformat); |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 470 | if (depthAttachment.type() == GL_TEXTURE) |
daniel@transgaming.com | 6b7c84c | 2012-05-31 01:14:39 +0000 | [diff] [blame] | 471 | { |
daniel@transgaming.com | 6b7c84c | 2012-05-31 01:14:39 +0000 | [diff] [blame] | 472 | // depth texture attachments require OES/ANGLE_depth_texture |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 473 | if (!data.extensions->depthTextures) |
daniel@transgaming.com | 6b7c84c | 2012-05-31 01:14:39 +0000 | [diff] [blame] | 474 | { |
| 475 | return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
| 476 | } |
| 477 | |
Geoff Lang | 6cf8e1b | 2014-07-03 13:03:57 -0400 | [diff] [blame] | 478 | if (!formatCaps.renderable) |
Geoff Lang | cec3590 | 2014-04-16 10:52:36 -0400 | [diff] [blame] | 479 | { |
Jamie Madill | 8117678 | 2015-11-24 16:10:23 -0500 | [diff] [blame] | 480 | return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
Geoff Lang | cec3590 | 2014-04-16 10:52:36 -0400 | [diff] [blame] | 481 | } |
| 482 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 483 | if (formatInfo.depthBits == 0) |
daniel@transgaming.com | 6b7c84c | 2012-05-31 01:14:39 +0000 | [diff] [blame] | 484 | { |
| 485 | return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
| 486 | } |
| 487 | } |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 488 | else if (depthAttachment.type() == GL_RENDERBUFFER) |
daniel@transgaming.com | 6b7c84c | 2012-05-31 01:14:39 +0000 | [diff] [blame] | 489 | { |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 490 | if (!formatCaps.renderable || formatInfo.depthBits == 0) |
Jamie Madill | bb94f34 | 2014-06-23 15:23:02 -0400 | [diff] [blame] | 491 | { |
| 492 | return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
| 493 | } |
daniel@transgaming.com | 6b7c84c | 2012-05-31 01:14:39 +0000 | [diff] [blame] | 494 | } |
| 495 | |
| 496 | if (missingAttachment) |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 497 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 498 | samples = depthAttachment.getSamples(); |
daniel@transgaming.com | 6b7c84c | 2012-05-31 01:14:39 +0000 | [diff] [blame] | 499 | missingAttachment = false; |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 500 | } |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 501 | else if (samples != depthAttachment.getSamples()) |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 502 | { |
| 503 | return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE; |
| 504 | } |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 505 | } |
| 506 | |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 507 | const FramebufferAttachment &stencilAttachment = mData.mStencilAttachment; |
| 508 | if (stencilAttachment.isAttached()) |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 509 | { |
Jamie Madill | 6b120b9 | 2015-11-24 13:00:07 -0500 | [diff] [blame] | 510 | const Extents &size = stencilAttachment.getSize(); |
| 511 | if (size.width == 0 || size.height == 0) |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 512 | { |
| 513 | return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
| 514 | } |
| 515 | |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 516 | GLenum internalformat = stencilAttachment.getInternalFormat(); |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 517 | const TextureCaps &formatCaps = data.textureCaps->get(internalformat); |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 518 | const InternalFormat &formatInfo = GetInternalFormatInfo(internalformat); |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 519 | if (stencilAttachment.type() == GL_TEXTURE) |
daniel@transgaming.com | 6b7c84c | 2012-05-31 01:14:39 +0000 | [diff] [blame] | 520 | { |
daniel@transgaming.com | 6b7c84c | 2012-05-31 01:14:39 +0000 | [diff] [blame] | 521 | // texture stencil attachments come along as part |
| 522 | // of OES_packed_depth_stencil + OES/ANGLE_depth_texture |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 523 | if (!data.extensions->depthTextures) |
daniel@transgaming.com | 6b7c84c | 2012-05-31 01:14:39 +0000 | [diff] [blame] | 524 | { |
| 525 | return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
| 526 | } |
| 527 | |
Geoff Lang | 6cf8e1b | 2014-07-03 13:03:57 -0400 | [diff] [blame] | 528 | if (!formatCaps.renderable) |
Geoff Lang | cec3590 | 2014-04-16 10:52:36 -0400 | [diff] [blame] | 529 | { |
Jamie Madill | 8117678 | 2015-11-24 16:10:23 -0500 | [diff] [blame] | 530 | return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
Geoff Lang | cec3590 | 2014-04-16 10:52:36 -0400 | [diff] [blame] | 531 | } |
| 532 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 533 | if (formatInfo.stencilBits == 0) |
daniel@transgaming.com | 6b7c84c | 2012-05-31 01:14:39 +0000 | [diff] [blame] | 534 | { |
| 535 | return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
| 536 | } |
| 537 | } |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 538 | else if (stencilAttachment.type() == GL_RENDERBUFFER) |
daniel@transgaming.com | 6b7c84c | 2012-05-31 01:14:39 +0000 | [diff] [blame] | 539 | { |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 540 | if (!formatCaps.renderable || formatInfo.stencilBits == 0) |
Jamie Madill | bb94f34 | 2014-06-23 15:23:02 -0400 | [diff] [blame] | 541 | { |
| 542 | return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
| 543 | } |
daniel@transgaming.com | 6b7c84c | 2012-05-31 01:14:39 +0000 | [diff] [blame] | 544 | } |
| 545 | |
| 546 | if (missingAttachment) |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 547 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 548 | samples = stencilAttachment.getSamples(); |
daniel@transgaming.com | 6b7c84c | 2012-05-31 01:14:39 +0000 | [diff] [blame] | 549 | missingAttachment = false; |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 550 | } |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 551 | else if (samples != stencilAttachment.getSamples()) |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 552 | { |
| 553 | return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE; |
| 554 | } |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 555 | } |
| 556 | |
daniel@transgaming.com | 6b7c84c | 2012-05-31 01:14:39 +0000 | [diff] [blame] | 557 | // we need to have at least one attachment to be complete |
| 558 | if (missingAttachment) |
| 559 | { |
| 560 | return GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT; |
daniel@transgaming.com | cdacc8e | 2010-07-28 19:20:50 +0000 | [diff] [blame] | 561 | } |
| 562 | |
Jamie Madill | cc86d64 | 2015-11-24 13:00:07 -0500 | [diff] [blame] | 563 | // In ES 2.0, all color attachments must have the same width and height. |
| 564 | // In ES 3.0, there is no such restriction. |
| 565 | if (data.clientVersion < 3 && !mData.attachmentsHaveSameDimensions()) |
| 566 | { |
| 567 | return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS; |
| 568 | } |
| 569 | |
| 570 | if (!mImpl->checkStatus()) |
| 571 | { |
| 572 | return GL_FRAMEBUFFER_UNSUPPORTED; |
| 573 | } |
| 574 | |
| 575 | return GL_FRAMEBUFFER_COMPLETE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 576 | } |
daniel@transgaming.com | 9ecb9f9 | 2010-07-28 19:21:12 +0000 | [diff] [blame] | 577 | |
Austin Kinross | 0833263 | 2015-05-05 13:35:47 -0700 | [diff] [blame] | 578 | Error Framebuffer::discard(size_t count, const GLenum *attachments) |
| 579 | { |
| 580 | return mImpl->discard(count, attachments); |
| 581 | } |
| 582 | |
Geoff Lang | 9ad4bda | 2014-12-01 11:03:09 -0500 | [diff] [blame] | 583 | Error Framebuffer::invalidate(size_t count, const GLenum *attachments) |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 584 | { |
Geoff Lang | 9ad4bda | 2014-12-01 11:03:09 -0500 | [diff] [blame] | 585 | return mImpl->invalidate(count, attachments); |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 586 | } |
| 587 | |
Geoff Lang | 9ad4bda | 2014-12-01 11:03:09 -0500 | [diff] [blame] | 588 | Error Framebuffer::invalidateSub(size_t count, const GLenum *attachments, const gl::Rectangle &area) |
Jamie Madill | 400a441 | 2014-08-29 15:46:45 -0400 | [diff] [blame] | 589 | { |
Geoff Lang | 9ad4bda | 2014-12-01 11:03:09 -0500 | [diff] [blame] | 590 | return mImpl->invalidateSub(count, attachments, area); |
Jamie Madill | 400a441 | 2014-08-29 15:46:45 -0400 | [diff] [blame] | 591 | } |
| 592 | |
Jamie Madill | c29968b | 2016-01-20 11:17:23 -0500 | [diff] [blame] | 593 | Error Framebuffer::clear(const gl::Data &data, GLbitfield mask) |
Geoff Lang | b04dc82 | 2014-12-01 12:02:02 -0500 | [diff] [blame] | 594 | { |
Jamie Madill | c29968b | 2016-01-20 11:17:23 -0500 | [diff] [blame] | 595 | if (data.state->isRasterizerDiscardEnabled()) |
Jamie Madill | 984ef41 | 2015-11-24 16:10:21 -0500 | [diff] [blame] | 596 | { |
| 597 | return gl::Error(GL_NO_ERROR); |
| 598 | } |
| 599 | |
Jamie Madill | c29968b | 2016-01-20 11:17:23 -0500 | [diff] [blame] | 600 | return mImpl->clear(data, mask); |
Geoff Lang | b04dc82 | 2014-12-01 12:02:02 -0500 | [diff] [blame] | 601 | } |
| 602 | |
Jamie Madill | c29968b | 2016-01-20 11:17:23 -0500 | [diff] [blame] | 603 | Error Framebuffer::clearBufferfv(const gl::Data &data, |
Jamie Madill | 1b94d43 | 2015-08-07 13:23:23 -0400 | [diff] [blame] | 604 | GLenum buffer, |
| 605 | GLint drawbuffer, |
| 606 | const GLfloat *values) |
Geoff Lang | b04dc82 | 2014-12-01 12:02:02 -0500 | [diff] [blame] | 607 | { |
Jamie Madill | c29968b | 2016-01-20 11:17:23 -0500 | [diff] [blame] | 608 | if (data.state->isRasterizerDiscardEnabled()) |
Jamie Madill | 984ef41 | 2015-11-24 16:10:21 -0500 | [diff] [blame] | 609 | { |
| 610 | return gl::Error(GL_NO_ERROR); |
| 611 | } |
| 612 | |
Jamie Madill | c29968b | 2016-01-20 11:17:23 -0500 | [diff] [blame] | 613 | return mImpl->clearBufferfv(data, buffer, drawbuffer, values); |
Geoff Lang | b04dc82 | 2014-12-01 12:02:02 -0500 | [diff] [blame] | 614 | } |
| 615 | |
Jamie Madill | c29968b | 2016-01-20 11:17:23 -0500 | [diff] [blame] | 616 | Error Framebuffer::clearBufferuiv(const gl::Data &data, |
Jamie Madill | 1b94d43 | 2015-08-07 13:23:23 -0400 | [diff] [blame] | 617 | GLenum buffer, |
| 618 | GLint drawbuffer, |
| 619 | const GLuint *values) |
Geoff Lang | b04dc82 | 2014-12-01 12:02:02 -0500 | [diff] [blame] | 620 | { |
Jamie Madill | c29968b | 2016-01-20 11:17:23 -0500 | [diff] [blame] | 621 | if (data.state->isRasterizerDiscardEnabled()) |
Jamie Madill | 984ef41 | 2015-11-24 16:10:21 -0500 | [diff] [blame] | 622 | { |
| 623 | return gl::Error(GL_NO_ERROR); |
| 624 | } |
| 625 | |
Jamie Madill | c29968b | 2016-01-20 11:17:23 -0500 | [diff] [blame] | 626 | return mImpl->clearBufferuiv(data, buffer, drawbuffer, values); |
Geoff Lang | b04dc82 | 2014-12-01 12:02:02 -0500 | [diff] [blame] | 627 | } |
| 628 | |
Jamie Madill | c29968b | 2016-01-20 11:17:23 -0500 | [diff] [blame] | 629 | Error Framebuffer::clearBufferiv(const gl::Data &data, |
Jamie Madill | 1b94d43 | 2015-08-07 13:23:23 -0400 | [diff] [blame] | 630 | GLenum buffer, |
| 631 | GLint drawbuffer, |
| 632 | const GLint *values) |
Geoff Lang | b04dc82 | 2014-12-01 12:02:02 -0500 | [diff] [blame] | 633 | { |
Jamie Madill | c29968b | 2016-01-20 11:17:23 -0500 | [diff] [blame] | 634 | if (data.state->isRasterizerDiscardEnabled()) |
Jamie Madill | 984ef41 | 2015-11-24 16:10:21 -0500 | [diff] [blame] | 635 | { |
| 636 | return gl::Error(GL_NO_ERROR); |
| 637 | } |
| 638 | |
Jamie Madill | c29968b | 2016-01-20 11:17:23 -0500 | [diff] [blame] | 639 | return mImpl->clearBufferiv(data, buffer, drawbuffer, values); |
Geoff Lang | b04dc82 | 2014-12-01 12:02:02 -0500 | [diff] [blame] | 640 | } |
| 641 | |
Jamie Madill | c29968b | 2016-01-20 11:17:23 -0500 | [diff] [blame] | 642 | Error Framebuffer::clearBufferfi(const gl::Data &data, |
Jamie Madill | 1b94d43 | 2015-08-07 13:23:23 -0400 | [diff] [blame] | 643 | GLenum buffer, |
| 644 | GLint drawbuffer, |
| 645 | GLfloat depth, |
| 646 | GLint stencil) |
Geoff Lang | b04dc82 | 2014-12-01 12:02:02 -0500 | [diff] [blame] | 647 | { |
Jamie Madill | c29968b | 2016-01-20 11:17:23 -0500 | [diff] [blame] | 648 | if (data.state->isRasterizerDiscardEnabled()) |
Jamie Madill | 984ef41 | 2015-11-24 16:10:21 -0500 | [diff] [blame] | 649 | { |
| 650 | return gl::Error(GL_NO_ERROR); |
| 651 | } |
| 652 | |
Jamie Madill | c29968b | 2016-01-20 11:17:23 -0500 | [diff] [blame] | 653 | return mImpl->clearBufferfi(data, buffer, drawbuffer, depth, stencil); |
Geoff Lang | b04dc82 | 2014-12-01 12:02:02 -0500 | [diff] [blame] | 654 | } |
| 655 | |
Geoff Lang | bce529e | 2014-12-01 12:48:41 -0500 | [diff] [blame] | 656 | GLenum Framebuffer::getImplementationColorReadFormat() const |
| 657 | { |
| 658 | return mImpl->getImplementationColorReadFormat(); |
| 659 | } |
| 660 | |
| 661 | GLenum Framebuffer::getImplementationColorReadType() const |
| 662 | { |
| 663 | return mImpl->getImplementationColorReadType(); |
| 664 | } |
| 665 | |
Jamie Madill | c29968b | 2016-01-20 11:17:23 -0500 | [diff] [blame] | 666 | Error Framebuffer::readPixels(const State &state, |
| 667 | const Rectangle &area, |
Jamie Madill | 1b94d43 | 2015-08-07 13:23:23 -0400 | [diff] [blame] | 668 | GLenum format, |
| 669 | GLenum type, |
| 670 | GLvoid *pixels) const |
Geoff Lang | bce529e | 2014-12-01 12:48:41 -0500 | [diff] [blame] | 671 | { |
Geoff Lang | 520c4ae | 2015-05-05 13:12:36 -0400 | [diff] [blame] | 672 | Error error = mImpl->readPixels(state, area, format, type, pixels); |
| 673 | if (error.isError()) |
| 674 | { |
| 675 | return error; |
| 676 | } |
| 677 | |
| 678 | Buffer *unpackBuffer = state.getUnpackState().pixelBuffer.get(); |
| 679 | if (unpackBuffer) |
| 680 | { |
| 681 | unpackBuffer->onPixelUnpack(); |
| 682 | } |
| 683 | |
| 684 | return Error(GL_NO_ERROR); |
Geoff Lang | bce529e | 2014-12-01 12:48:41 -0500 | [diff] [blame] | 685 | } |
| 686 | |
Jamie Madill | c29968b | 2016-01-20 11:17:23 -0500 | [diff] [blame] | 687 | Error Framebuffer::blit(const State &state, |
| 688 | const Rectangle &sourceArea, |
| 689 | const Rectangle &destArea, |
Geoff Lang | 242468f | 2015-09-24 14:15:41 -0400 | [diff] [blame] | 690 | GLbitfield mask, |
| 691 | GLenum filter, |
Jamie Madill | c29968b | 2016-01-20 11:17:23 -0500 | [diff] [blame] | 692 | const Framebuffer *sourceFramebuffer) |
Geoff Lang | 54bd5a4 | 2014-12-01 12:51:04 -0500 | [diff] [blame] | 693 | { |
| 694 | return mImpl->blit(state, sourceArea, destArea, mask, filter, sourceFramebuffer); |
| 695 | } |
| 696 | |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 697 | int Framebuffer::getSamples(const gl::Data &data) const |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 698 | { |
Geoff Lang | 748f74e | 2014-12-01 11:25:34 -0500 | [diff] [blame] | 699 | if (checkStatus(data) == GL_FRAMEBUFFER_COMPLETE) |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 700 | { |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 701 | // for a complete framebuffer, all attachments must have the same sample count |
| 702 | // in this case return the first nonzero sample size |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 703 | for (const FramebufferAttachment &colorAttachment : mData.mColorAttachments) |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 704 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 705 | if (colorAttachment.isAttached()) |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 706 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 707 | return colorAttachment.getSamples(); |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 708 | } |
| 709 | } |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 710 | } |
shannon.woods%transgaming.com@gtempaccount.com | f30ccc2 | 2013-04-13 03:28:36 +0000 | [diff] [blame] | 711 | |
| 712 | return 0; |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 713 | } |
| 714 | |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame] | 715 | bool Framebuffer::hasValidDepthStencil() const |
| 716 | { |
Jamie Madill | b6bda4a | 2015-04-20 12:53:26 -0400 | [diff] [blame] | 717 | return mData.getDepthStencilAttachment() != nullptr; |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame] | 718 | } |
| 719 | |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 720 | void Framebuffer::setAttachment(GLenum type, |
| 721 | GLenum binding, |
| 722 | const ImageIndex &textureIndex, |
| 723 | FramebufferAttachmentObject *resource) |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 724 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 725 | if (binding == GL_DEPTH_STENCIL || binding == GL_DEPTH_STENCIL_ATTACHMENT) |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 726 | { |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 727 | // ensure this is a legitimate depth+stencil format |
Jamie Madill | 375c37c | 2015-07-21 15:14:08 -0400 | [diff] [blame] | 728 | FramebufferAttachmentObject *attachmentObj = resource; |
| 729 | if (resource) |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 730 | { |
Jamie Madill | 375c37c | 2015-07-21 15:14:08 -0400 | [diff] [blame] | 731 | FramebufferAttachment::Target target(binding, textureIndex); |
| 732 | GLenum internalFormat = resource->getAttachmentInternalFormat(target); |
| 733 | const InternalFormat &formatInfo = GetInternalFormatInfo(internalFormat); |
| 734 | if (formatInfo.depthBits == 0 || formatInfo.stencilBits == 0) |
| 735 | { |
| 736 | // Attaching nullptr detaches the current attachment. |
| 737 | attachmentObj = nullptr; |
| 738 | } |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 739 | } |
Jamie Madill | 375c37c | 2015-07-21 15:14:08 -0400 | [diff] [blame] | 740 | |
| 741 | mData.mDepthAttachment.attach(type, binding, textureIndex, attachmentObj); |
| 742 | mData.mStencilAttachment.attach(type, binding, textureIndex, attachmentObj); |
Jamie Madill | 7d75e2b | 2015-04-30 09:42:18 -0400 | [diff] [blame] | 743 | mImpl->onUpdateDepthStencilAttachment(); |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 744 | } |
| 745 | else |
| 746 | { |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 747 | switch (binding) |
| 748 | { |
| 749 | case GL_DEPTH: |
| 750 | case GL_DEPTH_ATTACHMENT: |
Jamie Madill | 7d75e2b | 2015-04-30 09:42:18 -0400 | [diff] [blame] | 751 | mData.mDepthAttachment.attach(type, binding, textureIndex, resource); |
| 752 | mImpl->onUpdateDepthAttachment(); |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 753 | break; |
| 754 | case GL_STENCIL: |
| 755 | case GL_STENCIL_ATTACHMENT: |
Jamie Madill | 7d75e2b | 2015-04-30 09:42:18 -0400 | [diff] [blame] | 756 | mData.mStencilAttachment.attach(type, binding, textureIndex, resource); |
| 757 | mImpl->onUpdateStencilAttachment(); |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 758 | break; |
| 759 | case GL_BACK: |
Jamie Madill | 7d75e2b | 2015-04-30 09:42:18 -0400 | [diff] [blame] | 760 | mData.mColorAttachments[0].attach(type, binding, textureIndex, resource); |
| 761 | mImpl->onUpdateColorAttachment(0); |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 762 | break; |
| 763 | default: |
| 764 | { |
| 765 | size_t colorIndex = binding - GL_COLOR_ATTACHMENT0; |
| 766 | ASSERT(colorIndex < mData.mColorAttachments.size()); |
Jamie Madill | 7d75e2b | 2015-04-30 09:42:18 -0400 | [diff] [blame] | 767 | mData.mColorAttachments[colorIndex].attach(type, binding, textureIndex, resource); |
| 768 | mImpl->onUpdateColorAttachment(colorIndex); |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 769 | } |
| 770 | break; |
| 771 | } |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 772 | } |
| 773 | } |
| 774 | |
Jamie Madill | 2d06b73 | 2015-04-20 12:53:28 -0400 | [diff] [blame] | 775 | void Framebuffer::resetAttachment(GLenum binding) |
| 776 | { |
| 777 | setAttachment(GL_NONE, binding, ImageIndex::MakeInvalid(), nullptr); |
| 778 | } |
| 779 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 780 | } |