RESOLVED FIXED Bug 31517
[GTK] WebGL support
https://bugs.webkit.org/show_bug.cgi?id=31517
Summary [GTK] WebGL support
Zan Dobersek
Reported 2009-11-15 08:15:40 PST
This bug oversees the implementation of WebGL for the Gtk port.
Attachments
Work-In-Progress of WebGL implementation (58.05 KB, patch)
2009-11-15 08:58 PST, Zan Dobersek
no flags
Cairo patch (4.28 KB, patch)
2009-11-15 09:01 PST, Zan Dobersek
no flags
webkit-webgk-wip-rebased.patch (60.38 KB, patch)
2010-01-14 08:11 PST, Priit Laes (IRC: plaes)
no flags
Initial patch with WebGL support for the GTK+ port (82.11 KB, patch)
2011-02-07 12:49 PST, Martin Robinson
no flags
Patch with Benjamin's suggestions (83.64 KB, patch)
2011-02-08 11:41 PST, Martin Robinson
no flags
Patch updated to ToT (86.14 KB, patch)
2011-03-14 13:11 PDT, Martin Robinson
no flags
Patch with missing source files (86.83 KB, patch)
2011-03-15 08:37 PDT, Martin Robinson
no flags
revised patch (85.11 KB, patch)
2011-03-25 03:50 PDT, ChangSeok Oh
no flags
Patch adding missing shim table entry (86.73 KB, patch)
2011-03-29 12:31 PDT, Martin Robinson
no flags
Zan Dobersek
Comment 1 2009-11-15 08:58:54 PST
Created attachment 43247 [details] Work-In-Progress of WebGL implementation Warning - this patch is pretty outdated (2 or more weeks), so it probably won't apply easily or build properly. It also contains some debugging leftovers and unnecessary stuff (methods, lines etc.) This implementation requires use of cairo's OpenGL backend. A recent version or even trunk should be used, along with another patch applied. That patch will be attached to this bug. There are some notable problems with this implementation, but they can be fixed. The surface is not properly painted on the canvas. The surface is correctly shown on the canvas only if the canvashas size of 300x150px, which is the default canvas size. If the canvas is resized to a bigger size, the surface resizes also, but only the rectangle (x= 0, y = 0, width = 300, height = 150) of the surface is shown. When resized to a smaller size, the surface is shown completely, but unevenly, relatively to the canvas's size. The other problem is that the OpenGL content is rendered to the cairo's surface upside down - OpenGL is using lower-left coordinate system while images use upper-left coordinate system. This is described as twelveth pitfall at [1] and should be simple to fix. Other than that, the performance is, I feel, good. I've tested the webgl manual tests and they all worked pretty well apart from the mentioned problems. I experienced crashes on olliej's WebGL example[2], though. [1] http://www.opengl.org/resources/features/KilgardTechniques/oglpitfall/ [2] http://nerget.com/webgl
Zan Dobersek
Comment 2 2009-11-15 09:01:09 PST
Created attachment 43248 [details] Cairo patch This patch adds functionality to the cairo's OpenGL backend that is needed for the WebGL impl. to work.
Priit Laes (IRC: plaes)
Comment 3 2010-01-14 08:11:03 PST
Created attachment 46570 [details] webkit-webgk-wip-rebased.patch I took Zan's patch and rebased it (lots of changes have been happened in tree since the patch). Please note that I only "#if 0"-ed out the changed implementations of changed API in GraphicsContext3D class and stubbed the non-existing functions.
Cedric Vivier
Comment 4 2010-03-25 20:21:12 PDT
I think the GTK port should not link to libGL but use a dynamic dlopen/dlsym-based approach like what the QT port is doing. It probable make sense to use QT approach in base GraphicsContext3D since it can be shared among ports (Gtk/Qt/Chromium/Win/...) that cannot link to libGL (only Mac port can link libGL for sure afaik) ; only port-specific initialization stuff should be required in the ports, makes WebGL easier to test and less probability of behavior differences between ports (wrt to arguments checking etc).
Martin Robinson
Comment 5 2011-02-07 12:49:46 PST
Created attachment 81506 [details] Initial patch with WebGL support for the GTK+ port
WebKit Review Bot
Comment 6 2011-02-07 13:51:30 PST
Martin Robinson
Comment 7 2011-02-08 11:41:16 PST
Created attachment 81670 [details] Patch with Benjamin's suggestions
Martin Robinson
Comment 8 2011-03-14 13:11:21 PDT
Created attachment 85706 [details] Patch updated to ToT
Philippe Normand
Comment 9 2011-03-15 05:05:05 PDT
I get a bunch of errors at link time, like this one: ./.libs/libwebkitgtk-1.0.so: undefined reference to `sh::SearchSymbol::foundMatch() const' ./.libs/libwebkitgtk-1.0.so: undefined reference to `sh::SearchSymbol::SearchSymbol(std::basic_string<char, std::char_traits<char>, pool_allocator<char> > const&)' ./.libs/libwebkitgtk-1.0.so: undefined reference to `WebCore::WebGLExtension::WebGLExtension()' ./.libs/libwebkitgtk-1.0.so: undefined reference to `CollectAttribsUniforms::CollectAttribsUniforms(std::vector<TVariableInfo, std::allocator<TVariableInfo> >&, std::vector<TVariableInfo, std::allocator<TVariableInfo> >&)' ./.libs/libwebkitgtk-1.0.so: undefined reference to `WebCore::WebGLExtension::~WebGLExtension()' collect2: ld returned 1 exit status
Philippe Normand
Comment 10 2011-03-15 05:19:05 PDT
Adding Source/WebCore/html/canvas/WebGLExtension.{h,cpp} Source/ThirdParty/ANGLE/src/compiler/VariableInfo.{h,cpp} Source/ThirdParty/ANGLE/src/compiler/SearchSymbol.{h,cpp} in the build fixes those link errors :)
Martin Robinson
Comment 11 2011-03-15 08:37:23 PDT
Created attachment 85810 [details] Patch with missing source files
Thierry Reding
Comment 12 2011-03-23 08:27:38 PDT
FWIW, I've been able to run all lessons from the following page successfully with the latest patch (ID 85810) applied. http://learningwebgl.com/blog/?page_id=1217 Running the WebGL Conformance Tests from the Khronos website below, however, has the browser hanging after some time, consuming 100% CPU. https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests/webgl-conformance-tests.html Excellent work!
ChangSeok Oh
Comment 13 2011-03-25 03:50:11 PDT
Created attachment 86915 [details] revised patch I just revised Martin's patch to meet latest trunk(r81938).
ChangSeok Oh
Comment 14 2011-03-25 03:56:01 PDT
(In reply to comment #12) > FWIW, I've been able to run all lessons from the following page successfully > with the latest patch (ID 85810) applied. > > http://learningwebgl.com/blog/?page_id=1217 > > Running the WebGL Conformance Tests from the Khronos website below, however, > has the browser hanging after some time, consuming 100% CPU. > > https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests/webgl-conformance-tests.html > > Excellent work! I also faced an issue while running the test that Thierry mentioned on Ubuntu 10.10. In my case. It was crash. No problem to run learningwebgl tutorial, too.
ChangSeok Oh
Comment 15 2011-03-29 00:55:07 PDT
Martin, I think following line is missed in initializeOpenGLShims(). > ASSIGN_FUNCTION_TABLE_ENTRY(glUniform2fv, success); It cause a crash while running the WebGL Conformance Tests Thierry mentioned. :)
Martin Robinson
Comment 16 2011-03-29 12:31:45 PDT
Created attachment 87394 [details] Patch adding missing shim table entry
Martin Robinson
Comment 17 2011-03-29 12:32:23 PDT
(In reply to comment #15) > Martin, I think following line is missed in initializeOpenGLShims(). > > ASSIGN_FUNCTION_TABLE_ENTRY(glUniform2fv, success); > > It cause a crash while running the WebGL Conformance Tests Thierry mentioned. :) Thank you! I've uploaded a patch fixing this issue.
Gustavo Noronha (kov)
Comment 18 2011-04-04 07:23:29 PDT
Comment on attachment 87394 [details] Patch adding missing shim table entry View in context: https://bugs.webkit.org/attachment.cgi?id=87394&action=review It looks good to me. Like I've noted before I am no expert in OpenGL, but given this has been looked over by people who are, and it's essentially glue code I'll say go ahead after fixing/clarifying my comments =) > Source/WebCore/platform/graphics/gtk/GraphicsContext3DInternal.cpp:60 > + addedAtExitHandler = false; Looks like you want true here? I guess this raises the pressure on us to find a cross-platform way of cleaning up on exit heh. Didn't we have something added for the icon database at some point? > Source/WebCore/platform/graphics/gtk/GraphicsContext3DInternal.cpp:102 > + static bool initialized = false; > + static bool success = true; > + if (!initialized) { > + success = initializeOpenGLShims(); > + initialized = true; > + } > + if (!success) > + return 0; Just to make sure I understand this - if we fail to initialize the shims we're essentially out of luck and won't be able to support webgl, and there's no point in trying to initialize them again, so we cache the failure, that sounds good yeah. > Source/WebKit/gtk/webkit/webkitwebsettings.cpp:924 > + * Since: 1.3.7 Needs to be 1.3.14, or would it be 1.3.15? =)
Martin Robinson
Comment 19 2011-04-04 14:38:16 PDT
(In reply to comment #18) Thank you very kindly for the review. > > Source/WebCore/platform/graphics/gtk/GraphicsContext3DInternal.cpp:60 > > + addedAtExitHandler = false; > > Looks like you want true here? I guess this raises the pressure on us to find a cross-platform way of cleaning up on exit heh. Didn't we have something added for the icon database at some point? You're right! I will fix this before landing. > > > Source/WebCore/platform/graphics/gtk/GraphicsContext3DInternal.cpp:102 > > + static bool initialized = false; > > + static bool success = true; > > + if (!initialized) { > > + success = initializeOpenGLShims(); > > + initialized = true; > > + } > > + if (!success) > > + return 0; > > Just to make sure I understand this - if we fail to initialize the shims we're essentially out of luck and won't be able to support webgl, and there's no point in trying to initialize them again, so we cache the failure, that sounds good yeah. Exactly right. > > Source/WebKit/gtk/webkit/webkitwebsettings.cpp:924 > > + * Since: 1.3.7 > > Needs to be 1.3.14, or would it be 1.3.15? =) Will fix this!
Martin Robinson
Comment 20 2011-04-04 15:13:20 PDT
WebKit Review Bot
Comment 21 2011-04-04 15:29:59 PDT
http://trac.webkit.org/changeset/82878 might have broken GTK Linux 32-bit Release
Won Jeon
Comment 22 2011-05-12 14:00:02 PDT
Any plan to revive this CR and fix it soon? Thanks.
Martin Robinson
Comment 23 2011-05-13 11:32:04 PDT
(In reply to comment #22) > Any plan to revive this CR and fix it soon? Thanks. I'm not sure I understand. The patch landed and the bug was resolved.
Won Jeon
Comment 24 2011-05-13 11:40:47 PDT
I updated the source code yesterday and tested it on my 32-bit Linux machine (w/ NVidia GeForce 8600 GTS), with the build switches 'build-webkit --gtk --3d-canvas --enable-webgl' but it didn't work. When I executed the browser by 'run-launcher --gtk' and test it with HTML5 test (http://www.html5test.com), it fails in WebGL test. Am I missing anything?
Martin Robinson
Comment 25 2011-05-13 12:12:40 PDT
(In reply to comment #24) > I updated the source code yesterday and tested it on my 32-bit Linux machine (w/ NVidia GeForce 8600 GTS), with the build switches 'build-webkit --gtk --3d-canvas --enable-webgl' but it didn't work. When I executed the browser by 'run-launcher --gtk' and test it with HTML5 test (http://www.html5test.com), it fails in WebGL test. Am I missing anything? You need to enable the WebGL setting in WebKitWebViewSettings.
Won Jeon
Comment 26 2011-05-13 16:09:14 PDT
Where and how can it be enabled?
Martin Robinson
Comment 27 2011-05-13 16:39:52 PDT
(In reply to comment #26) > Where and how can it be enabled? g_object_set(webkit_web_view_get_settings(web_view), "enable-webgl", TRUE, NULL); Hopefully we'll have the online documentation updated soon.
Won Jeon
Comment 28 2011-05-13 16:55:05 PDT
I inserted it after createWindow(&webView) in the main() of GtkLauncher.c but it's still not working. Whenever GtkLauncher tries to load WebGL pages, it has "SSL handshake failed" error.
Martin Robinson
Comment 29 2011-05-13 17:06:10 PDT
(In reply to comment #28) > I inserted it after createWindow(&webView) in the main() of GtkLauncher.c but it's still not working. Whenever GtkLauncher tries to load WebGL pages, it has "SSL handshake failed" error. This is an unrelated issue with libsoup. Let's move this discussion off of Bugzilla, perhaps to the WebKitGTK+ mailing list http://webkitgtk.org/?page=contact. That would be a much more better place for this kind of discussions.
Note You need to log in before you can comment on or make changes to this bug.