[chromium] Add TextureCopier for copying texture contents
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Mar 2012 18:18:42 +0000 (18:18 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Mar 2012 18:18:42 +0000 (18:18 +0000)
commitdab2e19b7468bb24f8d8cb308cd8d24bdc5c30ec
tree7e73eca00f6d10e1950798715a6a3ff0cc9b3b8c
parent5a74e9ccf5566b71636a008e2ca5bb41941d5cca
[chromium] Add TextureCopier for copying texture contents
https://bugs.webkit.org/show_bug.cgi?id=80870

Patch by Sami Kyostila <skyostil@chromium.org> on 2012-03-27
Reviewed by Stephen White.

Source/WebCore:

This patch introduces a TextureCopier class whose job is to copy the
contents from one GL texture to another using the most efficient means
for the current GPU. This version uses render-to-texture to do the copy,
but a path based on EXT_framebuffer_blit can be added later.

The class is intended to replace the use of image path operations such
as glCopyTex{Sub}Image2D for duplicating texture contents. The reason is
that such functions may not be very well optimized in some -- mainly
mobile -- GPU drivers.

With this patch the new copier is used just for Canvas2D layer
presentation, but another potential use is for WebGL layer presentation.

Test: webkit_unit_tests: TextureCopierTest

* WebCore.gypi:
* platform/graphics/chromium/Canvas2DLayerChromium.cpp:
(WebCore::Canvas2DLayerChromium::Canvas2DLayerChromium):
(WebCore::Canvas2DLayerChromium::~Canvas2DLayerChromium):
(WebCore::Canvas2DLayerChromium::updateCompositorResources):
* platform/graphics/chromium/Canvas2DLayerChromium.h:
(Canvas2DLayerChromium):
* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::initializeSharedObjects):
* platform/graphics/chromium/LayerRendererChromium.h:
(WebCore):
(WebCore::LayerRendererChromium::textureCopier):
(LayerRendererChromium):
* platform/graphics/chromium/ShaderChromium.cpp:
(WebCore::VertexShaderPosTexIdentity::getShaderString):
(WebCore):
(WebCore::FragmentShaderRGBATexCopy::getShaderString):
* platform/graphics/chromium/ShaderChromium.h:
(VertexShaderPosTexIdentity):
(WebCore::VertexShaderPosTexIdentity::init):
(WebCore):
(FragmentShaderRGBATexCopy):
* platform/graphics/chromium/TextureCopier.cpp: Added.
(WebCore):
(WebCore::AcceleratedTextureCopier::AcceleratedTextureCopier):
(WebCore::AcceleratedTextureCopier::~AcceleratedTextureCopier):
(WebCore::AcceleratedTextureCopier::copyTexture):
* platform/graphics/chromium/TextureCopier.h: Added.
(WebCore):
(TextureCopier):
(WebCore::TextureCopier::~TextureCopier):
(AcceleratedTextureCopier):
(WebCore::AcceleratedTextureCopier::create):
* platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
(WebCore::CCSingleThreadProxy::doCommit):
* platform/graphics/chromium/cc/CCTextureUpdater.cpp:
(WebCore::CCTextureUpdater::CCTextureUpdater):
* platform/graphics/chromium/cc/CCTextureUpdater.h:
(WebCore):
(CCTextureUpdater):
(WebCore::CCTextureUpdater::copier):
* platform/graphics/chromium/cc/CCThreadProxy.cpp:
(WebCore::CCThreadProxy::beginFrameCompleteOnImplThread):

Source/WebKit/chromium:

Add new test for TextureCopier.

* WebKit.gypi:
* tests/Canvas2DLayerChromiumTest.cpp:
* tests/TextureCopierTest.cpp: Added.
* tests/TiledLayerChromiumTest.cpp:
(FakeTextureCopier):
(WTF::FakeTextureCopier::copyTexture):
(WTF):
(WTF::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112286 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.gypi
Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp
Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.h
Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h
Source/WebCore/platform/graphics/chromium/ShaderChromium.cpp
Source/WebCore/platform/graphics/chromium/ShaderChromium.h
Source/WebCore/platform/graphics/chromium/TextureCopier.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/chromium/TextureCopier.h [new file with mode: 0644]
Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp
Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp
Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h
Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/WebKit.gypi
Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp
Source/WebKit/chromium/tests/TextureCopierTest.cpp [new file with mode: 0644]
Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp