----Message d'origine----
De: "Wino Rojo" winorojo@hotmail.com A: wine-devel@winehq.org Date: Tue, 23 May 2006 18:12:36 -0400 Sujet: Fix for the BadMatch error (bug #4945)
Hi,
I'v found a way to fix my problem with wglShareLists - BadMatch error (X_GLXMakeCurrent) (see bug #4945).
In X11DRV_setup_opengl_visual() (x11drv/opengl.c), I've changed this line:
int dblBuf[] = {GLX_RGBA,GLX_DEPTH_SIZE, 16, GLX_STENCIL_SIZE, 8, GLX_DOUBLEBUFFER, None};
to this:
int dblBuf[] = {GLX_RGBA,GLX_DEPTH_SIZE, 24, GLX_STENCIL_SIZE, 8, GLX_ALPHA_SIZE, 8, GLX_DOUBLEBUFFER, None};
That is, I choose a visual with a depth size of 24 *and* I also need to set the alpha size to 8. With this small change, I can use my 3d app without problems
Does anybody see a problem with this fix?
I aggree. The problem is that will break for cards who don't support 24-32 bits frame buffers.
You must add a fallback for 16 bits :
- try GLX_RGBA,GLX_DEPTH_SIZE, 24, GLX_STENCIL_SIZE, 8, GLX_DOUBLEBUFFER - if failed try GLX_RGBA,GLX_DEPTH_SIZE, 16, GLX_STENCIL_SIZE, 8, GLX_DOUBLEBUFFER - if failed try GLX_RGBA,GLX_DEPTH_SIZE, 16, GLX_DOUBLEBUFFER
Thanks,
Wino
Raphael
I aggree. The problem is that will break for cards who don't support 24-32 bits frame buffers.
You must add a fallback for 16 bits :
- try GLX_RGBA,GLX_DEPTH_SIZE, 24, GLX_STENCIL_SIZE, 8, GLX_DOUBLEBUFFER
- if failed try GLX_RGBA,GLX_DEPTH_SIZE, 16, GLX_STENCIL_SIZE, 8,
GLX_DOUBLEBUFFER
- if failed try GLX_RGBA,GLX_DEPTH_SIZE, 16, GLX_DOUBLEBUFFER
Ok, what about this patch?:
RCS file: /home/wine/wine/dlls/x11drv/opengl.c,v retrieving revision 1.27 diff -u -r1.27 opengl.c --- opengl.c 9 May 2006 10:58:46 -0000 1.27 +++ opengl.c 24 May 2006 16:03:28 -0000 @@ -554,24 +554,33 @@ { XVisualInfo *visual = NULL; /* In order to support OpenGL or D3D, we require a double-buffered visual and stencil buffer support, */ - int dblBuf[] = {GLX_RGBA,GLX_DEPTH_SIZE, 16, GLX_STENCIL_SIZE, 8, GLX_DOUBLEBUFFER, None}; + int dblBuf[] = {GLX_RGBA,GLX_DEPTH_SIZE, 24, GLX_STENCIL_SIZE, 8, GLX_ALPHA_SIZE, 8, GLX_DOUBLEBUFFER, None}; if (!has_opengl()) return NULL;
wine_tsx11_lock(); visual = pglXChooseVisual(display, DefaultScreen(display), dblBuf); wine_tsx11_unlock(); if (visual == NULL) { - /* fallback to no stencil */ - int dblBuf2[] = {GLX_RGBA,GLX_DEPTH_SIZE, 16, GLX_DOUBLEBUFFER, None}; - WARN("Failed to get a visual with at least 8 bits of stencil\n"); + /* fallback to 16 bits depth, no alpha */ + int dblBuf2[] = {GLX_RGBA,GLX_DEPTH_SIZE, 16, GLX_STENCIL_SIZE, 8, GLX_DOUBLEBUFFER, None}; + WARN("Failed to get a visual with at least 24 bits depth\n");
wine_tsx11_lock(); visual = pglXChooseVisual(display, DefaultScreen(display), dblBuf2); wine_tsx11_unlock(); if (visual == NULL) { - /* This should only happen if we cannot find a match with a depth size 16 */ - FIXME("Failed to find a suitable visual\n"); - return visual; + /* fallback to no stencil */ + int dblBuf2[] = {GLX_RGBA,GLX_DEPTH_SIZE, 16, GLX_DOUBLEBUFFER, None}; + WARN("Failed to get a visual with at least 8 bits of stencil\n"); + + wine_tsx11_lock(); + visual = pglXChooseVisual(display, DefaultScreen(display), dblBuf2); + wine_tsx11_unlock(); + if (visual == NULL) { + /* This should only happen if we cannot find a match with a depth size 16 */ + FIXME("Failed to find a suitable visual\n"); + return visual; + } } } TRACE("Visual ID %lx Chosen\n",visual->visualid);
This is what I'm doing:
- try GLX_RGBA,GLX_DEPTH_SIZE, 24, GLX_STENCIL_SIZE, 8, GLX_ALPHA_SIZE, 8, GLX_DOUBLEBUFFER
- if failed try GLX_RGBA,GLX_DEPTH_SIZE, 16, GLX_STENCIL_SIZE, 8, GLX_DOUBLEBUFFER
- if failed try GLX_RGBA,GLX_DEPTH_SIZE, 16, GLX_DOUBLEBUFFER
Comments?
Thanks,
Wino
_________________________________________________________________ Don't just Search. Find! http://search.sympatico.msn.ca/default.aspx The new MSN Search! Check it out!