Temporarily restrict use of ImageBufferSkia::copyToPlatformTexture until bugs resolved
authorkbr@google.com <kbr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2012 00:00:12 +0000 (00:00 +0000)
committerkbr@google.com <kbr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2012 00:00:12 +0000 (00:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=100714

Reviewed by Stephen White.

For the moment, only use ImageBuffer::copyToPlatformTexture when
copying to RGBA/UNSIGNED_BYTE textures, and document restriction
in header. Restriction will be lifted once the implementations
(currently only Chromium has one) have been fixed; see bug 100715.

No new tests; manually ran WebGL conformance test
tex-image-and-sub-image-2d-with-canvas-rgba5551.html on NVIDIA
hardware on Mac OS.

* html/canvas/WebGLRenderingContext.cpp:
(WebCore):
(WebCore::WebGLRenderingContext::texImage2D):
* platform/graphics/ImageBuffer.h:
(ImageBuffer):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@132965 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/html/canvas/WebGLRenderingContext.cpp
Source/WebCore/platform/graphics/ImageBuffer.h

index 3c054b3..f0c6467 100644 (file)
@@ -1,3 +1,25 @@
+2012-10-30  Kenneth Russell  <kbr@google.com>
+
+        Temporarily restrict use of ImageBufferSkia::copyToPlatformTexture until bugs resolved
+        https://bugs.webkit.org/show_bug.cgi?id=100714
+
+        Reviewed by Stephen White.
+
+        For the moment, only use ImageBuffer::copyToPlatformTexture when
+        copying to RGBA/UNSIGNED_BYTE textures, and document restriction
+        in header. Restriction will be lifted once the implementations
+        (currently only Chromium has one) have been fixed; see bug 100715.
+
+        No new tests; manually ran WebGL conformance test
+        tex-image-and-sub-image-2d-with-canvas-rgba5551.html on NVIDIA
+        hardware on Mac OS.
+
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore):
+        (WebCore::WebGLRenderingContext::texImage2D):
+        * platform/graphics/ImageBuffer.h:
+        (ImageBuffer):
+
 2012-10-30  Nico Weber  <thakis@chromium.org>
 
         Fix potential overflow in jpeg exif reader. Found by aedla@google.com.
index 1e0ef3a..09155ec 100644 (file)
@@ -3699,7 +3699,11 @@ void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum
     WebGLTexture* texture = validateTextureBinding("texImage2D", target, true);
     // If possible, copy from the canvas element directly to the texture
     // via the GPU, without a read-back to system memory.
-    if (GraphicsContext3D::TEXTURE_2D == target && texture && type == texture->getType(target, level)) {
+    //
+    // FIXME: restriction of RGBA/UNSIGNED_BYTE should be lifted when
+    // ImageBuffer::copyToPlatformTexture implementations are fully functional.
+    if (GraphicsContext3D::TEXTURE_2D == target && texture && type == texture->getType(target, level)
+        && format == GraphicsContext3D::RGBA && type == GraphicsContext3D::UNSIGNED_BYTE) {
         ImageBuffer* buffer = canvas->buffer();
         if (buffer && buffer->copyToPlatformTexture(*m_context.get(), texture->object(), internalformat, m_unpackPremultiplyAlpha, m_unpackFlipY)) {
             texture->setLevelInfo(target, level, internalformat, canvas->width(), canvas->height(), type);
index fe0aee0..588efd1 100644 (file)
@@ -119,6 +119,8 @@ namespace WebCore {
         PlatformLayer* platformLayer() const;
 #endif
 
+        // FIXME: current implementations of this method have the restriction that they only work
+        // with textures that are RGBA format and UNSIGNED_BYTE type.
         bool copyToPlatformTexture(GraphicsContext3D&, Platform3DObject, GC3Denum, bool, bool);
 
         void reportMemoryUsage(MemoryObjectInfo*) const;