summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/wgl
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-03-20 10:52:17 +1000
committerDave Airlie <airlied@redhat.com>2009-03-20 10:52:17 +1000
commit407e8ae5b167b0193e1e5b1266a5d61ed836dfb5 (patch)
tree2d9d05a5c3122f41a13aa8bd9ae921c1176e6b0d /src/gallium/state_trackers/wgl
parentbdaa0341caffc353fd26bbd91865c2d86eed11c1 (diff)
parent114bb54324f22cb53bcd14607234d0acd74d37bd (diff)
Merge remote branch 'main/master' into radeon-rewrite
Conflicts: src/mesa/drivers/dri/r300/r300_cmdbuf.c src/mesa/drivers/dri/r300/r300_state.c src/mesa/drivers/dri/r300/r300_swtcl.c src/mesa/drivers/dri/r300/radeon_ioctl.c src/mesa/drivers/dri/radeon/radeon_screen.c
Diffstat (limited to 'src/gallium/state_trackers/wgl')
-rw-r--r--src/gallium/state_trackers/wgl/SConscript5
-rw-r--r--src/gallium/state_trackers/wgl/icd/stw_icd.c253
-rw-r--r--src/gallium/state_trackers/wgl/opengl32.mingw.def387
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_context.c213
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_context.h11
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_device.c69
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_device.h25
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_framebuffer.c49
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_pixelformat.c14
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_public.h27
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_quirks.c3
-rw-r--r--src/gallium/state_trackers/wgl/stw.c57
-rw-r--r--src/gallium/state_trackers/wgl/stw.h53
-rw-r--r--src/gallium/state_trackers/wgl/wgl/stw_wgl.c32
-rw-r--r--src/gallium/state_trackers/wgl/wgl/stw_wgl.h2
15 files changed, 731 insertions, 469 deletions
diff --git a/src/gallium/state_trackers/wgl/SConscript b/src/gallium/state_trackers/wgl/SConscript
index c72f495735..2141b02d68 100644
--- a/src/gallium/state_trackers/wgl/SConscript
+++ b/src/gallium/state_trackers/wgl/SConscript
@@ -14,13 +14,10 @@ if env['platform'] in ['windows']:
env.Append(CPPDEFINES = [
'_GDI32_', # prevent wgl* being declared __declspec(dllimport)
'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
- '__GL_EXPORTS',
- '_GNU_H_WINDOWS32_DEFINES',
+ 'WIN32_THREADS', # use Win32 thread API
])
sources = [
- 'stw.c',
-
'icd/stw_icd.c',
'wgl/stw_wgl.c',
diff --git a/src/gallium/state_trackers/wgl/icd/stw_icd.c b/src/gallium/state_trackers/wgl/icd/stw_icd.c
index 1aa4b8a6e2..faf7f2f410 100644
--- a/src/gallium/state_trackers/wgl/icd/stw_icd.c
+++ b/src/gallium/state_trackers/wgl/icd/stw_icd.c
@@ -30,82 +30,17 @@
#include "GL/gl.h"
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
#include "pipe/p_thread.h"
#include "shared/stw_public.h"
#include "icd/stw_icd.h"
-#include "stw.h"
+#define DBG 0
-#define DRV_CONTEXT_MAX 32
+static GLCLTPROCTABLE cpt;
+static boolean cpt_initialized = FALSE;
-struct stw_icd
-{
- pipe_mutex mutex;
-
- GLCLTPROCTABLE cpt;
- boolean cpt_initialized;
-
- struct {
- struct stw_context *ctx;
- } ctx_array[DRV_CONTEXT_MAX];
-};
-
-
-static struct stw_icd *stw_icd = NULL;
-
-
-boolean
-stw_icd_init( void )
-{
- static struct stw_icd stw_icd_storage;
-
- assert(!stw_icd);
-
- stw_icd = &stw_icd_storage;
- memset(stw_icd, 0, sizeof *stw_icd);
-
- pipe_mutex_init( stw_icd->mutex );
-
- return TRUE;
-}
-
-void
-stw_icd_cleanup(void)
-{
- int i;
-
- if (!stw_icd)
- return;
-
- pipe_mutex_lock( stw_icd->mutex );
- {
- /* Ensure all contexts are destroyed */
- for (i = 0; i < DRV_CONTEXT_MAX; i++)
- if (stw_icd->ctx_array[i].ctx)
- stw_delete_context( stw_icd->ctx_array[i].ctx );
- }
- pipe_mutex_unlock( stw_icd->mutex );
-
- pipe_mutex_init( stw_icd->mutex );
- stw_icd = NULL;
-}
-
-
-static struct stw_context *
-lookup_context( struct stw_icd *icd,
- DHGLRC dhglrc )
-{
- if (dhglrc == 0 ||
- dhglrc >= DRV_CONTEXT_MAX)
- return NULL;
-
- if (icd == NULL)
- return NULL;
-
- return icd->ctx_array[dhglrc - 1].ctx;
-}
BOOL APIENTRY
DrvCopyContext(
@@ -113,63 +48,16 @@ DrvCopyContext(
DHGLRC dhrcDest,
UINT fuMask )
{
- BOOL ret = FALSE;
-
- if (!stw_icd)
- return FALSE;
-
- pipe_mutex_lock( stw_icd->mutex );
- {
- struct stw_context *src = lookup_context( stw_icd, dhrcSource );
- struct stw_context *dst = lookup_context( stw_icd, dhrcDest );
-
- if (src == NULL || dst == NULL)
- goto done;
-
- ret = stw_copy_context( src, dst, fuMask );
- }
-done:
- pipe_mutex_unlock( stw_icd->mutex );
-
- return ret;
+ return stw_copy_context(dhrcSource, dhrcDest, fuMask);
}
+
DHGLRC APIENTRY
DrvCreateLayerContext(
HDC hdc,
INT iLayerPlane )
{
- DHGLRC handle = 0;
-
- if (!stw_icd)
- return handle;
-
- pipe_mutex_lock( stw_icd->mutex );
- {
- int i;
-
- for (i = 0; i < DRV_CONTEXT_MAX; i++) {
- if (stw_icd->ctx_array[i].ctx == NULL)
- break;
- }
-
- /* No slot available, fail:
- */
- if (i == DRV_CONTEXT_MAX)
- goto done;
-
- stw_icd->ctx_array[i].ctx = stw_create_context( hdc, iLayerPlane );
- if (stw_icd->ctx_array[i].ctx == NULL)
- goto done;
-
- /* success:
- */
- handle = (DHGLRC) i + 1;
- }
-done:
- pipe_mutex_unlock( stw_icd->mutex );
-
- return handle;
+ return stw_create_layer_context( hdc, iLayerPlane );
}
DHGLRC APIENTRY
@@ -183,30 +71,7 @@ BOOL APIENTRY
DrvDeleteContext(
DHGLRC dhglrc )
{
- BOOL ret = FALSE;
-
- if (!stw_icd)
- return ret;
-
- pipe_mutex_lock( stw_icd->mutex );
- {
- struct stw_context *ctx;
-
- ctx = lookup_context( stw_icd, dhglrc );
- if (ctx == NULL)
- goto done;
-
- if (stw_delete_context( ctx ) == FALSE)
- goto done;
-
- stw_icd->ctx_array[dhglrc - 1].ctx = NULL;
- ret = TRUE;
-
- }
-done:
- pipe_mutex_unlock( stw_icd->mutex );
-
- return ret;
+ return stw_delete_context( dhglrc );
}
BOOL APIENTRY
@@ -217,7 +82,8 @@ DrvDescribeLayerPlane(
UINT nBytes,
LPLAYERPLANEDESCRIPTOR plpd )
{
- debug_printf( "%s\n", __FUNCTION__ );
+ if (DBG)
+ debug_printf( "%s\n", __FUNCTION__ );
return FALSE;
}
@@ -233,8 +99,9 @@ DrvDescribePixelFormat(
r = stw_pixelformat_describe( hdc, iPixelFormat, cjpfd, ppfd );
- debug_printf( "%s( %p, %d, %u, %p ) = %d\n",
- __FUNCTION__, hdc, iPixelFormat, cjpfd, ppfd, r );
+ if (DBG)
+ debug_printf( "%s( %p, %d, %u, %p ) = %d\n",
+ __FUNCTION__, hdc, iPixelFormat, cjpfd, ppfd, r );
return r;
}
@@ -247,7 +114,8 @@ DrvGetLayerPaletteEntries(
INT cEntries,
COLORREF *pcr )
{
- debug_printf( "%s\n", __FUNCTION__ );
+ if (DBG)
+ debug_printf( "%s\n", __FUNCTION__ );
return 0;
}
@@ -260,7 +128,8 @@ DrvGetProcAddress(
r = stw_get_proc_address( lpszProc );
- debug_printf( "%s( \", __FUNCTION__%s\" ) = %p\n", lpszProc, r );
+ if (DBG)
+ debug_printf( "%s( \", __FUNCTION__%s\" ) = %p\n", lpszProc, r );
return r;
}
@@ -271,7 +140,8 @@ DrvRealizeLayerPalette(
INT iLayerPlane,
BOOL bRealize )
{
- debug_printf( "%s\n", __FUNCTION__ );
+ if (DBG)
+ debug_printf( "%s\n", __FUNCTION__ );
return FALSE;
}
@@ -280,32 +150,7 @@ BOOL APIENTRY
DrvReleaseContext(
DHGLRC dhglrc )
{
- BOOL ret = FALSE;
-
- if (!stw_icd)
- return ret;
-
- pipe_mutex_lock( stw_icd->mutex );
- {
- struct stw_context *ctx;
-
- /* XXX: The expectation is that ctx is the same context which is
- * current for this thread. We should check that and return False
- * if not the case.
- */
- ctx = lookup_context( stw_icd, dhglrc );
- if (ctx == NULL)
- goto done;
-
- if (stw_make_current( NULL, NULL ) == FALSE)
- goto done;
-
- ret = TRUE;
- }
-done:
- pipe_mutex_unlock( stw_icd->mutex );
-
- return ret;
+ return stw_release_context(dhglrc);
}
void APIENTRY
@@ -313,7 +158,8 @@ DrvSetCallbackProcs(
INT nProcs,
PROC *pProcs )
{
- debug_printf( "%s( %d, %p )\n", __FUNCTION__, nProcs, pProcs );
+ if (DBG)
+ debug_printf( "%s( %d, %p )\n", __FUNCTION__, nProcs, pProcs );
return;
}
@@ -671,38 +517,21 @@ DrvSetContext(
DHGLRC dhglrc,
PFN_SETPROCTABLE pfnSetProcTable )
{
- PGLCLTPROCTABLE result = NULL;
-
- if (!stw_icd)
- return result;
-
- pipe_mutex_lock( stw_icd->mutex );
- {
- struct stw_context *ctx;
-
+ if (DBG)
debug_printf( "%s( 0x%p, %u, 0x%p )\n",
__FUNCTION__, hdc, dhglrc, pfnSetProcTable );
- /* Although WGL allows different dispatch entrypoints per
- */
- if (!stw_icd->cpt_initialized) {
- init_proc_table( &stw_icd->cpt );
- stw_icd->cpt_initialized = TRUE;
- }
-
- ctx = lookup_context( stw_icd, dhglrc );
- if (ctx == NULL)
- goto done;
-
- if (!stw_make_current( hdc, ctx ))
- goto done;
-
- result = &stw_icd->cpt;
+ /* Although WGL allows different dispatch entrypoints per
+ */
+ if (!cpt_initialized) {
+ init_proc_table( &cpt );
+ cpt_initialized = TRUE;
}
-done:
- pipe_mutex_unlock( stw_icd->mutex );
- return result;
+ if (!stw_make_current( hdc, dhglrc ))
+ return NULL;
+
+ return &cpt;
}
int APIENTRY
@@ -713,7 +542,8 @@ DrvSetLayerPaletteEntries(
INT cEntries,
CONST COLORREF *pcr )
{
- debug_printf( "%s\n", __FUNCTION__ );
+ if (DBG)
+ debug_printf( "%s\n", __FUNCTION__ );
return 0;
}
@@ -727,7 +557,8 @@ DrvSetPixelFormat(
r = stw_pixelformat_set( hdc, iPixelFormat );
- debug_printf( "%s( %p, %d ) = %s\n", __FUNCTION__, hdc, iPixelFormat, r ? "TRUE" : "FALSE" );
+ if (DBG)
+ debug_printf( "%s( %p, %d ) = %s\n", __FUNCTION__, hdc, iPixelFormat, r ? "TRUE" : "FALSE" );
return r;
}
@@ -737,7 +568,8 @@ DrvShareLists(
DHGLRC dhglrc1,
DHGLRC dhglrc2 )
{
- debug_printf( "%s\n", __FUNCTION__ );
+ if (DBG)
+ debug_printf( "%s\n", __FUNCTION__ );
return FALSE;
}
@@ -746,7 +578,8 @@ BOOL APIENTRY
DrvSwapBuffers(
HDC hdc )
{
- debug_printf( "%s( %p )\n", __FUNCTION__, hdc );
+ if (DBG)
+ debug_printf( "%s( %p )\n", __FUNCTION__, hdc );
return stw_swap_buffers( hdc );
}
@@ -756,7 +589,8 @@ DrvSwapLayerBuffers(
HDC hdc,
UINT fuPlanes )
{
- debug_printf( "%s\n", __FUNCTION__ );
+ if (DBG)
+ debug_printf( "%s\n", __FUNCTION__ );
return FALSE;
}
@@ -765,7 +599,8 @@ BOOL APIENTRY
DrvValidateVersion(
ULONG ulVersion )
{
- debug_printf( "%s( %u )\n", __FUNCTION__, ulVersion );
+ if (DBG)
+ debug_printf( "%s( %u )\n", __FUNCTION__, ulVersion );
/* TODO: get the expected version from the winsys */
diff --git a/src/gallium/state_trackers/wgl/opengl32.mingw.def b/src/gallium/state_trackers/wgl/opengl32.mingw.def
new file mode 100644
index 0000000000..1f03ea3b37
--- /dev/null
+++ b/src/gallium/state_trackers/wgl/opengl32.mingw.def
@@ -0,0 +1,387 @@
+EXPORTS
+; GlmfBeginGlsBlock = GlmfBeginGlsBlock@4
+; GlmfCloseMetaFile = GlmfCloseMetaFile@4
+; GlmfEndGlsBlock = GlmfEndGlsBlock@4
+; GlmfEndPlayback = GlmfEndPlayback@4
+; GlmfInitPlayback = GlmfInitPlayback@12
+; GlmfPlayGlsRecord = GlmfPlayGlsRecord@16
+ glAccum = glAccum@8
+ glAlphaFunc = glAlphaFunc@8
+ glAreTexturesResident = glAreTexturesResident@12
+ glArrayElement = glArrayElement@4
+ glBegin = glBegin@4
+ glBindTexture = glBindTexture@8
+ glBitmap = glBitmap@28
+ glBlendFunc = glBlendFunc@8
+ glCallList = glCallList@4
+ glCallLists = glCallLists@12
+ glClear = glClear@4
+ glClearAccum = glClearAccum@16
+ glClearColor = glClearColor@16
+ glClearDepth = glClearDepth@8
+ glClearIndex = glClearIndex@4
+ glClearStencil = glClearStencil@4
+ glClipPlane = glClipPlane@8
+ glColor3b = glColor3b@12
+ glColor3bv = glColor3bv@4
+ glColor3d = glColor3d@24
+ glColor3dv = glColor3dv@4
+ glColor3f = glColor3f@12
+ glColor3fv = glColor3fv@4
+ glColor3i = glColor3i@12
+ glColor3iv = glColor3iv@4
+ glColor3s = glColor3s@12
+ glColor3sv = glColor3sv@4
+ glColor3ub = glColor3ub@12
+ glColor3ubv = glColor3ubv@4
+ glColor3ui = glColor3ui@12
+ glColor3uiv = glColor3uiv@4
+ glColor3us = glColor3us@12
+ glColor3usv = glColor3usv@4
+ glColor4b = glColor4b@16
+ glColor4bv = glColor4bv@4
+ glColor4d = glColor4d@32
+ glColor4dv = glColor4dv@4
+ glColor4f = glColor4f@16
+ glColor4fv = glColor4fv@4
+ glColor4i = glColor4i@16
+ glColor4iv = glColor4iv@4
+ glColor4s = glColor4s@16
+ glColor4sv = glColor4sv@4
+ glColor4ub = glColor4ub@16
+ glColor4ubv = glColor4ubv@4
+ glColor4ui = glColor4ui@16
+ glColor4uiv = glColor4uiv@4
+ glColor4us = glColor4us@16
+ glColor4usv = glColor4usv@4
+ glColorMask = glColorMask@16
+ glColorMaterial = glColorMaterial@8
+ glColorPointer = glColorPointer@16
+ glCopyPixels = glCopyPixels@20
+ glCopyTexImage1D = glCopyTexImage1D@28
+ glCopyTexImage2D = glCopyTexImage2D@32
+ glCopyTexSubImage1D = glCopyTexSubImage1D@24
+ glCopyTexSubImage2D = glCopyTexSubImage2D@32
+ glCullFace = glCullFace@4
+; glDebugEntry = glDebugEntry@8
+ glDeleteLists = glDeleteLists@8
+ glDeleteTextures = glDeleteTextures@8
+ glDepthFunc = glDepthFunc@4
+ glDepthMask = glDepthMask@4
+ glDepthRange = glDepthRange@16
+ glDisable = glDisable@4
+ glDisableClientState = glDisableClientState@4
+ glDrawArrays = glDrawArrays@12
+ glDrawBuffer = glDrawBuffer@4
+ glDrawElements = glDrawElements@16
+ glDrawPixels = glDrawPixels@20
+ glEdgeFlag = glEdgeFlag@4
+ glEdgeFlagPointer = glEdgeFlagPointer@8
+ glEdgeFlagv = glEdgeFlagv@4
+ glEnable = glEnable@4
+ glEnableClientState = glEnableClientState@4
+ glEnd = glEnd@0
+ glEndList = glEndList@0
+ glEvalCoord1d = glEvalCoord1d@8
+ glEvalCoord1dv = glEvalCoord1dv@4
+ glEvalCoord1f = glEvalCoord1f@4
+ glEvalCoord1fv = glEvalCoord1fv@4
+ glEvalCoord2d = glEvalCoord2d@16
+ glEvalCoord2dv = glEvalCoord2dv@4
+ glEvalCoord2f = glEvalCoord2f@8
+ glEvalCoord2fv = glEvalCoord2fv@4
+ glEvalMesh1 = glEvalMesh1@12
+ glEvalMesh2 = glEvalMesh2@20
+ glEvalPoint1 = glEvalPoint1@4
+ glEvalPoint2 = glEvalPoint2@8
+ glFeedbackBuffer = glFeedbackBuffer@12
+ glFinish = glFinish@0
+ glFlush = glFlush@0
+ glFogf = glFogf@8
+ glFogfv = glFogfv@8
+ glFogi = glFogi@8
+ glFogiv = glFogiv@8
+ glFrontFace = glFrontFace@4
+ glFrustum = glFrustum@48
+ glGenLists = glGenLists@4
+ glGenTextures = glGenTextures@8
+ glGetBooleanv = glGetBooleanv@8
+ glGetClipPlane = glGetClipPlane@8
+ glGetDoublev = glGetDoublev@8
+ glGetError = glGetError@0
+ glGetFloatv = glGetFloatv@8
+ glGetIntegerv = glGetIntegerv@8
+ glGetLightfv = glGetLightfv@12
+ glGetLightiv = glGetLightiv@12
+ glGetMapdv = glGetMapdv@12
+ glGetMapfv = glGetMapfv@12
+ glGetMapiv = glGetMapiv@12
+ glGetMaterialfv = glGetMaterialfv@12
+ glGetMaterialiv = glGetMaterialiv@12
+ glGetPixelMapfv = glGetPixelMapfv@8
+ glGetPixelMapuiv = glGetPixelMapuiv@8
+ glGetPixelMapusv = glGetPixelMapusv@8
+ glGetPointerv = glGetPointerv@8
+ glGetPolygonStipple = glGetPolygonStipple@4
+ glGetString = glGetString@4
+ glGetTexEnvfv = glGetTexEnvfv@12
+ glGetTexEnviv = glGetTexEnviv@12
+ glGetTexGendv = glGetTexGendv@12
+ glGetTexGenfv = glGetTexGenfv@12
+ glGetTexGeniv = glGetTexGeniv@12
+ glGetTexImage = glGetTexImage@20
+ glGetTexLevelParameterfv = glGetTexLevelParameterfv@16
+ glGetTexLevelParameteriv = glGetTexLevelParameteriv@16
+ glGetTexParameterfv = glGetTexParameterfv@12
+ glGetTexParameteriv = glGetTexParameteriv@12
+ glHint = glHint@8
+ glIndexMask = glIndexMask@4
+ glIndexPointer = glIndexPointer@12
+ glIndexd = glIndexd@8
+ glIndexdv = glIndexdv@4
+ glIndexf = glIndexf@4
+ glIndexfv = glIndexfv@4
+ glIndexi = glIndexi@4
+ glIndexiv = glIndexiv@4
+ glIndexs = glIndexs@4
+ glIndexsv = glIndexsv@4
+ glIndexub = glIndexub@4
+ glIndexubv = glIndexubv@4
+ glInitNames = glInitNames@0
+ glInterleavedArrays = glInterleavedArrays@12
+ glIsEnabled = glIsEnabled@4
+ glIsList = glIsList@4
+ glIsTexture = glIsTexture@4
+ glLightModelf = glLightModelf@8
+ glLightModelfv = glLightModelfv@8
+ glLightModeli = glLightModeli@8
+ glLightModeliv = glLightModeliv@8
+ glLightf = glLightf@12
+ glLightfv = glLightfv@12
+ glLighti = glLighti@12
+ glLightiv = glLightiv@12
+ glLineStipple = glLineStipple@8
+ glLineWidth = glLineWidth@4
+ glListBase = glListBase@4
+ glLoadIdentity = glLoadIdentity@0
+ glLoadMatrixd = glLoadMatrixd@4
+ glLoadMatrixf = glLoadMatrixf@4
+ glLoadName = glLoadName@4
+ glLogicOp = glLogicOp@4
+ glMap1d = glMap1d@32
+ glMap1f = glMap1f@24
+ glMap2d = glMap2d@56
+ glMap2f = glMap2f@40
+ glMapGrid1d = glMapGrid1d@20
+ glMapGrid1f = glMapGrid1f@12
+ glMapGrid2d = glMapGrid2d@40
+ glMapGrid2f = glMapGrid2f@24
+ glMaterialf = glMaterialf@12
+ glMaterialfv = glMaterialfv@12
+ glMateriali = glMateriali@12
+ glMaterialiv = glMaterialiv@12
+ glMatrixMode = glMatrixMode@4
+ glMultMatrixd = glMultMatrixd@4
+ glMultMatrixf = glMultMatrixf@4
+ glNewList = glNewList@8
+ glNormal3b = glNormal3b@12
+ glNormal3bv = glNormal3bv@4
+ glNormal3d = glNormal3d@24
+ glNormal3dv = glNormal3dv@4
+ glNormal3f = glNormal3f@12
+ glNormal3fv = glNormal3fv@4
+ glNormal3i = glNormal3i@12
+ glNormal3iv = glNormal3iv@4
+ glNormal3s = glNormal3s@12
+ glNormal3sv = glNormal3sv@4
+ glNormalPointer = glNormalPointer@12
+ glOrtho = glOrtho@48
+ glPassThrough = glPassThrough@4
+ glPixelMapfv = glPixelMapfv@12
+ glPixelMapuiv = glPixelMapuiv@12
+ glPixelMapusv = glPixelMapusv@12
+ glPixelStoref = glPixelStoref@8
+ glPixelStorei = glPixelStorei@8
+ glPixelTransferf = glPixelTransferf@8
+ glPixelTransferi = glPixelTransferi@8
+ glPixelZoom = glPixelZoom@8
+ glPointSize = glPointSize@4
+ glPolygonMode = glPolygonMode@8
+ glPolygonOffset = glPolygonOffset@8
+ glPolygonStipple = glPolygonStipple@4
+ glPopAttrib = glPopAttrib@0
+ glPopClientAttrib = glPopClientAttrib@0
+ glPopMatrix = glPopMatrix@0
+ glPopName = glPopName@0
+ glPrioritizeTextures = glPrioritizeTextures@12
+ glPushAttrib = glPushAttrib@4
+ glPushClientAttrib = glPushClientAttrib@4
+ glPushMatrix = glPushMatrix@0
+ glPushName = glPushName@4
+ glRasterPos2d = glRasterPos2d@16
+ glRasterPos2dv = glRasterPos2dv@4
+ glRasterPos2f = glRasterPos2f@8
+ glRasterPos2fv = glRasterPos2fv@4
+ glRasterPos2i = glRasterPos2i@8
+ glRasterPos2iv = glRasterPos2iv@4
+ glRasterPos2s = glRasterPos2s@8
+ glRasterPos2sv = glRasterPos2sv@4
+ glRasterPos3d = glRasterPos3d@24
+ glRasterPos3dv = glRasterPos3dv@4
+ glRasterPos3f = glRasterPos3f@12
+ glRasterPos3fv = glRasterPos3fv@4
+ glRasterPos3i = glRasterPos3i@12
+ glRasterPos3iv = glRasterPos3iv@4
+ glRasterPos3s = glRasterPos3s@12
+ glRasterPos3sv = glRasterPos3sv@4
+ glRasterPos4d = glRasterPos4d@32
+ glRasterPos4dv = glRasterPos4dv@4
+ glRasterPos4f = glRasterPos4f@16
+ glRasterPos4fv = glRasterPos4fv@4
+ glRasterPos4i = glRasterPos4i@16
+ glRasterPos4iv = glRasterPos4iv@4
+ glRasterPos4s = glRasterPos4s@16
+ glRasterPos4sv = glRasterPos4sv@4
+ glReadBuffer = glReadBuffer@4
+ glReadPixels = glReadPixels@28
+ glRectd = glRectd@32
+ glRectdv = glRectdv@8
+ glRectf = glRectf@16
+ glRectfv = glRectfv@8
+ glRecti = glRecti@16
+ glRectiv = glRectiv@8
+ glRects = glRects@16
+ glRectsv = glRectsv@8
+ glRenderMode = glRenderMode@4
+ glRotated = glRotated@32
+ glRotatef = glRotatef@16
+ glScaled = glScaled@24
+ glScalef = glScalef@12
+ glScissor = glScissor@16
+ glSelectBuffer = glSelectBuffer@8
+ glShadeModel = glShadeModel@4
+ glStencilFunc = glStencilFunc@12
+ glStencilMask = glStencilMask@4
+ glStencilOp = glStencilOp@12
+ glTexCoord1d = glTexCoord1d@8
+ glTexCoord1dv = glTexCoord1dv@4
+ glTexCoord1f = glTexCoord1f@4
+ glTexCoord1fv = glTexCoord1fv@4
+ glTexCoord1i = glTexCoord1i@4
+ glTexCoord1iv = glTexCoord1iv@4
+ glTexCoord1s = glTexCoord1s@4
+ glTexCoord1sv = glTexCoord1sv@4
+ glTexCoord2d = glTexCoord2d@16
+ glTexCoord2dv = glTexCoord2dv@4
+ glTexCoord2f = glTexCoord2f@8
+ glTexCoord2fv = glTexCoord2fv@4
+ glTexCoord2i = glTexCoord2i@8
+ glTexCoord2iv = glTexCoord2iv@4
+ glTexCoord2s = glTexCoord2s@8
+ glTexCoord2sv = glTexCoord2sv@4
+ glTexCoord3d = glTexCoord3d@24
+ glTexCoord3dv = glTexCoord3dv@4
+ glTexCoord3f = glTexCoord3f@12
+ glTexCoord3fv = glTexCoord3fv@4
+ glTexCoord3i = glTexCoord3i@12
+ glTexCoord3iv = glTexCoord3iv@4
+ glTexCoord3s = glTexCoord3s@12
+ glTexCoord3sv = glTexCoord3sv@4
+ glTexCoord4d = glTexCoord4d@32
+ glTexCoord4dv = glTexCoord4dv@4
+ glTexCoord4f = glTexCoord4f@16
+ glTexCoord4fv = glTexCoord4fv@4
+ glTexCoord4i = glTexCoord4i@16
+ glTexCoord4iv = glTexCoord4iv@4
+ glTexCoord4s = glTexCoord4s@16
+ glTexCoord4sv = glTexCoord4sv@4
+ glTexCoordPointer = glTexCoordPointer@16
+ glTexEnvf = glTexEnvf@12
+ glTexEnvfv = glTexEnvfv@12
+ glTexEnvi = glTexEnvi@12
+ glTexEnviv = glTexEnviv@12
+ glTexGend = glTexGend@16
+ glTexGendv = glTexGendv@12
+ glTexGenf = glTexGenf@12
+ glTexGenfv = glTexGenfv@12
+ glTexGeni = glTexGeni@12
+ glTexGeniv = glTexGeniv@12
+ glTexImage1D = glTexImage1D@32
+ glTexImage2D = glTexImage2D@36
+ glTexParameterf = glTexParameterf@12
+ glTexParameterfv = glTexParameterfv@12
+ glTexParameteri = glTexParameteri@12
+ glTexParameteriv = glTexParameteriv@12
+ glTexSubImage1D = glTexSubImage1D@28
+ glTexSubImage2D = glTexSubImage2D@36
+ glTranslated = glTranslated@24
+ glTranslatef = glTranslatef@12
+ glVertex2d = glVertex2d@16
+ glVertex2dv = glVertex2dv@4
+ glVertex2f = glVertex2f@8
+ glVertex2fv = glVertex2fv@4
+ glVertex2i = glVertex2i@8
+ glVertex2iv = glVertex2iv@4
+ glVertex2s = glVertex2s@8
+ glVertex2sv = glVertex2sv@4
+ glVertex3d = glVertex3d@24
+ glVertex3dv = glVertex3dv@4
+ glVertex3f = glVertex3f@12
+ glVertex3fv = glVertex3fv@4
+ glVertex3i = glVertex3i@12
+ glVertex3iv = glVertex3iv@4
+ glVertex3s = glVertex3s@12
+ glVertex3sv = glVertex3sv@4
+ glVertex4d = glVertex4d@32
+ glVertex4dv = glVertex4dv@4
+ glVertex4f = glVertex4f@16
+ glVertex4fv = glVertex4fv@4
+ glVertex4i = glVertex4i@16
+ glVertex4iv = glVertex4iv@4
+ glVertex4s = glVertex4s@16
+ glVertex4sv = glVertex4sv@4
+ glVertexPointer = glVertexPointer@16
+ glViewport = glViewport@16
+ wglChoosePixelFormat = wglChoosePixelFormat@8
+ wglCopyContext = wglCopyContext@12
+ wglCreateContext = wglCreateContext@4
+ wglCreateLayerContext = wglCreateLayerContext@8
+ wglDeleteContext = wglDeleteContext@4
+ wglDescribeLayerPlane = wglDescribeLayerPlane@20
+ wglDescribePixelFormat = wglDescribePixelFormat@16
+ wglGetCurrentContext = wglGetCurrentContext@0
+ wglGetCurrentDC = wglGetCurrentDC@0
+; wglGetDefaultProcAddress = wglGetDefaultProcAddress@4
+ wglGetLayerPaletteEntries = wglGetLayerPaletteEntries@20
+ wglGetPixelFormat = wglGetPixelFormat@4
+ wglGetProcAddress = wglGetProcAddress@4
+ wglMakeCurrent = wglMakeCurrent@8
+ wglRealizeLayerPalette = wglRealizeLayerPalette@12
+ wglSetLayerPaletteEntries = wglSetLayerPaletteEntries@20
+ wglSetPixelFormat = wglSetPixelFormat@12
+ wglShareLists = wglShareLists@8
+ wglSwapBuffers = wglSwapBuffers@4
+ wglSwapLayerBuffers = wglSwapLayerBuffers@8
+; wglSwapMultipleBuffers = wglSwapMultipleBuffers@8
+ wglUseFontBitmapsA = wglUseFontBitmapsA@16
+ wglUseFontBitmapsW = wglUseFontBitmapsW@16
+ wglUseFontOutlinesA = wglUseFontOutlinesA@32
+ wglUseFontOutlinesW = wglUseFontOutlinesW@32
+ DrvCopyContext = DrvCopyContext@12
+ DrvCreateContext = DrvCreateContext@4
+ DrvCreateLayerContext = DrvCreateLayerContext@8
+ DrvDeleteContext = DrvDeleteContext@4
+ DrvDescribeLayerPlane = DrvDescribeLayerPlane@20
+ DrvDescribePixelFormat = DrvDescribePixelFormat@16
+ DrvGetLayerPaletteEntries = DrvGetLayerPaletteEntries@20
+ DrvGetProcAddress = DrvGetProcAddress@4
+ DrvRealizeLayerPalette = DrvRealizeLayerPalette@12
+ DrvReleaseContext = DrvReleaseContext@4
+ DrvSetCallbackProcs = DrvSetCallbackProcs@8
+ DrvSetContext = DrvSetContext@12
+ DrvSetLayerPaletteEntries = DrvSetLayerPaletteEntries@20
+ DrvSetPixelFormat = DrvSetPixelFormat@8
+ DrvShareLists = DrvShareLists@8
+ DrvSwapBuffers = DrvSwapBuffers@4
+ DrvSwapLayerBuffers = DrvSwapLayerBuffers@8
+ DrvValidateVersion = DrvValidateVersion@4
diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c
index 2abf97b5ad..d77daac39c 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_context.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_context.c
@@ -40,26 +40,38 @@
#include "stw_public.h"
#include "stw_context.h"
-static struct stw_context *ctx_head = NULL;
-
static HDC current_hdc = NULL;
-static struct stw_context *current_hrc = NULL;
+static UINT_PTR current_hglrc = 0;
BOOL
stw_copy_context(
- struct stw_context *src,
- struct stw_context *dst,
+ UINT_PTR hglrcSrc,
+ UINT_PTR hglrcDst,
UINT mask )
{
- (void) src;
- (void) dst;
- (void) mask;
+ struct stw_context *src;
+ struct stw_context *dst;
+ BOOL ret = FALSE;
+
+ pipe_mutex_lock( stw_dev->mutex );
+
+ src = stw_lookup_context( hglrcSrc );
+ dst = stw_lookup_context( hglrcDst );
+
+ if (src && dst) {
+ /* FIXME */
+ (void) src;
+ (void) dst;
+ (void) mask;
+ }
- return FALSE;
+ pipe_mutex_unlock( stw_dev->mutex );
+
+ return ret;
}
-struct stw_context *
-stw_create_context(
+UINT_PTR
+stw_create_layer_context(
HDC hdc,
int iLayerPlane )
{
@@ -68,19 +80,23 @@ stw_create_context(
struct stw_context *ctx = NULL;
GLvisual *visual = NULL;
struct pipe_context *pipe = NULL;
+ UINT_PTR hglrc = 0;
+ if(!stw_dev)
+ return 0;
+
if (iLayerPlane != 0)
- return NULL;
+ return 0;
pfi = stw_pixelformat_get( hdc );
if (pfi == 0)
- return NULL;
+ return 0;
pf = pixelformat_get_info( pfi - 1 );
ctx = CALLOC_STRUCT( stw_context );
if (ctx == NULL)
- return NULL;
+ return 0;
ctx->hdc = hdc;
ctx->color_bits = GetDeviceCaps( ctx->hdc, BITSPIXEL );
@@ -119,10 +135,26 @@ stw_create_context(
ctx->st->ctx->DriverCtx = ctx;
- ctx->next = ctx_head;
- ctx_head = ctx;
+ pipe_mutex_lock( stw_dev->mutex );
+ {
+ UINT_PTR i;
+
+ for (i = 0; i < STW_CONTEXT_MAX; i++) {
+ if (stw_dev->ctx_array[i].ctx == NULL) {
+ /* success:
+ */
+ stw_dev->ctx_array[i].ctx = ctx;
+ hglrc = i + 1;
+ break;
+ }
+ }
+ }
+ pipe_mutex_unlock( stw_dev->mutex );
- return ctx;
+ /* Success?
+ */
+ if (hglrc != 0)
+ return hglrc;
fail:
if (visual)
@@ -132,47 +164,83 @@ fail:
pipe->destroy( pipe );
FREE( ctx );
- return NULL;
+ return 0;
}
-
BOOL
stw_delete_context(
- struct stw_context *hglrc )
+ UINT_PTR hglrc )
{
- struct stw_context **link = &ctx_head;
- struct stw_context *ctx = ctx_head;
+ struct stw_context *ctx ;
+ BOOL ret = FALSE;
+
+ if (!stw_dev)
+ return FALSE;
- while (ctx != NULL) {
- if (ctx == hglrc) {
- GLcontext *glctx = ctx->st->ctx;
- GET_CURRENT_CONTEXT( glcurctx );
- struct stw_framebuffer *fb;
+ pipe_mutex_lock( stw_dev->mutex );
- /* Unbind current if deleting current context.
- */
- if (glcurctx == glctx)
- st_make_current( NULL, NULL, NULL );
+ ctx = stw_lookup_context(hglrc);
+ if (ctx) {
+ GLcontext *glctx = ctx->st->ctx;
+ GET_CURRENT_CONTEXT( glcurctx );
+ struct stw_framebuffer *fb;
- fb = framebuffer_from_hdc( ctx->hdc );
- if (fb)
- framebuffer_destroy( fb );
+ /* Unbind current if deleting current context.
+ */
+ if (glcurctx == glctx)
+ st_make_current( NULL, NULL, NULL );
- if (WindowFromDC( ctx->hdc ) != NULL)
- ReleaseDC( WindowFromDC( ctx->hdc ), ctx->hdc );
+ fb = framebuffer_from_hdc( ctx->hdc );
+ if (fb)
+ framebuffer_destroy( fb );
- st_destroy_context( ctx->st );
+ if (WindowFromDC( ctx->hdc ) != NULL)
+ ReleaseDC( WindowFromDC( ctx->hdc ), ctx->hdc );
- *link = ctx->next;
- FREE( ctx );
- return TRUE;
- }
+ st_destroy_context( ctx->st );
- link = &ctx->next;
- ctx = ctx->next;
+ FREE( ctx );
+
+ stw_dev->ctx_array[hglrc - 1].ctx = NULL;
+
+ ret = TRUE;
}
- return FALSE;
+ pipe_mutex_unlock( stw_dev->mutex );
+
+ return ret;
+}
+
+BOOL
+stw_release_context(
+ UINT_PTR hglrc )
+{
+ BOOL ret = FALSE;
+
+ if (!stw_dev)
+ return ret;
+
+ pipe_mutex_lock( stw_dev->mutex );
+ {
+ struct stw_context *ctx;
+
+ /* XXX: The expectation is that ctx is the same context which is
+ * current for this thread. We should check that and return False
+ * if not the case.
+ */
+ ctx = stw_lookup_context( hglrc );
+ if (ctx == NULL)
+ goto done;
+
+ if (stw_make_current( NULL, 0 ) == FALSE)
+ goto done;
+
+ ret = TRUE;
+ }
+done:
+ pipe_mutex_unlock( stw_dev->mutex );
+
+ return ret;
}
/* Find the width and height of the window named by hdc.
@@ -193,10 +261,10 @@ get_window_size( HDC hdc, GLuint *width, GLuint *height )
}
}
-struct stw_context *
+UINT_PTR
stw_get_current_context( void )
{
- return current_hrc;
+ return current_hglrc;
}
HDC
@@ -208,35 +276,43 @@ stw_get_current_dc( void )
BOOL
stw_make_current(
HDC hdc,
- struct stw_context *hglrc )
+ UINT_PTR hglrc )
{
- struct stw_context *ctx = ctx_head;
+ struct stw_context *ctx;
GET_CURRENT_CONTEXT( glcurctx );
struct stw_framebuffer *fb;
GLuint width = 0;
GLuint height = 0;
+ struct stw_context *curctx;
+
+ if (!stw_dev)
+ return FALSE;
+
+ pipe_mutex_lock( stw_dev->mutex );
+ ctx = stw_lookup_context( hglrc );
+ pipe_mutex_unlock( stw_dev->mutex );
+
+ if (ctx == NULL)
+ return FALSE;
current_hdc = hdc;
- current_hrc = hglrc;
+ current_hglrc = hglrc;
- if (hdc == NULL || hglrc == NULL) {
- st_make_current( NULL, NULL, NULL );
- return TRUE;
+ if (glcurctx != NULL) {
+ curctx = (struct stw_context *) glcurctx->DriverCtx;
+
+ if (curctx != ctx)
+ st_flush(glcurctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
}
- while (ctx != NULL) {
- if (ctx == hglrc)
- break;
- ctx = ctx->next;
+ if (hdc == NULL || hglrc == 0) {
+ st_make_current( NULL, NULL, NULL );
+ return TRUE;
}
- if (ctx == NULL)
- return FALSE;
/* Return if already current.
*/
if (glcurctx != NULL) {
- struct stw_context *curctx = (struct stw_context *) glcurctx->DriverCtx;
-
if (curctx != NULL && curctx == ctx && ctx->hdc == hdc)
return TRUE;
}
@@ -273,20 +349,3 @@ stw_make_current(
return TRUE;
}
-
-struct stw_context *
-stw_context_from_hdc(
- HDC hdc )
-{
- struct stw_context *ctx = ctx_head;
-
- while (ctx != NULL) {
- if (ctx->hdc == hdc)
- return ctx;
- ctx = ctx->next;
- }
- return NULL;
-}
-
-
-
diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.h b/src/gallium/state_trackers/wgl/shared/stw_context.h
index 89a8f900d8..b289615272 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_context.h
+++ b/src/gallium/state_trackers/wgl/shared/stw_context.h
@@ -37,17 +37,6 @@ struct stw_context
struct st_context *st;
HDC hdc;
DWORD color_bits;
- struct stw_context *next;
};
-struct stw_context *
-stw_context_from_hdc(HDC hdc );
-
-
-
-
-
-
-
-
#endif /* STW_CONTEXT_H */
diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.c b/src/gallium/state_trackers/wgl/shared/stw_device.c
index 6873e813ee..0dca856d73 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_device.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_device.c
@@ -27,14 +27,19 @@
#include <windows.h>
-#include "pipe/p_debug.h"
+#include "glapi/glthread.h"
+#include "util/u_debug.h"
#include "pipe/p_screen.h"
#include "shared/stw_device.h"
#include "shared/stw_winsys.h"
#include "shared/stw_pixelformat.h"
#include "shared/stw_public.h"
-#include "stw.h"
+
+#ifdef WIN32_THREADS
+extern _glthread_Mutex OneTimeLock;
+extern void FreeAllTSD(void);
+#endif
struct stw_device *stw_dev = NULL;
@@ -57,23 +62,35 @@ st_flush_frontbuffer(struct pipe_screen *screen,
boolean
-stw_shared_init(const struct stw_winsys *stw_winsys)
+st_init(const struct stw_winsys *stw_winsys)
{
static struct stw_device stw_dev_storage;
+ debug_printf("%s\n", __FUNCTION__);
+
assert(!stw_dev);
stw_dev = &stw_dev_storage;
memset(stw_dev, 0, sizeof(*stw_dev));
+#ifdef DEBUG
+ stw_dev->memdbg_no = debug_memory_begin();
+#endif
+
stw_dev->stw_winsys = stw_winsys;
+#ifdef WIN32_THREADS
+ _glthread_INIT_MUTEX(OneTimeLock);
+#endif
+
stw_dev->screen = stw_winsys->create_screen();
if(!stw_dev->screen)
goto error1;
stw_dev->screen->flush_frontbuffer = st_flush_frontbuffer;
+ pipe_mutex_init( stw_dev->mutex );
+
pixelformat_init();
return TRUE;
@@ -85,7 +102,51 @@ error1:
void
-stw_shared_cleanup(void)
+st_cleanup(void)
{
+ UINT_PTR i;
+
+ debug_printf("%s\n", __FUNCTION__);
+
+ if (!stw_dev)
+ return;
+
+ pipe_mutex_lock( stw_dev->mutex );
+ {
+ /* Ensure all contexts are destroyed */
+ for (i = 0; i < STW_CONTEXT_MAX; i++)
+ if (stw_dev->ctx_array[i].ctx)
+ stw_delete_context( i + 1 );
+ }
+ pipe_mutex_unlock( stw_dev->mutex );
+
+ pipe_mutex_destroy( stw_dev->mutex );
+
+ stw_dev->screen->destroy(stw_dev->screen);
+
+#ifdef WIN32_THREADS
+ _glthread_DESTROY_MUTEX(OneTimeLock);
+ FreeAllTSD();
+#endif
+
+#ifdef DEBUG
+ debug_memory_end(stw_dev->memdbg_no);
+#endif
+
stw_dev = NULL;
}
+
+
+struct stw_context *
+stw_lookup_context( UINT_PTR dhglrc )
+{
+ if (dhglrc == 0 ||
+ dhglrc >= STW_CONTEXT_MAX)
+ return NULL;
+
+ if (stw_dev == NULL)
+ return NULL;
+
+ return stw_dev->ctx_array[dhglrc - 1].ctx;
+}
+
diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.h b/src/gallium/state_trackers/wgl/shared/stw_device.h
index bc0bce37c6..80da14b84f 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_device.h
+++ b/src/gallium/state_trackers/wgl/shared/stw_device.h
@@ -25,8 +25,15 @@
*
**************************************************************************/
-#ifndef ST_DEVICE_H_
-#define ST_DEVICE_H_
+#ifndef STW_DEVICE_H_
+#define STW_DEVICE_H_
+
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_thread.h"
+
+
+#define STW_CONTEXT_MAX 32
struct pipe_screen;
@@ -35,10 +42,22 @@ struct stw_device
{
const struct stw_winsys *stw_winsys;
struct pipe_screen *screen;
+
+ pipe_mutex mutex;
+
+ struct {
+ struct stw_context *ctx;
+ } ctx_array[STW_CONTEXT_MAX];
+
+#ifdef DEBUG
+ unsigned long memdbg_no;
+#endif
};
+struct stw_context *
+stw_lookup_context( UINT_PTR hglrc );
extern struct stw_device *stw_dev;
-#endif /* ST_DEVICE_H_ */
+#endif /* STW_DEVICE_H_ */
diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c
index c70b31a488..17c96c411f 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c
@@ -79,6 +79,14 @@ window_proc(
return CallWindowProc( fb->WndProc, hWnd, uMsg, wParam, lParam );
}
+static INLINE boolean
+stw_is_supported_depth_stencil(enum pipe_format format)
+{
+ struct pipe_screen *screen = stw_dev->screen;
+ return screen->is_format_supported(screen, format, PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
+}
+
/* Create a new framebuffer object which will correspond to the given HDC.
*/
struct stw_framebuffer *
@@ -101,18 +109,43 @@ framebuffer_create(
if (visual->depthBits == 0)
depthFormat = PIPE_FORMAT_NONE;
- else if (visual->depthBits <= 16)
+ else if (visual->depthBits <= 16 &&
+ stw_is_supported_depth_stencil(PIPE_FORMAT_Z16_UNORM))
depthFormat = PIPE_FORMAT_Z16_UNORM;
- else if (visual->depthBits <= 24)
+ else if (visual->depthBits <= 24 && visual->stencilBits != 8 &&
+ stw_is_supported_depth_stencil(PIPE_FORMAT_X8Z24_UNORM)) {
+ depthFormat = PIPE_FORMAT_X8Z24_UNORM;
+ }
+ else if (visual->depthBits <= 24 && visual->stencilBits != 8 &&
+ stw_is_supported_depth_stencil(PIPE_FORMAT_Z24X8_UNORM)) {
+ depthFormat = PIPE_FORMAT_Z24X8_UNORM;
+ }
+ else if (visual->depthBits <= 24 && visual->stencilBits == 8 &&
+ stw_is_supported_depth_stencil(PIPE_FORMAT_S8Z24_UNORM)) {
depthFormat = PIPE_FORMAT_S8Z24_UNORM;
- else
+ }
+ else if (visual->depthBits <= 24 && visual->stencilBits == 8 &&
+ stw_is_supported_depth_stencil(PIPE_FORMAT_Z24S8_UNORM)) {
+ depthFormat = PIPE_FORMAT_Z24S8_UNORM;
+ }
+ else if(stw_is_supported_depth_stencil(PIPE_FORMAT_Z32_UNORM)) {
depthFormat = PIPE_FORMAT_Z32_UNORM;
+ }
+ else if(stw_is_supported_depth_stencil(PIPE_FORMAT_Z32_FLOAT)) {
+ depthFormat = PIPE_FORMAT_Z32_FLOAT;
+ }
+ else {
+ assert(0);
+ depthFormat = PIPE_FORMAT_NONE;
+ }
- if (visual->stencilBits == 8) {
- if (depthFormat == PIPE_FORMAT_S8Z24_UNORM)
- stencilFormat = depthFormat;
- else
- stencilFormat = PIPE_FORMAT_S8_UNORM;
+ if (depthFormat == PIPE_FORMAT_S8Z24_UNORM ||
+ depthFormat == PIPE_FORMAT_Z24S8_UNORM) {
+ stencilFormat = depthFormat;
+ }
+ else if (visual->stencilBits == 8 &&
+ stw_is_supported_depth_stencil(PIPE_FORMAT_S8_UNORM)) {
+ stencilFormat = PIPE_FORMAT_S8_UNORM;
}
else {
stencilFormat = PIPE_FORMAT_NONE;
diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c
index 84b7b287b9..2992a1ac0a 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c
@@ -25,7 +25,7 @@
*
**************************************************************************/
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
#include "stw_pixelformat.h"
#include "stw_public.h"
@@ -76,6 +76,18 @@ add_standard_pixelformats(
pf->flags = flags;
pf->color = color24;
+ pf->alpha = alpha8;
+ pf->depth = depth16;
+ pf++;
+
+ pf->flags = flags;
+ pf->color = color24;
+ pf->alpha = alpha8;
+ pf->depth = depth24s8;
+ pf++;
+
+ pf->flags = flags;
+ pf->color = color24;
pf->alpha = noalpha;
pf->depth = depth16;
pf++;
diff --git a/src/gallium/state_trackers/wgl/shared/stw_public.h b/src/gallium/state_trackers/wgl/shared/stw_public.h
index 75b504a50f..39d377c16b 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_public.h
+++ b/src/gallium/state_trackers/wgl/shared/stw_public.h
@@ -29,31 +29,24 @@
#define STW_PUBLIC_H
#include <windows.h>
-#include "pipe/p_compiler.h"
-struct stw_winsys;
-struct stw_context;
-
-boolean
-st_shared_init(const struct stw_winsys *stw_winsys);
-
-void
-st_shared_cleanup(void);
-
-
-BOOL stw_copy_context( struct stw_context *src,
- struct stw_context *dst,
+BOOL stw_copy_context( UINT_PTR hglrcSrc,
+ UINT_PTR hglrcDst,
UINT mask );
-struct stw_context *stw_create_context( HDC hdc, int iLayerPlane );
+UINT_PTR stw_create_layer_context( HDC hdc,
+ int iLayerPlane );
+
+BOOL stw_delete_context( UINT_PTR hglrc );
-BOOL stw_delete_context( struct stw_context *ctx );
+BOOL
+stw_release_context( UINT_PTR dhglrc );
-struct stw_context *stw_get_current_context( void );
+UINT_PTR stw_get_current_context( void );
HDC stw_get_current_dc( void );
-BOOL stw_make_current( HDC hdc, struct stw_context *ctx );
+BOOL stw_make_current( HDC hdc, UINT_PTR hglrc );
BOOL stw_swap_buffers( HDC hdc );
diff --git a/src/gallium/state_trackers/wgl/shared/stw_quirks.c b/src/gallium/state_trackers/wgl/shared/stw_quirks.c
index 0961ce3bb0..2f7091a52c 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_quirks.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_quirks.c
@@ -111,3 +111,6 @@ void gl_dispatch_stub_770(void){}
void gl_dispatch_stub_771(void){}
void gl_dispatch_stub_772(void){}
void gl_dispatch_stub_773(void){}
+void gl_dispatch_stub_774(void){}
+void gl_dispatch_stub_750(void){}
+void gl_dispatch_stub_742(void){}
diff --git a/src/gallium/state_trackers/wgl/stw.c b/src/gallium/state_trackers/wgl/stw.c
deleted file mode 100644
index 8bccdad221..0000000000
--- a/src/gallium/state_trackers/wgl/stw.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009, VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include "stw.h"
-#include "shared/stw_winsys.h"
-
-boolean
-st_init(const struct stw_winsys *stw_winsys)
-{
- if (!stw_shared_init( stw_winsys ))
- goto fail;
-
- if (!stw_icd_init())
- goto fail;
-
- if (!stw_wgl_init())
- goto fail;
-
- return TRUE;
-
-fail:
- st_cleanup();
- return FALSE;
-}
-
-
-void
-st_cleanup(void)
-{
- stw_icd_cleanup();
- stw_shared_cleanup();
- stw_wgl_cleanup();
-}
diff --git a/src/gallium/state_trackers/wgl/stw.h b/src/gallium/state_trackers/wgl/stw.h
deleted file mode 100644
index 450af4ccb6..0000000000
--- a/src/gallium/state_trackers/wgl/stw.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef STW_H
-#define STW_H
-
-#include "pipe/p_compiler.h"
-
-struct stw_winsys;
-
-/* Public interface:
- */
-boolean stw_init( const struct stw_winsys *stw_winsys );
-void stw_cleanup( void );
-
-
-
-/* Internal functions
- */
-boolean stw_shared_init( const struct stw_winsys *stw_winsys );
-boolean stw_icd_init( void );
-boolean stw_wgl_init( void );
-
-void stw_shared_cleanup( void );
-void stw_icd_cleanup( void );
-void stw_wgl_cleanup( void );
-
-
-#endif /* STW_H */
diff --git a/src/gallium/state_trackers/wgl/wgl/stw_wgl.c b/src/gallium/state_trackers/wgl/wgl/stw_wgl.c
index f50b79b4e1..e06d2640b4 100644
--- a/src/gallium/state_trackers/wgl/wgl/stw_wgl.c
+++ b/src/gallium/state_trackers/wgl/wgl/stw_wgl.c
@@ -27,25 +27,9 @@
#include <windows.h>
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
#include "shared/stw_public.h"
#include "stw_wgl.h"
-#include "stw.h"
-
-boolean stw_wgl_init( void )
-{
- debug_printf("%s\n", __FUNCTION__);
- return TRUE;
-}
-
-void stw_wgl_cleanup( void )
-{
-}
-
-static INLINE struct stw_context *stw_context( HGLRC hglrc )
-{
- return (struct stw_context *)hglrc;
-}
WINGDIAPI BOOL APIENTRY
@@ -54,8 +38,8 @@ wglCopyContext(
HGLRC hglrcDst,
UINT mask )
{
- return stw_copy_context( stw_context(hglrcSrc),
- stw_context(hglrcDst),
+ return stw_copy_context( (UINT_PTR)hglrcSrc,
+ (UINT_PTR)hglrcDst,
mask );
}
@@ -63,7 +47,7 @@ WINGDIAPI HGLRC APIENTRY
wglCreateContext(
HDC hdc )
{
- return (HGLRC) stw_create_context( hdc, 0 );
+ return wglCreateLayerContext(hdc, 0);
}
WINGDIAPI HGLRC APIENTRY
@@ -71,21 +55,21 @@ wglCreateLayerContext(
HDC hdc,
int iLayerPlane )
{
- return (HGLRC) stw_create_context( hdc, iLayerPlane );
+ return (HGLRC) stw_create_layer_context( hdc, iLayerPlane );
}
WINGDIAPI BOOL APIENTRY
wglDeleteContext(
HGLRC hglrc )
{
- return stw_delete_context( stw_context(hglrc) );
+ return stw_delete_context( (UINT_PTR)hglrc );
}
WINGDIAPI HGLRC APIENTRY
wglGetCurrentContext( VOID )
{
- return (HGLRC) stw_get_current_context();
+ return (HGLRC)stw_get_current_context();
}
WINGDIAPI HDC APIENTRY
@@ -99,7 +83,7 @@ wglMakeCurrent(
HDC hdc,
HGLRC hglrc )
{
- return stw_make_current( hdc, stw_context(hglrc) );
+ return stw_make_current( hdc, (UINT_PTR)hglrc );
}
diff --git a/src/gallium/state_trackers/wgl/wgl/stw_wgl.h b/src/gallium/state_trackers/wgl/wgl/stw_wgl.h
index b86cc240f2..a98179944a 100644
--- a/src/gallium/state_trackers/wgl/wgl/stw_wgl.h
+++ b/src/gallium/state_trackers/wgl/wgl/stw_wgl.h
@@ -31,7 +31,7 @@
#include <windows.h>
-#include "GL/gl.h"
+#include <GL/gl.h>
/*