On Sun, Feb 20, 2005 at 01:43:44PM +0100, Lionel Ulmer wrote:
Well, if you want just to test if the application works better, just add (stubbed) support for the following extensions:
http://oss.sgi.com/projects/ogl-sample/registry/ARB/wgl_pixel_format.txt http://oss.sgi.com/projects/ogl-sample/registry/ARB/wgl_pbuffer.txt http://oss.sgi.com/projects/ogl-sample/registry/ARB/wgl_render_texture.txt
This entails:
= adding the string for the extension in the WGL extension string (no idea if it needs to be duplicated also in the 'standard' extension string). = adding all functions that are described in the three preceding extensions (having them returning correct values) and printing debug output = run the game again and see if it actually uses now these functions and if it works better (ie better in 'not crashing', not better as in 'working' :-) ).
Well, I've given it a try, but they're either not getting called, or I haven't implemented them correctly (first time hacking wine). I've included a patch below showing what I've done. A few of them don't return nice values, but I figured it should get to the traces if they are getting called.
I guess it's not just a case of passing through like the bulk of the opengl functions or they'd be done already.
For PBuffers, the WGL and SGIX interface is a bit different so an adaptation is required. For 'render to texture', one needs to use 'GL_EXT_framebuffer_object' (or PBuffers) to emulate the extension.
So this is not the 'simple' thunking that most of the rest of the OpenGL implementation is...
Well, if I can confirm that some of the functions are getting called, I may as well have a go at it ;)
Thanks for your help.
Index: opengl32.spec =================================================================== RCS file: /home/wine/wine/dlls/opengl32/opengl32.spec,v retrieving revision 1.23 diff -u -r1.23 opengl32.spec --- opengl32.spec 7 Feb 2004 01:29:33 -0000 1.23 +++ opengl32.spec 20 Feb 2005 16:09:21 -0000 @@ -24,6 +24,17 @@ @ stdcall wglGetPixelFormat(long) gdi32.GetPixelFormat @ stdcall wglSetPixelFormat(long long ptr) gdi32.SetPixelFormat @ stdcall wglSwapBuffers(long) gdi32.SwapBuffers +@ stdcall wglGetPixelFormatAttribivARB(ptr long long long ptr ptr) +@ stdcall wglGetPixelFormatAttribfvARB(ptr long long long ptr ptr) +@ stdcall wglChoosePixelFormatARB(ptr ptr ptr long ptr ptr) +@ stdcall wglCreatePbufferARB(ptr long long long ptr) +@ stdcall wglGetPbufferDCARB(ptr) +@ stdcall wglReleasePbufferDCARB(ptr ptr) +@ stdcall wglDestroyPbufferARB(ptr) +@ stdcall wglQueryPbufferARB(ptr long long) +@ stdcall wglBindTexImageARB(ptr long) +@ stdcall wglReleaseTexImageARB(ptr long) +@ stdcall wglSetPbufferAttribARB(ptr ptr) @ stdcall glAccum( long long ) wine_glAccum @ stdcall glAlphaFunc( long long ) wine_glAlphaFunc @ stdcall glAreTexturesResident( long ptr ptr ) wine_glAreTexturesResident Index: wgl_ext.c =================================================================== RCS file: /home/wine/wine/dlls/opengl32/wgl_ext.c,v retrieving revision 1.2 diff -u -r1.2 wgl_ext.c --- wgl_ext.c 31 Jan 2005 11:32:13 -0000 1.2 +++ wgl_ext.c 20 Feb 2005 16:09:43 -0000 @@ -39,7 +39,7 @@
/* Some WGL extensions... */ static const char *WGL_extensions_base = "WGL_ARB_extensions_string WGL_EXT_extensions_string"; -static char *WGL_extensions = NULL; +static char *WGL_extensions = "WGL_ARB_pixel_format WGL_ARB_pbuffer WGL_ARB_render_texture";
/* Extensions-query functions */ BOOL query_function_pbuffers(const char *gl_version, const char *gl_extensions, const char *glx_extensions, @@ -143,11 +143,89 @@ } }
+GLboolean WINAPI wglGetPixelFormatAttribivARB(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues) +{ + TRACE("(%p, %d, %d, %d, %p, %p)\n", hdc, iPixelFormat, iLayerPlane, nAttributes, piAttributes, piValues); + return GL_TRUE; +} + +GLboolean WINAPI wglGetPixelFormatAttribfvARB(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues) +{ + TRACE("(%p, %d, %d, %d, %p, %p)\n", hdc, iPixelFormat, iLayerPlane, nAttributes, piAttributes, pfValues); + return GL_TRUE; +} + +GLboolean WINAPI wglChoosePixelFormatARB(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats) +{ + TRACE("(%p, %p, %p, %d, %p, %p)\n", hdc, piAttribIList, pfAttribFList, nMaxFormats, piFormats, nNumFormats); + return GL_TRUE; +} + +#define HPBUFFERARB void * +HPBUFFERARB WINAPI wglCreatePbufferARB(HDC hdc, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList) +{ + TRACE("(%p, %d, %d, %d, %p)\n", hdc, iPixelFormat, iWidth, iHeight, piAttribList); + return 0; +} + +HDC WINAPI wglGetPbufferDCARB(HPBUFFERARB hPbuffer) +{ + TRACE("(%p)\n", hPbuffer); + return 0; +} + +int WINAPI wglReleasePbufferDCARB(HPBUFFERARB hPbuffer, HDC hdc) +{ + TRACE("(%p, %p)\n", hPbuffer, hdc); + return 0; +} + +GLboolean WINAPI wglDestroyPbufferARB(HPBUFFERARB hPbuffer) +{ + TRACE("(%p)\n", hPbuffer); + return GL_TRUE; +} + +GLboolean WINAPI wglQueryPbufferARB(HPBUFFERARB hPbuffer, int iAttribute, int *piValue) +{ + TRACE("(%p, %d, %p)\n", hPbuffer, iAttribute, piValue); + return GL_TRUE; +} + +GLboolean WINAPI wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuffer) +{ + TRACE("(%p, %d)\n", hPbuffer, iBuffer); + return GL_TRUE; +} + +GLboolean WINAPI wglReleaseTexImageARB(HPBUFFERARB hPbuffer, int iBuffer) +{ + TRACE("(%p, %d)\n", hPbuffer, iBuffer); + return GL_TRUE; +} + +GLboolean WINAPI wglSetPbufferAttribARB(HPBUFFERARB hPbuffer, const int *piAttribList) +{ + TRACE("(%p, %p)\n", hPbuffer, piAttribList); + return GL_TRUE; +} + /* Putting this at the end to prevent having to write the prototypes :-) */ WGL_extension wgl_extension_registry[] = { { "wglGetExtensionsStringARB", (void *) wglGetExtensionsStringARB, NULL, NULL}, { "wglGetExtensionsStringEXT", (void *) wglGetExtensionsStringEXT, NULL, NULL}, { "wglGetSwapIntervalEXT", (void *) wglSwapIntervalEXT, NULL, NULL}, - { "wglSwapIntervalEXT", (void *) wglSwapIntervalEXT, NULL, NULL} + { "wglSwapIntervalEXT", (void *) wglSwapIntervalEXT, NULL, NULL}, + { "wglGetPixelFormatAttribivARB", (void *) wglGetPixelFormatAttribivARB, NULL, NULL}, + { "wglGetPixelFormatAttribfvARB", (void *) wglGetPixelFormatAttribfvARB, NULL, NULL}, + { "wglChoosePixelFormatARB", (void *) wglChoosePixelFormatARB, NULL, NULL}, + { "wglCreatePbufferARB", (void *) wglCreatePbufferARB, NULL, NULL}, + { "wglGetPbufferDCARB", (void *) wglGetPbufferDCARB, NULL, NULL}, + { "wglReleasePbufferDCARB", (void *) wglReleasePbufferDCARB, NULL, NULL}, + { "wglDestroyPbufferARB", (void *) wglDestroyPbufferARB, NULL, NULL}, + { "wglQueryPbufferARB", (void *) wglQueryPbufferARB, NULL, NULL}, + { "wglBindTexImageARB", (void *) wglBindTexImageARB, NULL, NULL}, + { "wglReleaseTexImageARB", (void *) wglReleaseTexImageARB, NULL, NULL}, + { "wglSetPbufferAttribARB", (void *) wglSetPbufferAttribARB, NULL, NULL} }; int wgl_extension_registry_size = sizeof(wgl_extension_registry) / sizeof(wgl_extension_registry[0]);