Bug 38528

Summary: [Qt] WebGL viewport does not show up on N900
Product: WebKit Reporter: Jarkko Sakkinen <jarkko.j.sakkinen>
Component: WebKit QtAssignee: Jarkko Sakkinen <jarkko.j.sakkinen>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, hausmann, jesus, kbr, laszlo.gombos
Priority: P2 Keywords: Qt, QtTriaged
Version: 528+ (Nightly build)   
Hardware: Other   
OS: Linux   
Attachments:
Description Flags
Fixes shader issues with OGLES2, improves drawTexture usage a bit. none

Jarkko Sakkinen
Reported 2010-05-04 10:17:10 PDT
WebGL viewport does not show up anymore on N900 when tested with QtLauncher.
Attachments
Fixes shader issues with OGLES2, improves drawTexture usage a bit. (3.60 KB, patch)
2010-05-20 07:01 PDT, Jarkko Sakkinen
no flags
Jarkko Sakkinen
Comment 1 2010-05-05 00:20:53 PDT
Issue here is simple. Higher-level WebGL code does not handle precision arguments yet (I suppose) and WebGL applications do not usually define precisions.
Jarkko Sakkinen
Comment 2 2010-05-05 00:27:55 PDT
Verified that there is no code that handles shader precisions.
Jarkko Sakkinen
Comment 3 2010-05-05 00:31:47 PDT
https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/doc/spec/WebGL-spec.html#4.4 Issue here is that most of the WebGL pages do not respect that at all :) Shaders are not ES GLSL compatible. They don't define precision arguments.
Jarkko Sakkinen
Comment 4 2010-05-05 00:33:41 PDT
QGLContext::drawTexture functions do not work in Maemo version. Tweaked qgl.cpp a little bit: diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 644a737..da61e61 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2706,7 +2706,7 @@ void QGLContext::drawTexture(const QRectF &target, QMacCompatGLuint textureId, Q void QGLContext::drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget) { // this would be ok on OpenGL ES 2.0, but currently we don't have a define for that -#ifdef QT_OPENGL_ES +#if !defined(QT_OPENGL_ES_2) && defined(QT_OPENGL_ES) Q_UNUSED(point); Q_UNUSED(textureId); Q_UNUSED(textureTarget); Let's how that helps.
Jarkko Sakkinen
Comment 5 2010-05-05 00:51:20 PDT
Kenneth, Simon says that you have some ideas on handling the precision argument in shader code. Can you elaborate a bit what you have in mind? :) I think I'll add the following work-around to Qt backend: - QtWebKit is compiled for a desktop system: define precision arguments as empty macros so that shaders still compile (similar idea as in http://doc.qt.nokia.com/4.6-snapshot/qglshaderprogram.html) - QtWebKit is compiled for a mobile device: define default precisions and append to the beginning of shader code. When something more higher-level comes out this workaround can be dropped. Simon, I don't find that too hackish, what do you think?
Jarkko Sakkinen
Comment 6 2010-05-05 03:43:19 PDT
Jarkko Sakkinen
Comment 7 2010-05-05 09:04:53 PDT
See my comment on Qt Jira. I think point version of drawTexture() is really impossible to make work ES 2.0 but I don't actually can't figure out why rect version is only available for ES versions less than 2.0.
Jarkko Sakkinen
Comment 8 2010-05-05 09:27:39 PDT
Ok that first "patch snippet" was completely crap but now I have patch candidate for rect version, let's see if it works :)
Kenneth Russell
Comment 9 2010-05-05 09:31:29 PDT
(In reply to comment #5) > Kenneth, Simon says that you have some ideas on handling the precision argument > in shader code. Can you elaborate a bit what you have in mind? :) In the context of the ANGLE project ( http://code.google.com/p/angleproject/ ) a GLSL ES -> GLSL translator is being developed. Once this is complete, we hope to work with all browser vendors developing WebGL on the desktop to integrate it simultaneously, because as you've discovered, none of the shaders in the WebGL content currently on the web are GLSL ES compliant. > I think I'll add the following work-around to Qt backend: > - QtWebKit is compiled for a desktop system: define precision arguments as > empty macros so that shaders still compile (similar idea as in > http://doc.qt.nokia.com/4.6-snapshot/qglshaderprogram.html) > - QtWebKit is compiled for a mobile device: define default precisions and > append to the beginning of shader code. > > When something more higher-level comes out this workaround can be dropped. > Simon, I don't find that too hackish, what do you think? This sounds like the best short-term workaround.
Jarkko Sakkinen
Comment 10 2010-05-11 00:24:32 PDT
drawTexture() issue is now fixed by Qt people: http://bugreports.qt.nokia.com/browse/QTBUG-10420. Great :) I'm submitting soon patch with workaround for shaders.
Jesus Sanchez-Palencia
Comment 11 2010-05-12 06:57:42 PDT
Please remember to block the 2.0 release meta-bug if you want this to be cherry-picked when the patch is ready.
Jarkko Sakkinen
Comment 12 2010-05-14 02:00:47 PDT
Still waiting for the drawTexture() fix to arrive to Qt public repositories.
Simon Hausmann
Comment 13 2010-05-14 03:42:10 PDT
(In reply to comment #12) > Still waiting for the drawTexture() fix to arrive to Qt public repositories. Sounds like we should also make WebGL only available when compiling against Qt 4.7?
Jarkko Sakkinen
Comment 14 2010-05-14 03:59:54 PDT
Depends. If we want to keep readPixels as a fallback for 4.6 then we can support both. I don't really have an opinnion on this, I'll let others to decide this :) Simon, have you already created bug for dropping readPixels? We already discussed about readPixels support but does everyone else share the opinnion that WebGL should be only supported with GL viewport? drawTexture() can be used for both cases (AC enabled/disabled) when GL viewport is active. I have already fix for this in my gitorious repository and I'm planning to add that change to this patch.
Jarkko Sakkinen
Comment 15 2010-05-20 07:01:49 PDT
Created attachment 56592 [details] Fixes shader issues with OGLES2, improves drawTexture usage a bit.
WebKit Commit Bot
Comment 16 2010-06-16 19:55:20 PDT
Comment on attachment 56592 [details] Fixes shader issues with OGLES2, improves drawTexture usage a bit. Clearing flags on attachment: 56592 Committed r61301: <http://trac.webkit.org/changeset/61301>
WebKit Commit Bot
Comment 17 2010-06-16 19:55:26 PDT
All reviewed patches have been landed. Closing bug.
Simon Hausmann
Comment 18 2010-06-17 01:20:15 PDT
WebGL is not part of the QtWebKit 2.0 release, so removing from the blocker bug.
Note You need to log in before you can comment on or make changes to this bug.