Bug 324478 - GLES requires explicit precison definitions?!
Summary: GLES requires explicit precison definitions?!
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: scene-opengl (show other bugs)
Version: git master
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL: https://git.reviewboard.kde.org/r/112...
Keywords:
: 294468 325134 325790 331237 334704 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-09-03 22:42 UTC by Thomas Lübking
Modified: 2015-11-09 15:22 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.5
thomas.luebking: ReviewRequest+


Attachments
kwin_gles with MESA_GLSL=dump (26.54 KB, text/plain)
2013-09-04 20:57 UTC, Björn Bidar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Lübking 2013-09-03 22:42:37 UTC
http://forum.kde.org/viewtopic.php?f=111&t=117327
http://lists.freedesktop.org/archives/piglit/2013-February/004920.html
http://cgit.freedesktop.org/piglit/commit/?id=fb7bc989f211fe30c02ff687cbf53c01ad7970db
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cabd45773b58d6aa48202da1cdd8cf1a6b856c53

----

From section 4.5.4 ("Default Precision Qualifiers") of the GLSL ES
3.00 spec:

"The fragment language has no default precision qualifier for
floating point types. Hence for float, floating point vector
and matrix variable declarations, either the declaration must
include a precision qualifier or the default float precision
must have been previously declared."

Reproducible: Always
Comment 1 Martin Flöser 2013-09-04 11:56:34 UTC
are we missing it in some shaders? I thought we define it...
Comment 2 Thomas Lübking 2013-09-04 16:35:10 UTC
No idea, but apparently.

There's 

#ifdef KWIN_HAVE_OPENGLES
    if (GLPlatform::instance()->glslVersion() >= kVersionNumber(3, 0)) {
        ba.replace("#version 140", "#version 300 es\n\nprecision highp float;\n");
    }
#endif

What could fail if some shader had no "#version 140"
Also there's no mention of vec4 (and others) here, I'm not sure how (all) compiled in shaders are handled and there's fairly complex bytearray manipulation in the colorcorrection.
Comment 3 Martin Flöser 2013-09-04 16:55:45 UTC
> No idea, but apparently.
> 
> There's
> 
> #ifdef KWIN_HAVE_OPENGLES
>     if (GLPlatform::instance()->glslVersion() >= kVersionNumber(3, 0)) {
>         ba.replace("#version 140", "#version 300 es\n\nprecision highp
> float;\n");
>     }
> #endif
> 
> What could fail if some shader had no "#version 140"
then it wouldn't have a #version at all and should fail by definition (GLES 
requires a #version)
> Also there's no mention of vec4 (and others) here,
hmm never heard of that for vec4. I would expect that the precision for float 
should be valid for vec4, too.
> I'm not sure how (all)
> compiled in shaders are handled and there's fairly complex bytearray
> manipulation in the colorcorrection.
we need some further debug output to see which shader it is. I'll add 
something to the forum thread.
Comment 4 Thomas Lübking 2013-09-04 18:08:05 UTC
blurshader.cpp

#ifdef KWIN_HAVE_OPENGLES
    const bool glsl_140 = false;
#else
    const bool glsl_140 = GLPlatform::instance()->glslVersion() >= kVersionNumber(1, 40);
#endif

...

if (glsl_140)
        stream << "#version 140\n\n";

....
Comment 5 Björn Bidar 2013-09-04 20:57:46 UTC
Created attachment 82166 [details]
kwin_gles with MESA_GLSL=dump

Requested files from forum thread.
Comment 6 Thomas Lübking 2013-09-21 09:18:44 UTC
*** Bug 325134 has been marked as a duplicate of this bug. ***
Comment 7 Thomas Lübking 2013-10-08 19:30:52 UTC
*** Bug 325790 has been marked as a duplicate of this bug. ***
Comment 8 Hrvoje Senjan 2013-10-08 22:23:16 UTC
FWIW, diff3 of r112862 works here...
Comment 9 Dennis Schridde 2014-01-05 00:53:54 UTC
Was this fix merged already?
Comment 10 Thomas Lübking 2014-01-06 15:09:05 UTC
No.
The review request will be marked as submitted and this bug closed whenever that happens.
Comment 11 Eugene 2014-05-13 12:12:55 UTC
*** Bug 334704 has been marked as a duplicate of this bug. ***
Comment 12 Eugene 2014-09-20 14:40:58 UTC
Hey, hello, anybody home ? Can someone explain when this issue will be fixed and we can run KWin with OpenGL ES ?
Comment 13 Thomas Lübking 2014-09-20 18:27:26 UTC
No, but you probably just delayed the fix for no reason. Thanks.
Comment 14 AnAkkk 2014-09-20 18:30:16 UTC
Does that fix even make sense anymore though? kwin5/Qt5 is built either with OpenGL or OpenGL ES support, not both, and if I've understood correctly it'll always be OpenGL on desktop. Not sure if kwin is supposed to run on mobiles.
Comment 15 Thomas Lübking 2014-09-20 18:43:00 UTC
Afaics the shader is still there and incorrect for GLES + glsl 3.x
Comment 16 Eugene 2014-09-20 23:47:13 UTC
I don't understand guys what do you mean and why so much time gone but for today if I try:

kwin_gles --replace

I see white taskbar and following in terminal:

QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
OpenGL vendor string:                   X.Org
OpenGL renderer string:                 Gallium 0.4 on AMD RV630
OpenGL version string:                  OpenGL ES 3.0 Mesa 10.4.0-devel (git-4eb2bbe 2014-09-20 trusty-oibaf-ppa)
OpenGL shading language version string: OpenGL ES GLSL ES 3.0
Driver:                                 R600G
GPU class:                              R600
OpenGL version:                         3.0
GLSL version:                           3.0
Mesa version:                           10.4
X server version:                       1.15.1
Linux kernel version:                   3.16.3
Direct rendering:                       yes
Requires strict binding:                no
GLSL shaders:                           yes
Texture NPOT support:                   yes
Virtual Machine:                        no
kwin(4168) KWin::EglOnXBackend::init: Cannot enable v-sync as max. swap interval is 0 
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
kwin(4168): Failed to compile fragment shader: 
"0:2(1): error: no precision specified this scope for type `vec4'
0:4(1): error: no precision specified this scope for type `float'
0:5(1): error: no precision specified this scope for type `float'
0:6(1): error: no precision specified this scope for type `float'
0:7(1): error: no precision specified this scope for type `float'
0:8(1): error: no precision specified this scope for type `float'
0:9(1): error: no precision specified this scope for type `float'
0:10(1): error: no precision specified this scope for type `float'
0:14(2): error: no precision specified this scope for type `vec4'

kwin(4168): Failed to link shader: 
"error: program lacks a fragment shader
Comment 17 Dennis Schridde 2014-09-21 05:46:17 UTC
(In reply to Thomas Lübking from comment #13)
> No, but you probably just delayed the fix for no reason. Thanks.

Why was it delayed?

(In reply to AnAkkk from comment #14)
>  if I've understood correctly it'll always be OpenGL on desktop. Not sure if kwin is supposed to
> run on mobiles.

I was running KWin with GLES on the desktop. Actually, as I was programming using GLES, I was using it everywhere for testing, as it was still maturing back then.
Comment 18 Eugene 2014-10-24 18:02:42 UTC
Kubuntu 14.10
KDE 4.14.2
Mesa 10.4-git

Still not fixed. Please, fix it if it's possible at all.
Comment 19 Martin Flöser 2014-10-24 18:46:04 UTC
> Still not fixed. Please, fix it if it's possible at all.

I'm sorry but we won't fix this for 4.x. We might fix it in 5.x but it has kind of no priority and requires quite some work as one has to recompile all of Qt against GLES. So: patches welcome.
Comment 20 Thomas Lübking 2014-10-24 19:54:21 UTC
Discarded Qt4 patch - it should however still apply and probably fix the issue (if you compile yourself)

https://git.reviewboard.kde.org/r/112862/
Comment 21 Thomas Lübking 2014-11-04 10:56:03 UTC
*** Bug 294468 has been marked as a duplicate of this bug. ***
Comment 22 Martin Flöser 2015-01-14 08:19:32 UTC
*** Bug 331237 has been marked as a duplicate of this bug. ***
Comment 23 Martin Flöser 2015-11-09 15:22:52 UTC
Git commit 7983acea88ebbc419ab28d2bbfe16a3a1f6f04a1 by Martin Gräßlin.
Committed on 09/11/2015 at 15:22.
Pushed by graesslin into branch 'master'.

[effects] Support GLES 3 in Blur and BackgroundContrast

Fix code generation in case OpenGL ES 3 or later is used.
FIXED-IN: 5.5
REVIEW: 126003

M  +23   -9    effects/backgroundcontrast/contrastshader.cpp
M  +23   -9    effects/blur/blurshader.cpp

http://commits.kde.org/kwin/7983acea88ebbc419ab28d2bbfe16a3a1f6f04a1