[compiz] [PATCH] Water fixes

Erkin Bahceci erkinbah at gmail.com
Sun May 13 16:03:55 PDT 2007


Hi,

I had a look at some problems I saw in the Water plugin. Here are the
patches fixing those.

The file names should be self-descriptive.

Regards,
Erkin
-------------- next part --------------
From 450379b6f5bb60f18222cca0cceacab189b1f5e6 Mon Sep 17 00:00:00 2001
From: Erkin Bahceci <erkinbah at gmail.com>
Date: Sat, 12 May 2007 18:36:28 -0500
Subject: [PATCH] Slightly speed up Water by replacing a SUB-MUL pair with MAD.

---
 plugins/water.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/plugins/water.c b/plugins/water.c
index 00175cc..b906c1c 100644
--- a/plugins/water.c
+++ b/plugins/water.c
@@ -305,8 +305,7 @@ getBumpMapFragmentFunction (CompScreen  *s,
 		  "MOV offset, normal;"
 
 		  /* remove scale and bias from normal */
-		  "SUB normal, normal, 0.5;"
-		  "MUL normal, normal, 2.0;"
+		  "MAD normal, normal, 2.0, -1.0;"
 
 		  /* normalize the normal map */
 		  "DP3 temp, normal, normal;"
-- 
1.4.4.2
-------------- next part --------------
From a19016688a484e4052650d3d584cb6e08e5d61e4 Mon Sep 17 00:00:00 2001
From: Erkin Bahceci <erkinbah at gmail.com>
Date: Sun, 13 May 2007 14:26:14 -0500
Subject: [PATCH] Stop Water drawing right after waves disappear
to avoid unnecessary extended cpu/gpu use for
the following 10 or so seconds.
---
 plugins/water.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/plugins/water.c b/plugins/water.c
index b906c1c..e4a798e 100644
--- a/plugins/water.c
+++ b/plugins/water.c
@@ -1114,7 +1114,7 @@ waterPreparePaintScreen (CompScreen *s,
 
     if (ws->count)
     {
-	ws->count -= 10;
+	ws->count -= 35;
 	if (ws->count < 0)
 	    ws->count = 0;
 
-- 
1.4.4.2
-------------- next part --------------
From 2aaad634598ccc873c5468aa951a7c541632630b Mon Sep 17 00:00:00 2001
From: Erkin Bahceci <erkinbah at gmail.com>
Date: Sun, 13 May 2007 15:42:53 -0500
Subject: [PATCH] Fix white skydome problem when Water is active.

---
 plugins/water.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/plugins/water.c b/plugins/water.c
index e4a798e..4a7caca 100644
--- a/plugins/water.c
+++ b/plugins/water.c
@@ -415,6 +415,8 @@ allocTexture (CompScreen *s,
 #endif
 
 		  ws->t0);
+
+    glBindTexture (ws->target, 0);
 }
 
 static int
@@ -547,14 +549,16 @@ fboUpdate (CompScreen *s,
 
     glDisable (GL_FRAGMENT_PROGRAM_ARB);
 
-    glBindTexture (ws->target, 0);
     glTexParameteri (ws->target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     glTexParameteri (ws->target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    glBindTexture (ws->target, 0);
     (*s->activeTexture) (GL_TEXTURE0_ARB);
     glTexParameteri (ws->target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     glTexParameteri (ws->target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
     glBindTexture (ws->target, 0);
 
+    glDisable (ws->target);
+
     fboEpilogue (s);
 
     /* increment texture index */
-- 
1.4.4.2
-------------- next part --------------
From 83a42f81aaaab9f9fd4d29b2dce5a2c58ffe074c Mon Sep 17 00:00:00 2001
From: Erkin Bahceci <erkinbah at gmail.com>
Date: Sun, 13 May 2007 16:11:33 -0500
Subject: [PATCH] Center title wave starting y (was 1/4 below).

---
 plugins/water.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/plugins/water.c b/plugins/water.c
index 4a7caca..0c57d91 100644
--- a/plugins/water.c
+++ b/plugins/water.c
@@ -1396,7 +1396,7 @@ waterTitleWave (CompDisplay     *d,
 	XPoint p[2];
 
 	p[0].x = w->attrib.x - w->input.left;
-	p[0].y = w->attrib.y - (w->input.top >> 2);
+	p[0].y = w->attrib.y - w->input.top / 2;
 
 	p[1].x = w->attrib.x + w->width + w->input.right;
 	p[1].y = p[0].y;
-- 
1.4.4.2


More information about the compiz mailing list