PBuffer and wglMakeCurrent()

Tomas Carnecky tom at dbservice.com
Thu May 11 07:24:28 CDT 2006


Alexandre Julliard wrote:
> Tomas Carnecky <tom at dbservice.com> writes:
>> As far as I understand, the only way to access x11drv is through GDI
>> (which implements ExtEscape), would your proposed change require new
>> functions for opengl32 <-> x11drv communication through GDI? Or is it
>> somehow possible to bypass GDI and access x11drv directly from opengl32?
> 
> The DC access will have to be done through GDI, yes, but that can be a
> simple wrapper that calls the corresponding driver entry point. For
> functions that don't need to access the DC, opengl could call x11drv
> directly, though of course if everything goes through GDI it will make
> it easier to support opengl with a different driver.
> 

Based on your ideas, I did the following:
 - added a new gdi driver function: 'wglMakeCurrent'
 - move wglMakeCurernt to x11drv
 - new function wrapper_wglMakeCurrent in gdi/driver.c
 - wglMakeCurrent in opengl32 just calls wrapper_wglMakeCurrent

and it works, though I had to add -lGL to the x11drv Makefile, I don't
know how you see a libGL.so requirement for x11drv, maybe load libGL.so
 and the required entry points at runtime like in opengl32/wgl.c

I had to simplify wglMakeCurrent, I didn't spend much time on this hack,
and I had to copy the Wine_GLContext structure to x11drv/opengl.c, quite
ugly.. I know

I also had to comment out calls to 'NtCurrentTeb()' because it wouldn't
compile otherwise, I don't know what that function does, but World of
Warcraft works without it (and as a sidenote, I think it runs much faster).

I didn't know how much logic to put into opengl32/gdi or x11drv, gdi
extracts the PHYSDEV from the HDC and passes it as the first argument to
the x11drv function implementation, along with the original arguments
(Is is ok to pass HDC to the x11drv?).

And I don't know if the function naming is ok, x11drv exports a function
named wglMakeCurrent, maybe that should be changed to
wine_wglMakeCurrent and I don't know if the gdi wrapper and exported
function names (both wrapper_wglMakeCurrent) are ok.

If we can sort out the naming I could start adding the driver entry
points to both GDI and x11drv, without migrating the actual function
implementation, and than start migrating function by function to x11drv.

The attached patch is what came up by my hacking, just so you have an
idea what I've done ;)

tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wine-opengl-wrapper.patch
Type: text/x-patch
Size: 7640 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20060511/3d22f861/wine-opengl-wrapper.patch


More information about the wine-devel mailing list