Fix x11drv/wined3d/opengl regression [bug 6205]

Roderick Colenbrander thunderbird2k at
Mon Sep 18 13:13:21 CDT 2006


This patch fixes the D3D/OpenGL regression which was introduced in my opengl32 rewrite.

At x11drv initialization an X visual is allocated. Before allocating this we check using has_opengl if opengl is available or not. In case of wined3d this function in the end got called twice (each time from a different thread). The function calls 'X11DRV_InitOpenGLInfo' which retrieves OpenGL information. For this purpose it needs a GLX context. Afterwards the context has to be killed.

In order to use a context in opengl glXMakeCurrent is called. The function changes the context of the current thread. When you want to destroy a context, you need to use glXDestroyContext. It destroys it when the context becomes inactive.

The issue appeared to be that the context didn't get destroyed because it was still the active one at the moment glXDestroyContext got called. The next time glXMakeCurrent got called (in the next thread) there was still an active GLX context in another thread. For some reason this caused issues. It might be related to the fact that OpenGL isn't threadsafe.

When I switch to a no context before killing it, the context gets destroyed immedeately. This fixes 3dmark2001se, halflife2 and other games. This fix replaces the patch posted by Jesse Allen.

Roderick Colenbrander
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x11drv_wined3d_regression_fix.patch
Type: text/x-diff
Size: 593 bytes
Desc: not available
Url :

More information about the wine-patches mailing list