Tomas Carnecky wrote:
This patch adds an WineGL interface to the GDI driver and creates wrapper functions for them. If the wgl function takes a HDC, the wrapper extract the PHYSDEV and prepends it to the driver-function argument list. This way we have direct access to the PHYSDEV in x11drv and don't need to use ExtEscape().
I've run into some problems with this. opengl32.dll exports only the basic wgl functions, if an application wants to use functions which are provided by various extensions, it has to use wglGetProcAddress(). I moved all extensions to x11drv and wglGetProcAddress() returns the pointer to those functions. The problem is that those functions are called directly by the application and not through the wrapper and thus don't have access to PHYSDEV like the basic wgl functions. We could make wrapper functions for each extension, but that would require changing the driver function table every time we add a new extension.
I took another path and added a new GDI function 'wineGetDCPrivate(HDC)' that returns the PHYSDEV for the given DC. This way I can have all function prototypes the same for wgl?? in opengl32, WineGLWrapper_wgl?? in GDI and the WineGL_wgl?? implementation in x11drv. In the implementation in x11drv I get the PHYSDEV when required using the new GDI function and have direct access to it, no need to use ExtEscape().
In addition to the basic wgl?? functions the GDI driver has to expose two gl?? functions, glGetString() (for GL_EXTENSIONS to be able to report all supported WGL extensions) and glGetIntegerv() (because GL_DEPTH_BITS and GL_ALPHA_BITS don't have the same meaning on windows and X11).
Also, once the x11drv side is stable, opengl32.spec can be changed like this: @ stdcall wglGetCurrentDC() gdi32.WineGLWrapper_wglGetCurrentDC
And all but three functions can be deleted from wgl.c (and wgl_ext.c) can be removed completely). Those three functions are:
o wglGetProcAddress(): first scan OpenGL functions, if not found fall back to WineGLWrapper_wglGetProcAddress() to let x11drv return the pointer to the wgl function.
o glGetString: use glGetString and WineGLWrapper_glGetString() to build the extension string.
o glGetIntegerv(): let x11drv return the proper values if the app is requesting GL_DEPTH_BITS or GL_ALPHA_BITS.
tom