Alexandre Julliard : winex11: Export wglMakeCurrent and wglMakeContextCurrentARB as standard extension functions .
Alexandre Julliard
julliard at winehq.org
Wed Jun 27 19:14:01 CDT 2012
Module: wine
Branch: master
Commit: 4a367c57197b93a01c66d167db20420134e1f52c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4a367c57197b93a01c66d167db20420134e1f52c
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Jun 27 14:43:36 2012 +0200
winex11: Export wglMakeCurrent and wglMakeContextCurrentARB as standard extension functions.
---
dlls/gdi32/gdi32.spec | 3 +-
dlls/gdi32/opengl.c | 70 ---------------------------------------------
dlls/opengl32/wgl.c | 11 +++++--
dlls/winex11.drv/opengl.c | 22 +++++++-------
4 files changed, 20 insertions(+), 86 deletions(-)
diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec
index 2a7edc3..8fa7fe1 100644
--- a/dlls/gdi32/gdi32.spec
+++ b/dlls/gdi32/gdi32.spec
@@ -499,9 +499,8 @@
################################################################
# Wine extensions: OpenGL support
#
-@ stdcall wglCreateContext(long)
+@ stdcall -private wglCreateContext(long)
@ stdcall -private wglGetProcAddress(str)
-@ stdcall wglMakeCurrent(long long)
################################################################
# Wine extensions: Win16 functions that are needed by other dlls
diff --git a/dlls/gdi32/opengl.c b/dlls/gdi32/opengl.c
index d2ab2aa..90c2a87 100644
--- a/dlls/gdi32/opengl.c
+++ b/dlls/gdi32/opengl.c
@@ -101,74 +101,6 @@ static HGLRC WINAPI wglCreateContextAttribsARB(HDC hdc, HGLRC hShareContext, con
return ret;
}
-/***********************************************************************
- * wglMakeCurrent (OPENGL32.@)
- */
-BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
-{
- BOOL ret = FALSE;
- DC * dc = NULL;
-
- /* When the context hglrc is NULL, the HDC is ignored and can be NULL.
- * In that case use the global hDC to get access to the driver. */
- if(hglrc == NULL)
- {
- if (hdc == NULL && !NtCurrentTeb()->glContext)
- {
- WARN( "Current context is NULL\n");
- SetLastError( ERROR_INVALID_HANDLE );
- return FALSE;
- }
- dc = OPENGL_GetDefaultDC();
- }
- else
- dc = get_dc_ptr( hdc );
-
- TRACE("hdc: (%p), hglrc: (%p)\n", hdc, hglrc);
-
- if (dc)
- {
- PHYSDEV physdev = GET_DC_PHYSDEV( dc, pwglMakeCurrent );
- update_dc( dc );
- ret = physdev->funcs->pwglMakeCurrent( physdev, hglrc );
- release_dc_ptr( dc );
- }
- return ret;
-}
-
-/***********************************************************************
- * wglMakeContextCurrentARB
- */
-static BOOL WINAPI wglMakeContextCurrentARB(HDC hDrawDC, HDC hReadDC, HGLRC hglrc)
-{
- BOOL ret = FALSE;
- PHYSDEV draw_physdev, read_physdev;
- DC *DrawDC;
- DC *ReadDC;
-
- TRACE("hDrawDC: (%p), hReadDC: (%p) hglrc: (%p)\n", hDrawDC, hReadDC, hglrc);
-
- /* Both hDrawDC and hReadDC need to be valid */
- DrawDC = get_dc_ptr( hDrawDC );
- if (!DrawDC) return FALSE;
-
- ReadDC = get_dc_ptr( hReadDC );
- if (!ReadDC) {
- release_dc_ptr( DrawDC );
- return FALSE;
- }
-
- update_dc( DrawDC );
- update_dc( ReadDC );
- draw_physdev = GET_DC_PHYSDEV( DrawDC, pwglMakeContextCurrentARB );
- read_physdev = GET_DC_PHYSDEV( ReadDC, pwglMakeContextCurrentARB );
- if (draw_physdev->funcs == read_physdev->funcs)
- ret = draw_physdev->funcs->pwglMakeContextCurrentARB(draw_physdev, read_physdev, hglrc);
- release_dc_ptr( DrawDC );
- release_dc_ptr( ReadDC );
- return ret;
-}
-
/**************************************************************************************
* WINE-specific wglSetPixelFormat which can set the iPixelFormat multiple times
*
@@ -219,8 +151,6 @@ PROC WINAPI wglGetProcAddress(LPCSTR func)
*/
if(ret && strcmp(func, "wglCreateContextAttribsARB") == 0)
return (PROC)wglCreateContextAttribsARB;
- else if(ret && strcmp(func, "wglMakeContextCurrentARB") == 0)
- return (PROC)wglMakeContextCurrentARB;
else if(ret && strcmp(func, "wglSetPixelFormatWINE") == 0)
return (PROC)wglSetPixelFormatWINE;
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index d286a2a..e400f2e 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -48,7 +48,6 @@ WINE_DECLARE_DEBUG_CHANNEL(opengl);
static struct
{
PROC (WINAPI *p_wglGetProcAddress)(LPCSTR lpszProc);
- BOOL (WINAPI *p_wglMakeCurrent)(HDC hdc, HGLRC hglrc);
HGLRC (WINAPI *p_wglCreateContext)(HDC hdc);
INT (WINAPI *p_GetPixelFormat)(HDC hdc);
@@ -60,6 +59,7 @@ static struct
HGLRC (WINAPI *p_wglGetCurrentContext)(void);
HDC (WINAPI *p_wglGetCurrentDC)(void);
void (WINAPI *p_wglGetIntegerv)(GLenum pname, GLint* params);
+ BOOL (WINAPI *p_wglMakeCurrent)(HDC hdc, HGLRC hglrc);
BOOL (WINAPI *p_wglShareLists)(HGLRC hglrc1, HGLRC hglrc2);
} wine_wgl;
@@ -126,7 +126,12 @@ BOOL WINAPI wglDeleteContext(HGLRC hglrc)
*/
BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
{
- return wine_wgl.p_wglMakeCurrent(hdc, hglrc);
+ if (!hglrc && !hdc && !NtCurrentTeb()->glContext)
+ {
+ SetLastError( ERROR_INVALID_HANDLE );
+ return FALSE;
+ }
+ return wine_wgl.p_wglMakeCurrent(hdc, hglrc);
}
/***********************************************************************
@@ -1090,7 +1095,6 @@ static BOOL process_attach(void)
}
wine_wgl.p_wglGetProcAddress = (void *)GetProcAddress(mod_gdi32, "wglGetProcAddress");
- wine_wgl.p_wglMakeCurrent = (void *)GetProcAddress(mod_gdi32, "wglMakeCurrent");
wine_wgl.p_wglCreateContext = (void *)GetProcAddress(mod_gdi32, "wglCreateContext");
wine_wgl.p_GetPixelFormat = (void *)GetProcAddress(mod_gdi32, "GetPixelFormat");
@@ -1102,6 +1106,7 @@ static BOOL process_attach(void)
wine_wgl.p_wglGetCurrentContext = (void *)wine_wgl.p_wglGetProcAddress("wglGetCurrentContext");
wine_wgl.p_wglGetCurrentDC = (void *)wine_wgl.p_wglGetProcAddress("wglGetCurrentDC");
wine_wgl.p_wglGetIntegerv = (void *)wine_wgl.p_wglGetProcAddress("wglGetIntegerv");
+ wine_wgl.p_wglMakeCurrent = (void *)wine_wgl.p_wglGetProcAddress("wglMakeCurrent");
wine_wgl.p_wglShareLists = (void *)wine_wgl.p_wglGetProcAddress("wglShareLists");
return TRUE;
}
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 672d8d0..b78edc3 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1469,6 +1469,8 @@ static HGLRC glxdrv_wglCreateContext(PHYSDEV dev)
return (HGLRC) ret;
}
+static BOOL WINAPI X11DRV_wglMakeCurrent(HDC hdc, HGLRC hglrc);
+
/**
* X11DRV_wglDeleteContext
*
@@ -1497,7 +1499,7 @@ static BOOL WINAPI X11DRV_wglDeleteContext(HGLRC hglrc)
/* WGL makes a context not current if it is active before deletion. GLX waits until the context is not current. */
if (ctx == NtCurrentTeb()->glContext)
- wglMakeCurrent(ctx->hdc, NULL);
+ X11DRV_wglMakeCurrent(ctx->hdc, NULL);
wine_tsx11_lock();
list_remove( &ctx->entry );
@@ -1584,13 +1586,12 @@ static GLXPixmap get_context_pixmap( HDC hdc, struct wine_glcontext *ctx )
}
/**
- * glxdrv_wglMakeCurrent
+ * X11DRV_wglMakeCurrent
*
* For OpenGL32 wglMakeCurrent.
*/
-static BOOL glxdrv_wglMakeCurrent(PHYSDEV dev, HGLRC hglrc)
+static BOOL WINAPI X11DRV_wglMakeCurrent(HDC hdc, HGLRC hglrc)
{
- HDC hdc = dev->hdc;
BOOL ret;
Wine_GLContext *prev_ctx = NtCurrentTeb()->glContext;
Wine_GLContext *ctx = (Wine_GLContext *) hglrc;
@@ -1667,14 +1668,12 @@ static BOOL glxdrv_wglMakeCurrent(PHYSDEV dev, HGLRC hglrc)
}
/**
- * glxdrv_wglMakeContextCurrentARB
+ * X11DRV_wglMakeContextCurrentARB
*
* For OpenGL32 wglMakeContextCurrentARB
*/
-static BOOL glxdrv_wglMakeContextCurrentARB( PHYSDEV draw_dev, PHYSDEV read_dev, HGLRC hglrc )
+static BOOL WINAPI X11DRV_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, HGLRC hglrc )
{
- HDC draw_hdc = draw_dev->hdc;
- HDC read_hdc = read_dev->hdc;
Wine_GLContext *ctx = (Wine_GLContext *)hglrc;
Wine_GLContext *prev_ctx = NtCurrentTeb()->glContext;
struct x11drv_escape_get_drawable escape_draw, escape_read;
@@ -3070,6 +3069,7 @@ static const WineGLExtension WGL_internal_functions =
{ "wglGetCurrentContext", X11DRV_wglGetCurrentContext },
{ "wglGetCurrentDC", X11DRV_wglGetCurrentDC },
{ "wglGetIntegerv", X11DRV_wglGetIntegerv },
+ { "wglMakeCurrent", X11DRV_wglMakeCurrent },
{ "wglShareLists", X11DRV_wglShareLists },
}
};
@@ -3096,7 +3096,7 @@ static const WineGLExtension WGL_ARB_make_current_read =
"WGL_ARB_make_current_read",
{
{ "wglGetCurrentReadDCARB", X11DRV_wglGetCurrentReadDCARB },
- { "wglMakeContextCurrentARB", (void *)1 /* not called directly */ },
+ { "wglMakeContextCurrentARB", X11DRV_wglMakeContextCurrentARB },
}
};
@@ -3584,8 +3584,8 @@ static const struct gdi_dc_funcs glxdrv_funcs =
glxdrv_wglCreateContext, /* pwglCreateContext */
glxdrv_wglCreateContextAttribsARB, /* pwglCreateContextAttribsARB */
glxdrv_wglGetProcAddress, /* pwglGetProcAddress */
- glxdrv_wglMakeContextCurrentARB, /* pwglMakeContextCurrentARB */
- glxdrv_wglMakeCurrent, /* pwglMakeCurrent */
+ NULL, /* pwglMakeContextCurrentARB */
+ NULL, /* pwglMakeCurrent */
glxdrv_wglSetPixelFormatWINE, /* pwglSetPixelFormatWINE */
GDI_PRIORITY_GRAPHICS_DRV + 20 /* priority */
};
More information about the wine-cvs
mailing list