[gnome-shell] st-scroll-view-fade: Don't use return in the shader
- From: Adel Gadllah <agadllah src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] st-scroll-view-fade: Don't use return in the shader
- Date: Thu, 14 Mar 2013 21:43:22 +0000 (UTC)
commit 45fc7ec01f760da97ebaf1bf9c36096bd226f686
Author: Adel Gadllah <adel gadllah gmail com>
Date: Thu Mar 14 17:55:08 2013 +0100
st-scroll-view-fade: Don't use return in the shader
Returing from main() makes llvmpipe unhappy (produces black output color),
so rework the logic to avoid the return.
https://bugzilla.gnome.org/show_bug.cgi?id=695607
src/st/st-scroll-view-fade.glsl | 53 ++++++++++++++++++++------------------
1 files changed, 28 insertions(+), 25 deletions(-)
---
diff --git a/src/st/st-scroll-view-fade.glsl b/src/st/st-scroll-view-fade.glsl
index e8bd03a..4324c00 100644
--- a/src/st/st-scroll-view-fade.glsl
+++ b/src/st/st-scroll-view-fade.glsl
@@ -50,35 +50,38 @@ void main ()
float y = height * cogl_tex_coord_in[0].y;
float x = width * cogl_tex_coord_in[0].x;
- if (x < fade_area[0][0] || x > fade_area[1][0] ||
- y < fade_area[0][1] || y > fade_area[1][1])
- return;
+ /*
+ * We cannot just return here due to a bug in llvmpipe see:
+ * https://bugzilla.freedesktop.org/show_bug.cgi?id=62357
+ */
+ if (x > fade_area[0][0] && x < fade_area[1][0] &&
+ y > fade_area[0][1] && y < fade_area[1][1]) {
+ 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.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 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.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) {
+ ratio *= FADE((y / vfade_offset), min(sqrt(vvalue) * vfade_scale, 1.0));
+ }
- float vfade_scale = height / vfade_offset;
- if (fade_top) {
- ratio *= FADE((y / vfade_offset), min(sqrt(vvalue) * vfade_scale, 1.0));
- }
+ if (fade_bottom) {
+ ratio *= FADE((fade_area[1][1] - y)/(fade_area[1][1] - fade_bottom_start), min(sqrt(1.0 -
vvalue) * vfade_scale, 1.0));
+ }
- if (fade_bottom) {
- ratio *= FADE((fade_area[1][1] - y)/(fade_area[1][1] - fade_bottom_start), min(sqrt(1.0 - vvalue) *
vfade_scale, 1.0));
- }
+ float hfade_scale = width / hfade_offset;
+ if (fade_left) {
+ ratio *= FADE(x / hfade_offset, min(sqrt(hvalue) * hfade_scale, 1.0));
+ }
- float hfade_scale = width / hfade_offset;
- if (fade_left) {
- ratio *= FADE(x / hfade_offset, min(sqrt(hvalue) * hfade_scale, 1.0));
- }
+ if (fade_right) {
+ ratio *= FADE((fade_area[1][0] - x)/(fade_area[1][0] - fade_right_start), min(sqrt(1.0 - hvalue)
* hfade_scale, 1.0));
+ }
- if (fade_right) {
- ratio *= FADE((fade_area[1][0] - x)/(fade_area[1][0] - fade_right_start), min(sqrt(1.0 - hvalue) *
hfade_scale, 1.0));
+ cogl_color_out *= ratio;
}
-
- cogl_color_out *= ratio;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]