On Thu, Oct 20, 2005 at 08:25:42PM +0200, Lionel Ulmer wrote:
Ah I understand now. Do you know when the 'in DIB section' patch will be
sent to wine-patches (maybe after the 0.9 freeze) ?
Ok, here's a patch for fun.
It has one really nasty hack that needs to be sorted out - that's how
to keep the dib section pixmap and bits in sync during opengl calls.
We probably need to bracket all opengl calls with the equivalent of
x11drv's X11DRV_{Lock,Unlock}DIBSection, presumably exposed by another
x11drv escape. For now I just coerce the dib section into the correct
state whenever opengl.dll asks for a glx drawable. This will work
fine unless somebody starts fiddling with the bits of the dibsection,
in which case the thing will just go out of sync. If anybody has any
ideas on this then please let me know.
Huw.
--
Huw Davies
huw@codeweavers.com
? dlls/opengl32/opengl32.dll.dbg.c
Index: dlls/x11drv/init.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/init.c,v
retrieving revision 1.22
diff -u -p -r1.22 init.c
--- dlls/x11drv/init.c 26 Sep 2005 11:04:12 -0000 1.22
+++ dlls/x11drv/init.c 21 Oct 2005 10:39:55 -0000
@@ -415,6 +415,7 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *ph
if(!physDev->bitmap->glxpixmap)
physDev->bitmap->glxpixmap = create_glxpixmap(physDev);
+ X11DRV_CoerceDIBSection(physDev, DIB_Status_GdiMod, FALSE);
*(Drawable *)out_data = physDev->bitmap->glxpixmap;
}
else
Index: dlls/opengl32/wgl.c
===================================================================
RCS file: /home/wine/wine/dlls/opengl32/wgl.c,v
retrieving revision 1.64
diff -u -p -r1.64 wgl.c
--- dlls/opengl32/wgl.c 25 Sep 2005 15:23:21 -0000 1.64
+++ dlls/opengl32/wgl.c 21 Oct 2005 10:39:56 -0000
@@ -43,9 +43,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(opengl);
#define X11DRV_ESCAPE 6789
enum x11drv_escape_codes
{
- X11DRV_GET_DISPLAY, /* get X11 display for a DC */
- X11DRV_GET_DRAWABLE, /* get current drawable for a DC */
- X11DRV_GET_FONT, /* get current X font for a DC */
+ X11DRV_GET_DISPLAY, /* get X11 display for a DC */
+ X11DRV_GET_DRAWABLE, /* get current drawable for a DC */
+ X11DRV_GET_FONT, /* get current X font for a DC */
+ X11DRV_SET_DRAWABLE, /* set current drawable for a DC */
+ X11DRV_START_EXPOSURES, /* start graphics exposures */
+ X11DRV_END_EXPOSURES, /* end graphics exposures */
+ X11DRV_GET_DCE, /* get the DCE pointer */
+ X11DRV_SET_DCE, /* set the DCE pointer */
+ X11DRV_GET_GLX_DRAWABLE /* get current glx drawable for a DC */
};
void (*wine_tsx11_lock_ptr)(void) = NULL;
@@ -119,11 +125,11 @@ inline static Display *get_display( HDC
}
-/* retrieve the X drawable to use on a given DC */
+/* retrieve the GLX drawable to use on a given DC */
inline static Drawable get_drawable( HDC hdc )
{
- Drawable drawable;
- enum x11drv_escape_codes escape = X11DRV_GET_DRAWABLE;
+ GLXDrawable drawable;
+ enum x11drv_escape_codes escape = X11DRV_GET_GLX_DRAWABLE;
if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape,
sizeof(drawable), (LPSTR)&drawable )) drawable = 0;
@@ -142,7 +148,7 @@ inline static HDC get_hdc_from_Drawable(
return NULL;
}
-/* retrieve the X drawable to use on a given DC */
+/* retrieve the X font to use on a given DC */
inline static Font get_font( HDC hdc )
{
Font font;
@@ -433,6 +439,7 @@ void* WINAPI wglGetProcAddress(LPCSTR l
BOOL WINAPI wglMakeCurrent(HDC hdc,
HGLRC hglrc) {
BOOL ret;
+ DWORD type = GetObjectType(hdc);
TRACE("(%p,%p)\n", hdc, hglrc);
@@ -449,6 +456,8 @@ BOOL WINAPI wglMakeCurrent(HDC hdc,
}
TRACE(" make current for dis %p, drawable %p, ctx %p\n", ctx->display, (void*) drawable, ctx->ctx);
ret = glXMakeCurrent(ctx->display, drawable, ctx->ctx);
+ if(ret && type == OBJ_MEMDC)
+ glDrawBuffer(GL_FRONT_LEFT);
}
LEAVE_GL();
TRACE(" returning %s\n", (ret ? "True" : "False"));