Title: [144378] trunk/Source/WebCore
Revision
144378
Author
[email protected]
Date
2013-02-28 15:17:36 -0800 (Thu, 28 Feb 2013)

Log Message

Create GraphicsContext3DState to aggregate state objects
https://bugs.webkit.org/show_bug.cgi?id=110817

Reviewed by Kenneth Russell.

Aggregate context state-related objects on a GraphicsContext3DState
struct, in a similar fashion as GraphicsContext does. This is useful to
avoid duplicated values for platform-specific initialization lists.

No behavior changes, thus covered by existing tests.

* platform/graphics/GraphicsContext3D.h:
(WebCore::GraphicsContext3D::GraphicsContext3DState::GraphicsContext3DState):
(GraphicsContext3DState):
(GraphicsContext3D):
Moved m_boundFBO, m_activeTexture and m_boundTexture0 to GraphicsContext3DState.

* platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp:
(WebCore::GraphicsContext3D::GraphicsContext3D):
(WebCore::GraphicsContext3D::reshapeFBOs):
* platform/graphics/cairo/GraphicsContext3DCairo.cpp:
(WebCore::GraphicsContext3D::GraphicsContext3D):
* platform/graphics/cairo/GraphicsContext3DPrivate.cpp:
(WebCore::GraphicsContext3DPrivate::paintToTextureMapper):
* platform/graphics/efl/GraphicsContext3DEfl.cpp:
(WebCore::GraphicsContext3D::GraphicsContext3D):
* platform/graphics/efl/GraphicsContext3DPrivate.cpp:
(WebCore::GraphicsContext3DPrivate::copyToGraphicsSurface):
* platform/graphics/mac/GraphicsContext3DMac.mm:
(WebCore::GraphicsContext3D::GraphicsContext3D):
* platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
(WebCore::GraphicsContext3D::reshapeFBOs):
(WebCore::GraphicsContext3D::readPixels):
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::prepareTexture):
(WebCore::GraphicsContext3D::readRenderingResults):
(WebCore::GraphicsContext3D::reshape):
(WebCore::GraphicsContext3D::activeTexture):
(WebCore::GraphicsContext3D::bindFramebuffer):
(WebCore::GraphicsContext3D::bindTexture):
(WebCore::GraphicsContext3D::copyTexImage2D):
(WebCore::GraphicsContext3D::copyTexSubImage2D):
(WebCore::GraphicsContext3D::deleteFramebuffer):
(WebCore::GraphicsContext3D::deleteTexture):
* platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
(WebCore::GraphicsContext3D::readPixels):
(WebCore::GraphicsContext3D::readPixelsAndConvertToBGRAIfNecessary):
(WebCore::GraphicsContext3D::reshapeFBOs):
* platform/graphics/qt/GraphicsContext3DQt.cpp:
(WebCore::GraphicsContext3DPrivate::createOffscreenBuffers):
(WebCore::GraphicsContext3DPrivate::paintToTextureMapper):
(WebCore::GraphicsContext3DPrivate::blitMultisampleFramebuffer):
(WebCore::GraphicsContext3D::GraphicsContext3D):
Removed initialization list values not needed anymore and reassigned
calls to m_boundFBO, m_boundTexture0 and m_activeTexture to m_state
respectives.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (144377 => 144378)


--- trunk/Source/WebCore/ChangeLog	2013-02-28 23:06:44 UTC (rev 144377)
+++ trunk/Source/WebCore/ChangeLog	2013-02-28 23:17:36 UTC (rev 144378)
@@ -1,3 +1,62 @@
+2013-02-28  Bruno de Oliveira Abinader  <[email protected]>
+
+        Create GraphicsContext3DState to aggregate state objects
+        https://bugs.webkit.org/show_bug.cgi?id=110817
+
+        Reviewed by Kenneth Russell.
+
+        Aggregate context state-related objects on a GraphicsContext3DState
+        struct, in a similar fashion as GraphicsContext does. This is useful to
+        avoid duplicated values for platform-specific initialization lists.
+
+        No behavior changes, thus covered by existing tests.
+
+        * platform/graphics/GraphicsContext3D.h:
+        (WebCore::GraphicsContext3D::GraphicsContext3DState::GraphicsContext3DState):
+        (GraphicsContext3DState):
+        (GraphicsContext3D):
+        Moved m_boundFBO, m_activeTexture and m_boundTexture0 to GraphicsContext3DState.
+
+        * platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp:
+        (WebCore::GraphicsContext3D::GraphicsContext3D):
+        (WebCore::GraphicsContext3D::reshapeFBOs):
+        * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
+        (WebCore::GraphicsContext3D::GraphicsContext3D):
+        * platform/graphics/cairo/GraphicsContext3DPrivate.cpp:
+        (WebCore::GraphicsContext3DPrivate::paintToTextureMapper):
+        * platform/graphics/efl/GraphicsContext3DEfl.cpp:
+        (WebCore::GraphicsContext3D::GraphicsContext3D):
+        * platform/graphics/efl/GraphicsContext3DPrivate.cpp:
+        (WebCore::GraphicsContext3DPrivate::copyToGraphicsSurface):
+        * platform/graphics/mac/GraphicsContext3DMac.mm:
+        (WebCore::GraphicsContext3D::GraphicsContext3D):
+        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
+        (WebCore::GraphicsContext3D::reshapeFBOs):
+        (WebCore::GraphicsContext3D::readPixels):
+        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+        (WebCore::GraphicsContext3D::prepareTexture):
+        (WebCore::GraphicsContext3D::readRenderingResults):
+        (WebCore::GraphicsContext3D::reshape):
+        (WebCore::GraphicsContext3D::activeTexture):
+        (WebCore::GraphicsContext3D::bindFramebuffer):
+        (WebCore::GraphicsContext3D::bindTexture):
+        (WebCore::GraphicsContext3D::copyTexImage2D):
+        (WebCore::GraphicsContext3D::copyTexSubImage2D):
+        (WebCore::GraphicsContext3D::deleteFramebuffer):
+        (WebCore::GraphicsContext3D::deleteTexture):
+        * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
+        (WebCore::GraphicsContext3D::readPixels):
+        (WebCore::GraphicsContext3D::readPixelsAndConvertToBGRAIfNecessary):
+        (WebCore::GraphicsContext3D::reshapeFBOs):
+        * platform/graphics/qt/GraphicsContext3DQt.cpp:
+        (WebCore::GraphicsContext3DPrivate::createOffscreenBuffers):
+        (WebCore::GraphicsContext3DPrivate::paintToTextureMapper):
+        (WebCore::GraphicsContext3DPrivate::blitMultisampleFramebuffer):
+        (WebCore::GraphicsContext3D::GraphicsContext3D):
+        Removed initialization list values not needed anymore and reassigned
+        calls to m_boundFBO, m_boundTexture0 and m_activeTexture to m_state
+        respectives.
+
 2013-02-28  David Hyatt  <[email protected]>
 
         Unreviewed build fix. A merge error led to a duplication of a single line.

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (144377 => 144378)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h	2013-02-28 23:06:44 UTC (rev 144377)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h	2013-02-28 23:17:36 UTC (rev 144378)
@@ -1081,11 +1081,20 @@
     bool m_layerComposited;
     GC3Duint m_internalColorFormat;
 
-    // For tracking which FBO/texture is bound
-    GC3Duint m_boundFBO;
-    GC3Denum m_activeTexture;
-    GC3Duint m_boundTexture0;
+    struct GraphicsContext3DState {
+        GraphicsContext3DState()
+            : boundFBO(0)
+            , activeTexture(GraphicsContext3D::TEXTURE0)
+            , boundTexture0(0)
+        { }
 
+        GC3Duint boundFBO;
+        GC3Denum activeTexture;
+        GC3Duint boundTexture0;
+    };
+
+    GraphicsContext3DState m_state;
+
     // For multisampling
     GC3Duint m_multisampleFBO;
     GC3Duint m_multisampleDepthStencilBuffer;

Modified: trunk/Source/WebCore/platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp (144377 => 144378)


--- trunk/Source/WebCore/platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp	2013-02-28 23:06:44 UTC (rev 144377)
+++ trunk/Source/WebCore/platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp	2013-02-28 23:17:36 UTC (rev 144378)
@@ -62,9 +62,6 @@
     , m_depthStencilBuffer(0)
     , m_layerComposited(false)
     , m_internalColorFormat(GL_RGBA)
-    , m_boundFBO(0)
-    , m_activeTexture(GL_TEXTURE0)
-    , m_boundTexture0(0)
     , m_isImaginationHardware(0)
 {
     if (renderStyle != RenderDirectlyToHostWindow) {
@@ -87,7 +84,7 @@
         ::glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
         if (m_attrs.stencil || m_attrs.depth)
             ::glGenRenderbuffers(1, &m_depthStencilBuffer);
-        m_boundFBO = m_fbo;
+        m_state.boundFBO = m_fbo;
 
 #if USE(ACCELERATED_COMPOSITING)
         static_cast<WebGLLayerWebKitThread*>(m_compositingLayer.get())->setWebGLContext(this);
@@ -185,7 +182,7 @@
     }
 
     bool mustRestoreFBO = false;
-    if (m_boundFBO != m_fbo) {
+    if (m_state.boundFBO != m_fbo) {
         mustRestoreFBO = true;
         ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_fbo);
     }

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp (144377 => 144378)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp	2013-02-28 23:06:44 UTC (rev 144377)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp	2013-02-28 23:17:36 UTC (rev 144378)
@@ -79,9 +79,6 @@
     , m_texture(0)
     , m_fbo(0)
     , m_depthStencilBuffer(0)
-    , m_boundFBO(0)
-    , m_activeTexture(GL_TEXTURE0)
-    , m_boundTexture0(0)
     , m_multisampleFBO(0)
     , m_multisampleDepthStencilBuffer(0)
     , m_multisampleColorBuffer(0)
@@ -105,7 +102,7 @@
         ::glGenFramebuffers(1, &m_fbo);
         ::glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
 
-        m_boundFBO = m_fbo;
+        m_state.boundFBO = m_fbo;
         if (!m_attrs.antialias && (m_attrs.stencil || m_attrs.depth))
             ::glGenRenderbuffers(1, &m_depthStencilBuffer);
 
@@ -113,7 +110,7 @@
         if (m_attrs.antialias) {
             ::glGenFramebuffers(1, &m_multisampleFBO);
             ::glBindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO);
-            m_boundFBO = m_multisampleFBO;
+            m_state.boundFBO = m_multisampleFBO;
             ::glGenRenderbuffers(1, &m_multisampleColorBuffer);
             if (m_attrs.stencil || m_attrs.depth)
                 ::glGenRenderbuffers(1, &m_multisampleDepthStencilBuffer);

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DPrivate.cpp (144377 => 144378)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DPrivate.cpp	2013-02-28 23:06:44 UTC (rev 144377)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DPrivate.cpp	2013-02-28 23:17:36 UTC (rev 144378)
@@ -127,13 +127,13 @@
     }
 
 #if USE(TEXTURE_MAPPER_GL)
-    if (m_context->m_attrs.antialias && m_context->m_boundFBO == m_context->m_multisampleFBO) {
+    if (m_context->m_attrs.antialias && m_context->m_state.boundFBO == m_context->m_multisampleFBO) {
         GLContext* previousActiveContext = GLContext::getCurrent();
         if (previousActiveContext != m_glContext)
             m_context->makeContextCurrent();
 
         m_context->resolveMultisamplingIfNecessary();
-        ::glBindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_context->m_boundFBO);
+        ::glBindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_context->m_state.boundFBO);
 
         if (previousActiveContext && previousActiveContext != m_glContext)
             previousActiveContext->makeContextCurrent();

Modified: trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp (144377 => 144378)


--- trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp	2013-02-28 23:06:44 UTC (rev 144377)
+++ trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp	2013-02-28 23:17:36 UTC (rev 144378)
@@ -54,9 +54,6 @@
     , m_depthStencilBuffer(0)
     , m_layerComposited(false)
     , m_internalColorFormat(0)
-    , m_boundFBO(0)
-    , m_activeTexture(GL_TEXTURE0)
-    , m_boundTexture0(0)
     , m_multisampleFBO(0)
     , m_multisampleDepthStencilBuffer(0)
     , m_multisampleColorBuffer(0)
@@ -84,14 +81,14 @@
         if (m_attrs.antialias) {
             glGenFramebuffers(1, &m_multisampleFBO);
             glBindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO);
-            m_boundFBO = m_multisampleFBO;
+            m_state.boundFBO = m_multisampleFBO;
             glGenRenderbuffers(1, &m_multisampleColorBuffer);
             if (m_attrs.stencil || m_attrs.depth)
                 glGenRenderbuffers(1, &m_multisampleDepthStencilBuffer);
         } else {
             // Bind canvas FBO.
             glBindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
-            m_boundFBO = m_fbo;
+            m_state.boundFBO = m_fbo;
 #if USE(OPENGL_ES_2)
             if (m_attrs.depth)
                 glGenRenderbuffers(1, &m_depthBuffer);

Modified: trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp (144377 => 144378)


--- trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp	2013-02-28 23:06:44 UTC (rev 144377)
+++ trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp	2013-02-28 23:17:36 UTC (rev 144378)
@@ -234,7 +234,7 @@
 
     m_sharedSurface->updateContents(m_context->m_texture);
     makeContextCurrent();
-    glBindFramebuffer(GL_FRAMEBUFFER,  m_context->m_boundFBO);
+    glBindFramebuffer(GL_FRAMEBUFFER,  m_context->m_state.boundFBO);
     return 0;
 }
 

Modified: trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm (144377 => 144378)


--- trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm	2013-02-28 23:06:44 UTC (rev 144377)
+++ trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm	2013-02-28 23:17:36 UTC (rev 144378)
@@ -107,9 +107,6 @@
     , m_depthStencilBuffer(0)
     , m_layerComposited(false)
     , m_internalColorFormat(0)
-    , m_boundFBO(0)
-    , m_activeTexture(GL_TEXTURE0)
-    , m_boundTexture0(0)
     , m_multisampleFBO(0)
     , m_multisampleDepthStencilBuffer(0)
     , m_multisampleColorBuffer(0)
@@ -194,7 +191,7 @@
     ::glGenFramebuffersEXT(1, &m_fbo);
     ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo);
     
-    m_boundFBO = m_fbo;
+    m_state.boundFBO = m_fbo;
     if (!m_attrs.antialias && (m_attrs.stencil || m_attrs.depth))
         ::glGenRenderbuffersEXT(1, &m_depthStencilBuffer);
 
@@ -202,7 +199,7 @@
     if (m_attrs.antialias) {
         ::glGenFramebuffersEXT(1, &m_multisampleFBO);
         ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_multisampleFBO);
-        m_boundFBO = m_multisampleFBO;
+        m_state.boundFBO = m_multisampleFBO;
         ::glGenRenderbuffersEXT(1, &m_multisampleColorBuffer);
         if (m_attrs.stencil || m_attrs.depth)
             ::glGenRenderbuffersEXT(1, &m_multisampleDepthStencilBuffer);

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp (144377 => 144378)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp	2013-02-28 23:06:44 UTC (rev 144377)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp	2013-02-28 23:17:36 UTC (rev 144378)
@@ -98,7 +98,7 @@
         GLint sampleCount = std::min(8, maxSampleCount);
         if (sampleCount > maxSampleCount)
             sampleCount = maxSampleCount;
-        if (m_boundFBO != m_multisampleFBO) {
+        if (m_state.boundFBO != m_multisampleFBO) {
             ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_multisampleFBO);
             mustRestoreFBO = true;
         }
@@ -121,7 +121,7 @@
     }
 
     // resize regular FBO
-    if (m_boundFBO != m_fbo) {
+    if (m_state.boundFBO != m_fbo) {
         mustRestoreFBO = true;
         ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo);
     }
@@ -147,7 +147,7 @@
 
     if (m_attrs.antialias) {
         ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_multisampleFBO);
-        if (m_boundFBO == m_multisampleFBO)
+        if (m_state.boundFBO == m_multisampleFBO)
             mustRestoreFBO = false;
     }
 
@@ -287,13 +287,13 @@
     // all previous rendering calls should be done before reading pixels.
     makeContextCurrent();
     ::glFlush();
-    if (m_attrs.antialias && m_boundFBO == m_multisampleFBO) {
+    if (m_attrs.antialias && m_state.boundFBO == m_multisampleFBO) {
         resolveMultisamplingIfNecessary(IntRect(x, y, width, height));
         ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_fbo);
         ::glFlush();
     }
     ::glReadPixels(x, y, width, height, format, type, data);
-    if (m_attrs.antialias && m_boundFBO == m_multisampleFBO)
+    if (m_attrs.antialias && m_state.boundFBO == m_multisampleFBO)
         ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp (144377 => 144378)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2013-02-28 23:06:44 UTC (rev 144377)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2013-02-28 23:17:36 UTC (rev 144378)
@@ -169,10 +169,10 @@
     ::glActiveTexture(GL_TEXTURE0);
     ::glBindTexture(GL_TEXTURE_2D, m_compositorTexture);
     ::glCopyTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, 0, 0, m_currentWidth, m_currentHeight, 0);
-    ::glBindTexture(GL_TEXTURE_2D, m_boundTexture0);
-    ::glActiveTexture(m_activeTexture);
-    if (m_boundFBO != m_fbo)
-        ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_boundFBO);
+    ::glBindTexture(GL_TEXTURE_2D, m_state.boundTexture0);
+    ::glActiveTexture(m_state.activeTexture);
+    if (m_state.boundFBO != m_fbo)
+        ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_state.boundFBO);
     ::glFinish();
     m_layerComposited = true;
 }
@@ -191,7 +191,7 @@
         ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_fbo);
         mustRestoreFBO = true;
     } else {
-        if (m_boundFBO != m_fbo) {
+        if (m_state.boundFBO != m_fbo) {
             mustRestoreFBO = true;
             ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_fbo);
         }
@@ -211,7 +211,7 @@
         ::glPixelStorei(GL_PACK_ALIGNMENT, packAlignment);
 
     if (mustRestoreFBO)
-        ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_boundFBO);
+        ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_state.boundFBO);
 }
 
 void GraphicsContext3D::reshape(int width, int height)
@@ -288,7 +288,7 @@
         ::glDisable(GL_DITHER);
 
     if (mustRestoreFBO)
-        ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_boundFBO);
+        ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_state.boundFBO);
 
     ::glFlush();
 }
@@ -301,7 +301,7 @@
 void GraphicsContext3D::activeTexture(GC3Denum texture)
 {
     makeContextCurrent();
-    m_activeTexture = texture;
+    m_state.activeTexture = texture;
     ::glActiveTexture(texture);
 }
 
@@ -338,9 +338,9 @@
 #else
         fbo = (m_attrs.antialias ? m_multisampleFBO : m_fbo);
 #endif
-    if (fbo != m_boundFBO) {
+    if (fbo != m_state.boundFBO) {
         ::glBindFramebufferEXT(target, fbo);
-        m_boundFBO = fbo;
+        m_state.boundFBO = fbo;
     }
 }
 
@@ -354,8 +354,8 @@
 void GraphicsContext3D::bindTexture(GC3Denum target, Platform3DObject texture)
 {
     makeContextCurrent();
-    if (m_activeTexture == GL_TEXTURE0 && target == GL_TEXTURE_2D)
-        m_boundTexture0 = texture;
+    if (m_state.activeTexture == GL_TEXTURE0 && target == GL_TEXTURE_2D)
+        m_state.boundTexture0 = texture;
     ::glBindTexture(target, texture);
 }
 
@@ -487,14 +487,14 @@
 {
     makeContextCurrent();
 #if !PLATFORM(BLACKBERRY)
-    if (m_attrs.antialias && m_boundFBO == m_multisampleFBO) {
+    if (m_attrs.antialias && m_state.boundFBO == m_multisampleFBO) {
         resolveMultisamplingIfNecessary(IntRect(x, y, width, height));
         ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_fbo);
     }
 #endif
     ::glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
 #if !PLATFORM(BLACKBERRY)
-    if (m_attrs.antialias && m_boundFBO == m_multisampleFBO)
+    if (m_attrs.antialias && m_state.boundFBO == m_multisampleFBO)
         ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO);
 #endif
 }
@@ -503,14 +503,14 @@
 {
     makeContextCurrent();
 #if !PLATFORM(BLACKBERRY)
-    if (m_attrs.antialias && m_boundFBO == m_multisampleFBO) {
+    if (m_attrs.antialias && m_state.boundFBO == m_multisampleFBO) {
         resolveMultisamplingIfNecessary(IntRect(x, y, width, height));
         ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_fbo);
     }
 #endif
     ::glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
 #if !PLATFORM(BLACKBERRY)
-    if (m_attrs.antialias && m_boundFBO == m_multisampleFBO)
+    if (m_attrs.antialias && m_state.boundFBO == m_multisampleFBO)
         ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO);
 #endif
 }
@@ -1377,7 +1377,7 @@
 void GraphicsContext3D::deleteFramebuffer(Platform3DObject framebuffer)
 {
     makeContextCurrent();
-    if (framebuffer == m_boundFBO) {
+    if (framebuffer == m_state.boundFBO) {
         // Make sure the framebuffer is not going to be used for drawing
         // operations after it gets deleted.
         bindFramebuffer(FRAMEBUFFER, 0);
@@ -1406,8 +1406,8 @@
 void GraphicsContext3D::deleteTexture(Platform3DObject texture)
 {
     makeContextCurrent();
-    if (m_boundTexture0 == texture)
-        m_boundTexture0 = 0;
+    if (m_state.boundTexture0 == texture)
+        m_state.boundTexture0 = 0;
     glDeleteTextures(1, &texture);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp (144377 => 144378)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp	2013-02-28 23:06:44 UTC (rev 144377)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp	2013-02-28 23:17:36 UTC (rev 144378)
@@ -55,7 +55,7 @@
     // all previous rendering calls should be done before reading pixels.
     ::glFlush();
 #if PLATFORM(BLACKBERRY)
-    if (m_isImaginationHardware && m_fbo == m_boundFBO) {
+    if (m_isImaginationHardware && m_fbo == m_state.boundFBO) {
         // FIXME: This workaround should always be used until the
         // driver alignment bug is fixed, even when we aren't
         // drawing to the canvas.
@@ -63,7 +63,7 @@
     } else
         ::glReadPixels(x, y, width, height, format, type, data);
 #else
-    if (m_attrs.antialias && m_boundFBO == m_multisampleFBO) {
+    if (m_attrs.antialias && m_state.boundFBO == m_multisampleFBO) {
          resolveMultisamplingIfNecessary(IntRect(x, y, width, height));
         ::glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
         ::glFlush();
@@ -71,7 +71,7 @@
 
     ::glReadPixels(x, y, width, height, format, type, data);
 
-    if (m_attrs.antialias && m_boundFBO == m_multisampleFBO)
+    if (m_attrs.antialias && m_state.boundFBO == m_multisampleFBO)
         ::glBindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO);
 #endif
 }
@@ -79,7 +79,7 @@
 void GraphicsContext3D::readPixelsAndConvertToBGRAIfNecessary(int x, int y, int width, int height, unsigned char* pixels)
 {
 #if PLATFORM(BLACKBERRY)
-    if (m_isImaginationHardware && m_fbo == m_boundFBO) {
+    if (m_isImaginationHardware && m_fbo == m_state.boundFBO) {
         // FIXME: This workaround should always be used until the
         // driver alignment bug is fixed, even when we aren't
         // drawing to the canvas.
@@ -119,7 +119,7 @@
 
     // Resize regular FBO.
     bool mustRestoreFBO = false;
-    if (m_boundFBO != m_fbo) {
+    if (m_state.boundFBO != m_fbo) {
         mustRestoreFBO = true;
         ::glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
     }

Modified: trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp (144377 => 144378)


--- trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp	2013-02-28 23:06:44 UTC (rev 144377)
+++ trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp	2013-02-28 23:17:36 UTC (rev 144378)
@@ -155,14 +155,14 @@
     if (m_context->m_attrs.antialias) {
         glGenFramebuffers(1, &m_context->m_multisampleFBO);
         glBindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_context->m_multisampleFBO);
-        m_context->m_boundFBO = m_context->m_multisampleFBO;
+        m_context->m_state.boundFBO = m_context->m_multisampleFBO;
         glGenRenderbuffers(1, &m_context->m_multisampleColorBuffer);
         if (m_context->m_attrs.stencil || m_context->m_attrs.depth)
             glGenRenderbuffers(1, &m_context->m_multisampleDepthStencilBuffer);
     } else {
         // Bind canvas FBO.
         glBindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_context->m_fbo);
-        m_context->m_boundFBO = m_context->m_fbo;
+        m_context->m_state.boundFBO = m_context->m_fbo;
 #if USE(OPENGL_ES_2)
         if (m_context->m_attrs.depth)
             glGenRenderbuffers(1, &m_context->m_depthBuffer);
@@ -252,7 +252,7 @@
     makeCurrentIfNeeded();
     glBindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_context->m_fbo);
     glReadPixels(/* x */ 0, /* y */ 0, width, height, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, imagePixels);
-    glBindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_context->m_boundFBO);
+    glBindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_context->m_state.boundFBO);
 
     // OpenGL gives us ABGR on 32 bits, and with the origin at the bottom left
     // We need RGB32 or ARGB32_PM, with the origin at the top left.
@@ -318,7 +318,7 @@
     glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, m_context->m_fbo);
     glBlitFramebuffer(0, 0, m_context->m_currentWidth, m_context->m_currentHeight, 0, 0, m_context->m_currentWidth, m_context->m_currentHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR);
 #endif
-    glBindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_context->m_boundFBO);
+    glBindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_context->m_state.boundFBO);
 }
 
 void GraphicsContext3DPrivate::blitMultisampleFramebufferAndRestoreContext() const
@@ -384,9 +384,6 @@
     , m_depthStencilBuffer(0)
     , m_layerComposited(false)
     , m_internalColorFormat(0)
-    , m_boundFBO(0)
-    , m_activeTexture(GL_TEXTURE0)
-    , m_boundTexture0(0)
     , m_multisampleFBO(0)
     , m_multisampleDepthStencilBuffer(0)
     , m_multisampleColorBuffer(0)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to