Made ENTER_GL() - LEAVE_GL() free X11 lock on exception inside opengl, code

Roderick Colenbrander thunderbird2k at gmx.net
Sat Jun 28 09:16:06 CDT 2008


Hi,

I don't think we want to go this way. First of all we want to emulate win32 opengl. If windows does this we MIGHT have to do something like this. Second all opengl calls hit ENTER_GL / LEAVE_GL and these few extra calls affect performance.

Personally I think that when you are hitting such an X11 lock exception that there is just a bug somewhere in wine. E.g. in case of a Direct3D app a piece of wined3d not doing proper locking. The same can be the case for plain opengl apps where a call might not have called wine_tsx11_unlock.

Regards,
Roderick Colenbrander

>  From 31327546fc30520c80433fc964d7bd3ba4f80fa9 Mon Sep 17 00:00:00 2001
> From: Massimo Del Fedele <max at veneto.com>
> Date: Sat, 28 Jun 2008 12:00:17 +0200
> Subject: Made ENTER_GL() - LEAVE_GL() free X11 lock on exception inside 
> opengl
>    code
> 
> ---
>   dlls/opengl32/opengl_ext.h |    8 ++++++--
>   dlls/opengl32/wgl.c        |    6 ++++++
>   2 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/dlls/opengl32/opengl_ext.h b/dlls/opengl32/opengl_ext.h
> index 8ae7c2f..9892351 100644
> --- a/dlls/opengl32/opengl_ext.h
> +++ b/dlls/opengl32/opengl_ext.h
> @@ -40,6 +40,9 @@
>   #define WINAPI      __stdcall
>   #define APIENTRY    WINAPI
> 
> +#include "wine/library.h"
> +#include "wine/exception.h"
> +
>   /* X11 locking */
> 
>   extern void (*wine_tsx11_lock_ptr)(void);
> @@ -47,8 +50,9 @@ extern void (*wine_tsx11_unlock_ptr)(void);
> 
>   /* As GLX relies on X, this is needed */
>   void enter_gl(void);
> -#define ENTER_GL() enter_gl()
> -#define LEAVE_GL() wine_tsx11_unlock_ptr()
> +void CALLBACK leave_gl(BOOL);
> +#define ENTER_GL() enter_gl(); __TRY {
> +#define LEAVE_GL() } __FINALLY(leave_gl)
> 
> 
>   typedef struct {
> diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
> index 6fbdeb4..7e31e20 100644
> --- a/dlls/opengl32/wgl.c
> +++ b/dlls/opengl32/wgl.c
> @@ -114,6 +114,12 @@ void enter_gl(void)
>       return;
>   }
> 
> +void CALLBACK leave_gl(BOOL dummy)
> +{
> +    wine_tsx11_unlock_ptr();
> +    return;
> +}
> +
>   const GLubyte * WINAPI wine_glGetString( GLenum name );
> 
>   /***********************************************************************
> -- 
> 1.5.4.3
> 
> 
> 

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer



More information about the wine-patches mailing list