Commit 4b212dc4 authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

gdi32: Route WGL context code through gdi32.dll.

parent 2fb8ea4d
......@@ -44,6 +44,7 @@ C_SRCS = \
mfdrv/mapping.c \
mfdrv/objects.c \
mfdrv/text.c \
opengl.c \
painting.c \
palette.c \
path.c \
......
......@@ -194,6 +194,10 @@ static struct graphics_driver *create_driver( HMODULE module )
GET_FUNC(StrokePath);
GET_FUNC(SwapBuffers);
GET_FUNC(WidenPath);
/* OpenGL32 */
GET_FUNC(wglCreateContext);
GET_FUNC(wglMakeCurrent);
#undef GET_FUNC
}
else memset( &driver->funcs, 0, sizeof(driver->funcs) );
......
......@@ -496,6 +496,12 @@
@ stub pstackConnect
################################################################
# Wine extensions: OpenGL support
#
@ stdcall wglCreateContext(long)
@ stdcall wglMakeCurrent(long long)
################################################################
# Wine extensions: Win16 functions that are needed by other dlls
#
@ stdcall CloseJob16(long)
......
......@@ -182,6 +182,10 @@ typedef struct tagDC_FUNCS
BOOL (*pStrokePath)(PHYSDEV);
BOOL (*pSwapBuffers)(PHYSDEV);
BOOL (*pWidenPath)(PHYSDEV);
/* OpenGL32 */
HGLRC (*pwglCreateContext)(PHYSDEV);
BOOL (*pwglMakeCurrent)(PHYSDEV, HGLRC);
} DC_FUNCTIONS;
/* It should not be necessary to access the contents of the GdiPath
......
/*
* OpenGL function forwarding to the display driver
*
* Copyright (c) 1999 Lionel Ulmer
* Copyright (c) 2005 Raphael Junqueira
* Copyright (c) 2006 Roderick Colenbrander
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winerror.h"
#include "gdi.h"
#include "gdi_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wgl);
/***********************************************************************
* wglCreateContext (OPENGL32.@)
*/
HGLRC WINAPI wglCreateContext(HDC hdc)
{
HGLRC ret = 0;
DC * dc = DC_GetDCPtr( hdc );
TRACE("(%p)\n",hdc);
if (!dc) return 0;
if (!dc->funcs->pwglCreateContext) FIXME(" :stub\n");
else ret = dc->funcs->pwglCreateContext(dc->physDev);
GDI_ReleaseObj( hdc );
return ret;
}
/***********************************************************************
* wglMakeCurrent (OPENGL32.@)
*/
BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
{
BOOL ret = FALSE;
DC * dc = DC_GetDCPtr( hdc );
TRACE("hdc: (%p), hglrc: (%p)\n", hdc, hglrc);
if (!dc) return FALSE;
if (!dc->funcs->pwglMakeCurrent) FIXME(" :stub\n");
else ret = dc->funcs->pwglMakeCurrent(dc->physDev,hglrc);
GDI_ReleaseObj( hdc);
return ret;
}
......@@ -376,7 +376,7 @@
@ stdcall glViewport( long long long long ) wine_glViewport
@ stdcall wglChoosePixelFormat(long ptr) gdi32.ChoosePixelFormat
@ stdcall wglCopyContext(long long long)
@ stdcall wglCreateContext(long)
@ stdcall wglCreateContext(long) gdi32.wglCreateContext
@ stdcall wglCreateLayerContext(long long)
@ stdcall wglDeleteContext(long)
@ stdcall wglDescribeLayerPlane(long long long long ptr)
......@@ -387,7 +387,7 @@
@ stdcall wglGetLayerPaletteEntries(long long long long ptr)
@ stdcall wglGetPixelFormat(long) gdi32.GetPixelFormat
@ stdcall wglGetProcAddress(str)
@ stdcall wglMakeCurrent(long long)
@ stdcall wglMakeCurrent(long long) gdi32.wglMakeCurrent
@ stdcall wglRealizeLayerPalette(long long long)
@ stdcall wglSetLayerPaletteEntries(long long long long ptr)
@ stdcall wglSetPixelFormat(long long ptr) gdi32.SetPixelFormat
......
......@@ -47,12 +47,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(wgl);
WINE_DECLARE_DEBUG_CHANNEL(opengl);
typedef struct wine_wgl_s {
HGLRC WINAPI (*p_wglCreateContext)(HDC hdc);
BOOL WINAPI (*p_wglDeleteContext)(HGLRC hglrc);
HGLRC WINAPI (*p_wglGetCurrentContext)(void);
HDC WINAPI (*p_wglGetCurrentDC)(void);
PROC WINAPI (*p_wglGetProcAddress)(LPCSTR lpszProc);
BOOL WINAPI (*p_wglMakeCurrent)(HDC hdc, HGLRC hglrc);
BOOL WINAPI (*p_wglShareLists)(HGLRC hglrc1, HGLRC hglrc2);
BOOL WINAPI (*p_wglUseFontBitmapsA)(HDC hdc, DWORD first, DWORD count, DWORD listBase);
BOOL WINAPI (*p_wglUseFontBitmapsW)(HDC hdc, DWORD first, DWORD count, DWORD listBase);
......@@ -129,15 +127,6 @@ inline static Display *get_display( HDC hdc )
}
/***********************************************************************
* wglCreateContext (OPENGL32.@)
*/
HGLRC WINAPI wglCreateContext(HDC hdc)
{
TRACE("(%p)\n", hdc);
return wine_wgl.p_wglCreateContext(hdc);
}
/***********************************************************************
* wglCreateLayerContext (OPENGL32.@)
*/
HGLRC WINAPI wglCreateLayerContext(HDC hdc,
......@@ -288,14 +277,6 @@ PROC WINAPI wglGetProcAddress(LPCSTR lpszProc) {
}
/***********************************************************************
* wglMakeCurrent (OPENGL32.@)
*/
BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc) {
TRACE("hdc: (%p), hglrc: (%p)\n", hdc, hglrc);
return wine_wgl.p_wglMakeCurrent(hdc, hglrc);
}
/***********************************************************************
* wglRealizeLayerPalette (OPENGL32.@)
*/
BOOL WINAPI wglRealizeLayerPalette(HDC hdc,
......@@ -694,12 +675,10 @@ static BOOL process_attach(void)
wine_tsx11_unlock_ptr = (void *)GetProcAddress( mod, "wine_tsx11_unlock" );
/* Load WGL function pointers from winex11.drv */
wine_wgl.p_wglCreateContext = (void *)GetProcAddress(mod, "wglCreateContext");
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_wglGetProcAddress = (void *)GetProcAddress(mod, "wglGetProcAddress");
wine_wgl.p_wglMakeCurrent = (void *)GetProcAddress(mod, "wglMakeCurrent");
wine_wgl.p_wglShareLists = (void *)GetProcAddress(mod, "wglShareLists");
wine_wgl.p_wglUseFontBitmapsA = (void*)GetProcAddress(mod, "wglUseFontBitmapsA");
wine_wgl.p_wglUseFontBitmapsW = (void*)GetProcAddress(mod, "wglUseFontBitmapsW");
......
......@@ -1194,7 +1194,7 @@ BOOL X11DRV_SetPixelFormat(X11DRV_PDEVICE *physDev,
}
/* OpenGL32 wglCreateContext */
HGLRC WINAPI X11DRV_wglCreateContext(HDC hdc)
HGLRC X11DRV_wglCreateContext(X11DRV_PDEVICE *physDev)
{
Wine_GLContext *ret;
GLXFBConfig* cfgs_fmt = NULL;
......@@ -1205,6 +1205,7 @@ HGLRC WINAPI X11DRV_wglCreateContext(HDC hdc)
int nCfgs_fmt = 0;
int value = 0;
int gl_test = 0;
HDC hdc = physDev->hdc;
TRACE("(%p)->(PF:%d)\n", hdc, hdcPF);
......@@ -1365,8 +1366,9 @@ PROC X11DRV_wglGetProcAddress(LPCSTR lpszProc)
/* OpenGL32 wglMakeCurrent */
BOOL WINAPI X11DRV_wglMakeCurrent(HDC hdc, HGLRC hglrc) {
BOOL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
BOOL ret;
HDC hdc = physDev->hdc;
DWORD type = GetObjectType(hdc);
TRACE("(%p,%p)\n", hdc, hglrc);
......@@ -1377,7 +1379,7 @@ BOOL WINAPI X11DRV_wglMakeCurrent(HDC hdc, HGLRC hglrc) {
NtCurrentTeb()->glContext = NULL;
} else {
Wine_GLContext *ctx = (Wine_GLContext *) hglrc;
Drawable drawable = get_drawable( hdc );
Drawable drawable = physDev->drawable;
if (ctx->ctx == NULL) {
int draw_vis_id, ctx_vis_id;
VisualID visualid = (VisualID)GetPropA( GetDesktopWindow(), "__wine_x11_visual_id" );
......@@ -2373,12 +2375,14 @@ static GLboolean WINAPI X11DRV_wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuf
pglGetIntegerv(object->texture_target, &prev_binded_tex);
if (NULL == object->render_ctx) {
object->render_hdc = X11DRV_wglGetPbufferDCARB(hPbuffer);
object->render_ctx = X11DRV_wglCreateContext(object->render_hdc);
/* FIXME: This is routed through gdi32.dll to winex11.drv, replace this with GLX calls */
object->render_ctx = wglCreateContext(object->render_hdc);
do_init = 1;
}
object->prev_hdc = X11DRV_wglGetCurrentDC();
object->prev_ctx = X11DRV_wglGetCurrentContext();
X11DRV_wglMakeCurrent(object->render_hdc, object->render_ctx);
/* FIXME: This is routed through gdi32.dll to winex11.drv, replace this with GLX calls */
wglMakeCurrent(object->render_hdc, object->render_ctx);
/*
if (do_init) {
glBindTexture(object->texture_target, object->texture);
......@@ -2430,7 +2434,8 @@ static GLboolean WINAPI X11DRV_wglReleaseTexImageARB(HPBUFFERARB hPbuffer, int i
pglCopyTexSubImage2D(object->texture_target, object->texture_level, 0, 0, 0, 0, object->width, object->height);
}
X11DRV_wglMakeCurrent(object->prev_hdc, object->prev_ctx);
/* FIXME: This is routed through gdi32.dll to winex11.drv, replace this with GLX calls */
wglMakeCurrent(object->prev_hdc, object->prev_ctx);
return GL_TRUE;
}
if (NULL != pglXReleaseTexImageARB) {
......
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