[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz gfx/jni/GzzGL-jni.cxx gfx/libos/Os-GLX.cxx ...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] gzz gfx/jni/GzzGL-jni.cxx gfx/libos/Os-GLX.cxx ... |
Date: |
Sat, 25 Jan 2003 08:45:03 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Tuomas J. Lukka <address@hidden> 03/01/25 08:45:03
Modified files:
gfx/jni : GzzGL-jni.cxx
gfx/libos : Os-GLX.cxx
gfx/libpaper : papermill.py
gfx/progs : fbconfsgix.cxx
gfx/util : demo.py
gzz/gfx/gl : GL.java
Log message:
Start working around ATI driver bugs :(
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/jni/GzzGL-jni.cxx.diff?tr1=1.81&tr2=1.82&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libos/Os-GLX.cxx.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/papermill.py.diff?tr1=1.67&tr2=1.68&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/progs/fbconfsgix.cxx.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/util/demo.py.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GL.java.diff?tr1=1.43&tr2=1.44&r1=text&r2=text
Patches:
Index: gzz/gfx/jni/GzzGL-jni.cxx
diff -u gzz/gfx/jni/GzzGL-jni.cxx:1.81 gzz/gfx/jni/GzzGL-jni.cxx:1.82
--- gzz/gfx/jni/GzzGL-jni.cxx:1.81 Fri Jan 24 07:32:04 2003
+++ gzz/gfx/jni/GzzGL-jni.cxx Sat Jan 25 08:45:03 2003
@@ -239,7 +239,7 @@
ws = Os::WindowSystem::getInstance();
DBG(dbg) << "Creating one new window for initialization purposes\n";
defaultWindow = ws->openWindow(0, 0, 2, 2);
- DBG(dbg) << "Setting it current to get a gl context";
+ DBG(dbg) << "Setting it current to get a gl context\n";
setWindow();
Index: gzz/gfx/libos/Os-GLX.cxx
diff -u gzz/gfx/libos/Os-GLX.cxx:1.22 gzz/gfx/libos/Os-GLX.cxx:1.23
--- gzz/gfx/libos/Os-GLX.cxx:1.22 Sat Jan 25 07:12:51 2003
+++ gzz/gfx/libos/Os-GLX.cxx Sat Jan 25 08:45:03 2003
@@ -272,13 +272,16 @@
dbContext = glXCreateContext(dpy, dbVinfo, 0, GL_TRUE);
- pxVinfo = glXChooseVisual(dpy, DefaultScreen(dpy),
- old_pxattrs);
- if(!pxVinfo) BARF("Can't get dblbuf visual");
- pxContext = glXCreateContext(dpy, pxVinfo, dbContext, GL_TRUE);
}
+ // Get this in any case -- ATI doesn't
+ // let us use pbuffers on radeons...
+ pxVinfo = glXChooseVisual(dpy, DefaultScreen(dpy),
+ old_pxattrs);
+ if(!pxVinfo) BARF("Can't get dblbuf visual");
+ pxContext = glXCreateContext(dpy, pxVinfo, dbContext, GL_TRUE);
+
swa.border_pixel = 0;
swa.colormap = XCreateColormap(dpy, DefaultRootWindow(dpy),
@@ -359,6 +362,11 @@
w,
h,
ws->pxVinfo->depth);
+
+ DBG(dbg) << "Created LXPixmap: "<<pix<<" "<<ws->pixmapDrawable<<"
"<<
+ ws->pxVinfo->depth<<" "<<w<<" "<<h<<"\n";
+ if(pix == 0)
+ throw "Can't create pixmap";
this->w = w;
this->h = h;
}
@@ -367,12 +375,14 @@
DBG(dbg) << "setcurrent pixmap "<<pix<<" "<<ws->pxContext<<"\n";
bool ret = glXMakeContextCurrent(ws->dpy, pix, pix, ws->pxContext);
DBG(dbg) << "setcurrent pixmap ret: "<<ret<<"\n";
+ throw "Can't draw into pixmap";
return ret;
}
bool releaseCurrent() {
DBG(dbg) << "Releasecurrent pixmap "<<pix<<" "<<ws->pxContext<<"\n";
bool ret = glXMakeContextCurrent(ws->dpy, None, None, NULL);
DBG(dbg) << "Releasecurrent pixmap ret: "<<ret<<"\n";
+ throw "Can't draw into pixmap";
return ret;
}
@@ -385,6 +395,7 @@
};
+
// static char eventStringBuf[256];
//
struct LXPBuffer : public Os::RenderingSurface {
@@ -393,15 +404,8 @@
GLXPbuffer pbuf;
int w, h;
- LXPBuffer(LXWindowSystem *ws, int w, int h) : ws(ws) {
- int attrs[] = {
- GLX_PBUFFER_WIDTH, w,
- GLX_PBUFFER_HEIGHT, h,
- GLX_PRESERVED_CONTENTS, 1,
- GLX_LARGEST_PBUFFER, 0,
- 0
- };
- pbuf = glXCreatePbuffer(ws->dpy, ws->pbFbConfig[0], attrs);
+ LXPBuffer(LXWindowSystem *ws, GLXPbuffer pbuf,
+ int w, int h) : ws(ws), pbuf(pbuf) {
unsigned val;
glXQueryDrawable(ws->dpy, pbuf, GLX_PBUFFER_WIDTH, &val);
@@ -420,12 +424,14 @@
DBG(dbg) << "setcurrent pbuf "<<pbuf<<" "<<ws->pbContext<<"\n";
bool ret = glXMakeContextCurrent(ws->dpy, pbuf, pbuf,
ws->pbContext);
DBG(dbg) << "setcurrent pbuf ret: "<<ret<<"\n";
+ throw "Can't draw into pbuf";
return ret;
}
bool releaseCurrent() {
DBG(dbg) << "Releasecurrent pbuf "<<pbuf<<" "<<ws->pbContext<<"\n";
bool ret = glXMakeContextCurrent(ws->dpy, None, None, NULL);
DBG(dbg) << "Releasecurrent pbuf ret: "<<ret<<"\n";
+ throw "Can't draw into pbuf";
return ret;
}
@@ -437,6 +443,21 @@
}
};
+ LXPBuffer *createPBuffer(LXWindowSystem *ws, int w, int h) {
+ int attrs[] = {
+ GLX_PBUFFER_WIDTH, w,
+ GLX_PBUFFER_HEIGHT, h,
+ GLX_PRESERVED_CONTENTS, 1,
+ GLX_LARGEST_PBUFFER, 0,
+ 0
+ };
+ GLXPbuffer pbuf = glXCreatePbuffer(ws->dpy, ws->pbFbConfig[0],
attrs);
+ DBG(dbg) << "Pbuf alloc: "<<w<<" "<<h<<" "<<pbuf<<"\n";
+ if(pbuf == 0)
+ return 0;
+ return new LXPBuffer(ws, pbuf, w, h);
+ }
+
struct LXWindow : public Os::Window {
LXWindowSystem *ws;
::Window xw;
@@ -642,10 +663,15 @@
Os::RenderingSurface *LXWindowSystem::openStableOffScreen(int w, int h)
{
- if(pbFbConfig)
- return new LXPBuffer(this, w, h);
- else
- return new LXPixmap(this, w, h);
+ Os::RenderingSurface *ret = 0;
+ if(pbFbConfig) {
+ ret = createPBuffer(this, w, h);
+ if(ret != 0) {
+ DBG(dbg) << "Pixbuf successfully created\n";
+ return ret;
+ }
+ }
+ return new LXPixmap(this, w, h);
}
WindowSystem *WindowSystem::instance = 0;
Index: gzz/gfx/libpaper/papermill.py
diff -u gzz/gfx/libpaper/papermill.py:1.67 gzz/gfx/libpaper/papermill.py:1.68
--- gzz/gfx/libpaper/papermill.py:1.67 Mon Jan 20 03:51:08 2003
+++ gzz/gfx/libpaper/papermill.py Sat Jan 25 08:45:03 2003
@@ -142,6 +142,10 @@
print "Warning: not returning optimized paper because"
print "GL_SGIS_generate_mipmap extension is required but not
available"
return pap
+ if GL.workaroundStupidBuggyAtiDrivers:
+ print "Warning: not returning optimized paper because"
+ print "copyTexImage2D has problems on ATI drivers"
+ return pap
# Now, we render a region.
v = pap.repeat._getSTVectors()
@@ -165,8 +169,8 @@
BindTexture TEXTURE_2D %(texid)s
TexParameter TEXTURE_2D TEXTURE_MAX_ANISOTROPY_EXT 2
TexParameter TEXTURE_2D GENERATE_MIPMAP_SGIS TRUE
- TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
- TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR
+ TexParameter TEXTURE_2D TEXTURE_MIN_FILTER NEAREST
+ TexParameter TEXTURE_2D TEXTURE_MAG_FILTER NEAREST
BindTexture TEXTURE_2D 0
""" % locals())
print "READ: ", 0, vs.getSize().height-1-s, s, s
Index: gzz/gfx/progs/fbconfsgix.cxx
diff -u gzz/gfx/progs/fbconfsgix.cxx:1.4 gzz/gfx/progs/fbconfsgix.cxx:1.5
--- gzz/gfx/progs/fbconfsgix.cxx:1.4 Wed Dec 11 05:53:57 2002
+++ gzz/gfx/progs/fbconfsgix.cxx Sat Jan 25 08:45:03 2003
@@ -1,4 +1,5 @@
-#include </doc/nvidia-glx-dev/include/GL/glx.h>
+// #include </doc/nvidia-glx-dev/include/GL/glx.h>
+#include <GL/glx.h>
#include <stdio.h>
int attrs[] = {
Index: gzz/gfx/util/demo.py
diff -u gzz/gfx/util/demo.py:1.11 gzz/gfx/util/demo.py:1.12
--- gzz/gfx/util/demo.py:1.11 Fri Jan 17 09:37:17 2003
+++ gzz/gfx/util/demo.py Sat Jan 25 08:45:03 2003
@@ -153,7 +153,7 @@
class Bindings(AbstractBinder):
def keystroke(self, s):
global showHelp, currentScene
- # print "KEY: '%s'"%s
+ print "KEY: '%s'"%s
if usingNormalBindings:
if s == "q" or s == "Q":
System.exit(43)
Index: gzz/gzz/gfx/gl/GL.java
diff -u gzz/gzz/gfx/gl/GL.java:1.43 gzz/gzz/gfx/gl/GL.java:1.44
--- gzz/gzz/gfx/gl/GL.java:1.43 Fri Jan 24 07:32:04 2003
+++ gzz/gzz/gfx/gl/GL.java Sat Jan 25 08:45:03 2003
@@ -65,11 +65,17 @@
}
}
+ public static boolean workaroundStupidBuggyAtiDrivers = false;
+
/** Init the library - to be called once during startup.
*/
public static void init() {
loadLib();
init(1);
+ if(getGLString("VENDOR").startsWith("ATI ")) {
+ pa("WARNING: ATI Linux drivers still unstable - trying to work
around what I can.");
+ workaroundStupidBuggyAtiDrivers = true;
+ }
}
/** An interface to which GL provides events.