Optimize the texture packing for texImage2D() and texSubImage2D() in WebGL
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2013 02:58:32 +0000 (02:58 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2013 02:58:32 +0000 (02:58 +0000)
commit5ae283c22977207cc0366809463041adbce5204f
treeda25bb46083edede06645d09f3ef1c65790e92af
parente9be3093a71bab01e819c4b16dee3f61024b9871
Optimize the texture packing for texImage2D() and texSubImage2D() in WebGL
https://bugs.webkit.org/show_bug.cgi?id=105821

Patch by Jun Jiang <jun.a.jiang@intel.com> on 2013-01-22
Reviewed by Kenneth Russell.

The original texture packing code uses function pointers to denote each unpack and pack operations for different combination of Source formats,
Destination formats and Alpha Operations. It could be made cleaner and simpler. In this patch, template functions are used and try best to avoid
generating useless code for unreachable path to avoid code bloat. Moreover, the flipY operation is moved into the pack operation instead of
operating in a standalone method to improve performance.

Already covered by current test.

* html/canvas/WebGLRenderingContext.cpp:
(WebCore):
(WebCore::WebGLRenderingContext::texImage2DImpl):
(WebCore::WebGLRenderingContext::texSubImage2DImpl):
* platform/graphics/GraphicsContext3D.cpp:
(WebCore::GraphicsContext3D::packImageData):
(WebCore::GraphicsContext3D::extractImageData):
(WebCore::GraphicsContext3D::extractTextureData):
(WebCore):
(WebCore::GraphicsContext3D::packPixels):
* platform/graphics/GraphicsContext3D.h:
(WebCore::GraphicsContext3D::srcFormatComeFromDOMElementOrImageData):
(GraphicsContext3D):
(WebCore::GraphicsContext3D::ImageExtractor::imageSourceFormat):
(ImageExtractor):
* platform/graphics/cairo/GraphicsContext3DCairo.cpp:
(WebCore::GraphicsContext3D::ImageExtractor::extractImage):
* platform/graphics/cg/GraphicsContext3DCG.cpp:
(WebCore::getSourceDataFormat):
(WebCore::GraphicsContext3D::ImageExtractor::extractImage):
* platform/graphics/efl/GraphicsContext3DEfl.cpp:
(WebCore::GraphicsContext3D::ImageExtractor::extractImage):
* platform/graphics/qt/GraphicsContext3DQt.cpp:
(WebCore::GraphicsContext3D::ImageExtractor::extractImage):
* platform/graphics/skia/GraphicsContext3DSkia.cpp:
(WebCore::GraphicsContext3D::ImageExtractor::extractImage):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@140497 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/html/canvas/WebGLRenderingContext.cpp
Source/WebCore/platform/graphics/GraphicsContext3D.cpp
Source/WebCore/platform/graphics/GraphicsContext3D.h
Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp
Source/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp
Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
Source/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp