[opengl] Another possible fix for the BadMatch error

Leon Freitag leon_fraitak at mail.ru
Sun Apr 2 09:44:15 CDT 2006


Someone mentioned earlier that the code in wgl.c in DescribeDrawable() 
violates the GLX specification and therefore causes bogus return values for 
the visualid. However this code has been already present before the 
regression, but worked somehow. So the regression can't be caused by this 
violation.
I tried to correct this violation by calling glXChooseFBConfig and then 
glXGetChooseConfigAttrib, as suggested in the spec, and glXChooseFBConfig 
returns NULL for the appropriate FBCONFIG_ID.

However the problem seems to be in getting Drawable which is then passed to 
DescribeDrawable. The VisualID of the Drawable isn't needed at all, since 
before calling the glXMakeCurrent, we just want to know if the context 
visualid differs from visualid of Wine desktop. This one-liner should fix the 
BadMatch errors. Tested on Warcraft 3.

http://winehq.org/pipermail/wine-devel/2006-March/thread.html
------

diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index c7d3147..e9046ca 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -551,7 +551,7 @@ BOOL WINAPI wglMakeCurrent(HDC hdc,
        draw_vis_id = describeDrawable(ctx, drawable);
        ctx_vis_id = describeContext(ctx);

-       if (-1 == draw_vis_id || (draw_vis_id == visualid && draw_vis_id != 
ctx_vis_id)) {
+       if (visualid != ctx_vis_id) {
          /**
           * Inherits from root window so reuse desktop visual
           */

Please test this patch and report if it works. 
If it works fine (and doesn't introduce any regressions) then I'll submit it 
to wine-patches.

Leon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20060402/9f5fd2ab/attachment.pgp


More information about the wine-devel mailing list