opengl32: Get rid of the extension removal hack in wglGetProcAddress and clean up the tracing.
This commit is contained in:
parent
449deda62f
commit
a3d896897c
@ -738,79 +738,50 @@ static BOOL is_extension_supported(const char* extension)
|
|||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* wglGetProcAddress (OPENGL32.@)
|
* wglGetProcAddress (OPENGL32.@)
|
||||||
*/
|
*/
|
||||||
PROC WINAPI wglGetProcAddress(LPCSTR lpszProc)
|
PROC WINAPI wglGetProcAddress( LPCSTR name )
|
||||||
{
|
{
|
||||||
struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
|
struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
|
||||||
void **func_ptr;
|
void **func_ptr;
|
||||||
void *local_func;
|
OpenGL_extension ext;
|
||||||
OpenGL_extension ext;
|
const OpenGL_extension *ext_ret;
|
||||||
const OpenGL_extension *ext_ret;
|
|
||||||
struct wgl_handle *context = get_current_context_ptr();
|
|
||||||
|
|
||||||
TRACE("(%s)\n", lpszProc);
|
if (!name) return NULL;
|
||||||
|
|
||||||
if (lpszProc == NULL)
|
/* Without an active context opengl32 doesn't know to what
|
||||||
return NULL;
|
* driver it has to dispatch wglGetProcAddress.
|
||||||
|
*/
|
||||||
/* Without an active context opengl32 doesn't know to what
|
if (!get_current_context_ptr())
|
||||||
* driver it has to dispatch wglGetProcAddress.
|
{
|
||||||
*/
|
WARN("No active WGL context found\n");
|
||||||
if (!context)
|
return NULL;
|
||||||
{
|
|
||||||
WARN("No active WGL context found\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Search in the thunks to find the real name of the extension */
|
|
||||||
ext.name = lpszProc;
|
|
||||||
ext_ret = bsearch(&ext, extension_registry, extension_registry_size,
|
|
||||||
sizeof(OpenGL_extension), compar);
|
|
||||||
if (!ext_ret)
|
|
||||||
{
|
|
||||||
WARN("Extension '%s' not defined in opengl32.dll's function table!\n", lpszProc);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
func_ptr = (void **)&funcs->ext + (ext_ret - extension_registry);
|
|
||||||
if (!*func_ptr)
|
|
||||||
{
|
|
||||||
/* Check if the GL extension required by the function is available */
|
|
||||||
if(!is_extension_supported(ext_ret->extension)) {
|
|
||||||
WARN("Extension '%s' required by function '%s' not supported!\n", ext_ret->extension, lpszProc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local_func = context->funcs->wgl.p_wglGetProcAddress( ext_ret->name );
|
ext.name = name;
|
||||||
|
ext_ret = bsearch(&ext, extension_registry, extension_registry_size, sizeof(ext), compar);
|
||||||
/* After that, look at the extensions defined in the Linux OpenGL library */
|
if (!ext_ret)
|
||||||
if (local_func == NULL) {
|
{
|
||||||
char buf[256];
|
WARN("Function %s unknown\n", name);
|
||||||
void *ret = NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Remove the last 3 letters (EXT, ARB, ...).
|
|
||||||
|
|
||||||
I know that some extensions have more than 3 letters (MESA, NV,
|
|
||||||
INTEL, ...), but this is only a stop-gap measure to fix buggy
|
|
||||||
OpenGL drivers (moreover, it is only useful for old 1.0 apps
|
|
||||||
that query the glBindTextureEXT extension).
|
|
||||||
*/
|
|
||||||
memcpy(buf, ext_ret->name, strlen(ext_ret->name) - 3);
|
|
||||||
buf[strlen(ext_ret->name) - 3] = '\0';
|
|
||||||
TRACE("Extension not found in the Linux OpenGL library, checking against libGL bug with %s..\n", buf);
|
|
||||||
|
|
||||||
ret = GetProcAddress(opengl32_handle, 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->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
*func_ptr = local_func;
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE("returning function (%p)\n", ext_ret->func);
|
func_ptr = (void **)&funcs->ext + (ext_ret - extension_registry);
|
||||||
return ext_ret->func;
|
if (!*func_ptr)
|
||||||
|
{
|
||||||
|
void *driver_func = funcs->wgl.p_wglGetProcAddress( name );
|
||||||
|
|
||||||
|
if (!is_extension_supported(ext_ret->extension))
|
||||||
|
WARN("Extension %s required for %s not supported\n", ext_ret->extension, name);
|
||||||
|
|
||||||
|
if (driver_func == NULL)
|
||||||
|
{
|
||||||
|
WARN("Function %s not supported by driver\n", name);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
*func_ptr = driver_func;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRACE("returning %s -> %p\n", name, ext_ret->func);
|
||||||
|
return ext_ret->func;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
Loading…
x
Reference in New Issue
Block a user