Module: wine Branch: master Commit: f25cea1094a05860abe666c199b0793e195df49a URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=f25cea1094a05860abe666c1...
Author: Roderick Colenbrander thunderbird2k@gmx.net Date: Wed Aug 23 23:11:52 2006 +0000
opengl32: Fix ATI OpenGL bug.
---
dlls/opengl32/wgl.c | 45 +++++++++++++++++++++++++++++++++++++-------- 1 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 45f6297..f1efe8c 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -1276,21 +1276,50 @@ #endif static void wgl_initialize_glx(Display *display, int screen, glXGetProcAddressARB_t proc) { const char *server_glx_version = glXQueryServerString(display, screen, GLX_VERSION); - const char *server_glx_extensions = glXQueryServerString(display, screen, GLX_EXTENSIONS); - /* const char *client_glx_version = glXGetClientString(display, GLX_VERSION); - const char *client_glx_extensions = glXGetClientString(display, GLX_EXTENSIONS); - const char *glx_extensions = glXQueryExtensionsString(display, screen); - */ + const char *glx_extensions = NULL; + BOOL glx_direct = glXIsDirect(display, default_cx);
memset(&wine_glx, 0, sizeof(wine_glx));
- if (!strcmp("1.2", server_glx_version)) { + /* In case of GLX you have direct and indirect rendering. Most of the time direct rendering is used + * as in general only that is hardware accelerated. In some cases like in case of remote X indirect + * rendering is used. + * + * The main problem for our OpenGL code is that we need certain GLX calls but their presence + * depends on the reported GLX client / server version and on the client / server extension list. + * Those don't have to be the same. + * + * In general the server GLX information should be used in case of indirect rendering. When direct + * rendering is used, the OpenGL client library is responsible for which GLX calls are available. + * Nvidia's OpenGL drivers are the best in terms of GLX features. At the moment of writing their + * 8762 drivers support 1.3 for the server and 1.4 for the client and they support lots of extensions. + * Unfortunately it is much more complicated for Mesa/DRI-based drivers and ATI's drivers. + * Both sets of drivers report a server version of 1.2 and the client version can be 1.3 or 1.4. + * Further in case of atleast ATI's drivers one crucial extension needed for our pixel format code + * is only available in the list of server extensions and not in the client list. + * + * The versioning checks below try to take into account the comments from above. + */ + + /* Based on the default opengl context we decide whether direct or indirect rendering is used. + * In case of indirect rendering we check if the GLX version of the server is 1.2 and else + * the client version is checked. + */ + if ( (!glx_direct && !strcmp("1.2", server_glx_version)) || (glx_direct && !strcmp("1.2", client_glx_version)) ) { wine_glx.version = 2; } else { wine_glx.version = 3; }
+ /* Depending on the use of direct or indirect rendering we need either the list of extensions + * exported by the client or by the server. + */ + if(glx_direct) + glx_extensions = glXGetClientString(display, GLX_EXTENSIONS); + else + glx_extensions = glXQueryServerString(display, screen, GLX_EXTENSIONS); + if (2 < wine_glx.version) { wine_glx.p_glXChooseFBConfig = proc( (const GLubyte *) "glXChooseFBConfig"); wine_glx.p_glXGetFBConfigAttrib = proc( (const GLubyte *) "glXGetFBConfigAttrib"); @@ -1299,12 +1328,12 @@ static void wgl_initialize_glx(Display * /*wine_glx.p_glXGetFBConfigs = proc( (const GLubyte *) "glXGetFBConfigs");*/ wine_glx.p_glXQueryDrawable = proc( (const GLubyte *) "glXQueryDrawable"); } else { - if (NULL != strstr(server_glx_extensions, "GLX_SGIX_fbconfig")) { + if (NULL != strstr(glx_extensions, "GLX_SGIX_fbconfig")) { wine_glx.p_glXChooseFBConfig = proc( (const GLubyte *) "glXChooseFBConfigSGIX"); wine_glx.p_glXGetFBConfigAttrib = proc( (const GLubyte *) "glXGetFBConfigAttribSGIX"); wine_glx.p_glXGetVisualFromFBConfig = proc( (const GLubyte *) "glXGetVisualFromFBConfigSGIX"); } else { - ERR(" glx_version as %s and GLX_SGIX_fbconfig extension is unsupported. Expect problems.\n", server_glx_version); + ERR(" glx_version as %s and GLX_SGIX_fbconfig extension is unsupported. Expect problems.\n", client_glx_version); } } /** try anyway to retrieve that calls, maybe they works using glx client tricks */