[gnome-shell] Don't rely on implicit type conversion in the scroll view shader
- From: Neil Roberts <nroberts src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Don't rely on implicit type conversion in the scroll view shader
- Date: Fri, 8 Feb 2013 12:04:50 +0000 (UTC)
commit 33f69481f7c8e7dc122a71c381d1d4a06229ebe8
Author: Neil Roberts <neil linux intel com>
Date: Thu Feb 7 15:55:16 2013 +0000
Don't rely on implicit type conversion in the scroll view shader
Before version 1.2 of GLSL it would not implicitly convert from int to
float which meant that if you compare a float variable with an integer
constant it will generate a compile error. In particular this means
that on GLES2 (which uses GLSL 1.0) the scroll view shader will not
compile on pedantic compilers, which includes Mesa. This patch just
changes it to use floating point constants.
https://bugzilla.gnome.org/show_bug.cgi?id=693339
src/st/st-scroll-view-fade.glsl | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/st/st-scroll-view-fade.glsl b/src/st/st-scroll-view-fade.glsl
index 4e8ec6a..6acd260 100644
--- a/src/st/st-scroll-view-fade.glsl
+++ b/src/st/st-scroll-view-fade.glsl
@@ -41,7 +41,7 @@ uniform mat2 fade_area;
* changing it to scaling [1.0, 0.0] to [0.0, 0.0]
* and then transforming the end result.
*/
-#define FADE(gradient, factor) (1 - (1 - gradient) * factor)
+#define FADE(gradient, factor) (1.0 - (1.0 - gradient) * factor)
void main ()
{
@@ -57,10 +57,10 @@ void main ()
float ratio = 1.0;
float fade_bottom_start = fade_area[1][1] - vfade_offset;
float fade_right_start = fade_area[1][0] - hfade_offset;
- bool fade_top = y < vfade_offset && vvalue > 0;
- bool fade_bottom = y > fade_bottom_start && vvalue < 1;
- bool fade_left = x < hfade_offset && hvalue > 0;
- bool fade_right = x > fade_right_start && hvalue < 1;
+ bool fade_top = y < vfade_offset && vvalue > 0.0;
+ bool fade_bottom = y > fade_bottom_start && vvalue < 1.0;
+ bool fade_left = x < hfade_offset && hvalue > 0.0;
+ bool fade_right = x > fade_right_start && hvalue < 1.0;
float vfade_scale = height / vfade_offset;
if (fade_top) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]