X11Drv/OpenGL pixelformat rewrite
thunderbird2k at gmx.net
Wed Aug 16 09:42:23 CDT 2006
As mentioned in the email I sent to wine-devel containing a RFC version of this patch Wine's current opengl pixel format code is broken.
Due to the way x11drv is written we can only support the an opengl format corresponding to the VisualID of Wine's main visual. At the moment the code advertises some additional formats and when those are set in SetPixelFormat that can causes because the wglCreateContext code can create an opengl context using this 'bad' format. When glXMakeCurrent is called you'll get a BadMatch error.
I have rewritten the code to only advertise the formats we support. In case of the standard OpenGL code (the stuff in winex11.drv/opengl.c) this is only the format of the main visual.
To make it all more complicated various parts of the OpenGL code in x11drv but also in opengl32 look formats up in the formats table exported by GLX. Before when we advertised multiple formats there was a 1:1 mapping between the entries in both tables (they were the same). Because of the change this mapping got lost. Various functions had to be patched to only support our single format and the functions needed a way to convert the internal format to a GLX format.
In case of x11drv this conversion is easy because there's just one format. The conversion is done using 'get_fbconfig_from_main_visual'.
For opengl32 the conversion is a bit more complicated. There are some WGL extensions which work with pixel formats aswell and those support some additional pixel formats for offscreen rendering (in case of GLX that are formats WITHOUT an associated X visual). The functions are backwards compatible with the standard WGL pixelformat functions but next to the standard formats they add these additional formats. The conversion is handled using ConvertPixelFormatWGLtoGLX which supports the format of the main visual and that of offscreen formats.
I have tested the patch using a number of games (World Of Warcraft, Warcraft III, Jedi Outcast, Halflife1 and some others). Before World Of Warcraft crashed with a BadMatch error on Nvidia videocards this issue has been fixed. Halflife1 didn't work in OpenGL mode when X was started in 16bit this works aswell. The other programs I tested worked correctly aswell. I also verified using a windows opengl testing tool what formats we advertise. We correctly advertise our main format and those offscreen rendering formats.
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 7465 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20060816/17040cc4/opengl.patch.bin
More information about the wine-patches