Title: [110703] trunk/Source/WebCore
Revision
110703
Author
[email protected]
Date
2012-03-14 08:31:56 -0700 (Wed, 14 Mar 2012)

Log Message

[Textmap] Disable driver based BGRA swizzling for OpenGL/ES

Reviewed by Noam Rosenthal.

The current way of detecting swizzling support (check for GL_EXT_texture_format_BGRA8888)
is unfortunately not reliable. We need a better way of detection that (filed bug 81103).
In the meantime this patch reverts back to doing the swizzling in the texture mapper to
get pixels back onto the screen.

* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::driverSupportsBGRASwizzling):
(WebCore::BitmapTextureGL::updateContents):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (110702 => 110703)


--- trunk/Source/WebCore/ChangeLog	2012-03-14 15:28:34 UTC (rev 110702)
+++ trunk/Source/WebCore/ChangeLog	2012-03-14 15:31:56 UTC (rev 110703)
@@ -1,3 +1,18 @@
+2012-03-14  Simon Hausmann  <[email protected]>
+
+        [Textmap] Disable driver based BGRA swizzling for OpenGL/ES
+
+        Reviewed by Noam Rosenthal.
+
+        The current way of detecting swizzling support (check for GL_EXT_texture_format_BGRA8888)
+        is unfortunately not reliable. We need a better way of detection that (filed bug 81103).
+        In the meantime this patch reverts back to doing the swizzling in the texture mapper to
+        get pixels back onto the screen.
+
+        * platform/graphics/texmap/TextureMapperGL.cpp:
+        (WebCore::driverSupportsBGRASwizzling):
+        (WebCore::BitmapTextureGL::updateContents):
+
 2012-03-14  Leo Yang  <[email protected]>
 
         [BlackBerry] Upstream the BlackBerry change to platform/Cursor.h

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp (110702 => 110703)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2012-03-14 15:28:34 UTC (rev 110702)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2012-03-14 15:31:56 UTC (rev 110703)
@@ -419,30 +419,21 @@
     }
 }
 
-// FIXME: Move this to Extensions3D when we move TextureMapper to use GC3D.
-static bool hasExtension(const char* extension)
+static bool driverSupportsBGRASwizzling()
 {
-    static Vector<String> availableExtensions;
-    if (!availableExtensions.isEmpty())
-        return availableExtensions.contains(extension);
-    String extensionsString(reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)));
-    extensionsString.split(" ", availableExtensions);
-    return availableExtensions.contains(extension);
-}
-static bool hasBGRAExtension()
-{
-#if !defined(TEXMAP_OPENGL_ES_2)
+#if defined(TEXMAP_OPENGL_ES_2)
+    // FIXME: Implement reliable detection. See also https://bugs.webkit.org/show_bug.cgi?id=81103.
+    return false;
+#else
     return true;
 #endif
-    static bool hasBGRA = hasExtension("GL_EXT_texture_format_BGRA8888");
-    return hasBGRA;
 }
 
 void BitmapTextureGL::updateContents(const void* data, const IntRect& targetRect)
 {
     GLuint glFormat = GL_RGBA;
     GL_CMD(glBindTexture(GL_TEXTURE_2D, m_id))
-    if (hasBGRAExtension())
+    if (driverSupportsBGRASwizzling())
         glFormat = GL_BGRA;
     else {
         swizzleBGRAToRGBA(static_cast<uint32_t*>(const_cast<void*>(data)), targetRect.size());
@@ -476,7 +467,7 @@
     if (IntSize(qtImage.size()) != sourceRect.size())
         qtImage = qtImage.copy(sourceRect);
     if (format == BGRAFormat || format == BGRFormat) {
-        if (hasBGRAExtension())
+        if (driverSupportsBGRASwizzling())
             glFormat = isOpaque() ? GL_BGR : GL_BGRA;
         else
             swizzleBGRAToRGBA(reinterpret_cast<uint32_t*>(qtImage.bits()), qtImage.size());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to