| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 WebGLRenderbufferAttachment() { } | 47 WebGLRenderbufferAttachment() { } |
| 48 | 48 |
| 49 virtual GLsizei width() const override; | 49 virtual GLsizei width() const override; |
| 50 virtual GLsizei height() const override; | 50 virtual GLsizei height() const override; |
| 51 virtual GLenum format() const override; | 51 virtual GLenum format() const override; |
| 52 virtual GLenum type() const override; | 52 virtual GLenum type() const override; |
| 53 virtual WebGLSharedObject* object() const override; | 53 virtual WebGLSharedObject* object() const override; |
| 54 virtual bool isSharedObject(WebGLSharedObject*) const override; | 54 virtual bool isSharedObject(WebGLSharedObject*) const override; |
| 55 virtual bool valid() const override; | 55 virtual bool valid() const override; |
| 56 virtual void onDetached(WebGraphicsContext3D*) override; | 56 virtual void onDetached(WebGraphicsContext3D*) override; |
| 57 virtual void attach(WebGraphicsContext3D*, GLenum attachment) override; | 57 virtual void attach(WebGraphicsContext3D*, GLenum target, GLenum attachm
ent) override; |
| 58 virtual void unattach(WebGraphicsContext3D*, GLenum attachment) override
; | 58 virtual void unattach(WebGraphicsContext3D*, GLenum target, GLenum attac
hment) override; |
| 59 | 59 |
| 60 RefPtrWillBeMember<WebGLRenderbuffer> m_renderbuffer; | 60 RefPtrWillBeMember<WebGLRenderbuffer> m_renderbuffer; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> WebGLRenderbufferA
ttachment::create(WebGLRenderbuffer* renderbuffer) | 63 PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> WebGLRenderbufferA
ttachment::create(WebGLRenderbuffer* renderbuffer) |
| 64 { | 64 { |
| 65 return adoptRefWillBeNoop(new WebGLRenderbufferAttachment(renderbuffer))
; | 65 return adoptRefWillBeNoop(new WebGLRenderbufferAttachment(renderbuffer))
; |
| 66 } | 66 } |
| 67 | 67 |
| 68 DEFINE_TRACE(WebGLRenderbufferAttachment) | 68 DEFINE_TRACE(WebGLRenderbufferAttachment) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 bool WebGLRenderbufferAttachment::valid() const | 110 bool WebGLRenderbufferAttachment::valid() const |
| 111 { | 111 { |
| 112 return m_renderbuffer->object(); | 112 return m_renderbuffer->object(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void WebGLRenderbufferAttachment::onDetached(WebGraphicsContext3D* context) | 115 void WebGLRenderbufferAttachment::onDetached(WebGraphicsContext3D* context) |
| 116 { | 116 { |
| 117 m_renderbuffer->onDetached(context); | 117 m_renderbuffer->onDetached(context); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void WebGLRenderbufferAttachment::attach(WebGraphicsContext3D* context, GLen
um attachment) | 120 void WebGLRenderbufferAttachment::attach(WebGraphicsContext3D* context, GLen
um target, GLenum attachment) |
| 121 { | 121 { |
| 122 Platform3DObject object = objectOrZero(m_renderbuffer.get()); | 122 Platform3DObject object = objectOrZero(m_renderbuffer.get()); |
| 123 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT && m_renderbuffer->emulate
dStencilBuffer()) { | 123 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT && m_renderbuffer->emulate
dStencilBuffer()) { |
| 124 context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT
, GL_RENDERBUFFER, object); | 124 context->framebufferRenderbuffer(target, GL_DEPTH_ATTACHMENT, GL_REN
DERBUFFER, object); |
| 125 context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHME
NT, GL_RENDERBUFFER, objectOrZero(m_renderbuffer->emulatedStencilBuffer())); | 125 context->framebufferRenderbuffer(target, GL_STENCIL_ATTACHMENT, GL_R
ENDERBUFFER, objectOrZero(m_renderbuffer->emulatedStencilBuffer())); |
| 126 } else { | 126 } else { |
| 127 context->framebufferRenderbuffer(GL_FRAMEBUFFER, attachment, GL_REND
ERBUFFER, object); | 127 context->framebufferRenderbuffer(target, attachment, GL_RENDERBUFFER
, object); |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 | 130 |
| 131 void WebGLRenderbufferAttachment::unattach(WebGraphicsContext3D* context, GL
enum attachment) | 131 void WebGLRenderbufferAttachment::unattach(WebGraphicsContext3D* context, GL
enum target, GLenum attachment) |
| 132 { | 132 { |
| 133 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { | 133 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { |
| 134 context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT
, GL_RENDERBUFFER, 0); | 134 context->framebufferRenderbuffer(target, GL_DEPTH_ATTACHMENT, GL_REN
DERBUFFER, 0); |
| 135 context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHME
NT, GL_RENDERBUFFER, 0); | 135 context->framebufferRenderbuffer(target, GL_STENCIL_ATTACHMENT, GL_R
ENDERBUFFER, 0); |
| 136 } else { | 136 } else { |
| 137 context->framebufferRenderbuffer(GL_FRAMEBUFFER, attachment, GL_REND
ERBUFFER, 0); | 137 context->framebufferRenderbuffer(target, attachment, GL_RENDERBUFFER
, 0); |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 | 140 |
| 141 GLenum WebGLRenderbufferAttachment::type() const | 141 GLenum WebGLRenderbufferAttachment::type() const |
| 142 { | 142 { |
| 143 notImplemented(); | 143 notImplemented(); |
| 144 return 0; | 144 return 0; |
| 145 } | 145 } |
| 146 | 146 |
| 147 class WebGLTextureAttachment final : public WebGLFramebuffer::WebGLAttachmen
t { | 147 class WebGLTextureAttachment final : public WebGLFramebuffer::WebGLAttachmen
t { |
| 148 public: | 148 public: |
| 149 static PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> create(
WebGLTexture*, GLenum target, GLint level); | 149 static PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> create(
WebGLTexture*, GLenum target, GLint level); |
| 150 | 150 |
| 151 DECLARE_VIRTUAL_TRACE(); | 151 DECLARE_VIRTUAL_TRACE(); |
| 152 | 152 |
| 153 private: | 153 private: |
| 154 WebGLTextureAttachment(WebGLTexture*, GLenum target, GLint level); | 154 WebGLTextureAttachment(WebGLTexture*, GLenum target, GLint level); |
| 155 WebGLTextureAttachment() { } | 155 WebGLTextureAttachment() { } |
| 156 | 156 |
| 157 virtual GLsizei width() const override; | 157 virtual GLsizei width() const override; |
| 158 virtual GLsizei height() const override; | 158 virtual GLsizei height() const override; |
| 159 virtual GLenum format() const override; | 159 virtual GLenum format() const override; |
| 160 virtual GLenum type() const override; | 160 virtual GLenum type() const override; |
| 161 virtual WebGLSharedObject* object() const override; | 161 virtual WebGLSharedObject* object() const override; |
| 162 virtual bool isSharedObject(WebGLSharedObject*) const override; | 162 virtual bool isSharedObject(WebGLSharedObject*) const override; |
| 163 virtual bool valid() const override; | 163 virtual bool valid() const override; |
| 164 virtual void onDetached(WebGraphicsContext3D*) override; | 164 virtual void onDetached(WebGraphicsContext3D*) override; |
| 165 virtual void attach(WebGraphicsContext3D*, GLenum attachment) override; | 165 virtual void attach(WebGraphicsContext3D*, GLenum target, GLenum attachm
ent) override; |
| 166 virtual void unattach(WebGraphicsContext3D*, GLenum attachment) override
; | 166 virtual void unattach(WebGraphicsContext3D*, GLenum target, GLenum attac
hment) override; |
| 167 | 167 |
| 168 RefPtrWillBeMember<WebGLTexture> m_texture; | 168 RefPtrWillBeMember<WebGLTexture> m_texture; |
| 169 GLenum m_target; | 169 GLenum m_target; |
| 170 GLint m_level; | 170 GLint m_level; |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> WebGLTextureAttach
ment::create(WebGLTexture* texture, GLenum target, GLint level) | 173 PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> WebGLTextureAttach
ment::create(WebGLTexture* texture, GLenum target, GLint level) |
| 174 { | 174 { |
| 175 return adoptRefWillBeNoop(new WebGLTextureAttachment(texture, target, le
vel)); | 175 return adoptRefWillBeNoop(new WebGLTextureAttachment(texture, target, le
vel)); |
| 176 } | 176 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 bool WebGLTextureAttachment::valid() const | 216 bool WebGLTextureAttachment::valid() const |
| 217 { | 217 { |
| 218 return m_texture->object(); | 218 return m_texture->object(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void WebGLTextureAttachment::onDetached(WebGraphicsContext3D* context) | 221 void WebGLTextureAttachment::onDetached(WebGraphicsContext3D* context) |
| 222 { | 222 { |
| 223 m_texture->onDetached(context); | 223 m_texture->onDetached(context); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void WebGLTextureAttachment::attach(WebGraphicsContext3D* context, GLenum at
tachment) | 226 void WebGLTextureAttachment::attach(WebGraphicsContext3D* context, GLenum ta
rget, GLenum attachment) |
| 227 { | 227 { |
| 228 Platform3DObject object = objectOrZero(m_texture.get()); | 228 Platform3DObject object = objectOrZero(m_texture.get()); |
| 229 context->framebufferTexture2D(GL_FRAMEBUFFER, attachment, m_target, obje
ct, m_level); | 229 context->framebufferTexture2D(target, attachment, m_target, object, m_le
vel); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void WebGLTextureAttachment::unattach(WebGraphicsContext3D* context, GLenum
attachment) | 232 void WebGLTextureAttachment::unattach(WebGraphicsContext3D* context, GLenum
target, GLenum attachment) |
| 233 { | 233 { |
| 234 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { | 234 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { |
| 235 context->framebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, m
_target, 0, m_level); | 235 context->framebufferTexture2D(target, GL_DEPTH_ATTACHMENT, m_target,
0, m_level); |
| 236 context->framebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
m_target, 0, m_level); | 236 context->framebufferTexture2D(target, GL_STENCIL_ATTACHMENT, m_targe
t, 0, m_level); |
| 237 } else { | 237 } else { |
| 238 context->framebufferTexture2D(GL_FRAMEBUFFER, attachment, m_target,
0, m_level); | 238 context->framebufferTexture2D(target, attachment, m_target, 0, m_lev
el); |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 | 241 |
| 242 GLenum WebGLTextureAttachment::type() const | 242 GLenum WebGLTextureAttachment::type() const |
| 243 { | 243 { |
| 244 return m_texture->getType(m_target, m_level); | 244 return m_texture->getType(m_target, m_level); |
| 245 } | 245 } |
| 246 | 246 |
| 247 bool isColorRenderable(GLenum internalformat) | 247 bool isColorRenderable(GLenum internalformat) |
| 248 { | 248 { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 // is for the benefit of Oilpan, where the framebuffer object | 288 // is for the benefit of Oilpan, where the framebuffer object |
| 289 // isn't detached when it and the WebGLRenderingContextBase object | 289 // isn't detached when it and the WebGLRenderingContextBase object |
| 290 // it is registered with are both finalized. Without Oilpan, the | 290 // it is registered with are both finalized. Without Oilpan, the |
| 291 // object will have been detached. | 291 // object will have been detached. |
| 292 // | 292 // |
| 293 // To keep the code regular, the trivial detach()ment is always | 293 // To keep the code regular, the trivial detach()ment is always |
| 294 // performed. | 294 // performed. |
| 295 detachAndDeleteObject(); | 295 detachAndDeleteObject(); |
| 296 } | 296 } |
| 297 | 297 |
| 298 void WebGLFramebuffer::setAttachmentForBoundFramebuffer(GLenum attachment, GLenu
m texTarget, WebGLTexture* texture, GLint level) | 298 void WebGLFramebuffer::setAttachmentForBoundFramebuffer(GLenum target, GLenum at
tachment, GLenum texTarget, WebGLTexture* texture, GLint level) |
| 299 { | 299 { |
| 300 ASSERT(isBound()); | 300 ASSERT(isBound(target)); |
| 301 removeAttachmentFromBoundFramebuffer(attachment); | 301 removeAttachmentFromBoundFramebuffer(target, attachment); |
| 302 if (!m_object) | 302 if (!m_object) |
| 303 return; | 303 return; |
| 304 if (texture && texture->object()) { | 304 if (texture && texture->object()) { |
| 305 m_attachments.add(attachment, WebGLTextureAttachment::create(texture, te
xTarget, level)); | 305 m_attachments.add(attachment, WebGLTextureAttachment::create(texture, te
xTarget, level)); |
| 306 drawBuffersIfNecessary(false); | 306 drawBuffersIfNecessary(false); |
| 307 texture->onAttached(); | 307 texture->onAttached(); |
| 308 } | 308 } |
| 309 } | 309 } |
| 310 | 310 |
| 311 void WebGLFramebuffer::setAttachmentForBoundFramebuffer(GLenum attachment, WebGL
Renderbuffer* renderbuffer) | 311 void WebGLFramebuffer::setAttachmentForBoundFramebuffer(GLenum target, GLenum at
tachment, WebGLRenderbuffer* renderbuffer) |
| 312 { | 312 { |
| 313 ASSERT(isBound()); | 313 ASSERT(isBound(target)); |
| 314 removeAttachmentFromBoundFramebuffer(attachment); | 314 removeAttachmentFromBoundFramebuffer(target, attachment); |
| 315 if (!m_object) | 315 if (!m_object) |
| 316 return; | 316 return; |
| 317 if (renderbuffer && renderbuffer->object()) { | 317 if (renderbuffer && renderbuffer->object()) { |
| 318 m_attachments.add(attachment, WebGLRenderbufferAttachment::create(render
buffer)); | 318 m_attachments.add(attachment, WebGLRenderbufferAttachment::create(render
buffer)); |
| 319 drawBuffersIfNecessary(false); | 319 drawBuffersIfNecessary(false); |
| 320 renderbuffer->onAttached(); | 320 renderbuffer->onAttached(); |
| 321 } | 321 } |
| 322 } | 322 } |
| 323 | 323 |
| 324 void WebGLFramebuffer::attach(GLenum attachment, GLenum attachmentPoint) | 324 void WebGLFramebuffer::attach(GLenum target, GLenum attachment, GLenum attachmen
tPoint) |
| 325 { | 325 { |
| 326 ASSERT(isBound()); | 326 ASSERT(isBound(target)); |
| 327 WebGLAttachment* attachmentObject = getAttachment(attachment); | 327 WebGLAttachment* attachmentObject = getAttachment(attachment); |
| 328 if (attachmentObject) | 328 if (attachmentObject) |
| 329 attachmentObject->attach(context()->webContext(), attachmentPoint); | 329 attachmentObject->attach(context()->webContext(), target, attachmentPoin
t); |
| 330 } | 330 } |
| 331 | 331 |
| 332 WebGLSharedObject* WebGLFramebuffer::getAttachmentObject(GLenum attachment) cons
t | 332 WebGLSharedObject* WebGLFramebuffer::getAttachmentObject(GLenum attachment) cons
t |
| 333 { | 333 { |
| 334 if (!m_object) | 334 if (!m_object) |
| 335 return nullptr; | 335 return nullptr; |
| 336 WebGLAttachment* attachmentObject = getAttachment(attachment); | 336 WebGLAttachment* attachmentObject = getAttachment(attachment); |
| 337 return attachmentObject ? attachmentObject->object() : nullptr; | 337 return attachmentObject ? attachmentObject->object() : nullptr; |
| 338 } | 338 } |
| 339 | 339 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 } | 423 } |
| 424 return true; | 424 return true; |
| 425 } | 425 } |
| 426 | 426 |
| 427 WebGLFramebuffer::WebGLAttachment* WebGLFramebuffer::getAttachment(GLenum attach
ment) const | 427 WebGLFramebuffer::WebGLAttachment* WebGLFramebuffer::getAttachment(GLenum attach
ment) const |
| 428 { | 428 { |
| 429 const AttachmentMap::const_iterator it = m_attachments.find(attachment); | 429 const AttachmentMap::const_iterator it = m_attachments.find(attachment); |
| 430 return (it != m_attachments.end()) ? it->value.get() : 0; | 430 return (it != m_attachments.end()) ? it->value.get() : 0; |
| 431 } | 431 } |
| 432 | 432 |
| 433 void WebGLFramebuffer::removeAttachmentFromBoundFramebuffer(GLenum attachment) | 433 void WebGLFramebuffer::removeAttachmentFromBoundFramebuffer(GLenum target, GLenu
m attachment) |
| 434 { | 434 { |
| 435 ASSERT(isBound()); | 435 ASSERT(isBound(target)); |
| 436 if (!m_object) | 436 if (!m_object) |
| 437 return; | 437 return; |
| 438 | 438 |
| 439 WebGLAttachment* attachmentObject = getAttachment(attachment); | 439 WebGLAttachment* attachmentObject = getAttachment(attachment); |
| 440 if (attachmentObject) { | 440 if (attachmentObject) { |
| 441 attachmentObject->onDetached(context()->webContext()); | 441 attachmentObject->onDetached(context()->webContext()); |
| 442 m_attachments.remove(attachment); | 442 m_attachments.remove(attachment); |
| 443 drawBuffersIfNecessary(false); | 443 drawBuffersIfNecessary(false); |
| 444 switch (attachment) { | 444 switch (attachment) { |
| 445 case GL_DEPTH_STENCIL_ATTACHMENT: | 445 case GL_DEPTH_STENCIL_ATTACHMENT: |
| 446 attach(GL_DEPTH_ATTACHMENT, GL_DEPTH_ATTACHMENT); | 446 attach(target, GL_DEPTH_ATTACHMENT, GL_DEPTH_ATTACHMENT); |
| 447 attach(GL_STENCIL_ATTACHMENT, GL_STENCIL_ATTACHMENT); | 447 attach(target, GL_STENCIL_ATTACHMENT, GL_STENCIL_ATTACHMENT); |
| 448 break; | 448 break; |
| 449 case GL_DEPTH_ATTACHMENT: | 449 case GL_DEPTH_ATTACHMENT: |
| 450 attach(GL_DEPTH_STENCIL_ATTACHMENT, GL_DEPTH_ATTACHMENT); | 450 attach(target, GL_DEPTH_STENCIL_ATTACHMENT, GL_DEPTH_ATTACHMENT); |
| 451 break; | 451 break; |
| 452 case GL_STENCIL_ATTACHMENT: | 452 case GL_STENCIL_ATTACHMENT: |
| 453 attach(GL_DEPTH_STENCIL_ATTACHMENT, GL_STENCIL_ATTACHMENT); | 453 attach(target, GL_DEPTH_STENCIL_ATTACHMENT, GL_STENCIL_ATTACHMENT); |
| 454 break; | 454 break; |
| 455 } | 455 } |
| 456 } | 456 } |
| 457 } | 457 } |
| 458 | 458 |
| 459 void WebGLFramebuffer::removeAttachmentFromBoundFramebuffer(WebGLSharedObject* a
ttachment) | 459 void WebGLFramebuffer::removeAttachmentFromBoundFramebuffer(GLenum target, WebGL
SharedObject* attachment) |
| 460 { | 460 { |
| 461 ASSERT(isBound()); | 461 ASSERT(isBound(target)); |
| 462 if (!m_object) | 462 if (!m_object) |
| 463 return; | 463 return; |
| 464 if (!attachment) | 464 if (!attachment) |
| 465 return; | 465 return; |
| 466 | 466 |
| 467 bool checkMore = true; | 467 bool checkMore = true; |
| 468 while (checkMore) { | 468 while (checkMore) { |
| 469 checkMore = false; | 469 checkMore = false; |
| 470 for (const auto& it : m_attachments) { | 470 for (const auto& it : m_attachments) { |
| 471 WebGLAttachment* attachmentObject = it.value.get(); | 471 WebGLAttachment* attachmentObject = it.value.get(); |
| 472 if (attachmentObject->isSharedObject(attachment)) { | 472 if (attachmentObject->isSharedObject(attachment)) { |
| 473 GLenum attachmentType = it.key; | 473 GLenum attachmentType = it.key; |
| 474 attachmentObject->unattach(context()->webContext(), attachmentTy
pe); | 474 attachmentObject->unattach(context()->webContext(), target, atta
chmentType); |
| 475 removeAttachmentFromBoundFramebuffer(attachmentType); | 475 removeAttachmentFromBoundFramebuffer(target, attachmentType); |
| 476 checkMore = true; | 476 checkMore = true; |
| 477 break; | 477 break; |
| 478 } | 478 } |
| 479 } | 479 } |
| 480 } | 480 } |
| 481 } | 481 } |
| 482 | 482 |
| 483 GLenum WebGLFramebuffer::colorBufferFormat() const | 483 GLenum WebGLFramebuffer::colorBufferFormat() const |
| 484 { | 484 { |
| 485 if (!m_object) | 485 if (!m_object) |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 // on their own when finalizing, so the explicit notification is | 573 // on their own when finalizing, so the explicit notification is |
| 574 // not needed. | 574 // not needed. |
| 575 for (const auto& attachment : m_attachments) | 575 for (const auto& attachment : m_attachments) |
| 576 attachment.value->onDetached(context3d); | 576 attachment.value->onDetached(context3d); |
| 577 #endif | 577 #endif |
| 578 | 578 |
| 579 context3d->deleteFramebuffer(m_object); | 579 context3d->deleteFramebuffer(m_object); |
| 580 m_object = 0; | 580 m_object = 0; |
| 581 } | 581 } |
| 582 | 582 |
| 583 bool WebGLFramebuffer::isBound() const | 583 bool WebGLFramebuffer::isBound(GLenum target) const |
| 584 { | 584 { |
| 585 return (context()->m_framebufferBinding.get() == this); | 585 return (context()->getFramebufferBinding(target) == this); |
| 586 } | 586 } |
| 587 | 587 |
| 588 void WebGLFramebuffer::drawBuffers(const Vector<GLenum>& bufs) | 588 void WebGLFramebuffer::drawBuffers(const Vector<GLenum>& bufs) |
| 589 { | 589 { |
| 590 m_drawBuffers = bufs; | 590 m_drawBuffers = bufs; |
| 591 m_filteredDrawBuffers.resize(m_drawBuffers.size()); | 591 m_filteredDrawBuffers.resize(m_drawBuffers.size()); |
| 592 for (size_t i = 0; i < m_filteredDrawBuffers.size(); ++i) | 592 for (size_t i = 0; i < m_filteredDrawBuffers.size(); ++i) |
| 593 m_filteredDrawBuffers[i] = GL_NONE; | 593 m_filteredDrawBuffers[i] = GL_NONE; |
| 594 drawBuffersIfNecessary(true); | 594 drawBuffersIfNecessary(true); |
| 595 } | 595 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 | 632 |
| 633 DEFINE_TRACE(WebGLFramebuffer) | 633 DEFINE_TRACE(WebGLFramebuffer) |
| 634 { | 634 { |
| 635 #if ENABLE(OILPAN) | 635 #if ENABLE(OILPAN) |
| 636 visitor->trace(m_attachments); | 636 visitor->trace(m_attachments); |
| 637 #endif | 637 #endif |
| 638 WebGLContextObject::trace(visitor); | 638 WebGLContextObject::trace(visitor); |
| 639 } | 639 } |
| 640 | 640 |
| 641 } | 641 } |
| OLD | NEW |