Diff
Modified: trunk/LayoutTests/ChangeLog (121054 => 121055)
--- trunk/LayoutTests/ChangeLog 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/LayoutTests/ChangeLog 2012-06-22 20:45:52 UTC (rev 121055)
@@ -1,3 +1,17 @@
+2012-06-22 Jeff Timanus <[email protected]>
+
+ [Chromium] Change implementing a fast-path for copying GPU-accelerated Canvas2D instances to WebGL textures.
+ https://bugs.webkit.org/show_bug.cgi?id=86275
+
+ This change adds the necessary plumbing to the various rendering contexts to copy the backing store texture of
+ a Canvas2D instance to be copied to a WebGL texture. The GL_CHROMIUM_copy_texture extension is necessary
+ because the backing-store for a GPU-accelerated skia Canvas2D is normally in BGRA format, which is not supported
+ by glCopyTexImage.
+
+ Reviewed by Kenneth Russell.
+
+ * platform/chromium/TestExpectations: Temporarily suppressed layout test, fast/canvas/webgl/gl-teximage.html until a rebaseline can be submitted.
+
2012-06-22 Kenneth Russell <[email protected]>
Layout Test media/event-attributes.html is failing
Modified: trunk/LayoutTests/platform/chromium/TestExpectations (121054 => 121055)
--- trunk/LayoutTests/platform/chromium/TestExpectations 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/LayoutTests/platform/chromium/TestExpectations 2012-06-22 20:45:52 UTC (rev 121055)
@@ -2406,6 +2406,8 @@
BUGBSALOMON : platform/chromium/virtual/gpu/fast/canvas/image-object-in-canvas.html = IMAGE
BUGBSALOMON : platform/chromium/virtual/gpu/fast/canvas/image-pattern-rotate.html = IMAGE
+BUGWK89494 : platform/chromium/virtual/gpu/fast/canvas/webgl/gl-teximage.html = TEXT
+
BUGWK47923 : compositing/geometry/limit-layer-bounds-opacity-transition.html = TIMEOUT
// Chromium does not support PDF content in <img> tags.
Modified: trunk/Source/Platform/ChangeLog (121054 => 121055)
--- trunk/Source/Platform/ChangeLog 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/Source/Platform/ChangeLog 2012-06-22 20:45:52 UTC (rev 121055)
@@ -1,3 +1,19 @@
+2012-06-22 Jeff Timanus <[email protected]>
+
+ [Chromium] Change implementing a fast-path for copying GPU-accelerated Canvas2D instances to WebGL textures.
+ https://bugs.webkit.org/show_bug.cgi?id=86275
+
+ This change adds the necessary plumbing to the various rendering contexts to copy the backing store texture of
+ a Canvas2D instance to be copied to a WebGL texture. The GL_CHROMIUM_copy_texture extension is necessary
+ because the backing-store for a GPU-accelerated skia Canvas2D is normally in BGRA format, which is not supported
+ by glCopyTexImage.
+
+ Reviewed by Kenneth Russell.
+
+ * chromium/public/WebGraphicsContext3D.h:
+ (WebGraphicsContext3D):
+ (WebKit::WebGraphicsContext3D::copyTextureCHROMIUM):
+
2012-06-20 Christopher Cameron <[email protected]>
[chromium] webkit-backface-visibility doesn't work with video
Modified: trunk/Source/Platform/chromium/public/WebGraphicsContext3D.h (121054 => 121055)
--- trunk/Source/Platform/chromium/public/WebGraphicsContext3D.h 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/Source/Platform/chromium/public/WebGraphicsContext3D.h 2012-06-22 20:45:52 UTC (rev 121055)
@@ -411,6 +411,10 @@
virtual void getQueryivEXT(WGC3Denum target, WGC3Denum pname, WGC3Dint* params) { }
virtual void getQueryObjectuivEXT(WebGLId query, WGC3Denum pname, WGC3Duint* params) { }
+ // GL_CHROMIUM_copy_texture
+ virtual void copyTextureCHROMIUM(WGC3Denum target, WGC3Duint sourceId,
+ WGC3Duint destId, WGC3Dint level, WGC3Denum internalFormat) { }
+
GrGLInterface* createGrGLInterface();
protected:
Modified: trunk/Source/WebCore/ChangeLog (121054 => 121055)
--- trunk/Source/WebCore/ChangeLog 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/Source/WebCore/ChangeLog 2012-06-22 20:45:52 UTC (rev 121055)
@@ -1,3 +1,52 @@
+2012-06-22 Jeff Timanus <[email protected]>
+
+ [Chromium] Change implementing a fast-path for copying GPU-accelerated Canvas2D instances to WebGL textures.
+ https://bugs.webkit.org/show_bug.cgi?id=86275
+
+ This change adds the necessary plumbing to the various rendering contexts to copy the backing store texture of
+ a Canvas2D instance to be copied to a WebGL texture. The GL_CHROMIUM_copy_texture extension is necessary
+ because the backing-store for a GPU-accelerated skia Canvas2D is normally in BGRA format, which is not supported
+ by glCopyTexImage.
+
+ Reviewed by Kenneth Russell.
+
+ Test: fast/canvas/webgl/*
+
+ * html/canvas/WebGLRenderingContext.cpp:
+ (WebCore):
+ (WebCore::WebGLRenderingContext::texImage2D):
+ * platform/chromium/support/Extensions3DChromium.cpp:
+ (WebCore::Extensions3DChromium::copyTextureCHROMIUM):
+ (WebCore):
+ * platform/graphics/Extensions3D.h:
+ (Extensions3D):
+ * platform/graphics/ImageBuffer.cpp:
+ (WebCore):
+ (WebCore::ImageBuffer::copyToPlatformTexture):
+ * platform/graphics/ImageBuffer.h:
+ (WebCore):
+ (ImageBuffer):
+ * platform/graphics/chromium/Canvas2DLayerBridge.cpp:
+ (WebCore::Canvas2DLayerBridge::backBufferTexture):
+ (WebCore):
+ * platform/graphics/chromium/Canvas2DLayerBridge.h:
+ (Canvas2DLayerBridge):
+ * platform/graphics/chromium/Extensions3DChromium.h:
+ (Extensions3DChromium):
+ * platform/graphics/opengl/Extensions3DOpenGL.cpp:
+ (WebCore::Extensions3DOpenGL::copyTextureCHROMIUM):
+ (WebCore):
+ * platform/graphics/opengl/Extensions3DOpenGL.h:
+ (Extensions3DOpenGL):
+ * platform/graphics/qt/Extensions3DQt.cpp:
+ (WebCore::Extensions3DQt::copyTextureCHROMIUM):
+ (WebCore):
+ * platform/graphics/qt/Extensions3DQt.h:
+ (Extensions3DQt):
+ * platform/graphics/skia/ImageBufferSkia.cpp:
+ (WebCore::ImageBuffer::copyToPlatformTexture):
+ (WebCore):
+
2012-06-22 Danilo Cesar Lemes de Paula <[email protected]>
Add url to supportsType
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (121054 => 121055)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp 2012-06-22 20:45:52 UTC (rev 121055)
@@ -3634,6 +3634,19 @@
ec = SECURITY_ERR;
return;
}
+
+ 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)) {
+ 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);
+ cleanupAfterGraphicsCall(false);
+ return;
+ }
+ }
+
RefPtr<ImageData> imageData = canvas->getImageData();
if (imageData)
texImage2D(target, level, internalformat, format, type, imageData.get(), ec);
Modified: trunk/Source/WebCore/platform/chromium/support/Extensions3DChromium.cpp (121054 => 121055)
--- trunk/Source/WebCore/platform/chromium/support/Extensions3DChromium.cpp 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/Source/WebCore/platform/chromium/support/Extensions3DChromium.cpp 2012-06-22 20:45:52 UTC (rev 121055)
@@ -201,4 +201,9 @@
m_private->webContext()->getQueryObjectuivEXT(query, pname, params);
}
+void Extensions3DChromium::copyTextureCHROMIUM(GC3Denum target, Platform3DObject sourceId, Platform3DObject destId, GC3Dint level, GC3Denum internalFormat)
+{
+ m_private->webContext()->copyTextureCHROMIUM(target, sourceId, destId, level, internalFormat);
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/Extensions3D.h (121054 => 121055)
--- trunk/Source/WebCore/platform/graphics/Extensions3D.h 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/Source/WebCore/platform/graphics/Extensions3D.h 2012-06-22 20:45:52 UTC (rev 121055)
@@ -66,6 +66,8 @@
// GL_OES_compressed_ETC1_RGB8_texture
// GL_IMG_texture_compression_pvrtc
// EXT_texture_filter_anisotropic
+ // GL_CHROMIUM_copy_texture
+ // GL_CHROMIUM_flipy
// Takes full name of extension; for example,
// "GL_EXT_texture_format_BGRA8888".
@@ -140,6 +142,13 @@
// GL_EXT_texture_filter_anisotropic
TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE,
MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF,
+
+ // GL_CHROMIUM_flipy
+ UNPACK_FLIP_Y_CHROMIUM = 0x9240,
+
+ // GL_CHROMIUM_copy_texture
+ UNPACK_PREMULTIPLY_ALPHA_CHROMIUM = 0x9241,
+ UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM = 0x9242
};
// GL_ARB_robustness
@@ -165,6 +174,9 @@
// GL_ANGLE_translated_shader_source
virtual String getTranslatedShaderSourceANGLE(Platform3DObject) = 0;
+
+ // GL_CHROMIUM_copy_texture
+ virtual void copyTextureCHROMIUM(GC3Denum, Platform3DObject, Platform3DObject, GC3Dint, GC3Denum) = 0;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.cpp (121054 => 121055)
--- trunk/Source/WebCore/platform/graphics/ImageBuffer.cpp 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.cpp 2012-06-22 20:45:52 UTC (rev 121055)
@@ -105,4 +105,11 @@
}
#endif
+#if !USE(SKIA)
+bool ImageBuffer::copyToPlatformTexture(GraphicsContext3D&, Platform3DObject, GC3Denum, bool, bool)
+{
+ return false;
}
+#endif
+
+}
Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (121054 => 121055)
--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h 2012-06-22 20:45:52 UTC (rev 121055)
@@ -36,6 +36,7 @@
#include "GraphicsLayer.h"
#endif
#include "GraphicsTypes.h"
+#include "GraphicsTypes3D.h"
#include "IntSize.h"
#include "ImageBufferData.h"
#include <wtf/Forward.h>
@@ -51,6 +52,7 @@
class ImageData;
class IntPoint;
class IntRect;
+ class GraphicsContext3D;
enum Multiply {
Premultiplied,
@@ -117,6 +119,8 @@
PlatformLayer* platformLayer() const;
#endif
+ bool copyToPlatformTexture(GraphicsContext3D&, Platform3DObject, GC3Denum, bool, bool);
+
private:
#if USE(CG)
NativeImagePtr copyNativeImage(BackingStoreCopy = CopyBackingStore) const;
Modified: trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp (121054 => 121055)
--- trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp 2012-06-22 20:45:52 UTC (rev 121055)
@@ -166,5 +166,14 @@
m_layer.willModifyTexture();
}
+unsigned Canvas2DLayerBridge::backBufferTexture()
+{
+ contextAcquired();
+ if (m_canvas)
+ m_canvas->flush();
+ m_context->flush();
+ return m_backBufferTexture;
}
+}
+
Modified: trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.h (121054 => 121055)
--- trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.h 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.h 2012-06-22 20:45:52 UTC (rev 121055)
@@ -63,6 +63,8 @@
LayerChromium* layer() const;
void contextAcquired();
+ unsigned backBufferTexture();
+
private:
Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D>, const IntSize&, DeferralMode, unsigned textureId);
Modified: trunk/Source/WebCore/platform/graphics/chromium/Extensions3DChromium.h (121054 => 121055)
--- trunk/Source/WebCore/platform/graphics/chromium/Extensions3DChromium.h 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/Source/WebCore/platform/graphics/chromium/Extensions3DChromium.h 2012-06-22 20:45:52 UTC (rev 121055)
@@ -156,6 +156,9 @@
void getQueryivEXT(GC3Denum, GC3Denum, GC3Dint*);
void getQueryObjectuivEXT(Platform3DObject, GC3Denum, GC3Duint*);
+ // GL_CHROMIUM_copy_texture
+ void copyTextureCHROMIUM(GC3Denum, Platform3DObject, Platform3DObject, GC3Dint, GC3Denum);
+
private:
// Instances of this class are strictly owned by the GraphicsContext3D implementation and do not
// need to be instantiated by any other code.
Modified: trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp (121054 => 121055)
--- trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp 2012-06-22 20:45:52 UTC (rev 121055)
@@ -201,6 +201,12 @@
// FIXME: implement this function and add GL_ANGLE_translated_shader_source in supports().
}
+void Extensions3DOpenGL::copyTextureCHROMIUM(GC3Denum, Platform3DObject, Platform3DObject, GC3Dint, GC3Denum)
+{
+ // FIXME: implement this function and add GL_CHROMIUM_copy_texture in supports().
+ return;
+}
+
} // namespace WebCore
#endif // ENABLE(WEBGL)
Modified: trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h (121054 => 121055)
--- trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h 2012-06-22 20:45:52 UTC (rev 121055)
@@ -51,6 +51,7 @@
virtual GC3Dboolean isVertexArrayOES(Platform3DObject);
virtual void bindVertexArrayOES(Platform3DObject);
virtual String getTranslatedShaderSourceANGLE(Platform3DObject);
+ virtual void copyTextureCHROMIUM(GC3Denum, Platform3DObject, Platform3DObject, GC3Dint, GC3Denum);
private:
// This class only needs to be instantiated by GraphicsContext3D implementations.
Modified: trunk/Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp (121054 => 121055)
--- trunk/Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp 2012-06-22 20:45:52 UTC (rev 121055)
@@ -93,6 +93,11 @@
return "";
}
+void Extensions3DQt::copyTextureCHROMIUM(GC3Denum, Platform3DObject, Platform3DObject, GC3Dint, GC3Denum)
+{
+ return;
+}
+
} // namespace WebCore
#endif // ENABLE(WEBGL)
Modified: trunk/Source/WebCore/platform/graphics/qt/Extensions3DQt.h (121054 => 121055)
--- trunk/Source/WebCore/platform/graphics/qt/Extensions3DQt.h 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/Source/WebCore/platform/graphics/qt/Extensions3DQt.h 2012-06-22 20:45:52 UTC (rev 121055)
@@ -46,6 +46,7 @@
virtual GC3Dboolean isVertexArrayOES(Platform3DObject);
virtual void bindVertexArrayOES(Platform3DObject);
virtual String getTranslatedShaderSourceANGLE(Platform3DObject);
+ virtual void copyTextureCHROMIUM(GC3Denum, Platform3DObject, Platform3DObject, GC3Dint, GC3Denum);
private:
// This class only needs to be instantiated by GraphicsContext3D implementations.
Modified: trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp (121054 => 121055)
--- trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp 2012-06-22 20:45:52 UTC (rev 121055)
@@ -36,8 +36,10 @@
#include "Base64.h"
#include "BitmapImage.h"
#include "BitmapImageSingleFrameSkia.h"
+#include "Extensions3D.h"
#include "GrContext.h"
#include "GraphicsContext.h"
+#include "GraphicsContext3D.h"
#include "ImageData.h"
#include "JPEGImageEncoder.h"
#include "MIMETypeRegistry.h"
@@ -166,6 +168,33 @@
return m_data.m_layerBridge ? m_data.m_layerBridge->layer() : 0;
}
+bool ImageBuffer::copyToPlatformTexture(GraphicsContext3D& context, Platform3DObject texture, GC3Denum internalFormat, bool premultiplyAlpha, bool flipY)
+{
+ if (!m_data.m_layerBridge || !platformLayer())
+ return false;
+
+ Platform3DObject sourceTexture = m_data.m_layerBridge->backBufferTexture();
+
+ if (!context.makeContextCurrent())
+ return false;
+
+ Extensions3D* extensions = context.getExtensions();
+ if (!extensions->supports("GL_CHROMIUM_copy_texture") || !extensions->supports("GL_CHROMIUM_flipy"))
+ return false;
+
+ // The canvas is stored in a premultiplied format, so unpremultiply if necessary.
+ context.pixelStorei(Extensions3D::UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, !premultiplyAlpha);
+
+ // The canvas is stored in an inverted position, so the flip semantics are reversed.
+ context.pixelStorei(Extensions3D::UNPACK_FLIP_Y_CHROMIUM, !flipY);
+
+ extensions->copyTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D, sourceTexture, texture, 0, internalFormat);
+
+ context.pixelStorei(Extensions3D::UNPACK_FLIP_Y_CHROMIUM, false);
+ context.pixelStorei(Extensions3D::UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, false);
+ return true;
+}
+
void ImageBuffer::clip(GraphicsContext* context, const FloatRect& rect) const
{
context->platformContext()->beginLayerClippedToImage(rect, this);
Modified: trunk/Source/WebKit/chromium/ChangeLog (121054 => 121055)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-06-22 20:45:52 UTC (rev 121055)
@@ -1,3 +1,17 @@
+2012-06-22 Jeff Timanus <[email protected]>
+
+ [Chromium] Change implementing a fast-path for copying GPU-accelerated Canvas2D instances to WebGL textures.
+ https://bugs.webkit.org/show_bug.cgi?id=86275
+
+ This change adds the necessary plumbing to the various rendering contexts to copy the backing store texture of
+ a Canvas2D instance to be copied to a WebGL texture. The GL_CHROMIUM_copy_texture extension is necessary
+ because the backing-store for a GPU-accelerated skia Canvas2D is normally in BGRA format, which is not supported
+ by glCopyTexImage.
+
+ Reviewed by Kenneth Russell.
+
+ * DEPS: Rolled chromium to 143630 to fix chromium-linux ews failures.
+
2012-06-22 Kenneth Russell <[email protected]>
Unreviewed, rolling out r121025.
Modified: trunk/Source/WebKit/chromium/DEPS (121054 => 121055)
--- trunk/Source/WebKit/chromium/DEPS 2012-06-22 20:37:06 UTC (rev 121054)
+++ trunk/Source/WebKit/chromium/DEPS 2012-06-22 20:45:52 UTC (rev 121055)
@@ -32,7 +32,7 @@
vars = {
'chromium_svn': 'http://src.chromium.org/svn/trunk/src',
- 'chromium_rev': '142842'
+ 'chromium_rev': '143630'
}
deps = {