Title: [126675] trunk/Source/WebCore
Revision
126675
Author
[email protected]
Date
2012-08-24 19:26:06 -0700 (Fri, 24 Aug 2012)

Log Message

[Texmap] Move TextureMapperGL to use GraphicsContext3D
https://bugs.webkit.org/show_bug.cgi?id=78672

Patch by Helder Correia <[email protected]> on 2012-08-24
Reviewed by Noam Rosenthal.

Introducing a new GraphicsContext3D::texImage2DDirect() to allow
initialization of textures without allocation. The existing
textImage2D() refuses a null pixel buffer, and
texImage2DResourceSafe() allows it but performs memory
allocation and zeroes the bits. This was not fast enough for
BitmapTextureGL frequent setting up.

No new tests, refactoring.

* platform/graphics/GraphicsContext3D.h:
(GraphicsContext3D):
* platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
(WebCore::GraphicsContext3D::texImage2D):
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::texImage2DDirect):
(WebCore):
* platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
(WebCore::GraphicsContext3D::texImage2D):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (126674 => 126675)


--- trunk/Source/WebCore/ChangeLog	2012-08-25 02:07:09 UTC (rev 126674)
+++ trunk/Source/WebCore/ChangeLog	2012-08-25 02:26:06 UTC (rev 126675)
@@ -1,3 +1,29 @@
+2012-08-24  Helder Correia  <[email protected]>
+
+        [Texmap] Move TextureMapperGL to use GraphicsContext3D
+        https://bugs.webkit.org/show_bug.cgi?id=78672
+
+        Reviewed by Noam Rosenthal.
+
+        Introducing a new GraphicsContext3D::texImage2DDirect() to allow
+        initialization of textures without allocation. The existing
+        textImage2D() refuses a null pixel buffer, and
+        texImage2DResourceSafe() allows it but performs memory
+        allocation and zeroes the bits. This was not fast enough for
+        BitmapTextureGL frequent setting up.
+
+        No new tests, refactoring.
+
+        * platform/graphics/GraphicsContext3D.h:
+        (GraphicsContext3D):
+        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
+        (WebCore::GraphicsContext3D::texImage2D):
+        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+        (WebCore::GraphicsContext3D::texImage2DDirect):
+        (WebCore):
+        * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
+        (WebCore::GraphicsContext3D::texImage2D):
+
 2012-08-24  Roger Fong  <[email protected]>
 
         -webkit-font-smoothing: antialiased should use CG font rendering code path, not GDI

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (126674 => 126675)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h	2012-08-25 02:07:09 UTC (rev 126674)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h	2012-08-25 02:26:06 UTC (rev 126675)
@@ -526,6 +526,9 @@
     void prepareTexture();
 #endif
 
+    // Equivalent to ::glTexImage2D(). Allows pixels==0 with no allocation.
+    void texImage2DDirect(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, const void* pixels);
+
     // Helper to texImage2D with pixel==0 case: pixels are initialized to 0.
     // Return true if no GL error is synthesized.
     // By default, alignment is 4, the OpenGL default setting.

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


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp	2012-08-25 02:07:09 UTC (rev 126674)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp	2012-08-25 02:26:06 UTC (rev 126675)
@@ -256,7 +256,7 @@
         synthesizeGLError(INVALID_VALUE);
         return false;
     }
-    makeContextCurrent();
+
     GC3Denum openGLInternalFormat = internalformat;
     if (type == GL_FLOAT) {
         if (format == GL_RGBA)
@@ -265,7 +265,7 @@
             openGLInternalFormat = GL_RGB32F_ARB;
     }
 
-    ::glTexImage2D(target, level, openGLInternalFormat, width, height, border, format, type, pixels);
+    texImage2DDirect(target, level, openGLInternalFormat, width, height, border, format, type, pixels);
     return true;
 }
 

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


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2012-08-25 02:07:09 UTC (rev 126674)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2012-08-25 02:26:06 UTC (rev 126675)
@@ -1380,6 +1380,12 @@
     return m_layerComposited;
 }
 
+void GraphicsContext3D::texImage2DDirect(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, const void* pixels)
+{
+    makeContextCurrent();
+    ::glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
 }
 
+}
+
 #endif // USE(3D_GRAPHICS)

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


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp	2012-08-25 02:07:09 UTC (rev 126674)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp	2012-08-25 02:26:06 UTC (rev 126675)
@@ -31,6 +31,7 @@
 #if USE(3D_GRAPHICS)
 
 #include "GraphicsContext3D.h"
+
 #include "Extensions3DOpenGLES.h"
 #include "IntRect.h"
 #include "IntSize.h"
@@ -201,8 +202,8 @@
         synthesizeGLError(INVALID_VALUE);
         return false;
     }
-    makeContextCurrent();
-    ::glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
+
+    texImage2DDirect(target, level, internalformat, width, height, border, format, type, pixels);
     return true;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to