Commit ce3ab0e7 authored by Lionel Ulmer's avatar Lionel Ulmer Committed by Alexandre Julliard

- better support for extensions functions that do not have the same

name in windows and in Unix. - support the NV_vertex_array_range extension.
parent 3f510ad2
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -7,6 +7,7 @@
typedef struct {
char *name; /* name of the extension */
char *glx_name; /* name used on Unix's libGL */
void *func; /* pointer to the Wine function for this extension */
void **func_ptr; /* where to store the value of glXGetProcAddressARB */
} OpenGL_extension;
......
......@@ -233,17 +233,20 @@ int WINAPI wglGetLayerPaletteEntries(HDC hdc,
return 0;
}
/***********************************************************************
* wglGetProcAddress (OPENGL32.@)
*/
static int compar(const void *elt_a, const void *elt_b) {
return strcmp(((OpenGL_extension *) elt_a)->name,
((OpenGL_extension *) elt_b)->name);
}
/***********************************************************************
* wglGetProcAddress (OPENGL32.@)
*/
void* WINAPI wglGetProcAddress(LPCSTR lpszProc) {
void *local_func;
static HMODULE hm = 0;
OpenGL_extension ext;
OpenGL_extension *ext_ret;
TRACE("(%s)\n", lpszProc);
......@@ -256,8 +259,23 @@ void* WINAPI wglGetProcAddress(LPCSTR lpszProc) {
return local_func;
}
/* After that, search in the thunks to find the real name of the extension */
ext.name = (char *) lpszProc;
ext_ret = (OpenGL_extension *) bsearch(&ext, extension_registry,
extension_registry_size, sizeof(OpenGL_extension), compar);
if (ext_ret == NULL) {
/* Some sanity checks :-) */
if (glXGetProcAddressARB(lpszProc) != NULL) {
ERR("Extension %s defined in the OpenGL library but NOT in opengl_ext.c... Please report (lionel.ulmer@free.fr) !\n", lpszProc);
return NULL;
}
WARN("Did not find extension %s in either Wine or your OpenGL library.\n", lpszProc);
return NULL;
} else {
/* After that, look at the extensions defined in the Linux OpenGL library */
if ((local_func = glXGetProcAddressARB(lpszProc)) == NULL) {
if ((local_func = glXGetProcAddressARB(ext_ret->glx_name)) == NULL) {
char buf[256];
void *ret = NULL;
......@@ -268,32 +286,23 @@ void* WINAPI wglGetProcAddress(LPCSTR lpszProc) {
OpenGL drivers (moreover, it is only useful for old 1.0 apps
that query the glBindTextureEXT extension).
*/
strncpy(buf, lpszProc, strlen(lpszProc) - 3);
buf[strlen(lpszProc) - 3] = '\0';
strncpy(buf, ext_ret->glx_name, strlen(ext_ret->glx_name) - 3);
buf[strlen(ext_ret->glx_name) - 3] = '\0';
TRACE(" extension not found in the Linux OpenGL library, checking against libGL bug with %s..\n", buf);
ret = GetProcAddress(hm, buf);
if (ret != NULL) {
TRACE(" found function in main OpenGL library (%p) !\n", ret);
} else {
WARN("Did not find function %s (%s) in your OpenGL library !\n", lpszProc, ext_ret->glx_name);
}
return ret;
} else {
OpenGL_extension ext;
OpenGL_extension *ret;
TRACE(" returning function (%p)\n", ext_ret->func);
*(ext_ret->func_ptr) = local_func;
ext.name = (char *) lpszProc;
ret = (OpenGL_extension *) bsearch(&ext, extension_registry,
extension_registry_size, sizeof(OpenGL_extension), compar);
if (ret != NULL) {
TRACE(" returning function (%p)\n", ret->func);
*(ret->func_ptr) = local_func;
return ret->func;
} else {
ERR("Extension %s defined in the OpenGL library but NOT in opengl_ext.c... Please report (lionel.ulmer@free.fr) !\n", lpszProc);
return NULL;
return ext_ret->func;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment