sources = [
'icd/stw_icd.c',
+ 'shared/stw_context.c',
'shared/stw_device.c',
'shared/stw_framebuffer.c',
'shared/stw_pixelformat.c',
'wgl/stw_wgl_arbextensionsstring.c',
'wgl/stw_wgl_arbmultisample.c',
'wgl/stw_wgl_arbpixelformat.c',
- #'wgl/stw_wgl.c',
- 'wgl/stw_wgl_context.c',
+ 'wgl/stw_wgl.c',
'wgl/stw_wgl_getprocaddress.c',
'wgl/stw_wgl_pixelformat.c',
'wgl/stw_wgl_swapbuffers.c',
#include "pipe/p_debug.h"
#include "shared/stw_device.h"
+#include "shared/stw_context.h"
#include "icd/stw_icd.h"
#include "wgl/stw_wgl.h"
static HGLRC
-_drv_lookup_hglrc( DHGLRC dhglrc )
+lookup_hglrc( DHGLRC dhglrc )
{
- if (dhglrc == 0 || dhglrc >= DRV_CONTEXT_MAX)
+ if (dhglrc == 0 ||
+ dhglrc >= DRV_CONTEXT_MAX)
return NULL;
+
return stw_dev->ctx_array[dhglrc - 1].hglrc;
}
DHGLRC dhrcDest,
UINT fuMask )
{
- debug_printf( "%s\n", __FUNCTION__ );
-
- return FALSE;
+ HGLRC src = lookup_hglrc( dhrcSource );
+ HGLRC dst = lookup_hglrc( dhrcDest );
+
+ if (src == NULL ||
+ dst == NULL)
+ return FALSE;
+
+ return stw_wgl_copy_context( src, dst, fuMask );
}
DHGLRC APIENTRY
HDC hdc,
INT iLayerPlane )
{
- DHGLRC dhglrc = 0;
-
- if (iLayerPlane == 0) {
- DWORD i;
-
- for (i = 0; i < DRV_CONTEXT_MAX; i++) {
- if (stw_dev->ctx_array[i].hglrc == NULL)
- break;
- }
-
- if (i < DRV_CONTEXT_MAX) {
- stw_dev->ctx_array[i].hglrc = wglCreateContext( hdc );
- if (stw_dev->ctx_array[i].hglrc != NULL)
- dhglrc = i + 1;
- }
+ DWORD i;
+
+ for (i = 0; i < DRV_CONTEXT_MAX; i++) {
+ if (stw_dev->ctx_array[i].hglrc == NULL)
+ goto found_slot;
}
+
+ /* No slot available, fail:
+ */
+ return 0;
- debug_printf( "%s( 0x%p, %d ) = %u\n", __FUNCTION__, hdc, iLayerPlane, dhglrc );
+found_slot:
+ stw_dev->ctx_array[i].hglrc = stw_wgl_create_context( hdc, iLayerPlane );
+ if (stw_dev->ctx_array[i].hglrc == NULL)
+ return 0;
- return dhglrc;
+ return (DHGLRC) i + 1;
}
DHGLRC APIENTRY
DrvDeleteContext(
DHGLRC dhglrc )
{
- HGLRC hglrc = _drv_lookup_hglrc( dhglrc );
+ HGLRC hglrc = lookup_hglrc( dhglrc );
BOOL success = FALSE;
if (hglrc != NULL) {
- success = wglDeleteContext( hglrc );
+ success = stw_wgl_delete_context( hglrc );
if (success)
stw_dev->ctx_array[dhglrc - 1].hglrc = NULL;
}
r = wglDescribePixelFormat( hdc, iPixelFormat, cjpfd, ppfd );
- debug_printf( "%s( 0x%p, %d, %u, 0x%p ) = %d\n", __FUNCTION__, hdc, iPixelFormat, cjpfd, ppfd, r );
+ debug_printf( "%s( 0x%p, %d, %u, 0x%p ) = %d\n",
+ __FUNCTION__, hdc, iPixelFormat, cjpfd, ppfd, r );
return r;
}
BOOL success = FALSE;
if (dhglrc == stw_dev->ctx_current) {
- HGLRC hglrc = _drv_lookup_hglrc( dhglrc );
+ HGLRC hglrc = lookup_hglrc( dhglrc );
if (hglrc != NULL) {
success = wglMakeCurrent( NULL, NULL );
DHGLRC dhglrc,
PFN_SETPROCTABLE pfnSetProcTable )
{
- HGLRC hglrc = _drv_lookup_hglrc( dhglrc );
+ HGLRC hglrc = lookup_hglrc( dhglrc );
GLDISPATCHTABLE *disp = &cpt.glDispatchTable;
debug_printf( "%s( 0x%p, %u, 0x%p )\n", __FUNCTION__, hdc, dhglrc, pfnSetProcTable );
#include "shared/stw_winsys.h"
#include "shared/stw_framebuffer.h"
#include "shared/stw_pixelformat.h"
-#include "stw_wgl_arbmultisample.h"
-#include "stw_wgl_context.h"
-#include "stw_wgl.h"
+#include "wgl/stw_wgl_arbmultisample.h"
+#include "stw_context.h"
+//#include "stw_wgl.h"
static struct wgl_context *ctx_head = NULL;
static HDC current_hdc = NULL;
static HGLRC current_hrc = NULL;
-WINGDIAPI BOOL APIENTRY
-wglCopyContext(
+BOOL
+stw_wgl_copy_context(
HGLRC hglrcSrc,
HGLRC hglrcDst,
UINT mask )
return FALSE;
}
-WINGDIAPI HGLRC APIENTRY
-wglCreateContext(
- HDC hdc )
+HGLRC
+stw_wgl_create_context(
+ HDC hdc,
+ int iLayerPlane )
{
uint pfi;
const struct pixelformat_info *pf;
GLvisual *visual;
struct pipe_context *pipe;
+ if (iLayerPlane != 0)
+ return NULL;
+
pfi = wglGetPixelFormat( hdc );
if (pfi == 0)
return NULL;
return (HGLRC) ctx;
}
-WINGDIAPI HGLRC APIENTRY
-wglCreateLayerContext(
- HDC hdc,
- int iLayerPlane )
-{
- (void) hdc;
- (void) iLayerPlane;
-
- return NULL;
-}
-WINGDIAPI BOOL APIENTRY
-wglDeleteContext(
+BOOL
+stw_wgl_delete_context(
HGLRC hglrc )
{
struct wgl_context **link = &ctx_head;
}
}
-WINGDIAPI HGLRC APIENTRY
-wglGetCurrentContext( VOID )
+HGLRC
+stw_wgl_get_current_context( void )
{
return current_hrc;
}
-WINGDIAPI HDC APIENTRY
-wglGetCurrentDC( VOID )
+HDC
+stw_wgl_get_current_dc( void )
{
return current_hdc;
}
-WINGDIAPI BOOL APIENTRY
-wglMakeCurrent(
+BOOL
+stw_wgl_make_current(
HDC hdc,
HGLRC hglrc )
{
}
return NULL;
}
-
-#include "stw_wgl.c"
#include <windows.h>
#include "pipe/p_debug.h"
+#include "shared/stw_context.h"
+#include "stw_wgl.h"
+
+
+WINGDIAPI BOOL APIENTRY
+wglCopyContext(
+ HGLRC hglrcSrc,
+ HGLRC hglrcDst,
+ UINT mask )
+{
+ return stw_wgl_copy_context( hglrcSrc, hglrcDst, mask );
+}
+
+WINGDIAPI HGLRC APIENTRY
+wglCreateContext(
+ HDC hdc )
+{
+ return (HGLRC) stw_wgl_create_context( hdc, 0 );
+}
+
+WINGDIAPI HGLRC APIENTRY
+wglCreateLayerContext(
+ HDC hdc,
+ int iLayerPlane )
+{
+ return (HGLRC) stw_wgl_create_context( hdc, iLayerPlane );
+}
+
+WINGDIAPI BOOL APIENTRY
+wglDeleteContext(
+ HGLRC hglrc )
+{
+ return stw_wgl_delete_context( hglrc );
+}
+
+
+WINGDIAPI HGLRC APIENTRY
+wglGetCurrentContext( VOID )
+{
+ return stw_wgl_get_current_context();
+}
+
+WINGDIAPI HDC APIENTRY
+wglGetCurrentDC( VOID )
+{
+ return stw_wgl_get_current_dc();
+}
+
+WINGDIAPI BOOL APIENTRY
+wglMakeCurrent(
+ HDC hdc,
+ HGLRC hglrc )
+{
+ return stw_wgl_make_current( hdc, hglrc );
+}
+
+
WINGDIAPI BOOL APIENTRY
wglUseFontBitmapsA(