wgl: Move part of wglGetProcAddress to gdi32.
This commit is contained in:
parent
b4c1c67ea4
commit
88ad69f9bd
|
@ -198,6 +198,7 @@ static struct graphics_driver *create_driver( HMODULE module )
|
||||||
/* OpenGL32 */
|
/* OpenGL32 */
|
||||||
GET_FUNC(wglCreateContext);
|
GET_FUNC(wglCreateContext);
|
||||||
GET_FUNC(wglDeleteContext);
|
GET_FUNC(wglDeleteContext);
|
||||||
|
GET_FUNC(wglGetProcAddress);
|
||||||
GET_FUNC(wglMakeCurrent);
|
GET_FUNC(wglMakeCurrent);
|
||||||
GET_FUNC(wglShareLists);
|
GET_FUNC(wglShareLists);
|
||||||
GET_FUNC(wglUseFontBitmapsA);
|
GET_FUNC(wglUseFontBitmapsA);
|
||||||
|
|
|
@ -502,6 +502,7 @@
|
||||||
@ stdcall wglDeleteContext(long)
|
@ stdcall wglDeleteContext(long)
|
||||||
@ stdcall wglGetCurrentContext()
|
@ stdcall wglGetCurrentContext()
|
||||||
@ stdcall wglGetCurrentDC()
|
@ stdcall wglGetCurrentDC()
|
||||||
|
@ stdcall -private wglGetProcAddress(str)
|
||||||
@ stdcall wglMakeCurrent(long long)
|
@ stdcall wglMakeCurrent(long long)
|
||||||
@ stdcall wglShareLists(long long)
|
@ stdcall wglShareLists(long long)
|
||||||
@ stdcall wglUseFontBitmapsA(long long long long)
|
@ stdcall wglUseFontBitmapsA(long long long long)
|
||||||
|
|
|
@ -186,6 +186,7 @@ typedef struct tagDC_FUNCS
|
||||||
/* OpenGL32 */
|
/* OpenGL32 */
|
||||||
HGLRC (*pwglCreateContext)(PHYSDEV);
|
HGLRC (*pwglCreateContext)(PHYSDEV);
|
||||||
BOOL (*pwglDeleteContext)(HGLRC);
|
BOOL (*pwglDeleteContext)(HGLRC);
|
||||||
|
PROC (*pwglGetProcAddress)(LPCSTR);
|
||||||
BOOL (*pwglMakeCurrent)(PHYSDEV, HGLRC);
|
BOOL (*pwglMakeCurrent)(PHYSDEV, HGLRC);
|
||||||
BOOL (*pwglShareLists)(HGLRC hglrc1, HGLRC hglrc2);
|
BOOL (*pwglShareLists)(HGLRC hglrc1, HGLRC hglrc2);
|
||||||
BOOL (*pwglUseFontBitmapsA)(PHYSDEV, DWORD, DWORD, DWORD);
|
BOOL (*pwglUseFontBitmapsA)(PHYSDEV, DWORD, DWORD, DWORD);
|
||||||
|
|
|
@ -221,3 +221,28 @@ BOOL WINAPI wglUseFontBitmapsW(HDC hdc, DWORD first, DWORD count, DWORD listBase
|
||||||
GDI_ReleaseObj( hdc);
|
GDI_ReleaseObj( hdc);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* Internal wglGetProcAddress for retrieving WGL extensions
|
||||||
|
*/
|
||||||
|
PROC WINAPI wglGetProcAddress(LPCSTR func)
|
||||||
|
{
|
||||||
|
PROC ret = NULL;
|
||||||
|
DC * dc = NULL;
|
||||||
|
|
||||||
|
if(!func)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
TRACE("func: '%p'\n", func);
|
||||||
|
|
||||||
|
/* Retrieve the global hDC to get access to the driver. */
|
||||||
|
dc = OPENGL_GetDefaultDC();
|
||||||
|
if (!dc) return FALSE;
|
||||||
|
|
||||||
|
if (!dc->funcs->pwglGetProcAddress) FIXME(" :stub\n");
|
||||||
|
else ret = dc->funcs->pwglGetProcAddress(func);
|
||||||
|
|
||||||
|
GDI_ReleaseObj(default_hdc);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
|
@ -79,8 +79,6 @@ static Display *default_display; /* display to use for default context */
|
||||||
|
|
||||||
static HMODULE opengl32_handle;
|
static HMODULE opengl32_handle;
|
||||||
|
|
||||||
static void* (*p_glXGetProcAddressARB)(const GLubyte *);
|
|
||||||
|
|
||||||
static char internal_gl_disabled_extensions[512];
|
static char internal_gl_disabled_extensions[512];
|
||||||
static char* internal_gl_extensions = NULL;
|
static char* internal_gl_extensions = NULL;
|
||||||
|
|
||||||
|
@ -193,11 +191,6 @@ PROC WINAPI wglGetProcAddress(LPCSTR lpszProc) {
|
||||||
return local_func;
|
return local_func;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_glXGetProcAddressARB == NULL) {
|
|
||||||
ERR("Warning : dynamic GL extension loading not supported by native GL library.\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* After that, search in the thunks to find the real name of the extension */
|
/* After that, search in the thunks to find the real name of the extension */
|
||||||
ext.name = lpszProc;
|
ext.name = lpszProc;
|
||||||
ext_ret = (const OpenGL_extension *) bsearch(&ext, extension_registry,
|
ext_ret = (const OpenGL_extension *) bsearch(&ext, extension_registry,
|
||||||
|
@ -205,12 +198,10 @@ PROC WINAPI wglGetProcAddress(LPCSTR lpszProc) {
|
||||||
|
|
||||||
/* If nothing was found, we are looking for a WGL extension */
|
/* If nothing was found, we are looking for a WGL extension */
|
||||||
if (ext_ret == NULL) {
|
if (ext_ret == NULL) {
|
||||||
|
WARN("Extension '%s' not defined in opengl32.dll's function table!\n", lpszProc);
|
||||||
return wine_wgl.p_wglGetProcAddress(lpszProc);
|
return wine_wgl.p_wglGetProcAddress(lpszProc);
|
||||||
} else { /* We are looking for an OpenGL extension */
|
} else { /* We are looking for an OpenGL extension */
|
||||||
const char *glx_name = ext_ret->glx_name ? ext_ret->glx_name : ext_ret->name;
|
local_func = wine_wgl.p_wglGetProcAddress(ext_ret->name);
|
||||||
ENTER_GL();
|
|
||||||
local_func = p_glXGetProcAddressARB( (const GLubyte*)glx_name);
|
|
||||||
LEAVE_GL();
|
|
||||||
|
|
||||||
/* After that, look at the extensions defined in the Linux OpenGL library */
|
/* After that, look at the extensions defined in the Linux OpenGL library */
|
||||||
if (local_func == NULL) {
|
if (local_func == NULL) {
|
||||||
|
@ -224,15 +215,15 @@ PROC WINAPI wglGetProcAddress(LPCSTR lpszProc) {
|
||||||
OpenGL drivers (moreover, it is only useful for old 1.0 apps
|
OpenGL drivers (moreover, it is only useful for old 1.0 apps
|
||||||
that query the glBindTextureEXT extension).
|
that query the glBindTextureEXT extension).
|
||||||
*/
|
*/
|
||||||
memcpy(buf, glx_name, strlen(glx_name) - 3);
|
memcpy(buf, ext_ret->name, strlen(ext_ret->name) - 3);
|
||||||
buf[strlen(glx_name) - 3] = '\0';
|
buf[strlen(ext_ret->name) - 3] = '\0';
|
||||||
TRACE(" extension not found in the Linux OpenGL library, checking against libGL bug with %s..\n", buf);
|
TRACE(" extension not found in the Linux OpenGL library, checking against libGL bug with %s..\n", buf);
|
||||||
|
|
||||||
ret = GetProcAddress(opengl32_handle, buf);
|
ret = GetProcAddress(opengl32_handle, buf);
|
||||||
if (ret != NULL) {
|
if (ret != NULL) {
|
||||||
TRACE(" found function in main OpenGL library (%p) !\n", ret);
|
TRACE(" found function in main OpenGL library (%p) !\n", ret);
|
||||||
} else {
|
} else {
|
||||||
WARN("Did not find function %s (%s) in your OpenGL library !\n", lpszProc, glx_name);
|
WARN("Did not find function %s (%s) in your OpenGL library !\n", lpszProc, ext_ret->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -598,24 +589,23 @@ static BOOL process_attach(void)
|
||||||
XVisualInfo *vis = NULL;
|
XVisualInfo *vis = NULL;
|
||||||
Window root = (Window)GetPropA( GetDesktopWindow(), "__wine_x11_whole_window" );
|
Window root = (Window)GetPropA( GetDesktopWindow(), "__wine_x11_whole_window" );
|
||||||
HMODULE mod = GetModuleHandleA( "winex11.drv" );
|
HMODULE mod = GetModuleHandleA( "winex11.drv" );
|
||||||
void *opengl_handle;
|
HMODULE mod_gdi32 = GetModuleHandleA( "gdi32.dll" );
|
||||||
DWORD size = sizeof(internal_gl_disabled_extensions);
|
DWORD size = sizeof(internal_gl_disabled_extensions);
|
||||||
HKEY hkey = 0;
|
HKEY hkey = 0;
|
||||||
|
|
||||||
if (!root || !mod)
|
if (!root || !mod || !mod_gdi32)
|
||||||
{
|
{
|
||||||
ERR("X11DRV not loaded. Cannot create default context.\n");
|
ERR("X11DRV or GDI32 not loaded. Cannot create default context.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wine_tsx11_lock_ptr = (void *)GetProcAddress( mod, "wine_tsx11_lock" );
|
wine_tsx11_lock_ptr = (void *)GetProcAddress( mod, "wine_tsx11_lock" );
|
||||||
wine_tsx11_unlock_ptr = (void *)GetProcAddress( mod, "wine_tsx11_unlock" );
|
wine_tsx11_unlock_ptr = (void *)GetProcAddress( mod, "wine_tsx11_unlock" );
|
||||||
|
|
||||||
/* Load WGL function pointers from winex11.drv */
|
wine_wgl.p_wglGetProcAddress = (void *)GetProcAddress(mod_gdi32, "wglGetProcAddress");
|
||||||
wine_wgl.p_wglGetProcAddress = (void *)GetProcAddress(mod, "wglGetProcAddress");
|
|
||||||
|
|
||||||
/* Interal WGL function */
|
/* Interal WGL function */
|
||||||
wine_wgl.p_wglGetIntegerv = (void *)GetProcAddress(mod, "wglGetIntegerv");
|
wine_wgl.p_wglGetIntegerv = (void *)wine_wgl.p_wglGetProcAddress("wglGetIntegerv");
|
||||||
|
|
||||||
hdc = GetDC(0);
|
hdc = GetDC(0);
|
||||||
default_display = get_display( hdc );
|
default_display = get_display( hdc );
|
||||||
|
@ -651,14 +641,6 @@ static BOOL process_attach(void)
|
||||||
XFree(vis);
|
XFree(vis);
|
||||||
LEAVE_GL();
|
LEAVE_GL();
|
||||||
|
|
||||||
opengl_handle = wine_dlopen(SONAME_LIBGL, RTLD_NOW|RTLD_GLOBAL, NULL, 0);
|
|
||||||
if (opengl_handle != NULL) {
|
|
||||||
p_glXGetProcAddressARB = wine_dlsym(opengl_handle, "glXGetProcAddressARB", NULL, 0);
|
|
||||||
wine_dlclose(opengl_handle, NULL, 0);
|
|
||||||
if (p_glXGetProcAddressARB == NULL)
|
|
||||||
TRACE("could not find glXGetProcAddressARB in libGL.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
internal_gl_disabled_extensions[0] = 0;
|
internal_gl_disabled_extensions[0] = 0;
|
||||||
if (!RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\OpenGL", &hkey)) {
|
if (!RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\OpenGL", &hkey)) {
|
||||||
if (!RegQueryValueExA( hkey, "DisabledExtensions", 0, NULL, (LPBYTE)internal_gl_disabled_extensions, &size)) {
|
if (!RegQueryValueExA( hkey, "DisabledExtensions", 0, NULL, (LPBYTE)internal_gl_disabled_extensions, &size)) {
|
||||||
|
|
|
@ -1299,6 +1299,11 @@ PROC X11DRV_wglGetProcAddress(LPCSTR lpszProc)
|
||||||
if (padding < 0)
|
if (padding < 0)
|
||||||
padding = 0;
|
padding = 0;
|
||||||
|
|
||||||
|
/* Check the table of WGL extensions to see if we need to return a WGL extension
|
||||||
|
* or a function pointer to a native OpenGL function. */
|
||||||
|
if(strncmp(lpszProc, "wgl", 3) != 0) {
|
||||||
|
return pglXGetProcAddressARB((GLubyte*)lpszProc);
|
||||||
|
} else {
|
||||||
TRACE("('%s'):%*s", lpszProc, padding, " ");
|
TRACE("('%s'):%*s", lpszProc, padding, " ");
|
||||||
for (i = 0; i < WineGLExtensionListSize; ++i) {
|
for (i = 0; i < WineGLExtensionListSize; ++i) {
|
||||||
ext = WineGLExtensionList[i];
|
ext = WineGLExtensionList[i];
|
||||||
|
@ -1309,9 +1314,9 @@ PROC X11DRV_wglGetProcAddress(LPCSTR lpszProc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ERR("(%s) - not found\n", lpszProc);
|
ERR("(%s) - not found\n", lpszProc);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2457,6 +2462,15 @@ static BOOL register_extension(const WineGLExtension * ext)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const WineGLExtension WGL_internal_functions =
|
||||||
|
{
|
||||||
|
"",
|
||||||
|
{
|
||||||
|
{ "wglGetIntegerv", X11DRV_wglGetIntegerv },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static const WineGLExtension WGL_ARB_extensions_string =
|
static const WineGLExtension WGL_ARB_extensions_string =
|
||||||
{
|
{
|
||||||
"WGL_ARB_extensions_string",
|
"WGL_ARB_extensions_string",
|
||||||
|
@ -2536,6 +2550,9 @@ static void X11DRV_WineGL_LoadExtensions(void)
|
||||||
{
|
{
|
||||||
WineGLInfo.wglExtensions[0] = 0;
|
WineGLInfo.wglExtensions[0] = 0;
|
||||||
|
|
||||||
|
/* Load Wine internal functions */
|
||||||
|
register_extension(&WGL_internal_functions);
|
||||||
|
|
||||||
/* ARB Extensions */
|
/* ARB Extensions */
|
||||||
|
|
||||||
register_extension(&WGL_ARB_extensions_string);
|
register_extension(&WGL_ARB_extensions_string);
|
||||||
|
@ -2795,11 +2812,6 @@ BOOL WINAPI X11DRV_wglUseFontBitmapsW(HDC hdc, DWORD first, DWORD count, DWORD l
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WGL helper function which handles differences in glGetIntegerv from WGL and GLX */
|
|
||||||
void X11DRV_wglGetIntegerv(int pname, int* params) {
|
|
||||||
ERR_(opengl)("No OpenGL support compiled in.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
XVisualInfo *X11DRV_setup_opengl_visual( Display *display )
|
XVisualInfo *X11DRV_setup_opengl_visual( Display *display )
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -133,7 +133,6 @@
|
||||||
# OpenGL
|
# OpenGL
|
||||||
@ cdecl wglCreateContext(long) X11DRV_wglCreateContext
|
@ cdecl wglCreateContext(long) X11DRV_wglCreateContext
|
||||||
@ cdecl wglDeleteContext(long) X11DRV_wglDeleteContext
|
@ cdecl wglDeleteContext(long) X11DRV_wglDeleteContext
|
||||||
@ cdecl wglGetIntegerv(long ptr) X11DRV_wglGetIntegerv
|
|
||||||
@ cdecl wglGetProcAddress(ptr) X11DRV_wglGetProcAddress
|
@ cdecl wglGetProcAddress(ptr) X11DRV_wglGetProcAddress
|
||||||
@ cdecl wglMakeCurrent(long long) X11DRV_wglMakeCurrent
|
@ cdecl wglMakeCurrent(long long) X11DRV_wglMakeCurrent
|
||||||
@ cdecl wglShareLists(long long) X11DRV_wglShareLists
|
@ cdecl wglShareLists(long long) X11DRV_wglShareLists
|
||||||
|
|
Loading…
Reference in New Issue