summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2009-09-22 18:51:41 +0100
committerJosé Fonseca <[email protected]>2009-09-23 10:32:52 +0100
commit31f1571d1f6e325c16833afbb6e15b61561e5f1f (patch)
tree9493fb1359ee19048ea0b7b787cecc5cfa5de323
parentf8c11526c0034faca7b7e3ab01ab85206847f441 (diff)
wgl: Eliminate the shared layer; implement WGL API on top of the ICD callbacks.
While the WGL API has been stale for decades now, the ICD interface has been updated with new Windows versions, so it is much easier to define everything in terms of the ICD interfaces, which is pretty much what Microsoft's opengl32.dll does anyway.
-rw-r--r--src/gallium/state_trackers/wgl/SConscript1
-rw-r--r--src/gallium/state_trackers/wgl/stw_context.c441
-rw-r--r--src/gallium/state_trackers/wgl/stw_context.h8
-rw-r--r--src/gallium/state_trackers/wgl/stw_device.c23
-rw-r--r--src/gallium/state_trackers/wgl/stw_device.h5
-rw-r--r--src/gallium/state_trackers/wgl/stw_ext_gallium.c1
-rw-r--r--src/gallium/state_trackers/wgl/stw_ext_pixelformat.c1
-rw-r--r--src/gallium/state_trackers/wgl/stw_framebuffer.c18
-rw-r--r--src/gallium/state_trackers/wgl/stw_getprocaddress.c5
-rw-r--r--src/gallium/state_trackers/wgl/stw_icd.c617
-rw-r--r--src/gallium/state_trackers/wgl/stw_pixelformat.c60
-rw-r--r--src/gallium/state_trackers/wgl/stw_pixelformat.h7
-rw-r--r--src/gallium/state_trackers/wgl/stw_public.h73
-rw-r--r--src/gallium/state_trackers/wgl/stw_wgl.c63
14 files changed, 525 insertions, 798 deletions
diff --git a/src/gallium/state_trackers/wgl/SConscript b/src/gallium/state_trackers/wgl/SConscript
index 2e9aacb6e2c..b05944a33b3 100644
--- a/src/gallium/state_trackers/wgl/SConscript
+++ b/src/gallium/state_trackers/wgl/SConscript
@@ -26,7 +26,6 @@ if env['platform'] in ['windows']:
'stw_ext_swapinterval.c',
'stw_framebuffer.c',
'stw_getprocaddress.c',
- 'stw_icd.c',
'stw_pixelformat.c',
'stw_tls.c',
'stw_wgl.c',
diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c
index ead2c13cbfc..f2f0264844a 100644
--- a/src/gallium/state_trackers/wgl/stw_context.c
+++ b/src/gallium/state_trackers/wgl/stw_context.c
@@ -39,11 +39,11 @@
#include "trace/tr_context.h"
#endif
+#include "stw_icd.h"
#include "stw_device.h"
#include "stw_winsys.h"
#include "stw_framebuffer.h"
#include "stw_pixelformat.h"
-#include "stw_public.h"
#include "stw_context.h"
#include "stw_tls.h"
@@ -70,11 +70,11 @@ stw_current_context(void)
}
}
-BOOL
-stw_copy_context(
- UINT_PTR hglrcSrc,
- UINT_PTR hglrcDst,
- UINT mask )
+BOOL APIENTRY
+DrvCopyContext(
+ DHGLRC dhrcSource,
+ DHGLRC dhrcDest,
+ UINT fuMask )
{
struct stw_context *src;
struct stw_context *dst;
@@ -82,15 +82,15 @@ stw_copy_context(
pipe_mutex_lock( stw_dev->ctx_mutex );
- src = stw_lookup_context_locked( hglrcSrc );
- dst = stw_lookup_context_locked( hglrcDst );
+ src = stw_lookup_context_locked( dhrcSource );
+ dst = stw_lookup_context_locked( dhrcDest );
if (src && dst) {
/* FIXME */
assert(0);
(void) src;
(void) dst;
- (void) mask;
+ (void) fuMask;
}
pipe_mutex_unlock( stw_dev->ctx_mutex );
@@ -98,10 +98,10 @@ stw_copy_context(
return ret;
}
-BOOL
-stw_share_lists(
- UINT_PTR hglrc1,
- UINT_PTR hglrc2 )
+BOOL APIENTRY
+DrvShareLists(
+ DHGLRC dhglrc1,
+ DHGLRC dhglrc2 )
{
struct stw_context *ctx1;
struct stw_context *ctx2;
@@ -109,8 +109,8 @@ stw_share_lists(
pipe_mutex_lock( stw_dev->ctx_mutex );
- ctx1 = stw_lookup_context_locked( hglrc1 );
- ctx2 = stw_lookup_context_locked( hglrc2 );
+ ctx1 = stw_lookup_context_locked( dhglrc1 );
+ ctx2 = stw_lookup_context_locked( dhglrc2 );
if (ctx1 && ctx2 &&
ctx1->iPixelFormat == ctx2->iPixelFormat) {
@@ -136,10 +136,17 @@ stw_viewport(GLcontext * glctx, GLint x, GLint y,
}
}
-UINT_PTR
-stw_create_layer_context(
+DHGLRC APIENTRY
+DrvCreateContext(
+ HDC hdc )
+{
+ return DrvCreateLayerContext( hdc, 0 );
+}
+
+DHGLRC APIENTRY
+DrvCreateLayerContext(
HDC hdc,
- int iLayerPlane )
+ INT iLayerPlane )
{
int iPixelFormat;
const struct stw_pixelformat_info *pfi;
@@ -198,12 +205,12 @@ stw_create_layer_context(
ctx->st->ctx->Driver.Viewport = stw_viewport;
pipe_mutex_lock( stw_dev->ctx_mutex );
- ctx->hglrc = handle_table_add(stw_dev->ctx_table, ctx);
+ ctx->dhglrc = handle_table_add(stw_dev->ctx_table, ctx);
pipe_mutex_unlock( stw_dev->ctx_mutex );
- if (!ctx->hglrc)
+ if (!ctx->dhglrc)
goto no_hglrc;
- return ctx->hglrc;
+ return ctx->dhglrc;
no_hglrc:
st_destroy_context(ctx->st);
@@ -216,9 +223,9 @@ no_ctx:
return 0;
}
-BOOL
-stw_delete_context(
- UINT_PTR hglrc )
+BOOL APIENTRY
+DrvDeleteContext(
+ DHGLRC dhglrc )
{
struct stw_context *ctx ;
BOOL ret = FALSE;
@@ -227,8 +234,8 @@ stw_delete_context(
return FALSE;
pipe_mutex_lock( stw_dev->ctx_mutex );
- ctx = stw_lookup_context_locked(hglrc);
- handle_table_remove(stw_dev->ctx_table, hglrc);
+ ctx = stw_lookup_context_locked(dhglrc);
+ handle_table_remove(stw_dev->ctx_table, dhglrc);
pipe_mutex_unlock( stw_dev->ctx_mutex );
if (ctx) {
@@ -247,9 +254,9 @@ stw_delete_context(
return ret;
}
-BOOL
-stw_release_context(
- UINT_PTR hglrc )
+BOOL APIENTRY
+DrvReleaseContext(
+ DHGLRC dhglrc )
{
struct stw_context *ctx;
@@ -257,7 +264,7 @@ stw_release_context(
return FALSE;
pipe_mutex_lock( stw_dev->ctx_mutex );
- ctx = stw_lookup_context_locked( hglrc );
+ ctx = stw_lookup_context_locked( dhglrc );
pipe_mutex_unlock( stw_dev->ctx_mutex );
if (!ctx)
@@ -277,7 +284,7 @@ stw_release_context(
}
-UINT_PTR
+DHGLRC
stw_get_current_context( void )
{
struct stw_context *ctx;
@@ -286,7 +293,7 @@ stw_get_current_context( void )
if(!ctx)
return 0;
- return ctx->hglrc;
+ return ctx->dhglrc;
}
HDC
@@ -304,7 +311,7 @@ stw_get_current_dc( void )
BOOL
stw_make_current(
HDC hdc,
- UINT_PTR hglrc )
+ DHGLRC dhglrc )
{
struct stw_context *curctx = NULL;
struct stw_context *ctx = NULL;
@@ -315,23 +322,23 @@ stw_make_current(
curctx = stw_current_context();
if (curctx != NULL) {
- if (curctx->hglrc != hglrc)
+ if (curctx->dhglrc != dhglrc)
st_flush(curctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
/* Return if already current. */
- if (curctx->hglrc == hglrc && curctx->hdc == hdc) {
+ if (curctx->dhglrc == dhglrc && curctx->hdc == hdc) {
ctx = curctx;
fb = stw_framebuffer_from_hdc( hdc );
goto success;
}
}
- if (hdc == NULL || hglrc == 0) {
+ if (hdc == NULL || dhglrc == 0) {
return st_make_current( NULL, NULL, NULL );
}
pipe_mutex_lock( stw_dev->ctx_mutex );
- ctx = stw_lookup_context_locked( hglrc );
+ ctx = stw_lookup_context_locked( dhglrc );
pipe_mutex_unlock( stw_dev->ctx_mutex );
if(!ctx)
goto fail;
@@ -380,3 +387,363 @@ fail:
st_make_current( NULL, NULL, NULL );
return FALSE;
}
+
+/**
+ * Although WGL allows different dispatch entrypoints per context
+ */
+static const GLCLTPROCTABLE cpt =
+{
+ OPENGL_VERSION_110_ENTRIES,
+ {
+ &glNewList,
+ &glEndList,
+ &glCallList,
+ &glCallLists,
+ &glDeleteLists,
+ &glGenLists,
+ &glListBase,
+ &glBegin,
+ &glBitmap,
+ &glColor3b,
+ &glColor3bv,
+ &glColor3d,
+ &glColor3dv,
+ &glColor3f,
+ &glColor3fv,
+ &glColor3i,
+ &glColor3iv,
+ &glColor3s,
+ &glColor3sv,
+ &glColor3ub,
+ &glColor3ubv,
+ &glColor3ui,
+ &glColor3uiv,
+ &glColor3us,
+ &glColor3usv,
+ &glColor4b,
+ &glColor4bv,
+ &glColor4d,
+ &glColor4dv,
+ &glColor4f,
+ &glColor4fv,
+ &glColor4i,
+ &glColor4iv,
+ &glColor4s,
+ &glColor4sv,
+ &glColor4ub,
+ &glColor4ubv,
+ &glColor4ui,
+ &glColor4uiv,
+ &glColor4us,
+ &glColor4usv,
+ &glEdgeFlag,
+ &glEdgeFlagv,
+ &glEnd,
+ &glIndexd,
+ &glIndexdv,
+ &glIndexf,
+ &glIndexfv,
+ &glIndexi,
+ &glIndexiv,
+ &glIndexs,
+ &glIndexsv,
+ &glNormal3b,
+ &glNormal3bv,
+ &glNormal3d,
+ &glNormal3dv,
+ &glNormal3f,
+ &glNormal3fv,
+ &glNormal3i,
+ &glNormal3iv,
+ &glNormal3s,
+ &glNormal3sv,
+ &glRasterPos2d,
+ &glRasterPos2dv,
+ &glRasterPos2f,
+ &glRasterPos2fv,
+ &glRasterPos2i,
+ &glRasterPos2iv,
+ &glRasterPos2s,
+ &glRasterPos2sv,
+ &glRasterPos3d,
+ &glRasterPos3dv,
+ &glRasterPos3f,
+ &glRasterPos3fv,
+ &glRasterPos3i,
+ &glRasterPos3iv,
+ &glRasterPos3s,
+ &glRasterPos3sv,
+ &glRasterPos4d,
+ &glRasterPos4dv,
+ &glRasterPos4f,
+ &glRasterPos4fv,
+ &glRasterPos4i,
+ &glRasterPos4iv,
+ &glRasterPos4s,
+ &glRasterPos4sv,
+ &glRectd,
+ &glRectdv,
+ &glRectf,
+ &glRectfv,
+ &glRecti,
+ &glRectiv,
+ &glRects,
+ &glRectsv,
+ &glTexCoord1d,
+ &glTexCoord1dv,
+ &glTexCoord1f,
+ &glTexCoord1fv,
+ &glTexCoord1i,
+ &glTexCoord1iv,
+ &glTexCoord1s,
+ &glTexCoord1sv,
+ &glTexCoord2d,
+ &glTexCoord2dv,
+ &glTexCoord2f,
+ &glTexCoord2fv,
+ &glTexCoord2i,
+ &glTexCoord2iv,
+ &glTexCoord2s,
+ &glTexCoord2sv,
+ &glTexCoord3d,
+ &glTexCoord3dv,
+ &glTexCoord3f,
+ &glTexCoord3fv,
+ &glTexCoord3i,
+ &glTexCoord3iv,
+ &glTexCoord3s,
+ &glTexCoord3sv,
+ &glTexCoord4d,
+ &glTexCoord4dv,
+ &glTexCoord4f,
+ &glTexCoord4fv,
+ &glTexCoord4i,
+ &glTexCoord4iv,
+ &glTexCoord4s,
+ &glTexCoord4sv,
+ &glVertex2d,
+ &glVertex2dv,
+ &glVertex2f,
+ &glVertex2fv,
+ &glVertex2i,
+ &glVertex2iv,
+ &glVertex2s,
+ &glVertex2sv,
+ &glVertex3d,
+ &glVertex3dv,
+ &glVertex3f,
+ &glVertex3fv,
+ &glVertex3i,
+ &glVertex3iv,
+ &glVertex3s,
+ &glVertex3sv,
+ &glVertex4d,
+ &glVertex4dv,
+ &glVertex4f,
+ &glVertex4fv,
+ &glVertex4i,
+ &glVertex4iv,
+ &glVertex4s,
+ &glVertex4sv,
+ &glClipPlane,
+ &glColorMaterial,
+ &glCullFace,
+ &glFogf,
+ &glFogfv,
+ &glFogi,
+ &glFogiv,
+ &glFrontFace,
+ &glHint,
+ &glLightf,
+ &glLightfv,
+ &glLighti,
+ &glLightiv,
+ &glLightModelf,
+ &glLightModelfv,
+ &glLightModeli,
+ &glLightModeliv,
+ &glLineStipple,
+ &glLineWidth,
+ &glMaterialf,
+ &glMaterialfv,
+ &glMateriali,
+ &glMaterialiv,
+ &glPointSize,
+ &glPolygonMode,
+ &glPolygonStipple,
+ &glScissor,
+ &glShadeModel,
+ &glTexParameterf,
+ &glTexParameterfv,
+ &glTexParameteri,
+ &glTexParameteriv,
+ &glTexImage1D,
+ &glTexImage2D,
+ &glTexEnvf,
+ &glTexEnvfv,
+ &glTexEnvi,
+ &glTexEnviv,
+ &glTexGend,
+ &glTexGendv,
+ &glTexGenf,
+ &glTexGenfv,
+ &glTexGeni,
+ &glTexGeniv,
+ &glFeedbackBuffer,
+ &glSelectBuffer,
+ &glRenderMode,
+ &glInitNames,
+ &glLoadName,
+ &glPassThrough,
+ &glPopName,
+ &glPushName,
+ &glDrawBuffer,
+ &glClear,
+ &glClearAccum,
+ &glClearIndex,
+ &glClearColor,
+ &glClearStencil,
+ &glClearDepth,
+ &glStencilMask,
+ &glColorMask,
+ &glDepthMask,
+ &glIndexMask,
+ &glAccum,
+ &glDisable,
+ &glEnable,
+ &glFinish,
+ &glFlush,
+ &glPopAttrib,
+ &glPushAttrib,
+ &glMap1d,
+ &glMap1f,
+ &glMap2d,
+ &glMap2f,
+ &glMapGrid1d,
+ &glMapGrid1f,
+ &glMapGrid2d,
+ &glMapGrid2f,
+ &glEvalCoord1d,
+ &glEvalCoord1dv,
+ &glEvalCoord1f,
+ &glEvalCoord1fv,
+ &glEvalCoord2d,
+ &glEvalCoord2dv,
+ &glEvalCoord2f,
+ &glEvalCoord2fv,
+ &glEvalMesh1,
+ &glEvalPoint1,
+ &glEvalMesh2,
+ &glEvalPoint2,
+ &glAlphaFunc,
+ &glBlendFunc,
+ &glLogicOp,
+ &glStencilFunc,
+ &glStencilOp,
+ &glDepthFunc,
+ &glPixelZoom,
+ &glPixelTransferf,
+ &glPixelTransferi,
+ &glPixelStoref,
+ &glPixelStorei,
+ &glPixelMapfv,
+ &glPixelMapuiv,
+ &glPixelMapusv,
+ &glReadBuffer,
+ &glCopyPixels,
+ &glReadPixels,
+ &glDrawPixels,
+ &glGetBooleanv,
+ &glGetClipPlane,
+ &glGetDoublev,
+ &glGetError,
+ &glGetFloatv,
+ &glGetIntegerv,
+ &glGetLightfv,
+ &glGetLightiv,
+ &glGetMapdv,
+ &glGetMapfv,
+ &glGetMapiv,
+ &glGetMaterialfv,
+ &glGetMaterialiv,
+ &glGetPixelMapfv,
+ &glGetPixelMapuiv,
+ &glGetPixelMapusv,
+ &glGetPolygonStipple,
+ &glGetString,
+ &glGetTexEnvfv,
+ &glGetTexEnviv,
+ &glGetTexGendv,
+ &glGetTexGenfv,
+ &glGetTexGeniv,
+ &glGetTexImage,
+ &glGetTexParameterfv,
+ &glGetTexParameteriv,
+ &glGetTexLevelParameterfv,
+ &glGetTexLevelParameteriv,
+ &glIsEnabled,
+ &glIsList,
+ &glDepthRange,
+ &glFrustum,
+ &glLoadIdentity,
+ &glLoadMatrixf,
+ &glLoadMatrixd,
+ &glMatrixMode,
+ &glMultMatrixf,
+ &glMultMatrixd,
+ &glOrtho,
+ &glPopMatrix,
+ &glPushMatrix,
+ &glRotated,
+ &glRotatef,
+ &glScaled,
+ &glScalef,
+ &glTranslated,
+ &glTranslatef,
+ &glViewport,
+ &glArrayElement,
+ &glBindTexture,
+ &glColorPointer,
+ &glDisableClientState,
+ &glDrawArrays,
+ &glDrawElements,
+ &glEdgeFlagPointer,
+ &glEnableClientState,
+ &glIndexPointer,
+ &glIndexub,
+ &glIndexubv,
+ &glInterleavedArrays,
+ &glNormalPointer,
+ &glPolygonOffset,
+ &glTexCoordPointer,
+ &glVertexPointer,
+ &glAreTexturesResident,
+ &glCopyTexImage1D,
+ &glCopyTexImage2D,
+ &glCopyTexSubImage1D,
+ &glCopyTexSubImage2D,
+ &glDeleteTextures,
+ &glGenTextures,
+ &glGetPointerv,
+ &glIsTexture,
+ &glPrioritizeTextures,
+ &glTexSubImage1D,
+ &glTexSubImage2D,
+ &glPopClientAttrib,
+ &glPushClientAttrib
+ }
+};
+
+PGLCLTPROCTABLE APIENTRY
+DrvSetContext(
+ HDC hdc,
+ DHGLRC dhglrc,
+ PFN_SETPROCTABLE pfnSetProcTable )
+{
+ PGLCLTPROCTABLE r = (PGLCLTPROCTABLE)&cpt;
+
+ if (!stw_make_current( hdc, dhglrc ))
+ r = NULL;
+
+ return r;
+}
diff --git a/src/gallium/state_trackers/wgl/stw_context.h b/src/gallium/state_trackers/wgl/stw_context.h
index 166471de5eb..256c27e21ef 100644
--- a/src/gallium/state_trackers/wgl/stw_context.h
+++ b/src/gallium/state_trackers/wgl/stw_context.h
@@ -35,9 +35,15 @@ struct st_context;
struct stw_context
{
struct st_context *st;
- UINT_PTR hglrc;
+ DHGLRC dhglrc;
int iPixelFormat;
HDC hdc;
};
+DHGLRC stw_get_current_context( void );
+
+HDC stw_get_current_dc( void );
+
+BOOL stw_make_current( HDC hdc, DHGLRC dhglrc );
+
#endif /* STW_CONTEXT_H */
diff --git a/src/gallium/state_trackers/wgl/stw_device.c b/src/gallium/state_trackers/wgl/stw_device.c
index cbc3570cb9f..a1a5b892ef5 100644
--- a/src/gallium/state_trackers/wgl/stw_device.c
+++ b/src/gallium/state_trackers/wgl/stw_device.c
@@ -40,7 +40,7 @@
#include "stw_device.h"
#include "stw_winsys.h"
#include "stw_pixelformat.h"
-#include "stw_public.h"
+#include "stw_icd.h"
#include "stw_tls.h"
#include "stw_framebuffer.h"
@@ -182,7 +182,7 @@ stw_cleanup(void)
/* Ensure all contexts are destroyed */
i = handle_table_get_first_handle(stw_dev->ctx_table);
while (i) {
- stw_delete_context(i);
+ DrvDeleteContext(i);
i = handle_table_get_next_handle(stw_dev->ctx_table, i);
}
handle_table_destroy(stw_dev->ctx_table);
@@ -212,7 +212,7 @@ stw_cleanup(void)
struct stw_context *
-stw_lookup_context_locked( UINT_PTR dhglrc )
+stw_lookup_context_locked( DHGLRC dhglrc )
{
if (dhglrc == 0)
return NULL;
@@ -223,3 +223,20 @@ stw_lookup_context_locked( UINT_PTR dhglrc )
return (struct stw_context *) handle_table_get(stw_dev->ctx_table, dhglrc);
}
+
+void APIENTRY
+DrvSetCallbackProcs(
+ INT nProcs,
+ PROC *pProcs )
+{
+ return;
+}
+
+
+BOOL APIENTRY
+DrvValidateVersion(
+ ULONG ulVersion )
+{
+ /* TODO: get the expected version from the winsys */
+ return ulVersion == 1;
+}
diff --git a/src/gallium/state_trackers/wgl/stw_device.h b/src/gallium/state_trackers/wgl/stw_device.h
index e1bb9518dd1..5e4e3d61802 100644
--- a/src/gallium/state_trackers/wgl/stw_device.h
+++ b/src/gallium/state_trackers/wgl/stw_device.h
@@ -29,11 +29,10 @@
#define STW_DEVICE_H_
-#include <windows.h>
-
#include "pipe/p_compiler.h"
#include "pipe/p_thread.h"
#include "util/u_handle_table.h"
+#include "stw_icd.h"
#include "stw_pixelformat.h"
@@ -69,7 +68,7 @@ struct stw_device
};
struct stw_context *
-stw_lookup_context_locked( UINT_PTR hglrc );
+stw_lookup_context_locked( DHGLRC hglrc );
extern struct stw_device *stw_dev;
diff --git a/src/gallium/state_trackers/wgl/stw_ext_gallium.c b/src/gallium/state_trackers/wgl/stw_ext_gallium.c
index 13a42fee253..fb30ec5dba9 100644
--- a/src/gallium/state_trackers/wgl/stw_ext_gallium.c
+++ b/src/gallium/state_trackers/wgl/stw_ext_gallium.c
@@ -27,7 +27,6 @@
#include "pipe/p_screen.h"
-#include "stw_public.h"
#include "stw_device.h"
#include "stw_winsys.h"
#include "stw_ext_gallium.h"
diff --git a/src/gallium/state_trackers/wgl/stw_ext_pixelformat.c b/src/gallium/state_trackers/wgl/stw_ext_pixelformat.c
index 0e2d4076993..8a9995aba8e 100644
--- a/src/gallium/state_trackers/wgl/stw_ext_pixelformat.c
+++ b/src/gallium/state_trackers/wgl/stw_ext_pixelformat.c
@@ -43,7 +43,6 @@
#include "pipe/p_compiler.h"
#include "util/u_memory.h"
-#include "stw_public.h"
#include "stw_pixelformat.h"
diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c b/src/gallium/state_trackers/wgl/stw_framebuffer.c
index b8956bb5509..123b841c8f3 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c
@@ -38,9 +38,9 @@
#include "trace/tr_texture.h"
#endif
+#include "stw_icd.h"
#include "stw_framebuffer.h"
#include "stw_device.h"
-#include "stw_public.h"
#include "stw_winsys.h"
#include "stw_tls.h"
@@ -379,10 +379,10 @@ stw_framebuffer_from_hwnd(
}
-BOOL
-stw_pixelformat_set(
+BOOL APIENTRY
+DrvSetPixelFormat(
HDC hdc,
- int iPixelFormat )
+ LONG iPixelFormat )
{
uint count;
uint index;
@@ -435,8 +435,8 @@ stw_pixelformat_get(
}
-BOOL
-stw_swap_buffers(
+BOOL APIENTRY
+DrvSwapBuffers(
HDC hdc )
{
struct stw_framebuffer *fb;
@@ -481,13 +481,13 @@ stw_swap_buffers(
}
-BOOL
-stw_swap_layer_buffers(
+BOOL APIENTRY
+DrvSwapLayerBuffers(
HDC hdc,
UINT fuPlanes )
{
if(fuPlanes & WGL_SWAP_MAIN_PLANE)
- return stw_swap_buffers(hdc);
+ return DrvSwapBuffers(hdc);
return FALSE;
}
diff --git a/src/gallium/state_trackers/wgl/stw_getprocaddress.c b/src/gallium/state_trackers/wgl/stw_getprocaddress.c
index 57ce63ec021..8875dc22f3d 100644
--- a/src/gallium/state_trackers/wgl/stw_getprocaddress.c
+++ b/src/gallium/state_trackers/wgl/stw_getprocaddress.c
@@ -33,7 +33,6 @@
#include <GL/wglext.h>
#include "glapi/glapi.h"
-#include "stw_public.h"
#include "stw_ext_gallium.h"
struct stw_extension_entry
@@ -68,8 +67,8 @@ static const struct stw_extension_entry stw_extension_entries[] = {
{ NULL, NULL }
};
-PROC
-stw_get_proc_address(
+PROC APIENTRY
+DrvGetProcAddress(
LPCSTR lpszProc )
{
const struct stw_extension_entry *entry;
diff --git a/src/gallium/state_trackers/wgl/stw_icd.c b/src/gallium/state_trackers/wgl/stw_icd.c
deleted file mode 100644
index dc5ba9161e6..00000000000
--- a/src/gallium/state_trackers/wgl/stw_icd.c
+++ /dev/null
@@ -1,617 +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.
- *
- **************************************************************************/
-
-#include <windows.h>
-#include <stdio.h>
-
-#include "GL/gl.h"
-
-#include "util/u_debug.h"
-#include "pipe/p_thread.h"
-
-#include "stw_public.h"
-#include "stw_icd.h"
-
-#define DBG 0
-
-
-BOOL APIENTRY
-DrvCopyContext(
- DHGLRC dhrcSource,
- DHGLRC dhrcDest,
- UINT fuMask )
-{
- return stw_copy_context(dhrcSource, dhrcDest, fuMask);
-}
-
-
-DHGLRC APIENTRY
-DrvCreateLayerContext(
- HDC hdc,
- INT iLayerPlane )
-{
- DHGLRC r;
-
- r = stw_create_layer_context( hdc, iLayerPlane );
-
- if (DBG)
- debug_printf( "%s( %p, %i ) = %lu\n",
- __FUNCTION__, hdc, iLayerPlane, r );
-
- return r;
-}
-
-DHGLRC APIENTRY
-DrvCreateContext(
- HDC hdc )
-{
- return DrvCreateLayerContext( hdc, 0 );
-}
-
-BOOL APIENTRY
-DrvDeleteContext(
- DHGLRC dhglrc )
-{
- BOOL r;
-
- r = stw_delete_context( dhglrc );
-
- if (DBG)
- debug_printf( "%s( %lu ) = %u\n",
- __FUNCTION__, dhglrc, r );
-
- return r;
-}
-
-BOOL APIENTRY
-DrvDescribeLayerPlane(
- HDC hdc,
- INT iPixelFormat,
- INT iLayerPlane,
- UINT nBytes,
- LPLAYERPLANEDESCRIPTOR plpd )
-{
- if (DBG)
- debug_printf( "%s\n", __FUNCTION__ );
-
- return FALSE;
-}
-
-LONG APIENTRY
-DrvDescribePixelFormat(
- HDC hdc,
- INT iPixelFormat,
- ULONG cjpfd,
- PIXELFORMATDESCRIPTOR *ppfd )
-{
- LONG r;
-
- r = stw_pixelformat_describe( hdc, iPixelFormat, cjpfd, ppfd );
-
- if (DBG)
- debug_printf( "%s( %p, %i, %lu, %p ) = %li\n",
- __FUNCTION__, hdc, iPixelFormat, cjpfd, ppfd, r );
-
- return r;
-}
-
-int APIENTRY
-DrvGetLayerPaletteEntries(
- HDC hdc,
- INT iLayerPlane,
- INT iStart,
- INT cEntries,
- COLORREF *pcr )
-{
- if (DBG)
- debug_printf( "%s\n", __FUNCTION__ );
-
- return 0;
-}
-
-PROC APIENTRY
-DrvGetProcAddress(
- LPCSTR lpszProc )
-{
- PROC r;
-
- r = stw_get_proc_address( lpszProc );
-
- if (DBG)
- debug_printf( "%s( \"%s\" ) = %p\n", __FUNCTION__, lpszProc, r );
-
- return r;
-}
-
-BOOL APIENTRY
-DrvRealizeLayerPalette(
- HDC hdc,
- INT iLayerPlane,
- BOOL bRealize )
-{
- if (DBG)
- debug_printf( "%s\n", __FUNCTION__ );
-
- return FALSE;
-}
-
-BOOL APIENTRY
-DrvReleaseContext(
- DHGLRC dhglrc )
-{
- return stw_release_context(dhglrc);
-}
-
-void APIENTRY
-DrvSetCallbackProcs(
- INT nProcs,
- PROC *pProcs )
-{
- if (DBG)
- debug_printf( "%s( %d, %p )\n", __FUNCTION__, nProcs, pProcs );
-
- return;
-}
-
-
-/**
- * Although WGL allows different dispatch entrypoints per context
- */
-static const GLCLTPROCTABLE cpt =
-{
- OPENGL_VERSION_110_ENTRIES,
- {
- &glNewList,
- &glEndList,
- &glCallList,
- &glCallLists,
- &glDeleteLists,
- &glGenLists,
- &glListBase,
- &glBegin,
- &glBitmap,
- &glColor3b,
- &glColor3bv,
- &glColor3d,
- &glColor3dv,
- &glColor3f,
- &glColor3fv,
- &glColor3i,
- &glColor3iv,
- &glColor3s,
- &glColor3sv,
- &glColor3ub,
- &glColor3ubv,
- &glColor3ui,
- &glColor3uiv,
- &glColor3us,
- &glColor3usv,
- &glColor4b,
- &glColor4bv,
- &glColor4d,
- &glColor4dv,
- &glColor4f,
- &glColor4fv,
- &glColor4i,
- &glColor4iv,
- &glColor4s,
- &glColor4sv,
- &glColor4ub,
- &glColor4ubv,
- &glColor4ui,
- &glColor4uiv,
- &glColor4us,
- &glColor4usv,
- &glEdgeFlag,
- &glEdgeFlagv,
- &glEnd,
- &glIndexd,
- &glIndexdv,
- &glIndexf,
- &glIndexfv,
- &glIndexi,
- &glIndexiv,
- &glIndexs,
- &glIndexsv,
- &glNormal3b,
- &glNormal3bv,
- &glNormal3d,
- &glNormal3dv,
- &glNormal3f,
- &glNormal3fv,
- &glNormal3i,
- &glNormal3iv,
- &glNormal3s,
- &glNormal3sv,
- &glRasterPos2d,
- &glRasterPos2dv,
- &glRasterPos2f,
- &glRasterPos2fv,
- &glRasterPos2i,
- &glRasterPos2iv,
- &glRasterPos2s,
- &glRasterPos2sv,
- &glRasterPos3d,
- &glRasterPos3dv,
- &glRasterPos3f,
- &glRasterPos3fv,
- &glRasterPos3i,
- &glRasterPos3iv,
- &glRasterPos3s,
- &glRasterPos3sv,
- &glRasterPos4d,
- &glRasterPos4dv,
- &glRasterPos4f,
- &glRasterPos4fv,
- &glRasterPos4i,
- &glRasterPos4iv,
- &glRasterPos4s,
- &glRasterPos4sv,
- &glRectd,
- &glRectdv,
- &glRectf,
- &glRectfv,
- &glRecti,
- &glRectiv,
- &glRects,
- &glRectsv,
- &glTexCoord1d,
- &glTexCoord1dv,
- &glTexCoord1f,
- &glTexCoord1fv,
- &glTexCoord1i,
- &glTexCoord1iv,
- &glTexCoord1s,
- &glTexCoord1sv,
- &glTexCoord2d,
- &glTexCoord2dv,
- &glTexCoord2f,
- &glTexCoord2fv,
- &glTexCoord2i,
- &glTexCoord2iv,
- &glTexCoord2s,
- &glTexCoord2sv,
- &glTexCoord3d,
- &glTexCoord3dv,
- &glTexCoord3f,
- &glTexCoord3fv,
- &glTexCoord3i,
- &glTexCoord3iv,
- &glTexCoord3s,
- &glTexCoord3sv,
- &glTexCoord4d,
- &glTexCoord4dv,
- &glTexCoord4f,
- &glTexCoord4fv,
- &glTexCoord4i,
- &glTexCoord4iv,
- &glTexCoord4s,
- &glTexCoord4sv,
- &glVertex2d,
- &glVertex2dv,
- &glVertex2f,
- &glVertex2fv,
- &glVertex2i,
- &glVertex2iv,
- &glVertex2s,
- &glVertex2sv,
- &glVertex3d,
- &glVertex3dv,
- &glVertex3f,
- &glVertex3fv,
- &glVertex3i,
- &glVertex3iv,
- &glVertex3s,
- &glVertex3sv,
- &glVertex4d,
- &glVertex4dv,
- &glVertex4f,
- &glVertex4fv,
- &glVertex4i,
- &glVertex4iv,
- &glVertex4s,
- &glVertex4sv,
- &glClipPlane,
- &glColorMaterial,
- &glCullFace,
- &glFogf,
- &glFogfv,
- &glFogi,
- &glFogiv,
- &glFrontFace,
- &glHint,
- &glLightf,
- &glLightfv,
- &glLighti,
- &glLightiv,
- &glLightModelf,
- &glLightModelfv,
- &glLightModeli,
- &glLightModeliv,
- &glLineStipple,
- &glLineWidth,
- &glMaterialf,
- &glMaterialfv,
- &glMateriali,
- &glMaterialiv,
- &glPointSize,
- &glPolygonMode,
- &glPolygonStipple,
- &glScissor,
- &glShadeModel,
- &glTexParameterf,
- &glTexParameterfv,
- &glTexParameteri,
- &glTexParameteriv,
- &glTexImage1D,
- &glTexImage2D,
- &glTexEnvf,
- &glTexEnvfv,
- &glTexEnvi,
- &glTexEnviv,
- &glTexGend,
- &glTexGendv,
- &glTexGenf,
- &glTexGenfv,
- &glTexGeni,
- &glTexGeniv,
- &glFeedbackBuffer,
- &glSelectBuffer,
- &glRenderMode,
- &glInitNames,
- &glLoadName,
- &glPassThrough,
- &glPopName,
- &glPushName,
- &glDrawBuffer,
- &glClear,
- &glClearAccum,
- &glClearIndex,
- &glClearColor,
- &glClearStencil,
- &glClearDepth,
- &glStencilMask,
- &glColorMask,
- &glDepthMask,
- &glIndexMask,
- &glAccum,
- &glDisable,
- &glEnable,
- &glFinish,
- &glFlush,
- &glPopAttrib,
- &glPushAttrib,
- &glMap1d,
- &glMap1f,
- &glMap2d,
- &glMap2f,
- &glMapGrid1d,
- &glMapGrid1f,
- &glMapGrid2d,
- &glMapGrid2f,
- &glEvalCoord1d,
- &glEvalCoord1dv,
- &glEvalCoord1f,
- &glEvalCoord1fv,
- &glEvalCoord2d,
- &glEvalCoord2dv,
- &glEvalCoord2f,
- &glEvalCoord2fv,
- &glEvalMesh1,
- &glEvalPoint1,
- &glEvalMesh2,
- &glEvalPoint2,
- &glAlphaFunc,
- &glBlendFunc,
- &glLogicOp,
- &glStencilFunc,
- &glStencilOp,
- &glDepthFunc,
- &glPixelZoom,
- &glPixelTransferf,
- &glPixelTransferi,
- &glPixelStoref,
- &glPixelStorei,
- &glPixelMapfv,
- &glPixelMapuiv,
- &glPixelMapusv,
- &glReadBuffer,
- &glCopyPixels,
- &glReadPixels,
- &glDrawPixels,
- &glGetBooleanv,
- &glGetClipPlane,
- &glGetDoublev,
- &glGetError,
- &glGetFloatv,
- &glGetIntegerv,
- &glGetLightfv,
- &glGetLightiv,
- &glGetMapdv,
- &glGetMapfv,
- &glGetMapiv,
- &glGetMaterialfv,
- &glGetMaterialiv,
- &glGetPixelMapfv,
- &glGetPixelMapuiv,
- &glGetPixelMapusv,
- &glGetPolygonStipple,
- &glGetString,
- &glGetTexEnvfv,
- &glGetTexEnviv,
- &glGetTexGendv,
- &glGetTexGenfv,
- &glGetTexGeniv,
- &glGetTexImage,
- &glGetTexParameterfv,
- &glGetTexParameteriv,
- &glGetTexLevelParameterfv,
- &glGetTexLevelParameteriv,
- &glIsEnabled,
- &glIsList,
- &glDepthRange,
- &glFrustum,
- &glLoadIdentity,
- &glLoadMatrixf,
- &glLoadMatrixd,
- &glMatrixMode,
- &glMultMatrixf,
- &glMultMatrixd,
- &glOrtho,
- &glPopMatrix,
- &glPushMatrix,
- &glRotated,
- &glRotatef,
- &glScaled,
- &glScalef,
- &glTranslated,
- &glTranslatef,
- &glViewport,
- &glArrayElement,
- &glBindTexture,
- &glColorPointer,
- &glDisableClientState,
- &glDrawArrays,
- &glDrawElements,
- &glEdgeFlagPointer,
- &glEnableClientState,
- &glIndexPointer,
- &glIndexub,
- &glIndexubv,
- &glInterleavedArrays,
- &glNormalPointer,
- &glPolygonOffset,
- &glTexCoordPointer,
- &glVertexPointer,
- &glAreTexturesResident,
- &glCopyTexImage1D,
- &glCopyTexImage2D,
- &glCopyTexSubImage1D,
- &glCopyTexSubImage2D,
- &glDeleteTextures,
- &glGenTextures,
- &glGetPointerv,
- &glIsTexture,
- &glPrioritizeTextures,
- &glTexSubImage1D,
- &glTexSubImage2D,
- &glPopClientAttrib,
- &glPushClientAttrib
- }
-};
-
-
-PGLCLTPROCTABLE APIENTRY
-DrvSetContext(
- HDC hdc,
- DHGLRC dhglrc,
- PFN_SETPROCTABLE pfnSetProcTable )
-{
- PGLCLTPROCTABLE r = (PGLCLTPROCTABLE)&cpt;
-
- if (!stw_make_current( hdc, dhglrc ))
- r = NULL;
-
- if (DBG)
- debug_printf( "%s( 0x%p, %lu, 0x%p ) = %p\n",
- __FUNCTION__, hdc, dhglrc, pfnSetProcTable, r );
-
- return r;
-}
-
-int APIENTRY
-DrvSetLayerPaletteEntries(
- HDC hdc,
- INT iLayerPlane,
- INT iStart,
- INT cEntries,
- CONST COLORREF *pcr )
-{
- if (DBG)
- debug_printf( "%s\n", __FUNCTION__ );
-
- return 0;
-}
-
-BOOL APIENTRY
-DrvSetPixelFormat(
- HDC hdc,
- LONG iPixelFormat )
-{
- BOOL r;
-
- r = stw_pixelformat_set( hdc, iPixelFormat );
-
- if (DBG)
- debug_printf( "%s( %p, %li ) = %s\n", __FUNCTION__, hdc, iPixelFormat, r ? "TRUE" : "FALSE" );
-
- return r;
-}
-
-BOOL APIENTRY
-DrvShareLists(
- DHGLRC dhglrc1,
- DHGLRC dhglrc2 )
-{
- if (DBG)
- debug_printf( "%s\n", __FUNCTION__ );
-
- return stw_share_lists(dhglrc1, dhglrc2);
-}
-
-BOOL APIENTRY
-DrvSwapBuffers(
- HDC hdc )
-{
- if (DBG)
- debug_printf( "%s( %p )\n", __FUNCTION__, hdc );
-
- return stw_swap_buffers( hdc );
-}
-
-BOOL APIENTRY
-DrvSwapLayerBuffers(
- HDC hdc,
- UINT fuPlanes )
-{
- if (DBG)
- debug_printf( "%s\n", __FUNCTION__ );
-
- return stw_swap_layer_buffers( hdc, fuPlanes );
-}
-
-BOOL APIENTRY
-DrvValidateVersion(
- ULONG ulVersion )
-{
- if (DBG)
- debug_printf( "%s( %lu )\n", __FUNCTION__, ulVersion );
-
- /* TODO: get the expected version from the winsys */
-
- return ulVersion == 1;
-}
diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.c b/src/gallium/state_trackers/wgl/stw_pixelformat.c
index c296744838b..9b591d5751d 100644
--- a/src/gallium/state_trackers/wgl/stw_pixelformat.c
+++ b/src/gallium/state_trackers/wgl/stw_pixelformat.c
@@ -34,9 +34,9 @@
#include "util/u_debug.h"
+#include "stw_icd.h"
#include "stw_device.h"
#include "stw_pixelformat.h"
-#include "stw_public.h"
#include "stw_tls.h"
@@ -288,12 +288,12 @@ stw_pixelformat_visual(GLvisual *visual,
}
-int
-stw_pixelformat_describe(
+LONG APIENTRY
+DrvDescribePixelFormat(
HDC hdc,
- int iPixelFormat,
- UINT nBytes,
- LPPIXELFORMATDESCRIPTOR ppfd )
+ INT iPixelFormat,
+ ULONG cjpfd,
+ PIXELFORMATDESCRIPTOR *ppfd )
{
uint count;
uint index;
@@ -306,7 +306,7 @@ stw_pixelformat_describe(
if (ppfd == NULL)
return count;
- if (index >= count || nBytes != sizeof( PIXELFORMATDESCRIPTOR ))
+ if (index >= count || cjpfd != sizeof( PIXELFORMATDESCRIPTOR ))
return 0;
pfi = stw_pixelformat_get_info( index );
@@ -316,6 +316,52 @@ stw_pixelformat_describe(
return count;
}
+BOOL APIENTRY
+DrvDescribeLayerPlane(
+ HDC hdc,
+ INT iPixelFormat,
+ INT iLayerPlane,
+ UINT nBytes,
+ LPLAYERPLANEDESCRIPTOR plpd )
+{
+ assert(0);
+ return FALSE;
+}
+
+int APIENTRY
+DrvGetLayerPaletteEntries(
+ HDC hdc,
+ INT iLayerPlane,
+ INT iStart,
+ INT cEntries,
+ COLORREF *pcr )
+{
+ assert(0);
+ return 0;
+}
+
+int APIENTRY
+DrvSetLayerPaletteEntries(
+ HDC hdc,
+ INT iLayerPlane,
+ INT iStart,
+ INT cEntries,
+ CONST COLORREF *pcr )
+{
+ assert(0);
+ return 0;
+}
+
+BOOL APIENTRY
+DrvRealizeLayerPalette(
+ HDC hdc,
+ INT iLayerPlane,
+ BOOL bRealize )
+{
+ assert(0);
+ return FALSE;
+}
+
/* Only used by the wgl code, but have it here to avoid exporting the
* pixelformat.h functionality.
*/
diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.h b/src/gallium/state_trackers/wgl/stw_pixelformat.h
index bec429231b2..2fa7e22c436 100644
--- a/src/gallium/state_trackers/wgl/stw_pixelformat.h
+++ b/src/gallium/state_trackers/wgl/stw_pixelformat.h
@@ -62,4 +62,11 @@ void
stw_pixelformat_visual(GLvisual *visual,
const struct stw_pixelformat_info *pfi );
+int
+stw_pixelformat_choose( HDC hdc,
+ CONST PIXELFORMATDESCRIPTOR *ppfd );
+
+int
+stw_pixelformat_get(HDC hdc);
+
#endif /* STW_PIXELFORMAT_H */
diff --git a/src/gallium/state_trackers/wgl/stw_public.h b/src/gallium/state_trackers/wgl/stw_public.h
deleted file mode 100644
index 7fe9cfb3561..00000000000
--- a/src/gallium/state_trackers/wgl/stw_public.h
+++ /dev/null
@@ -1,73 +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.
- *
- **************************************************************************/
-
-#ifndef STW_PUBLIC_H
-#define STW_PUBLIC_H
-
-#include <windows.h>
-
-BOOL stw_copy_context( UINT_PTR hglrcSrc,
- UINT_PTR hglrcDst,
- UINT mask );
-
-UINT_PTR stw_create_layer_context( HDC hdc,
- int iLayerPlane );
-
-BOOL stw_share_lists( UINT_PTR hglrc1, UINT_PTR hglrc2 );
-
-BOOL stw_delete_context( UINT_PTR hglrc );
-
-BOOL
-stw_release_context( UINT_PTR dhglrc );
-
-UINT_PTR stw_get_current_context( void );
-
-HDC stw_get_current_dc( void );
-
-BOOL stw_make_current( HDC hdc, UINT_PTR hglrc );
-
-BOOL stw_swap_buffers( HDC hdc );
-
-BOOL
-stw_swap_layer_buffers( HDC hdc, UINT fuPlanes );
-
-PROC stw_get_proc_address( LPCSTR lpszProc );
-
-int stw_pixelformat_describe( HDC hdc,
- int iPixelFormat,
- UINT nBytes,
- LPPIXELFORMATDESCRIPTOR ppfd );
-
-int stw_pixelformat_get( HDC hdc );
-
-BOOL stw_pixelformat_set( HDC hdc,
- int iPixelFormat );
-
-int stw_pixelformat_choose( HDC hdc,
- CONST PIXELFORMATDESCRIPTOR *ppfd );
-
-#endif
diff --git a/src/gallium/state_trackers/wgl/stw_wgl.c b/src/gallium/state_trackers/wgl/stw_wgl.c
index d4b2f51f4c8..bb199fdd252 100644
--- a/src/gallium/state_trackers/wgl/stw_wgl.c
+++ b/src/gallium/state_trackers/wgl/stw_wgl.c
@@ -28,7 +28,9 @@
#include <windows.h>
#include "util/u_debug.h"
-#include "stw_public.h"
+#include "stw_icd.h"
+#include "stw_context.h"
+#include "stw_pixelformat.h"
#include "stw_wgl.h"
@@ -38,16 +40,16 @@ wglCopyContext(
HGLRC hglrcDst,
UINT mask )
{
- return stw_copy_context( (UINT_PTR)hglrcSrc,
- (UINT_PTR)hglrcDst,
- mask );
+ return DrvCopyContext( (DHGLRC)(UINT_PTR)hglrcSrc,
+ (DHGLRC)(UINT_PTR)hglrcDst,
+ mask );
}
WINGDIAPI HGLRC APIENTRY
wglCreateContext(
HDC hdc )
{
- return wglCreateLayerContext(hdc, 0);
+ return (HGLRC) DrvCreateContext(hdc);
}
WINGDIAPI HGLRC APIENTRY
@@ -55,21 +57,21 @@ wglCreateLayerContext(
HDC hdc,
int iLayerPlane )
{
- return (HGLRC) stw_create_layer_context( hdc, iLayerPlane );
+ return (HGLRC) DrvCreateLayerContext( hdc, iLayerPlane );
}
WINGDIAPI BOOL APIENTRY
wglDeleteContext(
HGLRC hglrc )
{
- return stw_delete_context( (UINT_PTR)hglrc );
+ return DrvDeleteContext((DHGLRC)(UINT_PTR)hglrc );
}
WINGDIAPI HGLRC APIENTRY
wglGetCurrentContext( VOID )
{
- return (HGLRC)stw_get_current_context();
+ return (HGLRC)(UINT_PTR)stw_get_current_context();
}
WINGDIAPI HDC APIENTRY
@@ -83,7 +85,7 @@ wglMakeCurrent(
HDC hdc,
HGLRC hglrc )
{
- return stw_make_current( hdc, (UINT_PTR)hglrc );
+ return DrvSetContext( hdc, (DHGLRC)(UINT_PTR)hglrc, NULL ) ? TRUE : FALSE;
}
@@ -91,7 +93,7 @@ WINGDIAPI BOOL APIENTRY
wglSwapBuffers(
HDC hdc )
{
- return stw_swap_buffers( hdc );
+ return DrvSwapBuffers( hdc );
}
@@ -100,14 +102,14 @@ wglSwapLayerBuffers(
HDC hdc,
UINT fuPlanes )
{
- return stw_swap_layer_buffers( hdc, fuPlanes );
+ return DrvSwapLayerBuffers( hdc, fuPlanes );
}
WINGDIAPI PROC APIENTRY
wglGetProcAddress(
LPCSTR lpszProc )
{
- return stw_get_proc_address( lpszProc );
+ return DrvGetProcAddress( lpszProc );
}
@@ -141,7 +143,7 @@ wglDescribePixelFormat(
UINT nBytes,
LPPIXELFORMATDESCRIPTOR ppfd )
{
- return stw_pixelformat_describe( hdc, iPixelFormat, nBytes, ppfd );
+ return DrvDescribePixelFormat( hdc, iPixelFormat, nBytes, ppfd );
}
WINGDIAPI int APIENTRY
@@ -160,7 +162,7 @@ wglSetPixelFormat(
if (ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR ))
return FALSE;
- return stw_pixelformat_set( hdc, iPixelFormat );
+ return DrvSetPixelFormat( hdc, iPixelFormat );
}
@@ -186,7 +188,8 @@ wglShareLists(
HGLRC hglrc1,
HGLRC hglrc2 )
{
- return stw_share_lists( (UINT_PTR)hglrc1, (UINT_PTR)hglrc2);;
+ return DrvShareLists((DHGLRC)(UINT_PTR)hglrc1,
+ (DHGLRC)(UINT_PTR)hglrc2);
}
WINGDIAPI BOOL APIENTRY
@@ -264,15 +267,7 @@ wglDescribeLayerPlane(
UINT nBytes,
LPLAYERPLANEDESCRIPTOR plpd )
{
- (void) hdc;
- (void) iPixelFormat;
- (void) iLayerPlane;
- (void) nBytes;
- (void) plpd;
-
- assert( 0 );
-
- return FALSE;
+ return DrvDescribeLayerPlane(hdc, iPixelFormat, iLayerPlane, nBytes, plpd);
}
WINGDIAPI int APIENTRY
@@ -283,15 +278,7 @@ wglSetLayerPaletteEntries(
int cEntries,
CONST COLORREF *pcr )
{
- (void) hdc;
- (void) iLayerPlane;
- (void) iStart;
- (void) cEntries;
- (void) pcr;
-
- assert( 0 );
-
- return 0;
+ return DrvSetLayerPaletteEntries(hdc, iLayerPlane, iStart, cEntries, pcr);
}
WINGDIAPI int APIENTRY
@@ -302,15 +289,7 @@ wglGetLayerPaletteEntries(
int cEntries,
COLORREF *pcr )
{
- (void) hdc;
- (void) iLayerPlane;
- (void) iStart;
- (void) cEntries;
- (void) pcr;
-
- assert( 0 );
-
- return 0;
+ return DrvGetLayerPaletteEntries(hdc, iLayerPlane, iStart, cEntries, pcr);
}
WINGDIAPI BOOL APIENTRY