Changeset 120636 in webkit
- Timestamp:
- Jun 18, 2012, 3:37:55 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r120634 r120636 1 2012-06-18 Zhenyao Mo <zmo@google.com> 2 3 Fix framebuffer-object-attachment.html failures 4 https://bugs.webkit.org/show_bug.cgi?id=89387 5 6 Reviewed by Kenneth Russell. 7 8 * html/canvas/WebGLFramebuffer.cpp: fix detachment behavior with depth/stencil/depth_stencil conflicts 9 (WebCore::WebGLFramebuffer::setAttachmentForBoundFramebuffer): 10 (WebCore::WebGLFramebuffer::removeAttachmentFromBoundFramebuffer): 11 * html/canvas/WebGLFramebuffer.h: 12 (WebGLFramebuffer): 13 * html/canvas/WebGLRenderingContext.cpp: 14 (WebCore): 15 (WebCore::WebGLRenderingContext::framebufferRenderbuffer): move logic to WebGLFramebuffer 16 (WebCore::WebGLRenderingContext::framebufferTexture2D): Ditto. 17 (WebCore::WebGLRenderingContext::getParameter): Correct the wrong assumption that it's always checking the drawingbuffer's DEPTH_BITS/STENCIL_BITS 18 * html/canvas/WebGLRenderingContext.h: 19 (WebGLRenderingContext): 20 1 21 2012-06-18 Ian Vollick <vollick@chromium.org> 2 22 -
trunk/Source/WebCore/html/canvas/WebGLFramebuffer.cpp
r120571 r120636 129 129 void WebGLRenderbufferAttachment::unattach(GraphicsContext3D* context, GC3Denum attachment) 130 130 { 131 if (attachment == GraphicsContext3D::DEPTH_STENCIL ) {131 if (attachment == GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT) { 132 132 context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, 0); 133 133 context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, 0); … … 284 284 { 285 285 ASSERT(isBound()); 286 removeAttachmentFromBoundFramebuffer(attachment); 286 287 if (!object()) 287 288 return; 288 removeAttachmentFromBoundFramebuffer(attachment);289 289 if (texture && texture->object()) { 290 291 290 m_attachments.add(attachment, WebGLTextureAttachment::create(texture, texTarget, level)); 292 291 texture->onAttached(); … … 297 296 { 298 297 ASSERT(isBound()); 298 removeAttachmentFromBoundFramebuffer(attachment); 299 299 if (!object()) 300 300 return; 301 removeAttachmentFromBoundFramebuffer(attachment);302 301 if (renderbuffer && renderbuffer->object()) { 303 302 m_attachments.add(attachment, WebGLRenderbufferAttachment::create(renderbuffer)); … … 338 337 attachmentObject->onDetached(context()->graphicsContext3D()); 339 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::STENCIL_ATTACHMENT); 343 break; 344 case GraphicsContext3D::DEPTH_ATTACHMENT: 345 attach(GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT, GraphicsContext3D::DEPTH_ATTACHMENT); 346 break; 347 case GraphicsContext3D::STENCIL_ATTACHMENT: 348 attach(GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT, GraphicsContext3D::STENCIL_ATTACHMENT); 349 break; 350 } 340 351 } 341 352 } -
trunk/Source/WebCore/html/canvas/WebGLFramebuffer.h
r120255 r120636 72 72 WebGLSharedObject* getAttachmentObject(GC3Denum) const; 73 73 74 // attach 'attachment' at 'attachmentPoint'.75 void attach(GC3Denum attachment, GC3Denum attachmentPoint);76 77 74 GC3Denum getColorBufferFormat() const; 78 75 GC3Dsizei getColorBufferWidth() const; … … 115 112 bool isBound() const; 116 113 114 // attach 'attachment' at 'attachmentPoint'. 115 void attach(GC3Denum attachment, GC3Denum attachmentPoint); 116 117 117 typedef WTF::HashMap<GC3Denum, RefPtr<WebGLAttachment> > AttachmentMap; 118 118 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
r120401 r120636 2060 2060 } 2061 2061 Platform3DObject bufferObject = objectOrZero(buffer); 2062 bool reattachDepth = false;2063 bool reattachStencil = false;2064 bool reattachDepthStencilDepth = false;2065 bool reattachDepthStencilStencil = false;2066 2062 switch (attachment) { 2067 2063 case GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT: 2068 2064 m_context->framebufferRenderbuffer(target, GraphicsContext3D::DEPTH_ATTACHMENT, renderbuffertarget, bufferObject); 2069 2065 m_context->framebufferRenderbuffer(target, GraphicsContext3D::STENCIL_ATTACHMENT, renderbuffertarget, bufferObject); 2070 if (!bufferObject) {2071 reattachDepth = true;2072 reattachStencil = true;2073 }2074 2066 break; 2075 2067 case GraphicsContext3D::DEPTH_ATTACHMENT: 2076 2068 m_context->framebufferRenderbuffer(target, attachment, renderbuffertarget, bufferObject); 2077 if (!bufferObject)2078 reattachDepthStencilDepth = true;2079 2069 break; 2080 2070 case GraphicsContext3D::STENCIL_ATTACHMENT: 2081 2071 m_context->framebufferRenderbuffer(target, attachment, renderbuffertarget, bufferObject); 2082 if (!bufferObject)2083 reattachDepthStencilStencil = true;2084 2072 break; 2085 2073 default: … … 2087 2075 } 2088 2076 m_framebufferBinding->setAttachmentForBoundFramebuffer(attachment, buffer); 2089 reattachDepthStencilAttachments(reattachDepth, reattachStencil, reattachDepthStencilDepth, reattachDepthStencilStencil);2090 2077 applyStencilTest(); 2091 2078 cleanupAfterGraphicsCall(false); 2092 }2093 2094 void WebGLRenderingContext::reattachDepthStencilAttachments(bool reattachDepth, bool reattachStencil, bool reattachDepthStencilDepth, bool reattachDepthStencilStencil)2095 {2096 if (reattachDepth)2097 m_framebufferBinding->attach(GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::DEPTH_ATTACHMENT);2098 if (reattachStencil)2099 m_framebufferBinding->attach(GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::STENCIL_ATTACHMENT);2100 if (reattachDepthStencilDepth)2101 m_framebufferBinding->attach(GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT, GraphicsContext3D::DEPTH_ATTACHMENT);2102 if (reattachDepthStencilStencil)2103 m_framebufferBinding->attach(GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT, GraphicsContext3D::STENCIL_ATTACHMENT);2104 2079 } 2105 2080 … … 2125 2100 } 2126 2101 Platform3DObject textureObject = objectOrZero(texture); 2127 bool reattachDepth = false;2128 bool reattachStencil = false;2129 bool reattachDepthStencilDepth = false;2130 bool reattachDepthStencilStencil = false;2131 2102 switch (attachment) { 2132 2103 case GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT: 2133 2104 m_context->framebufferTexture2D(target, GraphicsContext3D::DEPTH_ATTACHMENT, textarget, textureObject, level); 2134 2105 m_context->framebufferTexture2D(target, GraphicsContext3D::STENCIL_ATTACHMENT, textarget, textureObject, level); 2135 if (!textureObject) {2136 reattachDepth = true;2137 reattachStencil = true;2138 }2139 2106 break; 2140 2107 case GraphicsContext3D::DEPTH_ATTACHMENT: 2141 2108 m_context->framebufferTexture2D(target, attachment, textarget, textureObject, level); 2142 if (!textureObject)2143 reattachDepthStencilDepth = true;2144 2109 break; 2145 2110 case GraphicsContext3D::STENCIL_ATTACHMENT: 2146 2111 m_context->framebufferTexture2D(target, attachment, textarget, textureObject, level); 2147 if (!textureObject)2148 reattachDepthStencilStencil = true;2149 2112 break; 2150 2113 default: … … 2152 2115 } 2153 2116 m_framebufferBinding->setAttachmentForBoundFramebuffer(attachment, textarget, texture, level); 2154 reattachDepthStencilAttachments(reattachDepth, reattachStencil, reattachDepthStencilDepth, reattachDepthStencilStencil);2155 2117 applyStencilTest(); 2156 2118 cleanupAfterGraphicsCall(false); … … 2471 2433 return WebGLGetInfo(PassRefPtr<WebGLProgram>(m_currentProgram)); 2472 2434 case GraphicsContext3D::DEPTH_BITS: 2473 if (!m_ attributes.depth)2435 if (!m_framebufferBinding && !m_attributes.depth) 2474 2436 return WebGLGetInfo(intZero); 2475 2437 return getIntParameter(pname); … … 2566 2528 return getUnsignedIntParameter(pname); 2567 2529 case GraphicsContext3D::STENCIL_BITS: 2568 if (!m_ attributes.stencil)2530 if (!m_framebufferBinding && !m_attributes.stencil) 2569 2531 return WebGLGetInfo(intZero); 2570 2532 return getIntParameter(pname); -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h
r120255 r120636 368 368 // Adds a compressed texture format. 369 369 void addCompressedTextureFormat(GC3Denum); 370 371 // Reattaches depth and stencil attachments after one has been unattached.372 void reattachDepthStencilAttachments(bool reattachDepth, bool reattachStencil, bool reattachDepthStencilDepth, bool reattachDepthStencilStencil);373 370 374 371 #if ENABLE(VIDEO)
Note:
See TracChangeset
for help on using the changeset viewer.