RESOLVED FIXED 89867
[Texmap] Remove platform specific code in BitmapImageGL::updateContents by using GraphicsContext3D::extractImageData.
https://bugs.webkit.org/show_bug.cgi?id=89867
Summary [Texmap] Remove platform specific code in BitmapImageGL::updateContents by us...
Dongseong Hwang
Reported 2012-06-25 04:25:38 PDT
[Texmap] Remove platform specific code in BitmapImageGL::updateContents by using GraphicsContext3D::extractImageData.
Attachments
Patch (6.19 KB, patch)
2012-06-25 04:26 PDT, Dongseong Hwang
no flags
patch (7.50 KB, patch)
2012-06-25 04:31 PDT, Dongseong Hwang
noam: review+
webkit-ews: commit-queue-
patch v.3 (8.01 KB, patch)
2012-06-25 16:55 PDT, Dongseong Hwang
no flags
patch v.4 (8.06 KB, patch)
2012-06-25 17:00 PDT, Dongseong Hwang
noam: review-
noam: commit-queue-
patch v.5 (7.73 KB, patch)
2012-06-25 19:06 PDT, Dongseong Hwang
no flags
Dongseong Hwang
Comment 1 2012-06-25 04:26:42 PDT
Dongseong Hwang
Comment 2 2012-06-25 04:31:38 PDT
Created attachment 149273 [details] patch [Texmap] Remove platform specific code in BitmapImageGL::updateContents by using GraphicsContext3D::extractImageData.
Early Warning System Bot
Comment 3 2012-06-25 04:38:32 PDT
Early Warning System Bot
Comment 4 2012-06-25 04:38:42 PDT
Gustavo Noronha (kov)
Comment 5 2012-06-25 04:39:06 PDT
Dongseong Hwang
Comment 6 2012-06-25 04:43:51 PDT
Oops, I made mistake. This patch can be compiled after Bug 89866 is accepted.
Noam Rosenthal
Comment 7 2012-06-25 06:06:27 PDT
Comment on attachment 149273 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=149273&action=review I'd rather if we just moved TExtureMapperGL to use GC3D, see https://bugs.webkit.org/show_bug.cgi?id=78672. Though this might be a good intermediate step. What do others think? > Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp:526 > + GraphicsContext3D::extractImageData(image, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, false, premultiplyAlpha, false, imageData); Add comments near the "false" arguments
Noam Rosenthal
Comment 8 2012-06-25 08:28:47 PDT
Comment on attachment 149273 [details] patch Please fix nitpick comment before committing.
Dongseong Hwang
Comment 9 2012-06-25 16:08:24 PDT
Sorry, I recognized that nitpick in subway to go home in yesterday night. I'll fix it.
Dongseong Hwang
Comment 10 2012-06-25 16:55:33 PDT
Created attachment 149396 [details] patch v.3
Dongseong Hwang
Comment 11 2012-06-25 17:00:08 PDT
Created attachment 149398 [details] patch v.4
Noam Rosenthal
Comment 12 2012-06-25 18:20:13 PDT
Comment on attachment 149398 [details] patch v.4 View in context: https://bugs.webkit.org/attachment.cgi?id=149398&action=review > Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp:523 > + // The premultiplyAlpha is true, because the default value of alphaOption in ImageSource is AlphaPremultiplied. > + bool premultiplyAlpha = true; > + // The ignoreGammaAndColorProfile is false, because the default value of gammaAndColorProfileOption in ImageSource is GammaAndColorProfileApplied. > + bool ignoreGammaAndColorProfile = false; > + GraphicsContext3D::extractImageData(image, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, flipY, premultiplyAlpha, ignoreGammaAndColorProfile, imageData); Not exactly what I meant... something like: GraphicsContext3D::extractImageData(image, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, flipY, true /* premultiplyAlpha */, false /* ignoreGammaAndColorProfile */, imageData); this way there are no magic "false" and "true" around.
Dongseong Hwang
Comment 13 2012-06-25 19:06:20 PDT
Created attachment 149423 [details] patch v.5 Ok. I'll remember it. :)
Noam Rosenthal
Comment 14 2012-06-25 19:10:45 PDT
The other optimization we need to do, if we're to use this code, is to load the image directly to ARGB32_Premultiplied instead of to ARGB32 and then add a premultiply step.
Dongseong Hwang
Comment 15 2012-06-25 19:18:29 PDT
When I called GraphicsContext3D::extractImageData(image, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, flipY, false /* premultiplyAlpha */, false /* ignoreGammaAndColorProfile */, imageData); I can not get proper pixel data. Could you explain briefly how we can get unpremultiplyAlpha pixel using GC3D?
Noam Rosenthal
Comment 16 2012-06-25 19:20:41 PDT
(In reply to comment #15) > When I called GraphicsContext3D::extractImageData(image, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, flipY, false /* premultiplyAlpha */, false /* ignoreGammaAndColorProfile */, imageData); > I can not get proper pixel data. > > Could you explain briefly how we can get unpremultiplyAlpha pixel using GC3D? Sorry, it's inside GRaphicsContext3D::extractImageData. This comment should have been for bug 89865.
Dongseong Hwang
Comment 17 2012-06-25 19:36:00 PDT
After this patch, if we run WebKit Leaves, you can see strange command message. libpng warning: Ignoring attempt to set cHRM RGB triangle with zero area It is because of GraphicsContext3D::extractImageData. I filed Bug 89938
WebKit Review Bot
Comment 18 2012-06-25 20:59:45 PDT
Comment on attachment 149423 [details] patch v.5 Clearing flags on attachment: 149423 Committed r121223: <http://trac.webkit.org/changeset/121223>
WebKit Review Bot
Comment 19 2012-06-25 20:59:51 PDT
All reviewed patches have been landed. Closing bug.
Simon Hausmann
Comment 20 2012-06-25 21:21:10 PDT
This patch broke the minimal Qt build bot ;( /usr/bin/gold: /ramdisk/qt-linux-release-minimal/build/WebKitBuild/Release/Source/WebCore/release/libWebCore.a(TextureMapperGL.o): in function WebCore::BitmapTextureGL::updateContents(WebCore::Image*, WebCore::IntRect const&, WebCore::IntPoint const&):TextureMapperGL.cpp(.text._ZN7WebCore15BitmapTextureGL14updateContentsEPNS_5ImageERKNS_7IntRectERKNS_8IntPointE+0x6a): error: undefined reference to 'WebCore::GraphicsContext3D::extractImageData(WebCore::Image*, unsigned int, unsigned int, bool, bool, bool, WTF::Vector<unsigned char, 0u>&)'
Simon Hausmann
Comment 21 2012-06-25 21:33:27 PDT
I'll try to fix the build. Essentially TextureMapperGL now requires WebGL.
Simon Hausmann
Comment 22 2012-06-25 21:44:08 PDT
Minimal build fixed in http://trac.webkit.org/changeset/121226 . The bot however needs a clean rebuild now though, because the DEFINES in WebCore's Target.pri changed and TextureMapperGL.cpp should not be compiled anymore.
Noam Rosenthal
Comment 23 2012-06-25 22:20:35 PDT
(In reply to comment #21) > I'll try to fix the build. Essentially TextureMapperGL now requires WebGL. It doesn't require WebGL, it requires GraphicsContext3D (which is a low-level part of WebGL). We should still be able to use TextureMapperGL without WebGL - should we create a separate bug to support this?
Simon Hausmann
Comment 24 2012-06-25 22:30:20 PDT
(In reply to comment #23) > (In reply to comment #21) > > I'll try to fix the build. Essentially TextureMapperGL now requires WebGL. > > It doesn't require WebGL, it requires GraphicsContext3D (which is a low-level part of WebGL). We should still be able to use TextureMapperGL without WebGL - should we create a separate bug to support this? Yes, because GraphicsContext3D.cpp has a big #if ENABLE(WEBGL) at the top :) I have the feeling that what's missing are some lower level convenience APIs for OpenGL that don't pull in the entire WebGL stuff, i.e. an OpenGL context abstraction and like in this case convenience for getting data out of a texture.
Dongseong Hwang
Comment 25 2012-06-25 23:05:24 PDT
(In reply to comment #22) > Minimal build fixed in http://trac.webkit.org/changeset/121226 . The bot however needs a clean rebuild now though, because the DEFINES in WebCore's Target.pri changed and TextureMapperGL.cpp should not be compiled anymore. Thanks for your favor. I should be more careful.
Ryosuke Niwa
Comment 26 2012-06-25 23:35:32 PDT
It's still broken :(
Simon Hausmann
Comment 27 2012-06-26 00:06:31 PDT
(In reply to comment #26) > It's still broken :( Yeah, but that's an issue on the bot. I built it locally and it works. The bot needs a nudge or somebody touching config.h ;)
Csaba Osztrogonác
Comment 28 2012-06-26 00:51:38 PDT
(In reply to comment #27) > (In reply to comment #26) > > It's still broken :( > > Yeah, but that's an issue on the bot. I built it locally and it works. The bot needs a nudge or somebody touching config.h ;) rgabor triggered a clean build on the bot, it's green again. ;-)
Noam Rosenthal
Comment 29 2012-06-26 05:58:05 PDT
(In reply to comment #24) > (In reply to comment #23) > > (In reply to comment #21) > > > I'll try to fix the build. Essentially TextureMapperGL now requires WebGL. > > > > It doesn't require WebGL, it requires GraphicsContext3D (which is a low-level part of WebGL). We should still be able to use TextureMapperGL without WebGL - should we create a separate bug to support this? > > Yes, because GraphicsContext3D.cpp has a big #if ENABLE(WEBGL) at the top :) > > I have the feeling that what's missing are some lower level convenience APIs for OpenGL that don't pull in the entire WebGL stuff, i.e. an OpenGL context abstraction and like in this case convenience for getting data out of a texture. We're not missing it. GraphicsContext3D is it - we just need to change that ENABLE flag at the top :)
Note You need to log in before you can comment on or make changes to this bug.