Fix x11drv/wined3d/opengl regression [bug 6205]

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


Hi,

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.

Regards,
Roderick Colenbrander
-- 
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
-------------- 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 : http://www.winehq.org/pipermail/wine-patches/attachments/20060918/fd54934c/x11drv_wined3d_regression_fix.bin


More information about the wine-patches mailing list