Merge ~smspillaz/compiz:fix-blur-frag-shader-precision-gles into compiz:master

Proposed by Sam Spilsbury
Status: Merged
Approved by: Dmitry Shachnev
Approved revision: 5e83dccbbfef0e856cdbc75f6c0262dc7286520c
Merged at revision: ded568c3e7cdcbf6eb674877df0ea6076e5cbcd6
Proposed branch: ~smspillaz/compiz:fix-blur-frag-shader-precision-gles
Merge into: compiz:master
Diff against target: 16 lines (+4/-1)
1 file modified
plugins/blur/src/blur.cpp (+4/-1)
Reviewer Review Type Date Requested Status
Compiz Maintainers Pending
Review via email: mp+412180@code.launchpad.net

Commit message

blur: Set precision level in fragment shader in GL_ES case.

Description of the change

Background blurring wasn't working on GLES platforms. Running in the terminal would get a bunch of these messages:

0:1(1): error: No precision specified in this scope for type `vec2'
0:6(2): error: No precision specified in this scope for type `vec4'
0:6(2): error: No precision specified in this scope for type `vec4'
0:7(2): error: No precision specified in this scope for type `vec4'
0:7(2): error: No precision specified in this scope for type `vec4'
0:8(2): error: No precision specified in this scope for type `vec2'
0:8(2): error: No precision specified in this scope for type `vec2'
0:9(2): error: No precision specified in this scope for type `vec2' 0:9(2): error: No precision specified in this scope for type `vec2'
0:10(2): error: No precision specified in this scope for type `vec4'

This change sets the precision to medium on the fragment shader by default, so that we don't get these errors and it works again.

To post a comment you must log in.
Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Thank you! The backslashes at end of each line are probably not needed, C/C++ treats "one" "two" the same way as a single string literal.

I am going to make a new upload and release at some point. If you want I can do it sooner rather than later.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

> The backslashes at end of each line are probably not needed, C/C++ treats "one" "two" the same way as a single string literal.

Ah, good to know. I was just copying the old style, but happy to drop it in case its not necessary. Fixed + rebased.

> I am going to make a new upload and release at some point. If you want I can do it sooner rather than later.

Sounds good! There's really no rush. I was just doing some weekend hacking. Was actually quite surprised to see that unity still works well on my rpi4, performs much better than other DEs like shell or plasma.

Unfortunately this fix is a little bit useless for the rpi4 in the sense that glCopyTexSubImage2d seems to be an unaccelerated path (at least, it slows down a lot once you enable alpha-blurring - I checked with sysprof glCopyTexSubImage2d in videocore was accounting for the majority of cpu time). The blur plugin basically works by copying off the backbuffer into a texture, so working around this would mean rewriting the whole plugin. Maybe this will be fixed in a future driver version, but for now its at least good to fix the bugs on the compiz side.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/plugins/blur/src/blur.cpp b/plugins/blur/src/blur.cpp
2index 00b8efa..0675498 100644
3--- a/plugins/blur/src/blur.cpp
4+++ b/plugins/blur/src/blur.cpp
5@@ -1041,7 +1041,10 @@ BlurScreen::loadFilterProgram (int numITC)
6
7 SamplerInfo info (getSamplerInfoForSize (*screen));
8
9- str << "varying vec2 vTexCoord0;\n"\
10+ str << "#ifdef GL_ES\n"
11+ "precision mediump float;\n"
12+ "#endif\n"
13+ "varying vec2 vTexCoord0;\n"
14 "uniform sampler2D texture0;\n";
15
16 if (maxTemp - 1 > (numTexop + (numTexop - numITC)) * 2)

Subscribers

People subscribed via source and target branches