Title: [114787] trunk/Source/WebCore
Revision
114787
Author
commit-qu...@webkit.org
Date
2012-04-20 15:18:04 -0700 (Fri, 20 Apr 2012)

Log Message

[chromium] Fix compile errors when DEBUG_GL_CALLS is enabled
https://bugs.webkit.org/show_bug.cgi?id=84491

Patch by Alexandre Elias <ael...@google.com> on 2012-04-20
Reviewed by Ojan Vafai.

DEBUG_GL_CALLS had not been used in a while and the mode no longer
compiled when I tried it.  I improved the GLC macro to support either
raw pointers or RefPtrs, and to be a single _expression_ in order to
interact properly with if/else blocks.  I fixed the cases where we
were passing in the "context" method pointer by mistake, and removed the
now-unnecessary "get()" calls for the RefPtrs.

No new tests. (No-op change in release builds.)

* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::initialize):
(WebCore::LayerRendererChromium::clearRenderSurface):
(WebCore::LayerRendererChromium::beginDrawingFrame):
(WebCore::LayerRendererChromium::doNoOp):
(WebCore::LayerRendererChromium::drawQuad):
(WebCore::LayerRendererChromium::drawTextureQuad):
(WebCore::LayerRendererChromium::drawHeadsUpDisplay):
(WebCore::LayerRendererChromium::finishDrawingFrame):
(WebCore::LayerRendererChromium::useRenderSurface):
(WebCore::LayerRendererChromium::bindFramebufferToTexture):
(WebCore::LayerRendererChromium::setScissorToRect):
(WebCore::LayerRendererChromium::setDrawViewportRect):
(WebCore::LayerRendererChromium::initializeSharedObjects):
(WebCore::LayerRendererChromium::cleanupSharedObjects):
* platform/graphics/chromium/LayerRendererChromium.h:
(WebCore):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (114786 => 114787)


--- trunk/Source/WebCore/ChangeLog	2012-04-20 22:15:48 UTC (rev 114786)
+++ trunk/Source/WebCore/ChangeLog	2012-04-20 22:18:04 UTC (rev 114787)
@@ -1,3 +1,37 @@
+2012-04-20  Alexandre Elias  <ael...@google.com>
+
+        [chromium] Fix compile errors when DEBUG_GL_CALLS is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=84491
+
+        Reviewed by Ojan Vafai.
+
+        DEBUG_GL_CALLS had not been used in a while and the mode no longer
+        compiled when I tried it.  I improved the GLC macro to support either
+        raw pointers or RefPtrs, and to be a single _expression_ in order to
+        interact properly with if/else blocks.  I fixed the cases where we
+        were passing in the "context" method pointer by mistake, and removed the
+        now-unnecessary "get()" calls for the RefPtrs.
+
+        No new tests. (No-op change in release builds.)
+
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererChromium::initialize):
+        (WebCore::LayerRendererChromium::clearRenderSurface):
+        (WebCore::LayerRendererChromium::beginDrawingFrame):
+        (WebCore::LayerRendererChromium::doNoOp):
+        (WebCore::LayerRendererChromium::drawQuad):
+        (WebCore::LayerRendererChromium::drawTextureQuad):
+        (WebCore::LayerRendererChromium::drawHeadsUpDisplay):
+        (WebCore::LayerRendererChromium::finishDrawingFrame):
+        (WebCore::LayerRendererChromium::useRenderSurface):
+        (WebCore::LayerRendererChromium::bindFramebufferToTexture):
+        (WebCore::LayerRendererChromium::setScissorToRect):
+        (WebCore::LayerRendererChromium::setDrawViewportRect):
+        (WebCore::LayerRendererChromium::initializeSharedObjects):
+        (WebCore::LayerRendererChromium::cleanupSharedObjects):
+        * platform/graphics/chromium/LayerRendererChromium.h:
+        (WebCore):
+
 2012-04-20  Anders Carlsson  <ander...@apple.com>
 
         Fix build.

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp (114786 => 114787)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2012-04-20 22:15:48 UTC (rev 114786)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2012-04-20 22:18:04 UTC (rev 114787)
@@ -302,7 +302,7 @@
     if (m_capabilities.usingDiscardFramebuffer)
         extensions->ensureEnabled("GL_CHROMIUM_discard_framebuffer");
 
-    GLC(m_context.get(), m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &m_capabilities.maxTextureSize));
+    GLC(m_context, m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &m_capabilities.maxTextureSize));
     m_capabilities.bestTextureFormat = PlatformColor::bestTextureFormat(m_context.get());
 
     if (!initializeSharedObjects())
@@ -371,21 +371,21 @@
     // of the screen.
 
     if (renderSurface != rootRenderSurface)
-        GLC(m_context.get(), m_context->clearColor(0, 0, 0, 0));
+        GLC(m_context, m_context->clearColor(0, 0, 0, 0));
     else
-        GLC(m_context.get(), m_context->clearColor(0, 0, 1, 1));
+        GLC(m_context, m_context->clearColor(0, 0, 1, 1));
 
     if (m_capabilities.usingPartialSwap)
         setScissorToRect(enclosingIntRect(surfaceDamageRect));
     else
-        GLC(m_context.get(), m_context->disable(GraphicsContext3D::SCISSOR_TEST));
+        GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST));
 
 #if defined(NDEBUG)
     if (renderSurface != rootRenderSurface)
 #endif
         m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT);
 
-    GLC(m_context.get(), m_context->enable(GraphicsContext3D::SCISSOR_TEST));
+    GLC(m_context, m_context->enable(GraphicsContext3D::SCISSOR_TEST));
 }
 
 void LayerRendererChromium::beginDrawingFrame(CCRenderSurface* defaultRenderSurface)
@@ -416,17 +416,17 @@
     // Bind the common vertex attributes used for drawing all the layers.
     m_sharedGeometry->prepareForDraw();
 
-    GLC(m_context.get(), m_context->disable(GraphicsContext3D::DEPTH_TEST));
-    GLC(m_context.get(), m_context->disable(GraphicsContext3D::CULL_FACE));
-    GLC(m_context.get(), m_context->colorMask(true, true, true, true));
-    GLC(m_context.get(), m_context->enable(GraphicsContext3D::BLEND));
-    GLC(m_context.get(), m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA));
+    GLC(m_context, m_context->disable(GraphicsContext3D::DEPTH_TEST));
+    GLC(m_context, m_context->disable(GraphicsContext3D::CULL_FACE));
+    GLC(m_context, m_context->colorMask(true, true, true, true));
+    GLC(m_context, m_context->enable(GraphicsContext3D::BLEND));
+    GLC(m_context, m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA));
 }
 
 void LayerRendererChromium::doNoOp()
 {
-    GLC(m_context.get(), m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0));
-    GLC(m_context.get(), m_context->flush());
+    GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0));
+    GLC(m_context, m_context->flush());
 }
 
 void LayerRendererChromium::drawRenderPass(const CCRenderPass* renderPass)
@@ -456,14 +456,14 @@
         scissorRect = quad->clipRect();
 
     if (scissorRect.isEmpty())
-        GLC(m_context.get(), m_context->disable(GraphicsContext3D::SCISSOR_TEST));
+        GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST));
     else
         setScissorToRect(scissorRect);
 
     if (quad->needsBlending())
-        GLC(m_context.get(), m_context->enable(GraphicsContext3D::BLEND));
+        GLC(m_context, m_context->enable(GraphicsContext3D::BLEND));
     else
-        GLC(m_context.get(), m_context->disable(GraphicsContext3D::BLEND));
+        GLC(m_context, m_context->disable(GraphicsContext3D::BLEND));
 
     switch (quad->material()) {
     case CCDrawQuad::Invalid:
@@ -1045,10 +1045,10 @@
             binding.set(textureLayerProgramStretchFlip());
         else
             binding.set(textureLayerProgramStretch());
-        GLC(context, context()->useProgram(binding.programId));
-        GLC(context, context()->uniform1i(binding.samplerLocation, 0));
-        GLC(context, context()->uniform2f(binding.offsetLocation, quad->uvRect().x(), quad->uvRect().y()));
-        GLC(context, context()->uniform2f(binding.scaleLocation, quad->uvRect().width(), quad->uvRect().height()));
+        GLC(context(), context()->useProgram(binding.programId));
+        GLC(context(), context()->uniform1i(binding.samplerLocation, 0));
+        GLC(context(), context()->uniform2f(binding.offsetLocation, quad->uvRect().x(), quad->uvRect().y()));
+        GLC(context(), context()->uniform2f(binding.scaleLocation, quad->uvRect().width(), quad->uvRect().height()));
 
         matrixLocation = binding.matrixLocation;
         alphaLocation = binding.alphaLocation;
@@ -1062,10 +1062,10 @@
 
     // FIXME: setting the texture parameters every time is redundant. Move this code somewhere
     // where it will only happen once per texture.
-    GLC(context, context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR));
-    GLC(context, context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR));
-    GLC(context, context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE));
-    GLC(context, context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
+    GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR));
+    GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR));
+    GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE));
+    GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
 
     if (quad->hasAlpha() && !quad->premultipliedAlpha())
         GLC(context(), context()->blendFunc(GraphicsContext3D::SRC_ALPHA, GraphicsContext3D::ONE_MINUS_SRC_ALPHA));
@@ -1074,7 +1074,7 @@
 
     drawTexturedQuad(quad->layerTransform(), bounds.width(), bounds.height(), quad->opacity(), sharedGeometryQuad(), matrixLocation, alphaLocation, -1);
 
-    GLC(m_context.get(), m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA));
+    GLC(m_context, m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA));
 
     if (quad->ioSurfaceTextureId())
         GLC(context(), context()->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, 0));
@@ -1082,17 +1082,17 @@
 
 void LayerRendererChromium::drawHeadsUpDisplay(ManagedTexture* hudTexture, const IntSize& hudSize)
 {
-    GLC(m_context.get(), m_context->enable(GraphicsContext3D::BLEND));
-    GLC(m_context.get(), m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA));
-    GLC(m_context.get(), m_context->disable(GraphicsContext3D::SCISSOR_TEST));
+    GLC(m_context, m_context->enable(GraphicsContext3D::BLEND));
+    GLC(m_context, m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA));
+    GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST));
     useRenderSurface(m_defaultRenderSurface);
 
     const CCHeadsUpDisplay::Program* program = headsUpDisplayProgram();
     ASSERT(program && program->initialized());
-    GLC(m_context.get(), m_context->activeTexture(GraphicsContext3D::TEXTURE0));
+    GLC(m_context, m_context->activeTexture(GraphicsContext3D::TEXTURE0));
     hudTexture->bindTexture(m_context.get(), renderSurfaceTextureAllocator());
-    GLC(m_context.get(), m_context->useProgram(program->program()));
-    GLC(m_context.get(), m_context->uniform1i(program->fragmentShader().samplerLocation(), 0));
+    GLC(m_context, m_context->useProgram(program->program()));
+    GLC(m_context, m_context->uniform1i(program->fragmentShader().samplerLocation(), 0));
 
     TransformationMatrix matrix;
     matrix.translate3d(hudSize.width() * 0.5, hudSize.height() * 0.5, 0);
@@ -1104,8 +1104,8 @@
 
 void LayerRendererChromium::finishDrawingFrame()
 {
-    GLC(m_context.get(), m_context->disable(GraphicsContext3D::SCISSOR_TEST));
-    GLC(m_context.get(), m_context->disable(GraphicsContext3D::BLEND));
+    GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST));
+    GLC(m_context, m_context->disable(GraphicsContext3D::BLEND));
 
     size_t contentsMemoryUseBytes = m_contentsTextureAllocator->currentMemoryUseBytes();
     size_t reclaimLimit = TextureManager::reclaimLimitBytes(viewportSize());
@@ -1313,7 +1313,7 @@
     m_currentManagedTexture = 0;
 
     if (renderSurface == m_defaultRenderSurface) {
-        GLC(m_context.get(), m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0));
+        GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0));
         setDrawViewportRect(renderSurface->contentRect(), true);
         return true;
     }
@@ -1334,7 +1334,7 @@
 
 bool LayerRendererChromium::bindFramebufferToTexture(ManagedTexture* texture, const IntRect& viewportRect)
 {
-    GLC(m_context.get(), m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_offscreenFramebufferId));
+    GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_offscreenFramebufferId));
 
     texture->framebufferTexture2D(m_context.get(), m_renderSurfaceTextureAllocator.get());
 
@@ -1356,7 +1356,7 @@
 {
     IntRect contentRect = (m_currentRenderSurface ? m_currentRenderSurface->contentRect() : m_defaultRenderSurface->contentRect());
 
-    GLC(m_context.get(), m_context->enable(GraphicsContext3D::SCISSOR_TEST));
+    GLC(m_context, m_context->enable(GraphicsContext3D::SCISSOR_TEST));
 
     // The scissor coordinates must be supplied in viewport space so we need to offset
     // by the relative position of the top left corner of the current render surface.
@@ -1369,7 +1369,7 @@
         scissorY = m_currentRenderSurface->contentRect().height() - (scissorRect.maxY() - m_currentRenderSurface->contentRect().y());
     else
         scissorY = scissorRect.y() - contentRect.y();
-    GLC(m_context.get(), m_context->scissor(scissorX, scissorY, scissorRect.width(), scissorRect.height()));
+    GLC(m_context, m_context->scissor(scissorX, scissorY, scissorRect.width(), scissorRect.height()));
 }
 
 bool LayerRendererChromium::makeContextCurrent()
@@ -1386,7 +1386,7 @@
         m_projectionMatrix = orthoMatrix(drawRect.x(), drawRect.maxX(), drawRect.maxY(), drawRect.y());
     else
         m_projectionMatrix = orthoMatrix(drawRect.x(), drawRect.maxX(), drawRect.y(), drawRect.maxY());
-    GLC(m_context.get(), m_context->viewport(0, 0, drawRect.width(), drawRect.height()));
+    GLC(m_context, m_context->viewport(0, 0, drawRect.width(), drawRect.height()));
     m_windowMatrix = screenMatrix(0, 0, drawRect.width(), drawRect.height());
 }
 
@@ -1397,7 +1397,7 @@
     makeContextCurrent();
 
     // Create an FBO for doing offscreen rendering.
-    GLC(m_context.get(), m_offscreenFramebufferId = m_context->createFramebuffer());
+    GLC(m_context, m_offscreenFramebufferId = m_context->createFramebuffer());
 
     // We will always need these programs to render, so create the programs eagerly so that the shader compilation can
     // start while we do other work. Other programs are created lazily on first access.
@@ -1406,7 +1406,7 @@
     m_tilerProgram = adoptPtr(new CCTiledLayerImpl::Program(m_context.get()));
     m_tilerProgramOpaque = adoptPtr(new CCTiledLayerImpl::ProgramOpaque(m_context.get()));
 
-    GLC(m_context.get(), m_context->flush());
+    GLC(m_context, m_context->flush());
 
     m_renderSurfaceTextureManager = TextureManager::create(TextureManager::highLimitBytes(viewportSize()),
                                                            TextureManager::reclaimLimitBytes(viewportSize()),
@@ -1737,7 +1737,7 @@
     m_videoLayerNativeTextureProgram.clear();
     m_streamTextureLayerProgram.clear();
     if (m_offscreenFramebufferId)
-        GLC(m_context.get(), m_context->deleteFramebuffer(m_offscreenFramebufferId));
+        GLC(m_context, m_context->deleteFramebuffer(m_offscreenFramebufferId));
     m_textureCopier.clear();
     m_textureUploader.clear();
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h (114786 => 114787)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h	2012-04-20 22:15:48 UTC (rev 114786)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h	2012-04-20 22:18:04 UTC (rev 114787)
@@ -270,7 +270,7 @@
 #define DEBUG_GL_CALLS 0
 
 #if DEBUG_GL_CALLS && !defined ( NDEBUG )
-#define GLC(context, x) { (x), LayerRendererChromium::debugGLCall(context, #x, __FILE__, __LINE__); }
+#define GLC(context, x) (x, LayerRendererChromium::debugGLCall(&*context, #x, __FILE__, __LINE__))
 #else
 #define GLC(context, x) (x)
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to