summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Kasprzyk <onestone@opencompositing.org>2007-10-24 01:53:32 +0200
committerDennis kasprzyk <onestone@opencompositing.org>2007-10-24 01:53:32 +0200
commitb9ace874204515a1bb1e49d9c98a966fa3e26413 (patch)
tree301ea7d3cfeec3b75dad3718a6bba6b89b237912
parentca1f5a4d00fcc46868fb6b3f94e067f54a9972b9 (diff)
downloadworkarounds-b9ace874204515a1bb1e49d9c98a966fa3e26413.tar.gz
workarounds-b9ace874204515a1bb1e49d9c98a966fa3e26413.tar.bz2
Added a fix for broken glProgramEnvParameter4f under AIGLX with indirect rendering.
Fixes: blur,reflection & water for intel & fglrx.
-rw-r--r--workarounds.c79
-rw-r--r--workarounds.xml.in5
2 files changed, 84 insertions, 0 deletions
diff --git a/workarounds.c b/workarounds.c
index f2a8661..dcbb634 100644
--- a/workarounds.c
+++ b/workarounds.c
@@ -37,13 +37,24 @@ typedef struct _WorkaroundsDisplay {
Atom roleAtom;
} WorkaroundsDisplay;
+typedef void (*GLProgramParameter4dvProc) (GLenum target,
+ GLuint index,
+ const GLdouble *data);
+
+
typedef struct _WorkaroundsScreen {
int windowPrivateIndex;
WindowResizeNotifyProc windowResizeNotify;
GetAllowedActionsForWindowProc getAllowedActionsForWindow;
+ PaintScreenProc paintScreen;
+
+ GLProgramParameter4fProc origProgramEnvParameter4f;
+ GLProgramParameter4dvProc programEnvParameter4dv;
} WorkaroundsScreen;
+CompScreen *currentScreen = NULL;
+
typedef struct _WorkaroundsWindow {
Bool adjustedWinType;
Bool madeSticky;
@@ -71,6 +82,59 @@ typedef struct _WorkaroundsWindow {
GET_WORKAROUNDS_SCREEN (w->screen, \
GET_WORKAROUNDS_DISPLAY (w->screen->display)))
+static void
+workaroundsProgramEnvParameter4f (GLenum target,
+ GLuint index,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat w)
+{
+ WorkaroundsScreen *ws;
+ GLdouble data[4];
+
+ if (!currentScreen)
+ return;
+
+ ws = GET_WORKAROUNDS_SCREEN (currentScreen, GET_WORKAROUNDS_DISPLAY (
+ currentScreen->display));
+
+ data[0] = x;
+ data[1] = y;
+ data[2] = z;
+ data[3] = w;
+
+ (*ws->programEnvParameter4dv) (target, index, data);
+}
+
+static void
+workaroundsUpdateParameterFix (CompScreen *s)
+{
+ WORKAROUNDS_SCREEN (s);
+
+ if (!s->programEnvParameter4f || !ws->programEnvParameter4dv)
+ return;
+ if (workaroundsGetAiglxFragmentFix (s->display))
+ s->programEnvParameter4f = workaroundsProgramEnvParameter4f;
+ else
+ s->programEnvParameter4f = ws->origProgramEnvParameter4f;
+}
+
+static void
+workaroundsPaintScreen (CompScreen *s,
+ CompOutput *outputs,
+ int numOutputs,
+ unsigned int mask)
+{
+ WORKAROUNDS_SCREEN (s);
+
+ currentScreen = s;
+
+ UNWRAP (ws, s, paintScreen);
+ (*s->paintScreen) (s, outputs, numOutputs, mask);
+ WRAP (ws, s, paintScreen, workaroundsPaintScreen);
+}
+
static char *
workaroundsGetWindowRoleAtom (CompWindow *w)
{
@@ -340,8 +404,11 @@ workaroundsDisplayOptionChanged (CompDisplay *d,
CompWindow *w;
for (s = d->screens; s; s = s->next)
+ {
for (w = s->windows; w; w = w->next)
workaroundsUpdateSticky (w);
+ workaroundsUpdateParameterFix (s);
+ }
}
static void
@@ -453,6 +520,8 @@ workaroundsInitDisplay (CompPlugin *plugin, CompDisplay *d)
workaroundsSetStickyAlldesktopsNotify (d, workaroundsDisplayOptionChanged);
workaroundsSetAlldesktopStickyMatchNotify (d,
workaroundsDisplayOptionChanged);
+ workaroundsSetAiglxFragmentFixNotify (d, workaroundsDisplayOptionChanged);
+
d->base.privates[displayPrivateIndex].ptr = wd;
@@ -491,12 +560,20 @@ workaroundsInitScreen (CompPlugin *plugin, CompScreen *s)
return FALSE;
}
+ ws->programEnvParameter4dv = (GLProgramParameter4dvProc)
+ (*s->getProcAddress) ((GLubyte *) "glProgramEnvParameter4dvARB");
+ ws->origProgramEnvParameter4f = s->programEnvParameter4f;
+
WRAP (ws, s, windowResizeNotify, workaroundsWindowResizeNotify);
WRAP (ws, s, getAllowedActionsForWindow,
workaroundsGetAllowedActionsForWindow);
+ WRAP (ws, s, paintScreen, workaroundsPaintScreen);
+
s->base.privates[wd->screenPrivateIndex].ptr = ws;
+ workaroundsUpdateParameterFix (s);
+
return TRUE;
}
@@ -510,6 +587,8 @@ workaroundsFiniScreen (CompPlugin *plugin, CompScreen *s)
UNWRAP (ws, s, windowResizeNotify);
UNWRAP (ws, s, getAllowedActionsForWindow);
+ UNWRAP (ws, s, paintScreen);
+
free (ws);
}
diff --git a/workarounds.xml.in b/workarounds.xml.in
index c79c557..872c090 100644
--- a/workarounds.xml.in
+++ b/workarounds.xml.in
@@ -38,6 +38,11 @@
<_long>Fix window type of various Qt windows.</_long>
<default>true</default>
</option>
+ <option type="bool" name="aiglx_fragment_fix">
+ <_short>AIGLX Fragment Parameter Fix</_short>
+ <_long>Fix broken glProgramEnvParameter4f implementation.</_long>
+ <default>true</default>
+ </option>
<subgroup>
<_short>Window stickyness</_short>
<option type="bool" name="sticky_alldesktops">