winex11: Move wglCopyContext and wglDeleteContext to the internal OpenGL extension functions.

This commit is contained in:
Alexandre Julliard 2012-06-25 12:21:18 +02:00
parent beeba895d3
commit 08efea0218
4 changed files with 26 additions and 15 deletions

View File

@ -49,8 +49,6 @@ static struct
{
PROC (WINAPI *p_wglGetProcAddress)(LPCSTR lpszProc);
BOOL (WINAPI *p_SetPixelFormat)(HDC hdc, INT iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd);
BOOL (WINAPI *p_wglCopyContext)(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask);
BOOL (WINAPI *p_wglDeleteContext)(HGLRC hglrc);
BOOL (WINAPI *p_wglMakeCurrent)(HDC hdc, HGLRC hglrc);
HDC (WINAPI *p_wglGetCurrentDC)(void);
HGLRC (WINAPI *p_wglCreateContext)(HDC hdc);
@ -60,6 +58,8 @@ static struct
INT (WINAPI *p_GetPixelFormat)(HDC hdc);
/* internal WGL functions */
BOOL (WINAPI *p_wglCopyContext)(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask);
BOOL (WINAPI *p_wglDeleteContext)(HGLRC hglrc);
void (WINAPI *p_wglGetIntegerv)(GLenum pname, GLint* params);
void (WINAPI *p_wglFinish)(void);
void (WINAPI *p_wglFlush)(void);
@ -104,7 +104,12 @@ BOOL WINAPI wglSetPixelFormat( HDC hdc, INT iPixelFormat,
*/
BOOL WINAPI wglCopyContext(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask)
{
return wine_wgl.p_wglCopyContext(hglrcSrc, hglrcDst, mask);
if (!hglrcSrc || !hglrcDst)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
return wine_wgl.p_wglCopyContext(hglrcSrc, hglrcDst, mask);
}
/***********************************************************************
@ -112,7 +117,12 @@ BOOL WINAPI wglCopyContext(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask)
*/
BOOL WINAPI wglDeleteContext(HGLRC hglrc)
{
return wine_wgl.p_wglDeleteContext(hglrc);
if (!hglrc)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
return wine_wgl.p_wglDeleteContext(hglrc);
}
/***********************************************************************
@ -921,8 +931,6 @@ static BOOL process_attach(void)
wine_wgl.p_wglGetProcAddress = (void *)GetProcAddress(mod_gdi32, "wglGetProcAddress");
wine_wgl.p_SetPixelFormat = (void *)GetProcAddress(mod_gdi32, "SetPixelFormat");
wine_wgl.p_wglCopyContext = (void *)GetProcAddress(mod_gdi32, "wglCopyContext");
wine_wgl.p_wglDeleteContext = (void *)GetProcAddress(mod_gdi32, "wglDeleteContext");
wine_wgl.p_wglMakeCurrent = (void *)GetProcAddress(mod_gdi32, "wglMakeCurrent");
wine_wgl.p_wglGetCurrentDC = (void *)GetProcAddress(mod_gdi32, "wglGetCurrentDC");
wine_wgl.p_wglCreateContext = (void *)GetProcAddress(mod_gdi32, "wglCreateContext");
@ -932,6 +940,8 @@ static BOOL process_attach(void)
wine_wgl.p_GetPixelFormat = (void *)GetProcAddress(mod_gdi32, "GetPixelFormat");
/* internal WGL functions */
wine_wgl.p_wglCopyContext = (void *)wine_wgl.p_wglGetProcAddress("wglCopyContext");
wine_wgl.p_wglDeleteContext = (void *)wine_wgl.p_wglGetProcAddress("wglDeleteContext");
wine_wgl.p_wglGetIntegerv = (void *)wine_wgl.p_wglGetProcAddress("wglGetIntegerv");
wine_wgl.p_wglFinish = (void *)wine_wgl.p_wglGetProcAddress("wglFinish");
wine_wgl.p_wglFlush = (void *)wine_wgl.p_wglGetProcAddress("wglFlush");

View File

@ -5359,10 +5359,12 @@ static BOOL InitAdapters(struct wined3d *wined3d)
#ifdef USE_WIN32_OPENGL
wglFinish = (void*)GetProcAddress(mod_gl, "glFinish");
wglFlush = (void*)GetProcAddress(mod_gl, "glFlush");
pwglDeleteContext = (void*)GetProcAddress(mod_gl, "wglDeleteContext");
pwglShareLists = (void*)GetProcAddress(mod_gl, "wglShareLists");
#else
wglFinish = (void*)pwglGetProcAddress("wglFinish");
wglFlush = (void*)pwglGetProcAddress("wglFlush");
pwglDeleteContext = (void*)pwglGetProcAddress("wglDeleteContext");
pwglShareLists = (void*)pwglGetProcAddress("wglShareLists");
#endif

View File

@ -1713,7 +1713,6 @@ BOOL (WINAPI *pwglShareLists)(HGLRC, HGLRC) DECLSPEC_HIDDEN;
#define WGL_FUNCS_GEN \
USE_WGL_FUNC(wglCreateContext) \
USE_WGL_FUNC(wglDeleteContext) \
USE_WGL_FUNC(wglGetCurrentContext) \
USE_WGL_FUNC(wglGetCurrentDC) \
USE_WGL_FUNC(wglGetProcAddress) \

View File

@ -1624,11 +1624,11 @@ static BOOL glxdrv_SetPixelFormat(PHYSDEV dev, int iPixelFormat, const PIXELFORM
}
/**
* glxdrv_wglCopyContext
* X11DRV_wglCopyContext
*
* For OpenGL32 wglCopyContext.
*/
static BOOL glxdrv_wglCopyContext(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask)
static BOOL WINAPI X11DRV_wglCopyContext(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask)
{
Wine_GLContext *src = (Wine_GLContext*)hglrcSrc;
Wine_GLContext *dst = (Wine_GLContext*)hglrcDst;
@ -1688,18 +1688,16 @@ static HGLRC glxdrv_wglCreateContext(PHYSDEV dev)
}
/**
* glxdrv_wglDeleteContext
* X11DRV_wglDeleteContext
*
* For OpenGL32 wglDeleteContext.
*/
static BOOL glxdrv_wglDeleteContext(HGLRC hglrc)
static BOOL WINAPI X11DRV_wglDeleteContext(HGLRC hglrc)
{
Wine_GLContext *ctx = (Wine_GLContext *) hglrc;
TRACE("(%p)\n", hglrc);
if (!has_opengl()) return 0;
if (!is_valid_context(ctx))
{
WARN("Error deleting context !\n");
@ -3251,6 +3249,8 @@ static const WineGLExtension WGL_internal_functions =
{
"",
{
{ "wglCopyContext", X11DRV_wglCopyContext },
{ "wglDeleteContext", X11DRV_wglDeleteContext },
{ "wglGetIntegerv", X11DRV_wglGetIntegerv },
{ "wglFinish", X11DRV_wglFinish },
{ "wglFlush", X11DRV_wglFlush },
@ -3755,10 +3755,10 @@ static const struct gdi_dc_funcs glxdrv_funcs =
glxdrv_SwapBuffers, /* pSwapBuffers */
NULL, /* pUnrealizePalette */
NULL, /* pWidenPath */
glxdrv_wglCopyContext, /* pwglCopyContext */
NULL, /* pwglCopyContext */
glxdrv_wglCreateContext, /* pwglCreateContext */
glxdrv_wglCreateContextAttribsARB, /* pwglCreateContextAttribsARB */
glxdrv_wglDeleteContext, /* pwglDeleteContext */
NULL, /* pwglDeleteContext */
glxdrv_wglGetProcAddress, /* pwglGetProcAddress */
glxdrv_wglMakeContextCurrentARB, /* pwglMakeContextCurrentARB */
glxdrv_wglMakeCurrent, /* pwglMakeCurrent */