Commit ad7bc71c authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

wgl: Move wglGetCurrentContext to gdi32.

parent ef998ea6
...@@ -499,6 +499,7 @@ ...@@ -499,6 +499,7 @@
# Wine extensions: OpenGL support # Wine extensions: OpenGL support
# #
@ stdcall wglCreateContext(long) @ stdcall wglCreateContext(long)
@ stdcall wglGetCurrentContext()
@ stdcall wglMakeCurrent(long long) @ stdcall wglMakeCurrent(long long)
@ stdcall wglUseFontBitmapsA(long long long long) @ stdcall wglUseFontBitmapsA(long long long long)
@ stdcall wglUseFontBitmapsW(long long long long) @ stdcall wglUseFontBitmapsW(long long long long)
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "winbase.h" #include "winbase.h"
#include "wingdi.h" #include "wingdi.h"
#include "winerror.h" #include "winerror.h"
#include "winternl.h"
#include "winnt.h"
#include "gdi.h" #include "gdi.h"
#include "gdi_private.h" #include "gdi_private.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -73,6 +75,16 @@ HGLRC WINAPI wglCreateContext(HDC hdc) ...@@ -73,6 +75,16 @@ HGLRC WINAPI wglCreateContext(HDC hdc)
} }
/*********************************************************************** /***********************************************************************
* wglGetCurrentContext (OPENGL32.@)
*/
HGLRC WINAPI wglGetCurrentContext(void)
{
HGLRC ret = NtCurrentTeb()->glContext;
TRACE(" returning %p\n", ret);
return ret;
}
/***********************************************************************
* wglMakeCurrent (OPENGL32.@) * wglMakeCurrent (OPENGL32.@)
*/ */
BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc) BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
......
...@@ -381,7 +381,7 @@ ...@@ -381,7 +381,7 @@
@ stdcall wglDeleteContext(long) @ stdcall wglDeleteContext(long)
@ stdcall wglDescribeLayerPlane(long long long long ptr) @ stdcall wglDescribeLayerPlane(long long long long ptr)
@ stdcall wglDescribePixelFormat(long long long ptr) gdi32.DescribePixelFormat @ stdcall wglDescribePixelFormat(long long long ptr) gdi32.DescribePixelFormat
@ stdcall wglGetCurrentContext() @ stdcall wglGetCurrentContext() gdi32.wglGetCurrentContext
@ stdcall wglGetCurrentDC() @ stdcall wglGetCurrentDC()
@ stub wglGetDefaultProcAddress @ stub wglGetDefaultProcAddress
@ stdcall wglGetLayerPaletteEntries(long long long long ptr) @ stdcall wglGetLayerPaletteEntries(long long long long ptr)
......
...@@ -48,7 +48,6 @@ WINE_DECLARE_DEBUG_CHANNEL(opengl); ...@@ -48,7 +48,6 @@ WINE_DECLARE_DEBUG_CHANNEL(opengl);
typedef struct wine_wgl_s { typedef struct wine_wgl_s {
BOOL WINAPI (*p_wglDeleteContext)(HGLRC hglrc); BOOL WINAPI (*p_wglDeleteContext)(HGLRC hglrc);
HGLRC WINAPI (*p_wglGetCurrentContext)(void);
HDC WINAPI (*p_wglGetCurrentDC)(void); HDC WINAPI (*p_wglGetCurrentDC)(void);
PROC WINAPI (*p_wglGetProcAddress)(LPCSTR lpszProc); PROC WINAPI (*p_wglGetProcAddress)(LPCSTR lpszProc);
BOOL WINAPI (*p_wglShareLists)(HGLRC hglrc1, HGLRC hglrc2); BOOL WINAPI (*p_wglShareLists)(HGLRC hglrc1, HGLRC hglrc2);
...@@ -173,14 +172,6 @@ BOOL WINAPI wglDescribeLayerPlane(HDC hdc, ...@@ -173,14 +172,6 @@ BOOL WINAPI wglDescribeLayerPlane(HDC hdc,
} }
/*********************************************************************** /***********************************************************************
* wglGetCurrentContext (OPENGL32.@)
*/
HGLRC WINAPI wglGetCurrentContext(void) {
TRACE("\n");
return wine_wgl.p_wglGetCurrentContext();
}
/***********************************************************************
* wglGetCurrentDC (OPENGL32.@) * wglGetCurrentDC (OPENGL32.@)
*/ */
HDC WINAPI wglGetCurrentDC(void) { HDC WINAPI wglGetCurrentDC(void) {
...@@ -650,7 +641,6 @@ static BOOL process_attach(void) ...@@ -650,7 +641,6 @@ static BOOL process_attach(void)
/* Load WGL function pointers from winex11.drv */ /* Load WGL function pointers from winex11.drv */
wine_wgl.p_wglDeleteContext = (void *)GetProcAddress(mod, "wglDeleteContext"); wine_wgl.p_wglDeleteContext = (void *)GetProcAddress(mod, "wglDeleteContext");
wine_wgl.p_wglGetCurrentContext = (void *)GetProcAddress(mod, "wglGetCurrentContext");
wine_wgl.p_wglGetCurrentDC = (void *)GetProcAddress(mod, "wglGetCurrentDC"); wine_wgl.p_wglGetCurrentDC = (void *)GetProcAddress(mod, "wglGetCurrentDC");
wine_wgl.p_wglGetProcAddress = (void *)GetProcAddress(mod, "wglGetProcAddress"); wine_wgl.p_wglGetProcAddress = (void *)GetProcAddress(mod, "wglGetProcAddress");
wine_wgl.p_wglShareLists = (void *)GetProcAddress(mod, "wglShareLists"); wine_wgl.p_wglShareLists = (void *)GetProcAddress(mod, "wglShareLists");
......
...@@ -1272,23 +1272,6 @@ BOOL WINAPI X11DRV_wglDeleteContext(HGLRC hglrc) ...@@ -1272,23 +1272,6 @@ BOOL WINAPI X11DRV_wglDeleteContext(HGLRC hglrc)
return ret; return ret;
} }
/* OpenGL32 wglGetCurrentContext() */
HGLRC WINAPI X11DRV_wglGetCurrentContext(void) {
GLXContext gl_ctx;
Wine_GLContext *ret;
TRACE("()\n");
wine_tsx11_lock();
gl_ctx = pglXGetCurrentContext();
ret = get_context_from_GLXContext(gl_ctx);
wine_tsx11_unlock();
TRACE(" returning %p (GL context %p)\n", ret, gl_ctx);
return (HGLRC)ret;
}
/* OpenGL32 wglGetCurrentDC */ /* OpenGL32 wglGetCurrentDC */
HDC WINAPI X11DRV_wglGetCurrentDC(void) { HDC WINAPI X11DRV_wglGetCurrentDC(void) {
GLXContext gl_ctx; GLXContext gl_ctx;
...@@ -1417,6 +1400,7 @@ static BOOL WINAPI X11DRV_wglMakeContextCurrentARB(HDC hDrawDC, HDC hReadDC, HGL ...@@ -1417,6 +1400,7 @@ static BOOL WINAPI X11DRV_wglMakeContextCurrentARB(HDC hDrawDC, HDC hReadDC, HGL
wine_tsx11_lock(); wine_tsx11_lock();
if (hglrc == NULL) { if (hglrc == NULL) {
ret = pglXMakeCurrent(gdi_display, None, NULL); ret = pglXMakeCurrent(gdi_display, None, NULL);
NtCurrentTeb()->glContext = NULL;
} else { } else {
if (NULL == pglXMakeContextCurrent) { if (NULL == pglXMakeContextCurrent) {
ret = FALSE; ret = FALSE;
...@@ -1430,6 +1414,7 @@ static BOOL WINAPI X11DRV_wglMakeContextCurrentARB(HDC hDrawDC, HDC hReadDC, HGL ...@@ -1430,6 +1414,7 @@ static BOOL WINAPI X11DRV_wglMakeContextCurrentARB(HDC hDrawDC, HDC hReadDC, HGL
TRACE(" created a delayed OpenGL context (%p)\n", ctx->ctx); TRACE(" created a delayed OpenGL context (%p)\n", ctx->ctx);
} }
ret = pglXMakeContextCurrent(ctx->display, d_draw, d_read, ctx->ctx); ret = pglXMakeContextCurrent(ctx->display, d_draw, d_read, ctx->ctx);
NtCurrentTeb()->glContext = ctx;
} }
} }
wine_tsx11_unlock(); wine_tsx11_unlock();
...@@ -2369,7 +2354,7 @@ static GLboolean WINAPI X11DRV_wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuf ...@@ -2369,7 +2354,7 @@ static GLboolean WINAPI X11DRV_wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuf
do_init = 1; do_init = 1;
} }
object->prev_hdc = X11DRV_wglGetCurrentDC(); object->prev_hdc = X11DRV_wglGetCurrentDC();
object->prev_ctx = X11DRV_wglGetCurrentContext(); object->prev_ctx = wglGetCurrentContext();
/* FIXME: This is routed through gdi32.dll to winex11.drv, replace this with GLX calls */ /* FIXME: This is routed through gdi32.dll to winex11.drv, replace this with GLX calls */
wglMakeCurrent(object->render_hdc, object->render_ctx); wglMakeCurrent(object->render_hdc, object->render_ctx);
/* /*
...@@ -2799,12 +2784,6 @@ BOOL WINAPI X11DRV_wglDeleteContext(HGLRC hglrc) { ...@@ -2799,12 +2784,6 @@ BOOL WINAPI X11DRV_wglDeleteContext(HGLRC hglrc) {
return FALSE; return FALSE;
} }
/* OpenGL32 wglGetCurrentContext() */
HGLRC WINAPI X11DRV_wglGetCurrentContext(void) {
ERR_(opengl)("No OpenGL support compiled in.\n");
return NULL;
}
/* OpenGL32 wglGetCurrentDC */ /* OpenGL32 wglGetCurrentDC */
HDC WINAPI X11DRV_wglGetCurrentDC(void) { HDC WINAPI X11DRV_wglGetCurrentDC(void) {
ERR_(opengl)("No OpenGL support compiled in.\n"); ERR_(opengl)("No OpenGL support compiled in.\n");
......
...@@ -131,7 +131,6 @@ ...@@ -131,7 +131,6 @@
# OpenGL # OpenGL
@ cdecl wglCreateContext(long) X11DRV_wglCreateContext @ cdecl wglCreateContext(long) X11DRV_wglCreateContext
@ cdecl wglDeleteContext(long) X11DRV_wglDeleteContext @ cdecl wglDeleteContext(long) X11DRV_wglDeleteContext
@ cdecl wglGetCurrentContext() X11DRV_wglGetCurrentContext
@ cdecl wglGetCurrentDC() X11DRV_wglGetCurrentDC @ cdecl wglGetCurrentDC() X11DRV_wglGetCurrentDC
@ cdecl wglGetIntegerv(long ptr) X11DRV_wglGetIntegerv @ cdecl wglGetIntegerv(long ptr) X11DRV_wglGetIntegerv
@ cdecl wglGetProcAddress(ptr) X11DRV_wglGetProcAddress @ cdecl wglGetProcAddress(ptr) X11DRV_wglGetProcAddress
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment