Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: Source/WebCore/html/canvas/WebGLFramebuffer.cpp

Issue 10584035: Merge 120636 - Fix framebuffer-object-attachment.html failures (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 121 }
122 122
123 void WebGLRenderbufferAttachment::attach(GraphicsContext3D* context, GC3Denu m attachment) 123 void WebGLRenderbufferAttachment::attach(GraphicsContext3D* context, GC3Denu m attachment)
124 { 124 {
125 Platform3DObject object = objectOrZero(m_renderbuffer.get()); 125 Platform3DObject object = objectOrZero(m_renderbuffer.get());
126 context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, attachm ent, GraphicsContext3D::RENDERBUFFER, object); 126 context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, attachm ent, GraphicsContext3D::RENDERBUFFER, object);
127 } 127 }
128 128
129 void WebGLRenderbufferAttachment::unattach(GraphicsContext3D* context, GC3De num attachment) 129 void WebGLRenderbufferAttachment::unattach(GraphicsContext3D* context, GC3De num attachment)
130 { 130 {
131 if (attachment == GraphicsContext3D::DEPTH_STENCIL) { 131 if (attachment == GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT) {
132 context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, Gra phicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, 0); 132 context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, Gra phicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, 0);
133 context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, Gra phicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, 0); 133 context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, Gra phicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, 0);
134 } else 134 } else
135 context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, att achment, GraphicsContext3D::RENDERBUFFER, 0); 135 context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, att achment, GraphicsContext3D::RENDERBUFFER, 0);
136 } 136 }
137 137
138 class WebGLTextureAttachment : public WebGLFramebuffer::WebGLAttachment { 138 class WebGLTextureAttachment : public WebGLFramebuffer::WebGLAttachment {
139 public: 139 public:
140 static PassRefPtr<WebGLFramebuffer::WebGLAttachment> create(WebGLTexture *, GC3Denum target, GC3Dint level); 140 static PassRefPtr<WebGLFramebuffer::WebGLAttachment> create(WebGLTexture *, GC3Denum target, GC3Dint level);
141 141
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 276 }
277 277
278 WebGLFramebuffer::~WebGLFramebuffer() 278 WebGLFramebuffer::~WebGLFramebuffer()
279 { 279 {
280 deleteObject(0); 280 deleteObject(0);
281 } 281 }
282 282
283 void WebGLFramebuffer::setAttachmentForBoundFramebuffer(GC3Denum attachment, GC3 Denum texTarget, WebGLTexture* texture, GC3Dint level) 283 void WebGLFramebuffer::setAttachmentForBoundFramebuffer(GC3Denum attachment, GC3 Denum texTarget, WebGLTexture* texture, GC3Dint level)
284 { 284 {
285 ASSERT(isBound()); 285 ASSERT(isBound());
286 removeAttachmentFromBoundFramebuffer(attachment);
286 if (!object()) 287 if (!object())
287 return; 288 return;
288 removeAttachmentFromBoundFramebuffer(attachment);
289 if (texture && texture->object()) { 289 if (texture && texture->object()) {
290
291 m_attachments.add(attachment, WebGLTextureAttachment::create(texture, te xTarget, level)); 290 m_attachments.add(attachment, WebGLTextureAttachment::create(texture, te xTarget, level));
292 texture->onAttached(); 291 texture->onAttached();
293 } 292 }
294 } 293 }
295 294
296 void WebGLFramebuffer::setAttachmentForBoundFramebuffer(GC3Denum attachment, Web GLRenderbuffer* renderbuffer) 295 void WebGLFramebuffer::setAttachmentForBoundFramebuffer(GC3Denum attachment, Web GLRenderbuffer* renderbuffer)
297 { 296 {
298 ASSERT(isBound()); 297 ASSERT(isBound());
298 removeAttachmentFromBoundFramebuffer(attachment);
299 if (!object()) 299 if (!object())
300 return; 300 return;
301 removeAttachmentFromBoundFramebuffer(attachment);
302 if (renderbuffer && renderbuffer->object()) { 301 if (renderbuffer && renderbuffer->object()) {
303 m_attachments.add(attachment, WebGLRenderbufferAttachment::create(render buffer)); 302 m_attachments.add(attachment, WebGLRenderbufferAttachment::create(render buffer));
304 renderbuffer->onAttached(); 303 renderbuffer->onAttached();
305 } 304 }
306 } 305 }
307 306
308 void WebGLFramebuffer::attach(GC3Denum attachment, GC3Denum attachmentPoint) 307 void WebGLFramebuffer::attach(GC3Denum attachment, GC3Denum attachmentPoint)
309 { 308 {
310 ASSERT(isBound()); 309 ASSERT(isBound());
311 WebGLAttachment* attachmentObject = getAttachment(attachment); 310 WebGLAttachment* attachmentObject = getAttachment(attachment);
(...skipping 18 matching lines...) Expand all
330 void WebGLFramebuffer::removeAttachmentFromBoundFramebuffer(GC3Denum attachment) 329 void WebGLFramebuffer::removeAttachmentFromBoundFramebuffer(GC3Denum attachment)
331 { 330 {
332 ASSERT(isBound()); 331 ASSERT(isBound());
333 if (!object()) 332 if (!object())
334 return; 333 return;
335 334
336 WebGLAttachment* attachmentObject = getAttachment(attachment); 335 WebGLAttachment* attachmentObject = getAttachment(attachment);
337 if (attachmentObject) { 336 if (attachmentObject) {
338 attachmentObject->onDetached(context()->graphicsContext3D()); 337 attachmentObject->onDetached(context()->graphicsContext3D());
339 m_attachments.remove(attachment); 338 m_attachments.remove(attachment);
339 switch (attachment) {
340 case GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT:
341 attach(GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::DEPTH _ATTACHMENT);
342 attach(GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::STE NCIL_ATTACHMENT);
343 break;
344 case GraphicsContext3D::DEPTH_ATTACHMENT:
345 attach(GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT, GraphicsContext3 D::DEPTH_ATTACHMENT);
346 break;
347 case GraphicsContext3D::STENCIL_ATTACHMENT:
348 attach(GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT, GraphicsContext3 D::STENCIL_ATTACHMENT);
349 break;
350 }
340 } 351 }
341 } 352 }
342 353
343 void WebGLFramebuffer::removeAttachmentFromBoundFramebuffer(WebGLSharedObject* a ttachment) 354 void WebGLFramebuffer::removeAttachmentFromBoundFramebuffer(WebGLSharedObject* a ttachment)
344 { 355 {
345 ASSERT(isBound()); 356 ASSERT(isBound());
346 if (!object()) 357 if (!object())
347 return; 358 return;
348 if (!attachment) 359 if (!attachment)
349 return; 360 return;
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 } 577 }
567 578
568 bool WebGLFramebuffer::isBound() const 579 bool WebGLFramebuffer::isBound() const
569 { 580 {
570 return (context()->m_framebufferBinding.get() == this); 581 return (context()->m_framebufferBinding.get() == this);
571 } 582 }
572 583
573 } 584 }
574 585
575 #endif // ENABLE(WEBGL) 586 #endif // ENABLE(WEBGL)
OLDNEW
« no previous file with comments | « Source/WebCore/html/canvas/WebGLFramebuffer.h ('k') | Source/WebCore/html/canvas/WebGLRenderingContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698