Alexandre Julliard : winex11: Move wglGetCurrentContext and wglGetCurrentDC to the internal OpenGL extension functions .
Alexandre Julliard
julliard at winehq.org
Mon Jun 25 13:24:12 CDT 2012
Module: wine
Branch: master
Commit: 66a5995e119d9f91d33bf21cbe1a43e643c86c4e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=66a5995e119d9f91d33bf21cbe1a43e643c86c4e
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Jun 25 16:22:16 2012 +0200
winex11: Move wglGetCurrentContext and wglGetCurrentDC to the internal OpenGL extension functions.
---
dlls/opengl32/wgl.c | 12 ++++++------
dlls/wined3d/directx.c | 4 ++++
dlls/wined3d/wined3d_gl.h | 2 --
dlls/winex11.drv/opengl.c | 24 +++++++++++++++++++++++-
4 files changed, 33 insertions(+), 9 deletions(-)
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index a3b5319..7a195be 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -50,9 +50,7 @@ static struct
PROC (WINAPI *p_wglGetProcAddress)(LPCSTR lpszProc);
BOOL (WINAPI *p_SetPixelFormat)(HDC hdc, INT iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd);
BOOL (WINAPI *p_wglMakeCurrent)(HDC hdc, HGLRC hglrc);
- HDC (WINAPI *p_wglGetCurrentDC)(void);
HGLRC (WINAPI *p_wglCreateContext)(HDC hdc);
- HGLRC (WINAPI *p_wglGetCurrentContext)(void);
INT (WINAPI *p_ChoosePixelFormat)(HDC hdc, const PIXELFORMATDESCRIPTOR* ppfd);
INT (WINAPI *p_DescribePixelFormat)(HDC hdc, INT iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR ppfd);
INT (WINAPI *p_GetPixelFormat)(HDC hdc);
@@ -60,9 +58,11 @@ static struct
/* 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);
+ HGLRC (WINAPI *p_wglGetCurrentContext)(void);
+ HDC (WINAPI *p_wglGetCurrentDC)(void);
+ void (WINAPI *p_wglGetIntegerv)(GLenum pname, GLint* params);
BOOL (WINAPI *p_wglShareLists)(HGLRC hglrc1, HGLRC hglrc2);
} wine_wgl;
@@ -932,9 +932,7 @@ 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_wglMakeCurrent = (void *)GetProcAddress(mod_gdi32, "wglMakeCurrent");
- wine_wgl.p_wglGetCurrentDC = (void *)GetProcAddress(mod_gdi32, "wglGetCurrentDC");
wine_wgl.p_wglCreateContext = (void *)GetProcAddress(mod_gdi32, "wglCreateContext");
- wine_wgl.p_wglGetCurrentContext = (void *)GetProcAddress(mod_gdi32, "wglGetCurrentContext");
wine_wgl.p_ChoosePixelFormat = (void *)GetProcAddress(mod_gdi32, "ChoosePixelFormat");
wine_wgl.p_DescribePixelFormat = (void *)GetProcAddress(mod_gdi32, "DescribePixelFormat");
wine_wgl.p_GetPixelFormat = (void *)GetProcAddress(mod_gdi32, "GetPixelFormat");
@@ -942,9 +940,11 @@ static BOOL process_attach(void)
/* 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");
+ 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_wglShareLists = (void *)wine_wgl.p_wglGetProcAddress("wglShareLists");
if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\OpenGL", &hkey)) {
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 0647ae3..1d0407d 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -5360,11 +5360,15 @@ static BOOL InitAdapters(struct wined3d *wined3d)
wglFinish = (void*)GetProcAddress(mod_gl, "glFinish");
wglFlush = (void*)GetProcAddress(mod_gl, "glFlush");
pwglDeleteContext = (void*)GetProcAddress(mod_gl, "wglDeleteContext");
+ pwglGetCurrentContext = (void*)GetProcAddress(mod_gl, "wglGetCurrentContext");
+ pwglGetCurrentDC = (void*)GetProcAddress(mod_gl, "wglGetCurrentDC");
pwglShareLists = (void*)GetProcAddress(mod_gl, "wglShareLists");
#else
wglFinish = (void*)pwglGetProcAddress("wglFinish");
wglFlush = (void*)pwglGetProcAddress("wglFlush");
pwglDeleteContext = (void*)pwglGetProcAddress("wglDeleteContext");
+ pwglGetCurrentContext = (void*)pwglGetProcAddress("wglGetCurrentContext");
+ pwglGetCurrentDC = (void*)pwglGetProcAddress("wglGetCurrentDC");
pwglShareLists = (void*)pwglGetProcAddress("wglShareLists");
#endif
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
index fa39de5..2ffb14b 100644
--- a/dlls/wined3d/wined3d_gl.h
+++ b/dlls/wined3d/wined3d_gl.h
@@ -1713,8 +1713,6 @@ BOOL (WINAPI *pwglShareLists)(HGLRC, HGLRC) DECLSPEC_HIDDEN;
#define WGL_FUNCS_GEN \
USE_WGL_FUNC(wglCreateContext) \
- USE_WGL_FUNC(wglGetCurrentContext) \
- USE_WGL_FUNC(wglGetCurrentDC) \
USE_WGL_FUNC(wglGetProcAddress) \
USE_WGL_FUNC(wglMakeCurrent)
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 62802b85..d3118c2 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -2005,6 +2005,26 @@ static BOOL WINAPI X11DRV_wglShareLists(HGLRC hglrc1, HGLRC hglrc2)
return FALSE;
}
+/***********************************************************************
+ * X11DRV_wglGetCurrentContext
+ */
+static HGLRC WINAPI X11DRV_wglGetCurrentContext(void)
+{
+ return NtCurrentTeb()->glContext;
+}
+
+/***********************************************************************
+ * X11DRV_wglGetCurrentDC
+ */
+static HDC WINAPI X11DRV_wglGetCurrentDC(void)
+{
+ Wine_GLContext *ctx = NtCurrentTeb()->glContext;
+
+ if (!ctx) return NULL;
+ TRACE("hdc %p\n", ctx->hdc);
+ return ctx->hdc;
+}
+
/* WGL helper function which handles differences in glGetIntegerv from WGL and GLX */
static void WINAPI X11DRV_wglGetIntegerv(GLenum pname, GLint* params)
{
@@ -3251,9 +3271,11 @@ static const WineGLExtension WGL_internal_functions =
{
{ "wglCopyContext", X11DRV_wglCopyContext },
{ "wglDeleteContext", X11DRV_wglDeleteContext },
- { "wglGetIntegerv", X11DRV_wglGetIntegerv },
{ "wglFinish", X11DRV_wglFinish },
{ "wglFlush", X11DRV_wglFlush },
+ { "wglGetCurrentContext", X11DRV_wglGetCurrentContext },
+ { "wglGetCurrentDC", X11DRV_wglGetCurrentDC },
+ { "wglGetIntegerv", X11DRV_wglGetIntegerv },
{ "wglShareLists", X11DRV_wglShareLists },
}
};
More information about the wine-cvs
mailing list