Changeset 120636 in webkit


Ignore:
Timestamp:
Jun 18, 2012, 3:37:55 PM (13 years ago)
Author:
zmo@google.com
Message:

Fix framebuffer-object-attachment.html failures
https://bugs.webkit.org/show_bug.cgi?id=89387

Reviewed by Kenneth Russell.

  • html/canvas/WebGLFramebuffer.cpp: fix detachment behavior with depth/stencil/depth_stencil conflicts

(WebCore::WebGLFramebuffer::setAttachmentForBoundFramebuffer):
(WebCore::WebGLFramebuffer::removeAttachmentFromBoundFramebuffer):

  • html/canvas/WebGLFramebuffer.h:

(WebGLFramebuffer):

  • html/canvas/WebGLRenderingContext.cpp:

(WebCore):
(WebCore::WebGLRenderingContext::framebufferRenderbuffer): move logic to WebGLFramebuffer
(WebCore::WebGLRenderingContext::framebufferTexture2D): Ditto.
(WebCore::WebGLRenderingContext::getParameter): Correct the wrong assumption that it's always checking the drawingbuffer's DEPTH_BITS/STENCIL_BITS

  • html/canvas/WebGLRenderingContext.h:

(WebGLRenderingContext):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r120634 r120636  
     12012-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
    1212012-06-18  Ian Vollick  <vollick@chromium.org>
    222
  • trunk/Source/WebCore/html/canvas/WebGLFramebuffer.cpp

    r120571 r120636  
    129129    void WebGLRenderbufferAttachment::unattach(GraphicsContext3D* context, GC3Denum attachment)
    130130    {
    131         if (attachment == GraphicsContext3D::DEPTH_STENCIL) {
     131        if (attachment == GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT) {
    132132            context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, 0);
    133133            context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, 0);
     
    284284{
    285285    ASSERT(isBound());
     286    removeAttachmentFromBoundFramebuffer(attachment);
    286287    if (!object())
    287288        return;
    288     removeAttachmentFromBoundFramebuffer(attachment);
    289289    if (texture && texture->object()) {
    290 
    291290        m_attachments.add(attachment, WebGLTextureAttachment::create(texture, texTarget, level));
    292291        texture->onAttached();
     
    297296{
    298297    ASSERT(isBound());
     298    removeAttachmentFromBoundFramebuffer(attachment);
    299299    if (!object())
    300300        return;
    301     removeAttachmentFromBoundFramebuffer(attachment);
    302301    if (renderbuffer && renderbuffer->object()) {
    303302        m_attachments.add(attachment, WebGLRenderbufferAttachment::create(renderbuffer));
     
    338337        attachmentObject->onDetached(context()->graphicsContext3D());
    339338        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        }
    340351    }
    341352}
  • trunk/Source/WebCore/html/canvas/WebGLFramebuffer.h

    r120255 r120636  
    7272    WebGLSharedObject* getAttachmentObject(GC3Denum) const;
    7373
    74     // attach 'attachment' at 'attachmentPoint'.
    75     void attach(GC3Denum attachment, GC3Denum attachmentPoint);
    76 
    7774    GC3Denum getColorBufferFormat() const;
    7875    GC3Dsizei getColorBufferWidth() const;
     
    115112    bool isBound() const;
    116113
     114    // attach 'attachment' at 'attachmentPoint'.
     115    void attach(GC3Denum attachment, GC3Denum attachmentPoint);
     116
    117117    typedef WTF::HashMap<GC3Denum, RefPtr<WebGLAttachment> > AttachmentMap;
    118118
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp

    r120401 r120636  
    20602060    }
    20612061    Platform3DObject bufferObject = objectOrZero(buffer);
    2062     bool reattachDepth = false;
    2063     bool reattachStencil = false;
    2064     bool reattachDepthStencilDepth = false;
    2065     bool reattachDepthStencilStencil = false;
    20662062    switch (attachment) {
    20672063    case GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT:
    20682064        m_context->framebufferRenderbuffer(target, GraphicsContext3D::DEPTH_ATTACHMENT, renderbuffertarget, bufferObject);
    20692065        m_context->framebufferRenderbuffer(target, GraphicsContext3D::STENCIL_ATTACHMENT, renderbuffertarget, bufferObject);
    2070         if (!bufferObject) {
    2071             reattachDepth = true;
    2072             reattachStencil = true;
    2073         }
    20742066        break;
    20752067    case GraphicsContext3D::DEPTH_ATTACHMENT:
    20762068        m_context->framebufferRenderbuffer(target, attachment, renderbuffertarget, bufferObject);
    2077         if (!bufferObject)
    2078             reattachDepthStencilDepth = true;
    20792069        break;
    20802070    case GraphicsContext3D::STENCIL_ATTACHMENT:
    20812071        m_context->framebufferRenderbuffer(target, attachment, renderbuffertarget, bufferObject);
    2082         if (!bufferObject)
    2083             reattachDepthStencilStencil = true;
    20842072        break;
    20852073    default:
     
    20872075    }
    20882076    m_framebufferBinding->setAttachmentForBoundFramebuffer(attachment, buffer);
    2089     reattachDepthStencilAttachments(reattachDepth, reattachStencil, reattachDepthStencilDepth, reattachDepthStencilStencil);
    20902077    applyStencilTest();
    20912078    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);
    21042079}
    21052080
     
    21252100    }
    21262101    Platform3DObject textureObject = objectOrZero(texture);
    2127     bool reattachDepth = false;
    2128     bool reattachStencil = false;
    2129     bool reattachDepthStencilDepth = false;
    2130     bool reattachDepthStencilStencil = false;
    21312102    switch (attachment) {
    21322103    case GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT:
    21332104        m_context->framebufferTexture2D(target, GraphicsContext3D::DEPTH_ATTACHMENT, textarget, textureObject, level);
    21342105        m_context->framebufferTexture2D(target, GraphicsContext3D::STENCIL_ATTACHMENT, textarget, textureObject, level);
    2135         if (!textureObject) {
    2136             reattachDepth = true;
    2137             reattachStencil = true;
    2138         }
    21392106        break;
    21402107    case GraphicsContext3D::DEPTH_ATTACHMENT:
    21412108        m_context->framebufferTexture2D(target, attachment, textarget, textureObject, level);
    2142         if (!textureObject)
    2143             reattachDepthStencilDepth = true;
    21442109        break;
    21452110    case GraphicsContext3D::STENCIL_ATTACHMENT:
    21462111        m_context->framebufferTexture2D(target, attachment, textarget, textureObject, level);
    2147         if (!textureObject)
    2148             reattachDepthStencilStencil = true;
    21492112        break;
    21502113    default:
     
    21522115    }
    21532116    m_framebufferBinding->setAttachmentForBoundFramebuffer(attachment, textarget, texture, level);
    2154     reattachDepthStencilAttachments(reattachDepth, reattachStencil, reattachDepthStencilDepth, reattachDepthStencilStencil);
    21552117    applyStencilTest();
    21562118    cleanupAfterGraphicsCall(false);
     
    24712433        return WebGLGetInfo(PassRefPtr<WebGLProgram>(m_currentProgram));
    24722434    case GraphicsContext3D::DEPTH_BITS:
    2473         if (!m_attributes.depth)
     2435        if (!m_framebufferBinding && !m_attributes.depth)
    24742436            return WebGLGetInfo(intZero);
    24752437        return getIntParameter(pname);
     
    25662528        return getUnsignedIntParameter(pname);
    25672529    case GraphicsContext3D::STENCIL_BITS:
    2568         if (!m_attributes.stencil)
     2530        if (!m_framebufferBinding && !m_attributes.stencil)
    25692531            return WebGLGetInfo(intZero);
    25702532        return getIntParameter(pname);
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h

    r120255 r120636  
    368368    // Adds a compressed texture format.
    369369    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);
    373370
    374371#if ENABLE(VIDEO)
Note: See TracChangeset for help on using the changeset viewer.