env.Append(CPPPATH = [
'#src/mesa',
+ '.',
])
env.Append(CPPDEFINES = [
])
sources = [
- 'stw_device.c',
- 'stw_framebuffer.c',
- 'stw_icd.c',
- 'stw_pixelformat.c',
- 'stw_quirks.c',
- 'stw_wgl_arbextensionsstring.c',
- 'stw_wgl_arbmultisample.c',
- 'stw_wgl_arbpixelformat.c',
- #'stw_wgl.c',
- 'stw_wgl_context.c',
- 'stw_wgl_getprocaddress.c',
- 'stw_wgl_pixelformat.c',
- 'stw_wgl_swapbuffers.c',
+ 'icd/stw_icd.c',
+ 'shared/stw_device.c',
+ 'shared/stw_framebuffer.c',
+ 'shared/stw_pixelformat.c',
+ 'shared/stw_quirks.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_getprocaddress.c',
+ 'wgl/stw_wgl_pixelformat.c',
+ 'wgl/stw_wgl_swapbuffers.c',
]
wgl = env.ConvenienceLibrary(
--- /dev/null
+/**************************************************************************
+ *
+ * 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 "pipe/p_debug.h"
+
+#include "shared/stw_device.h"
+#include "icd/stw_icd.h"
+#include "wgl/stw_wgl.h"
+
+
+static HGLRC
+_drv_lookup_hglrc( DHGLRC dhglrc )
+{
+ if (dhglrc == 0 || dhglrc >= DRV_CONTEXT_MAX)
+ return NULL;
+ return stw_dev->ctx_array[dhglrc - 1].hglrc;
+}
+
+BOOL APIENTRY
+DrvCopyContext(
+ DHGLRC dhrcSource,
+ DHGLRC dhrcDest,
+ UINT fuMask )
+{
+ debug_printf( "%s\n", __FUNCTION__ );
+
+ return FALSE;
+}
+
+DHGLRC APIENTRY
+DrvCreateLayerContext(
+ 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;
+ }
+ }
+
+ debug_printf( "%s( 0x%p, %d ) = %u\n", __FUNCTION__, hdc, iLayerPlane, dhglrc );
+
+ return dhglrc;
+}
+
+DHGLRC APIENTRY
+DrvCreateContext(
+ HDC hdc )
+{
+ return DrvCreateLayerContext( hdc, 0 );
+}
+
+BOOL APIENTRY
+DrvDeleteContext(
+ DHGLRC dhglrc )
+{
+ HGLRC hglrc = _drv_lookup_hglrc( dhglrc );
+ BOOL success = FALSE;
+
+ if (hglrc != NULL) {
+ success = wglDeleteContext( hglrc );
+ if (success)
+ stw_dev->ctx_array[dhglrc - 1].hglrc = NULL;
+ }
+
+ debug_printf( "%s( %u ) = %s\n", __FUNCTION__, dhglrc, success ? "TRUE" : "FALSE" );
+
+ return success;
+}
+
+BOOL APIENTRY
+DrvDescribeLayerPlane(
+ HDC hdc,
+ INT iPixelFormat,
+ INT iLayerPlane,
+ UINT nBytes,
+ LPLAYERPLANEDESCRIPTOR plpd )
+{
+ debug_printf( "%s\n", __FUNCTION__ );
+
+ return FALSE;
+}
+
+LONG APIENTRY
+DrvDescribePixelFormat(
+ HDC hdc,
+ INT iPixelFormat,
+ ULONG cjpfd,
+ PIXELFORMATDESCRIPTOR *ppfd )
+{
+ LONG r;
+
+ r = wglDescribePixelFormat( hdc, iPixelFormat, cjpfd, ppfd );
+
+ debug_printf( "%s( 0x%p, %d, %u, 0x%p ) = %d\n", __FUNCTION__, hdc, iPixelFormat, cjpfd, ppfd, r );
+
+ return r;
+}
+
+int APIENTRY
+DrvGetLayerPaletteEntries(
+ HDC hdc,
+ INT iLayerPlane,
+ INT iStart,
+ INT cEntries,
+ COLORREF *pcr )
+{
+ debug_printf( "%s\n", __FUNCTION__ );
+
+ return 0;
+}
+
+PROC APIENTRY
+DrvGetProcAddress(
+ LPCSTR lpszProc )
+{
+ PROC r;
+
+ r = wglGetProcAddress( lpszProc );
+
+ debug_printf( "%s( \", __FUNCTION__%s\" ) = 0x%p\n", lpszProc, r );
+
+ return r;
+}
+
+BOOL APIENTRY
+DrvRealizeLayerPalette(
+ HDC hdc,
+ INT iLayerPlane,
+ BOOL bRealize )
+{
+ debug_printf( "%s\n", __FUNCTION__ );
+
+ return FALSE;
+}
+
+BOOL APIENTRY
+DrvReleaseContext(
+ DHGLRC dhglrc )
+{
+ BOOL success = FALSE;
+
+ if (dhglrc == stw_dev->ctx_current) {
+ HGLRC hglrc = _drv_lookup_hglrc( dhglrc );
+
+ if (hglrc != NULL) {
+ success = wglMakeCurrent( NULL, NULL );
+ if (success)
+ stw_dev->ctx_current = 0;
+ }
+ }
+
+ debug_printf( "%s( %u ) = %s\n", __FUNCTION__, dhglrc, success ? "TRUE" : "FALSE" );
+
+ return success;
+}
+
+void APIENTRY
+DrvSetCallbackProcs(
+ INT nProcs,
+ PROC *pProcs )
+{
+ debug_printf( "%s( %d, 0x%p )\n", __FUNCTION__, nProcs, pProcs );
+
+ return;
+}
+
+#define GPA_GL( NAME ) disp->NAME = gl##NAME
+
+static GLCLTPROCTABLE cpt;
+
+PGLCLTPROCTABLE APIENTRY
+DrvSetContext(
+ HDC hdc,
+ DHGLRC dhglrc,
+ PFN_SETPROCTABLE pfnSetProcTable )
+{
+ HGLRC hglrc = _drv_lookup_hglrc( dhglrc );
+ GLDISPATCHTABLE *disp = &cpt.glDispatchTable;
+
+ debug_printf( "%s( 0x%p, %u, 0x%p )\n", __FUNCTION__, hdc, dhglrc, pfnSetProcTable );
+
+ if (hglrc == NULL)
+ return NULL;
+
+ if (!wglMakeCurrent( hdc, hglrc ))
+ return NULL;
+
+ memset( &cpt, 0, sizeof( cpt ) );
+ cpt.cEntries = OPENGL_VERSION_110_ENTRIES;
+
+ GPA_GL( NewList );
+ GPA_GL( EndList );
+ GPA_GL( CallList );
+ GPA_GL( CallLists );
+ GPA_GL( DeleteLists );
+ GPA_GL( GenLists );
+ GPA_GL( ListBase );
+ GPA_GL( Begin );
+ GPA_GL( Bitmap );
+ GPA_GL( Color3b );
+ GPA_GL( Color3bv );
+ GPA_GL( Color3d );
+ GPA_GL( Color3dv );
+ GPA_GL( Color3f );
+ GPA_GL( Color3fv );
+ GPA_GL( Color3i );
+ GPA_GL( Color3iv );
+ GPA_GL( Color3s );
+ GPA_GL( Color3sv );
+ GPA_GL( Color3ub );
+ GPA_GL( Color3ubv );
+ GPA_GL( Color3ui );
+ GPA_GL( Color3uiv );
+ GPA_GL( Color3us );
+ GPA_GL( Color3usv );
+ GPA_GL( Color4b );
+ GPA_GL( Color4bv );
+ GPA_GL( Color4d );
+ GPA_GL( Color4dv );
+ GPA_GL( Color4f );
+ GPA_GL( Color4fv );
+ GPA_GL( Color4i );
+ GPA_GL( Color4iv );
+ GPA_GL( Color4s );
+ GPA_GL( Color4sv );
+ GPA_GL( Color4ub );
+ GPA_GL( Color4ubv );
+ GPA_GL( Color4ui );
+ GPA_GL( Color4uiv );
+ GPA_GL( Color4us );
+ GPA_GL( Color4usv );
+ GPA_GL( EdgeFlag );
+ GPA_GL( EdgeFlagv );
+ GPA_GL( End );
+ GPA_GL( Indexd );
+ GPA_GL( Indexdv );
+ GPA_GL( Indexf );
+ GPA_GL( Indexfv );
+ GPA_GL( Indexi );
+ GPA_GL( Indexiv );
+ GPA_GL( Indexs );
+ GPA_GL( Indexsv );
+ GPA_GL( Normal3b );
+ GPA_GL( Normal3bv );
+ GPA_GL( Normal3d );
+ GPA_GL( Normal3dv );
+ GPA_GL( Normal3f );
+ GPA_GL( Normal3fv );
+ GPA_GL( Normal3i );
+ GPA_GL( Normal3iv );
+ GPA_GL( Normal3s );
+ GPA_GL( Normal3sv );
+ GPA_GL( RasterPos2d );
+ GPA_GL( RasterPos2dv );
+ GPA_GL( RasterPos2f );
+ GPA_GL( RasterPos2fv );
+ GPA_GL( RasterPos2i );
+ GPA_GL( RasterPos2iv );
+ GPA_GL( RasterPos2s );
+ GPA_GL( RasterPos2sv );
+ GPA_GL( RasterPos3d );
+ GPA_GL( RasterPos3dv );
+ GPA_GL( RasterPos3f );
+ GPA_GL( RasterPos3fv );
+ GPA_GL( RasterPos3i );
+ GPA_GL( RasterPos3iv );
+ GPA_GL( RasterPos3s );
+ GPA_GL( RasterPos3sv );
+ GPA_GL( RasterPos4d );
+ GPA_GL( RasterPos4dv );
+ GPA_GL( RasterPos4f );
+ GPA_GL( RasterPos4fv );
+ GPA_GL( RasterPos4i );
+ GPA_GL( RasterPos4iv );
+ GPA_GL( RasterPos4s );
+ GPA_GL( RasterPos4sv );
+ GPA_GL( Rectd );
+ GPA_GL( Rectdv );
+ GPA_GL( Rectf );
+ GPA_GL( Rectfv );
+ GPA_GL( Recti );
+ GPA_GL( Rectiv );
+ GPA_GL( Rects );
+ GPA_GL( Rectsv );
+ GPA_GL( TexCoord1d );
+ GPA_GL( TexCoord1dv );
+ GPA_GL( TexCoord1f );
+ GPA_GL( TexCoord1fv );
+ GPA_GL( TexCoord1i );
+ GPA_GL( TexCoord1iv );
+ GPA_GL( TexCoord1s );
+ GPA_GL( TexCoord1sv );
+ GPA_GL( TexCoord2d );
+ GPA_GL( TexCoord2dv );
+ GPA_GL( TexCoord2f );
+ GPA_GL( TexCoord2fv );
+ GPA_GL( TexCoord2i );
+ GPA_GL( TexCoord2iv );
+ GPA_GL( TexCoord2s );
+ GPA_GL( TexCoord2sv );
+ GPA_GL( TexCoord3d );
+ GPA_GL( TexCoord3dv );
+ GPA_GL( TexCoord3f );
+ GPA_GL( TexCoord3fv );
+ GPA_GL( TexCoord3i );
+ GPA_GL( TexCoord3iv );
+ GPA_GL( TexCoord3s );
+ GPA_GL( TexCoord3sv );
+ GPA_GL( TexCoord4d );
+ GPA_GL( TexCoord4dv );
+ GPA_GL( TexCoord4f );
+ GPA_GL( TexCoord4fv );
+ GPA_GL( TexCoord4i );
+ GPA_GL( TexCoord4iv );
+ GPA_GL( TexCoord4s );
+ GPA_GL( TexCoord4sv );
+ GPA_GL( Vertex2d );
+ GPA_GL( Vertex2dv );
+ GPA_GL( Vertex2f );
+ GPA_GL( Vertex2fv );
+ GPA_GL( Vertex2i );
+ GPA_GL( Vertex2iv );
+ GPA_GL( Vertex2s );
+ GPA_GL( Vertex2sv );
+ GPA_GL( Vertex3d );
+ GPA_GL( Vertex3dv );
+ GPA_GL( Vertex3f );
+ GPA_GL( Vertex3fv );
+ GPA_GL( Vertex3i );
+ GPA_GL( Vertex3iv );
+ GPA_GL( Vertex3s );
+ GPA_GL( Vertex3sv );
+ GPA_GL( Vertex4d );
+ GPA_GL( Vertex4dv );
+ GPA_GL( Vertex4f );
+ GPA_GL( Vertex4fv );
+ GPA_GL( Vertex4i );
+ GPA_GL( Vertex4iv );
+ GPA_GL( Vertex4s );
+ GPA_GL( Vertex4sv );
+ GPA_GL( ClipPlane );
+ GPA_GL( ColorMaterial );
+ GPA_GL( CullFace );
+ GPA_GL( Fogf );
+ GPA_GL( Fogfv );
+ GPA_GL( Fogi );
+ GPA_GL( Fogiv );
+ GPA_GL( FrontFace );
+ GPA_GL( Hint );
+ GPA_GL( Lightf );
+ GPA_GL( Lightfv );
+ GPA_GL( Lighti );
+ GPA_GL( Lightiv );
+ GPA_GL( LightModelf );
+ GPA_GL( LightModelfv );
+ GPA_GL( LightModeli );
+ GPA_GL( LightModeliv );
+ GPA_GL( LineStipple );
+ GPA_GL( LineWidth );
+ GPA_GL( Materialf );
+ GPA_GL( Materialfv );
+ GPA_GL( Materiali );
+ GPA_GL( Materialiv );
+ GPA_GL( PointSize );
+ GPA_GL( PolygonMode );
+ GPA_GL( PolygonStipple );
+ GPA_GL( Scissor );
+ GPA_GL( ShadeModel );
+ GPA_GL( TexParameterf );
+ GPA_GL( TexParameterfv );
+ GPA_GL( TexParameteri );
+ GPA_GL( TexParameteriv );
+ GPA_GL( TexImage1D );
+ GPA_GL( TexImage2D );
+ GPA_GL( TexEnvf );
+ GPA_GL( TexEnvfv );
+ GPA_GL( TexEnvi );
+ GPA_GL( TexEnviv );
+ GPA_GL( TexGend );
+ GPA_GL( TexGendv );
+ GPA_GL( TexGenf );
+ GPA_GL( TexGenfv );
+ GPA_GL( TexGeni );
+ GPA_GL( TexGeniv );
+ GPA_GL( FeedbackBuffer );
+ GPA_GL( SelectBuffer );
+ GPA_GL( RenderMode );
+ GPA_GL( InitNames );
+ GPA_GL( LoadName );
+ GPA_GL( PassThrough );
+ GPA_GL( PopName );
+ GPA_GL( PushName );
+ GPA_GL( DrawBuffer );
+ GPA_GL( Clear );
+ GPA_GL( ClearAccum );
+ GPA_GL( ClearIndex );
+ GPA_GL( ClearColor );
+ GPA_GL( ClearStencil );
+ GPA_GL( ClearDepth );
+ GPA_GL( StencilMask );
+ GPA_GL( ColorMask );
+ GPA_GL( DepthMask );
+ GPA_GL( IndexMask );
+ GPA_GL( Accum );
+ GPA_GL( Disable );
+ GPA_GL( Enable );
+ GPA_GL( Finish );
+ GPA_GL( Flush );
+ GPA_GL( PopAttrib );
+ GPA_GL( PushAttrib );
+ GPA_GL( Map1d );
+ GPA_GL( Map1f );
+ GPA_GL( Map2d );
+ GPA_GL( Map2f );
+ GPA_GL( MapGrid1d );
+ GPA_GL( MapGrid1f );
+ GPA_GL( MapGrid2d );
+ GPA_GL( MapGrid2f );
+ GPA_GL( EvalCoord1d );
+ GPA_GL( EvalCoord1dv );
+ GPA_GL( EvalCoord1f );
+ GPA_GL( EvalCoord1fv );
+ GPA_GL( EvalCoord2d );
+ GPA_GL( EvalCoord2dv );
+ GPA_GL( EvalCoord2f );
+ GPA_GL( EvalCoord2fv );
+ GPA_GL( EvalMesh1 );
+ GPA_GL( EvalPoint1 );
+ GPA_GL( EvalMesh2 );
+ GPA_GL( EvalPoint2 );
+ GPA_GL( AlphaFunc );
+ GPA_GL( BlendFunc );
+ GPA_GL( LogicOp );
+ GPA_GL( StencilFunc );
+ GPA_GL( StencilOp );
+ GPA_GL( DepthFunc );
+ GPA_GL( PixelZoom );
+ GPA_GL( PixelTransferf );
+ GPA_GL( PixelTransferi );
+ GPA_GL( PixelStoref );
+ GPA_GL( PixelStorei );
+ GPA_GL( PixelMapfv );
+ GPA_GL( PixelMapuiv );
+ GPA_GL( PixelMapusv );
+ GPA_GL( ReadBuffer );
+ GPA_GL( CopyPixels );
+ GPA_GL( ReadPixels );
+ GPA_GL( DrawPixels );
+ GPA_GL( GetBooleanv );
+ GPA_GL( GetClipPlane );
+ GPA_GL( GetDoublev );
+ GPA_GL( GetError );
+ GPA_GL( GetFloatv );
+ GPA_GL( GetIntegerv );
+ GPA_GL( GetLightfv );
+ GPA_GL( GetLightiv );
+ GPA_GL( GetMapdv );
+ GPA_GL( GetMapfv );
+ GPA_GL( GetMapiv );
+ GPA_GL( GetMaterialfv );
+ GPA_GL( GetMaterialiv );
+ GPA_GL( GetPixelMapfv );
+ GPA_GL( GetPixelMapuiv );
+ GPA_GL( GetPixelMapusv );
+ GPA_GL( GetPolygonStipple );
+ GPA_GL( GetString );
+ GPA_GL( GetTexEnvfv );
+ GPA_GL( GetTexEnviv );
+ GPA_GL( GetTexGendv );
+ GPA_GL( GetTexGenfv );
+ GPA_GL( GetTexGeniv );
+ GPA_GL( GetTexImage );
+ GPA_GL( GetTexParameterfv );
+ GPA_GL( GetTexParameteriv );
+ GPA_GL( GetTexLevelParameterfv );
+ GPA_GL( GetTexLevelParameteriv );
+ GPA_GL( IsEnabled );
+ GPA_GL( IsList );
+ GPA_GL( DepthRange );
+ GPA_GL( Frustum );
+ GPA_GL( LoadIdentity );
+ GPA_GL( LoadMatrixf );
+ GPA_GL( LoadMatrixd );
+ GPA_GL( MatrixMode );
+ GPA_GL( MultMatrixf );
+ GPA_GL( MultMatrixd );
+ GPA_GL( Ortho );
+ GPA_GL( PopMatrix );
+ GPA_GL( PushMatrix );
+ GPA_GL( Rotated );
+ GPA_GL( Rotatef );
+ GPA_GL( Scaled );
+ GPA_GL( Scalef );
+ GPA_GL( Translated );
+ GPA_GL( Translatef );
+ GPA_GL( Viewport );
+ GPA_GL( ArrayElement );
+ GPA_GL( BindTexture );
+ GPA_GL( ColorPointer );
+ GPA_GL( DisableClientState );
+ GPA_GL( DrawArrays );
+ GPA_GL( DrawElements );
+ GPA_GL( EdgeFlagPointer );
+ GPA_GL( EnableClientState );
+ GPA_GL( IndexPointer );
+ GPA_GL( Indexub );
+ GPA_GL( Indexubv );
+ GPA_GL( InterleavedArrays );
+ GPA_GL( NormalPointer );
+ GPA_GL( PolygonOffset );
+ GPA_GL( TexCoordPointer );
+ GPA_GL( VertexPointer );
+ GPA_GL( AreTexturesResident );
+ GPA_GL( CopyTexImage1D );
+ GPA_GL( CopyTexImage2D );
+ GPA_GL( CopyTexSubImage1D );
+ GPA_GL( CopyTexSubImage2D );
+ GPA_GL( DeleteTextures );
+ GPA_GL( GenTextures );
+ GPA_GL( GetPointerv );
+ GPA_GL( IsTexture );
+ GPA_GL( PrioritizeTextures );
+ GPA_GL( TexSubImage1D );
+ GPA_GL( TexSubImage2D );
+ GPA_GL( PopClientAttrib );
+ GPA_GL( PushClientAttrib );
+
+ return &cpt;
+}
+
+int APIENTRY
+DrvSetLayerPaletteEntries(
+ HDC hdc,
+ INT iLayerPlane,
+ INT iStart,
+ INT cEntries,
+ CONST COLORREF *pcr )
+{
+ debug_printf( "%s\n", __FUNCTION__ );
+
+ return 0;
+}
+
+BOOL APIENTRY
+DrvSetPixelFormat(
+ HDC hdc,
+ LONG iPixelFormat )
+{
+ PIXELFORMATDESCRIPTOR pfd;
+ BOOL r;
+
+ wglDescribePixelFormat( hdc, iPixelFormat, sizeof( pfd ), &pfd );
+ r = wglSetPixelFormat( hdc, iPixelFormat, &pfd );
+
+ debug_printf( "%s( 0x%p, %d ) = %s\n", __FUNCTION__, hdc, iPixelFormat, r ? "TRUE" : "FALSE" );
+
+ return r;
+}
+
+BOOL APIENTRY
+DrvShareLists(
+ DHGLRC dhglrc1,
+ DHGLRC dhglrc2 )
+{
+ debug_printf( "%s\n", __FUNCTION__ );
+
+ return FALSE;
+}
+
+BOOL APIENTRY
+DrvSwapBuffers(
+ HDC hdc )
+{
+ debug_printf( "%s( 0x%p )\n", __FUNCTION__, hdc );
+
+ return wglSwapBuffers( hdc );
+}
+
+BOOL APIENTRY
+DrvSwapLayerBuffers(
+ HDC hdc,
+ UINT fuPlanes )
+{
+ debug_printf( "%s\n", __FUNCTION__ );
+
+ return FALSE;
+}
+
+BOOL APIENTRY
+DrvValidateVersion(
+ ULONG ulVersion )
+{
+ debug_printf( "%s( %u )\n", __FUNCTION__, ulVersion );
+
+ return ulVersion == 1;
+}
--- /dev/null
+/**************************************************************************
+ *
+ * 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 DRV_H
+#define DRV_H
+
+
+#include <windows.h>
+
+#include "GL/gl.h"
+
+
+typedef ULONG DHGLRC;
+
+#define OPENGL_VERSION_110_ENTRIES 336
+
+struct __GLdispatchTableRec
+{
+ void (GLAPIENTRY * NewList)(GLuint, GLenum);
+ void (GLAPIENTRY * EndList)(void);
+ void (GLAPIENTRY * CallList)(GLuint);
+ void (GLAPIENTRY * CallLists)(GLsizei, GLenum, const GLvoid *);
+ void (GLAPIENTRY * DeleteLists)(GLuint, GLsizei);
+ GLuint (GLAPIENTRY * GenLists)(GLsizei);
+ void (GLAPIENTRY * ListBase)(GLuint);
+ void (GLAPIENTRY * Begin)(GLenum);
+ void (GLAPIENTRY * Bitmap)(GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat, const GLubyte *);
+ void (GLAPIENTRY * Color3b)(GLbyte, GLbyte, GLbyte);
+ void (GLAPIENTRY * Color3bv)(const GLbyte *);
+ void (GLAPIENTRY * Color3d)(GLdouble, GLdouble, GLdouble);
+ void (GLAPIENTRY * Color3dv)(const GLdouble *);
+ void (GLAPIENTRY * Color3f)(GLfloat, GLfloat, GLfloat);
+ void (GLAPIENTRY * Color3fv)(const GLfloat *);
+ void (GLAPIENTRY * Color3i)(GLint, GLint, GLint);
+ void (GLAPIENTRY * Color3iv)(const GLint *);
+ void (GLAPIENTRY * Color3s)(GLshort, GLshort, GLshort);
+ void (GLAPIENTRY * Color3sv)(const GLshort *);
+ void (GLAPIENTRY * Color3ub)(GLubyte, GLubyte, GLubyte);
+ void (GLAPIENTRY * Color3ubv)(const GLubyte *);
+ void (GLAPIENTRY * Color3ui)(GLuint, GLuint, GLuint);
+ void (GLAPIENTRY * Color3uiv)(const GLuint *);
+ void (GLAPIENTRY * Color3us)(GLushort, GLushort, GLushort);
+ void (GLAPIENTRY * Color3usv)(const GLushort *);
+ void (GLAPIENTRY * Color4b)(GLbyte, GLbyte, GLbyte, GLbyte);
+ void (GLAPIENTRY * Color4bv)(const GLbyte *);
+ void (GLAPIENTRY * Color4d)(GLdouble, GLdouble, GLdouble, GLdouble);
+ void (GLAPIENTRY * Color4dv)(const GLdouble *);
+ void (GLAPIENTRY * Color4f)(GLfloat, GLfloat, GLfloat, GLfloat);
+ void (GLAPIENTRY * Color4fv)(const GLfloat *);
+ void (GLAPIENTRY * Color4i)(GLint, GLint, GLint, GLint);
+ void (GLAPIENTRY * Color4iv)(const GLint *);
+ void (GLAPIENTRY * Color4s)(GLshort, GLshort, GLshort, GLshort);
+ void (GLAPIENTRY * Color4sv)(const GLshort *);
+ void (GLAPIENTRY * Color4ub)(GLubyte, GLubyte, GLubyte, GLubyte);
+ void (GLAPIENTRY * Color4ubv)(const GLubyte *);
+ void (GLAPIENTRY * Color4ui)(GLuint, GLuint, GLuint, GLuint);
+ void (GLAPIENTRY * Color4uiv)(const GLuint *);
+ void (GLAPIENTRY * Color4us)(GLushort, GLushort, GLushort, GLushort);
+ void (GLAPIENTRY * Color4usv)(const GLushort *);
+ void (GLAPIENTRY * EdgeFlag)(GLboolean);
+ void (GLAPIENTRY * EdgeFlagv)(const GLboolean *);
+ void (GLAPIENTRY * End)(void);
+ void (GLAPIENTRY * Indexd)(GLdouble);
+ void (GLAPIENTRY * Indexdv)(const GLdouble *);
+ void (GLAPIENTRY * Indexf)(GLfloat);
+ void (GLAPIENTRY * Indexfv)(const GLfloat *);
+ void (GLAPIENTRY * Indexi)(GLint);
+ void (GLAPIENTRY * Indexiv)(const GLint *);
+ void (GLAPIENTRY * Indexs)(GLshort);
+ void (GLAPIENTRY * Indexsv)(const GLshort *);
+ void (GLAPIENTRY * Normal3b)(GLbyte, GLbyte, GLbyte);
+ void (GLAPIENTRY * Normal3bv)(const GLbyte *);
+ void (GLAPIENTRY * Normal3d)(GLdouble, GLdouble, GLdouble);
+ void (GLAPIENTRY * Normal3dv)(const GLdouble *);
+ void (GLAPIENTRY * Normal3f)(GLfloat, GLfloat, GLfloat);
+ void (GLAPIENTRY * Normal3fv)(const GLfloat *);
+ void (GLAPIENTRY * Normal3i)(GLint, GLint, GLint);
+ void (GLAPIENTRY * Normal3iv)(const GLint *);
+ void (GLAPIENTRY * Normal3s)(GLshort, GLshort, GLshort);
+ void (GLAPIENTRY * Normal3sv)(const GLshort *);
+ void (GLAPIENTRY * RasterPos2d)(GLdouble, GLdouble);
+ void (GLAPIENTRY * RasterPos2dv)(const GLdouble *);
+ void (GLAPIENTRY * RasterPos2f)(GLfloat, GLfloat);
+ void (GLAPIENTRY * RasterPos2fv)(const GLfloat *);
+ void (GLAPIENTRY * RasterPos2i)(GLint, GLint);
+ void (GLAPIENTRY * RasterPos2iv)(const GLint *);
+ void (GLAPIENTRY * RasterPos2s)(GLshort, GLshort);
+ void (GLAPIENTRY * RasterPos2sv)(const GLshort *);
+ void (GLAPIENTRY * RasterPos3d)(GLdouble, GLdouble, GLdouble);
+ void (GLAPIENTRY * RasterPos3dv)(const GLdouble *);
+ void (GLAPIENTRY * RasterPos3f)(GLfloat, GLfloat, GLfloat);
+ void (GLAPIENTRY * RasterPos3fv)(const GLfloat *);
+ void (GLAPIENTRY * RasterPos3i)(GLint, GLint, GLint);
+ void (GLAPIENTRY * RasterPos3iv)(const GLint *);
+ void (GLAPIENTRY * RasterPos3s)(GLshort, GLshort, GLshort);
+ void (GLAPIENTRY * RasterPos3sv)(const GLshort *);
+ void (GLAPIENTRY * RasterPos4d)(GLdouble, GLdouble, GLdouble, GLdouble);
+ void (GLAPIENTRY * RasterPos4dv)(const GLdouble *);
+ void (GLAPIENTRY * RasterPos4f)(GLfloat, GLfloat, GLfloat, GLfloat);
+ void (GLAPIENTRY * RasterPos4fv)(const GLfloat *);
+ void (GLAPIENTRY * RasterPos4i)(GLint, GLint, GLint, GLint);
+ void (GLAPIENTRY * RasterPos4iv)(const GLint *);
+ void (GLAPIENTRY * RasterPos4s)(GLshort, GLshort, GLshort, GLshort);
+ void (GLAPIENTRY * RasterPos4sv)(const GLshort *);
+ void (GLAPIENTRY * Rectd)(GLdouble, GLdouble, GLdouble, GLdouble);
+ void (GLAPIENTRY * Rectdv)(const GLdouble *, const GLdouble *);
+ void (GLAPIENTRY * Rectf)(GLfloat, GLfloat, GLfloat, GLfloat);
+ void (GLAPIENTRY * Rectfv)(const GLfloat *, const GLfloat *);
+ void (GLAPIENTRY * Recti)(GLint, GLint, GLint, GLint);
+ void (GLAPIENTRY * Rectiv)(const GLint *, const GLint *);
+ void (GLAPIENTRY * Rects)(GLshort, GLshort, GLshort, GLshort);
+ void (GLAPIENTRY * Rectsv)(const GLshort *, const GLshort *);
+ void (GLAPIENTRY * TexCoord1d)(GLdouble);
+ void (GLAPIENTRY * TexCoord1dv)(const GLdouble *);
+ void (GLAPIENTRY * TexCoord1f)(GLfloat);
+ void (GLAPIENTRY * TexCoord1fv)(const GLfloat *);
+ void (GLAPIENTRY * TexCoord1i)(GLint);
+ void (GLAPIENTRY * TexCoord1iv)(const GLint *);
+ void (GLAPIENTRY * TexCoord1s)(GLshort);
+ void (GLAPIENTRY * TexCoord1sv)(const GLshort *);
+ void (GLAPIENTRY * TexCoord2d)(GLdouble, GLdouble);
+ void (GLAPIENTRY * TexCoord2dv)(const GLdouble *);
+ void (GLAPIENTRY * TexCoord2f)(GLfloat, GLfloat);
+ void (GLAPIENTRY * TexCoord2fv)(const GLfloat *);
+ void (GLAPIENTRY * TexCoord2i)(GLint, GLint);
+ void (GLAPIENTRY * TexCoord2iv)(const GLint *);
+ void (GLAPIENTRY * TexCoord2s)(GLshort, GLshort);
+ void (GLAPIENTRY * TexCoord2sv)(const GLshort *);
+ void (GLAPIENTRY * TexCoord3d)(GLdouble, GLdouble, GLdouble);
+ void (GLAPIENTRY * TexCoord3dv)(const GLdouble *);
+ void (GLAPIENTRY * TexCoord3f)(GLfloat, GLfloat, GLfloat);
+ void (GLAPIENTRY * TexCoord3fv)(const GLfloat *);
+ void (GLAPIENTRY * TexCoord3i)(GLint, GLint, GLint);
+ void (GLAPIENTRY * TexCoord3iv)(const GLint *);
+ void (GLAPIENTRY * TexCoord3s)(GLshort, GLshort, GLshort);
+ void (GLAPIENTRY * TexCoord3sv)(const GLshort *);
+ void (GLAPIENTRY * TexCoord4d)(GLdouble, GLdouble, GLdouble, GLdouble);
+ void (GLAPIENTRY * TexCoord4dv)(const GLdouble *);
+ void (GLAPIENTRY * TexCoord4f)(GLfloat, GLfloat, GLfloat, GLfloat);
+ void (GLAPIENTRY * TexCoord4fv)(const GLfloat *);
+ void (GLAPIENTRY * TexCoord4i)(GLint, GLint, GLint, GLint);
+ void (GLAPIENTRY * TexCoord4iv)(const GLint *);
+ void (GLAPIENTRY * TexCoord4s)(GLshort, GLshort, GLshort, GLshort);
+ void (GLAPIENTRY * TexCoord4sv)(const GLshort *);
+ void (GLAPIENTRY * Vertex2d)(GLdouble, GLdouble);
+ void (GLAPIENTRY * Vertex2dv)(const GLdouble *);
+ void (GLAPIENTRY * Vertex2f)(GLfloat, GLfloat);
+ void (GLAPIENTRY * Vertex2fv)(const GLfloat *);
+ void (GLAPIENTRY * Vertex2i)(GLint, GLint);
+ void (GLAPIENTRY * Vertex2iv)(const GLint *);
+ void (GLAPIENTRY * Vertex2s)(GLshort, GLshort);
+ void (GLAPIENTRY * Vertex2sv)(const GLshort *);
+ void (GLAPIENTRY * Vertex3d)(GLdouble, GLdouble, GLdouble);
+ void (GLAPIENTRY * Vertex3dv)(const GLdouble *);
+ void (GLAPIENTRY * Vertex3f)(GLfloat, GLfloat, GLfloat);
+ void (GLAPIENTRY * Vertex3fv)(const GLfloat *);
+ void (GLAPIENTRY * Vertex3i)(GLint, GLint, GLint);
+ void (GLAPIENTRY * Vertex3iv)(const GLint *);
+ void (GLAPIENTRY * Vertex3s)(GLshort, GLshort, GLshort);
+ void (GLAPIENTRY * Vertex3sv)(const GLshort *);
+ void (GLAPIENTRY * Vertex4d)(GLdouble, GLdouble, GLdouble, GLdouble);
+ void (GLAPIENTRY * Vertex4dv)(const GLdouble *);
+ void (GLAPIENTRY * Vertex4f)(GLfloat, GLfloat, GLfloat, GLfloat);
+ void (GLAPIENTRY * Vertex4fv)(const GLfloat *);
+ void (GLAPIENTRY * Vertex4i)(GLint, GLint, GLint, GLint);
+ void (GLAPIENTRY * Vertex4iv)(const GLint *);
+ void (GLAPIENTRY * Vertex4s)(GLshort, GLshort, GLshort, GLshort);
+ void (GLAPIENTRY * Vertex4sv)(const GLshort *);
+ void (GLAPIENTRY * ClipPlane)(GLenum, const GLdouble *);
+ void (GLAPIENTRY * ColorMaterial)(GLenum, GLenum);
+ void (GLAPIENTRY * CullFace)(GLenum);
+ void (GLAPIENTRY * Fogf)(GLenum, GLfloat);
+ void (GLAPIENTRY * Fogfv)(GLenum, const GLfloat *);
+ void (GLAPIENTRY * Fogi)(GLenum, GLint);
+ void (GLAPIENTRY * Fogiv)(GLenum, const GLint *);
+ void (GLAPIENTRY * FrontFace)(GLenum);
+ void (GLAPIENTRY * Hint)(GLenum, GLenum);
+ void (GLAPIENTRY * Lightf)(GLenum, GLenum, GLfloat);
+ void (GLAPIENTRY * Lightfv)(GLenum, GLenum, const GLfloat *);
+ void (GLAPIENTRY * Lighti)(GLenum, GLenum, GLint);
+ void (GLAPIENTRY * Lightiv)(GLenum, GLenum, const GLint *);
+ void (GLAPIENTRY * LightModelf)(GLenum, GLfloat);
+ void (GLAPIENTRY * LightModelfv)(GLenum, const GLfloat *);
+ void (GLAPIENTRY * LightModeli)(GLenum, GLint);
+ void (GLAPIENTRY * LightModeliv)(GLenum, const GLint *);
+ void (GLAPIENTRY * LineStipple)(GLint, GLushort);
+ void (GLAPIENTRY * LineWidth)(GLfloat);
+ void (GLAPIENTRY * Materialf)(GLenum, GLenum, GLfloat);
+ void (GLAPIENTRY * Materialfv)(GLenum, GLenum, const GLfloat *);
+ void (GLAPIENTRY * Materiali)(GLenum, GLenum, GLint);
+ void (GLAPIENTRY * Materialiv)(GLenum, GLenum, const GLint *);
+ void (GLAPIENTRY * PointSize)(GLfloat);
+ void (GLAPIENTRY * PolygonMode)(GLenum, GLenum);
+ void (GLAPIENTRY * PolygonStipple)(const GLubyte *);
+ void (GLAPIENTRY * Scissor)(GLint, GLint, GLsizei, GLsizei);
+ void (GLAPIENTRY * ShadeModel)(GLenum);
+ void (GLAPIENTRY * TexParameterf)(GLenum, GLenum, GLfloat);
+ void (GLAPIENTRY * TexParameterfv)(GLenum, GLenum, const GLfloat *);
+ void (GLAPIENTRY * TexParameteri)(GLenum, GLenum, GLint);
+ void (GLAPIENTRY * TexParameteriv)(GLenum, GLenum, const GLint *);
+ void (GLAPIENTRY * TexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
+ void (GLAPIENTRY * TexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
+ void (GLAPIENTRY * TexEnvf)(GLenum, GLenum, GLfloat);
+ void (GLAPIENTRY * TexEnvfv)(GLenum, GLenum, const GLfloat *);
+ void (GLAPIENTRY * TexEnvi)(GLenum, GLenum, GLint);
+ void (GLAPIENTRY * TexEnviv)(GLenum, GLenum, const GLint *);
+ void (GLAPIENTRY * TexGend)(GLenum, GLenum, GLdouble);
+ void (GLAPIENTRY * TexGendv)(GLenum, GLenum, const GLdouble *);
+ void (GLAPIENTRY * TexGenf)(GLenum, GLenum, GLfloat);
+ void (GLAPIENTRY * TexGenfv)(GLenum, GLenum, const GLfloat *);
+ void (GLAPIENTRY * TexGeni)(GLenum, GLenum, GLint);
+ void (GLAPIENTRY * TexGeniv)(GLenum, GLenum, const GLint *);
+ void (GLAPIENTRY * FeedbackBuffer)(GLsizei, GLenum, GLfloat *);
+ void (GLAPIENTRY * SelectBuffer)(GLsizei, GLuint *);
+ GLint (GLAPIENTRY * RenderMode)(GLenum);
+ void (GLAPIENTRY * InitNames)(void);
+ void (GLAPIENTRY * LoadName)(GLuint);
+ void (GLAPIENTRY * PassThrough)(GLfloat);
+ void (GLAPIENTRY * PopName)(void);
+ void (GLAPIENTRY * PushName)(GLuint);
+ void (GLAPIENTRY * DrawBuffer)(GLenum);
+ void (GLAPIENTRY * Clear)(GLbitfield);
+ void (GLAPIENTRY * ClearAccum)(GLfloat, GLfloat, GLfloat, GLfloat);
+ void (GLAPIENTRY * ClearIndex)(GLfloat);
+ void (GLAPIENTRY * ClearColor)(GLclampf, GLclampf, GLclampf, GLclampf);
+ void (GLAPIENTRY * ClearStencil)(GLint);
+ void (GLAPIENTRY * ClearDepth)(GLclampd);
+ void (GLAPIENTRY * StencilMask)(GLuint);
+ void (GLAPIENTRY * ColorMask)(GLboolean, GLboolean, GLboolean, GLboolean);
+ void (GLAPIENTRY * DepthMask)(GLboolean);
+ void (GLAPIENTRY * IndexMask)(GLuint);
+ void (GLAPIENTRY * Accum)(GLenum, GLfloat);
+ void (GLAPIENTRY * Disable)(GLenum);
+ void (GLAPIENTRY * Enable)(GLenum);
+ void (GLAPIENTRY * Finish)(void);
+ void (GLAPIENTRY * Flush)(void);
+ void (GLAPIENTRY * PopAttrib)(void);
+ void (GLAPIENTRY * PushAttrib)(GLbitfield);
+ void (GLAPIENTRY * Map1d)(GLenum, GLdouble, GLdouble, GLint, GLint, const GLdouble *);
+ void (GLAPIENTRY * Map1f)(GLenum, GLfloat, GLfloat, GLint, GLint, const GLfloat *);
+ void (GLAPIENTRY * Map2d)(GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *);
+ void (GLAPIENTRY * Map2f)(GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *);
+ void (GLAPIENTRY * MapGrid1d)(GLint, GLdouble, GLdouble);
+ void (GLAPIENTRY * MapGrid1f)(GLint, GLfloat, GLfloat);
+ void (GLAPIENTRY * MapGrid2d)(GLint, GLdouble, GLdouble, GLint, GLdouble, GLdouble);
+ void (GLAPIENTRY * MapGrid2f)(GLint, GLfloat, GLfloat, GLint, GLfloat, GLfloat);
+ void (GLAPIENTRY * EvalCoord1d)(GLdouble);
+ void (GLAPIENTRY * EvalCoord1dv)(const GLdouble *);
+ void (GLAPIENTRY * EvalCoord1f)(GLfloat);
+ void (GLAPIENTRY * EvalCoord1fv)(const GLfloat *);
+ void (GLAPIENTRY * EvalCoord2d)(GLdouble, GLdouble);
+ void (GLAPIENTRY * EvalCoord2dv)(const GLdouble *);
+ void (GLAPIENTRY * EvalCoord2f)(GLfloat, GLfloat);
+ void (GLAPIENTRY * EvalCoord2fv)(const GLfloat *);
+ void (GLAPIENTRY * EvalMesh1)(GLenum, GLint, GLint);
+ void (GLAPIENTRY * EvalPoint1)(GLint);
+ void (GLAPIENTRY * EvalMesh2)(GLenum, GLint, GLint, GLint, GLint);
+ void (GLAPIENTRY * EvalPoint2)(GLint, GLint);
+ void (GLAPIENTRY * AlphaFunc)(GLenum, GLclampf);
+ void (GLAPIENTRY * BlendFunc)(GLenum, GLenum);
+ void (GLAPIENTRY * LogicOp)(GLenum);
+ void (GLAPIENTRY * StencilFunc)(GLenum, GLint, GLuint);
+ void (GLAPIENTRY * StencilOp)(GLenum, GLenum, GLenum);
+ void (GLAPIENTRY * DepthFunc)(GLenum);
+ void (GLAPIENTRY * PixelZoom)(GLfloat, GLfloat);
+ void (GLAPIENTRY * PixelTransferf)(GLenum, GLfloat);
+ void (GLAPIENTRY * PixelTransferi)(GLenum, GLint);
+ void (GLAPIENTRY * PixelStoref)(GLenum, GLfloat);
+ void (GLAPIENTRY * PixelStorei)(GLenum, GLint);
+ void (GLAPIENTRY * PixelMapfv)(GLenum, GLint, const GLfloat *);
+ void (GLAPIENTRY * PixelMapuiv)(GLenum, GLint, const GLuint *);
+ void (GLAPIENTRY * PixelMapusv)(GLenum, GLint, const GLushort *);
+ void (GLAPIENTRY * ReadBuffer)(GLenum);
+ void (GLAPIENTRY * CopyPixels)(GLint, GLint, GLsizei, GLsizei, GLenum);
+ void (GLAPIENTRY * ReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *);
+ void (GLAPIENTRY * DrawPixels)(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+ void (GLAPIENTRY * GetBooleanv)(GLenum, GLboolean *);
+ void (GLAPIENTRY * GetClipPlane)(GLenum, GLdouble *);
+ void (GLAPIENTRY * GetDoublev)(GLenum, GLdouble *);
+ GLenum (GLAPIENTRY * GetError)(void);
+ void (GLAPIENTRY * GetFloatv)(GLenum, GLfloat *);
+ void (GLAPIENTRY * GetIntegerv)(GLenum, GLint *);
+ void (GLAPIENTRY * GetLightfv)(GLenum, GLenum, GLfloat *);
+ void (GLAPIENTRY * GetLightiv)(GLenum, GLenum, GLint *);
+ void (GLAPIENTRY * GetMapdv)(GLenum, GLenum, GLdouble *);
+ void (GLAPIENTRY * GetMapfv)(GLenum, GLenum, GLfloat *);
+ void (GLAPIENTRY * GetMapiv)(GLenum, GLenum, GLint *);
+ void (GLAPIENTRY * GetMaterialfv)(GLenum, GLenum, GLfloat *);
+ void (GLAPIENTRY * GetMaterialiv)(GLenum, GLenum, GLint *);
+ void (GLAPIENTRY * GetPixelMapfv)(GLenum, GLfloat *);
+ void (GLAPIENTRY * GetPixelMapuiv)(GLenum, GLuint *);
+ void (GLAPIENTRY * GetPixelMapusv)(GLenum, GLushort *);
+ void (GLAPIENTRY * GetPolygonStipple)(GLubyte *);
+ const GLubyte * (GLAPIENTRY * GetString)(GLenum);
+ void (GLAPIENTRY * GetTexEnvfv)(GLenum, GLenum, GLfloat *);
+ void (GLAPIENTRY * GetTexEnviv)(GLenum, GLenum, GLint *);
+ void (GLAPIENTRY * GetTexGendv)(GLenum, GLenum, GLdouble *);
+ void (GLAPIENTRY * GetTexGenfv)(GLenum, GLenum, GLfloat *);
+ void (GLAPIENTRY * GetTexGeniv)(GLenum, GLenum, GLint *);
+ void (GLAPIENTRY * GetTexImage)(GLenum, GLint, GLenum, GLenum, GLvoid *);
+ void (GLAPIENTRY * GetTexParameterfv)(GLenum, GLenum, GLfloat *);
+ void (GLAPIENTRY * GetTexParameteriv)(GLenum, GLenum, GLint *);
+ void (GLAPIENTRY * GetTexLevelParameterfv)(GLenum, GLint, GLenum, GLfloat *);
+ void (GLAPIENTRY * GetTexLevelParameteriv)(GLenum, GLint, GLenum, GLint *);
+ GLboolean (GLAPIENTRY * IsEnabled)(GLenum);
+ GLboolean (GLAPIENTRY * IsList)(GLuint);
+ void (GLAPIENTRY * DepthRange)(GLclampd, GLclampd);
+ void (GLAPIENTRY * Frustum)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
+ void (GLAPIENTRY * LoadIdentity)(void);
+ void (GLAPIENTRY * LoadMatrixf)(const GLfloat *);
+ void (GLAPIENTRY * LoadMatrixd)(const GLdouble *);
+ void (GLAPIENTRY * MatrixMode)(GLenum);
+ void (GLAPIENTRY * MultMatrixf)(const GLfloat *);
+ void (GLAPIENTRY * MultMatrixd)(const GLdouble *);
+ void (GLAPIENTRY * Ortho)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
+ void (GLAPIENTRY * PopMatrix)(void);
+ void (GLAPIENTRY * PushMatrix)(void);
+ void (GLAPIENTRY * Rotated)(GLdouble, GLdouble, GLdouble, GLdouble);
+ void (GLAPIENTRY * Rotatef)(GLfloat, GLfloat, GLfloat, GLfloat);
+ void (GLAPIENTRY * Scaled)(GLdouble, GLdouble, GLdouble);
+ void (GLAPIENTRY * Scalef)(GLfloat, GLfloat, GLfloat);
+ void (GLAPIENTRY * Translated)(GLdouble, GLdouble, GLdouble);
+ void (GLAPIENTRY * Translatef)(GLfloat, GLfloat, GLfloat);
+ void (GLAPIENTRY * Viewport)(GLint, GLint, GLsizei, GLsizei);
+ void (GLAPIENTRY * ArrayElement)(GLint);
+ void (GLAPIENTRY * BindTexture)(GLenum, GLuint);
+ void (GLAPIENTRY * ColorPointer)(GLint, GLenum, GLsizei, const GLvoid *);
+ void (GLAPIENTRY * DisableClientState)(GLenum);
+ void (GLAPIENTRY * DrawArrays)(GLenum, GLint, GLsizei);
+ void (GLAPIENTRY * DrawElements)(GLenum, GLsizei, GLenum, const GLvoid *);
+ void (GLAPIENTRY * EdgeFlagPointer)(GLsizei, const GLvoid *);
+ void (GLAPIENTRY * EnableClientState)(GLenum);
+ void (GLAPIENTRY * IndexPointer)(GLenum, GLsizei, const GLvoid *);
+ void (GLAPIENTRY * Indexub)(GLubyte);
+ void (GLAPIENTRY * Indexubv)(const GLubyte *);
+ void (GLAPIENTRY * InterleavedArrays)(GLenum, GLsizei, const GLvoid *);
+ void (GLAPIENTRY * NormalPointer)(GLenum, GLsizei, const GLvoid *);
+ void (GLAPIENTRY * PolygonOffset)(GLfloat, GLfloat);
+ void (GLAPIENTRY * TexCoordPointer)(GLint, GLenum, GLsizei, const GLvoid *);
+ void (GLAPIENTRY * VertexPointer)(GLint, GLenum, GLsizei, const GLvoid *);
+ GLboolean (GLAPIENTRY * AreTexturesResident)(GLsizei, const GLuint *, GLboolean *);
+ void (GLAPIENTRY * CopyTexImage1D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint);
+ void (GLAPIENTRY * CopyTexImage2D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
+ void (GLAPIENTRY * CopyTexSubImage1D)(GLenum, GLint, GLint, GLint, GLint, GLsizei);
+ void (GLAPIENTRY * CopyTexSubImage2D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
+ void (GLAPIENTRY * DeleteTextures)(GLsizei, const GLuint *);
+ void (GLAPIENTRY * GenTextures)(GLsizei, GLuint *);
+ void (GLAPIENTRY * GetPointerv)(GLenum, GLvoid **);
+ GLboolean (GLAPIENTRY * IsTexture)(GLuint);
+ void (GLAPIENTRY * PrioritizeTextures)(GLsizei, const GLuint *, const GLclampf *);
+ void (GLAPIENTRY * TexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *);
+ void (GLAPIENTRY * TexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+ void (GLAPIENTRY * PopClientAttrib)(void);
+ void (GLAPIENTRY * PushClientAttrib)(GLbitfield);
+};
+
+typedef struct __GLdispatchTableRec GLDISPATCHTABLE;
+
+typedef struct _GLCLTPROCTABLE
+{
+ int cEntries;
+ GLDISPATCHTABLE glDispatchTable;
+} GLCLTPROCTABLE, * PGLCLTPROCTABLE;
+
+typedef VOID (APIENTRY * PFN_SETPROCTABLE)(PGLCLTPROCTABLE);
+
+BOOL APIENTRY
+DrvCopyContext(
+ DHGLRC dhrcSource,
+ DHGLRC dhrcDest,
+ UINT fuMask );
+
+DHGLRC APIENTRY
+DrvCreateLayerContext(
+ HDC hdc,
+ INT iLayerPlane );
+
+DHGLRC APIENTRY
+DrvCreateContext(
+ HDC hdc );
+
+BOOL APIENTRY
+DrvDeleteContext(
+ DHGLRC dhglrc );
+
+BOOL APIENTRY
+DrvDescribeLayerPlane(
+ HDC hdc,
+ INT iPixelFormat,
+ INT iLayerPlane,
+ UINT nBytes,
+ LPLAYERPLANEDESCRIPTOR plpd );
+
+LONG APIENTRY
+DrvDescribePixelFormat(
+ HDC hdc,
+ INT iPixelFormat,
+ ULONG cjpfd,
+ PIXELFORMATDESCRIPTOR *ppfd );
+
+int APIENTRY
+DrvGetLayerPaletteEntries(
+ HDC hdc,
+ INT iLayerPlane,
+ INT iStart,
+ INT cEntries,
+ COLORREF *pcr );
+
+PROC APIENTRY
+DrvGetProcAddress(
+ LPCSTR lpszProc );
+
+BOOL APIENTRY
+DrvRealizeLayerPalette(
+ HDC hdc,
+ INT iLayerPlane,
+ BOOL bRealize );
+
+BOOL APIENTRY
+DrvReleaseContext(
+ DHGLRC dhglrc );
+
+void APIENTRY
+DrvSetCallbackProcs(
+ INT nProcs,
+ PROC *pProcs );
+
+PGLCLTPROCTABLE APIENTRY
+DrvSetContext(
+ HDC hdc,
+ DHGLRC dhglrc,
+ PFN_SETPROCTABLE pfnSetProcTable );
+
+int APIENTRY
+DrvSetLayerPaletteEntries(
+ HDC hdc,
+ INT iLayerPlane,
+ INT iStart,
+ INT cEntries,
+ CONST COLORREF *pcr );
+
+BOOL APIENTRY
+DrvSetPixelFormat(
+ HDC hdc,
+ LONG iPixelFormat );
+
+BOOL APIENTRY
+DrvShareLists(
+ DHGLRC dhglrc1,
+ DHGLRC dhglrc2 );
+
+BOOL APIENTRY
+DrvSwapBuffers(
+ HDC hdc );
+
+BOOL APIENTRY
+DrvSwapLayerBuffers(
+ HDC hdc,
+ UINT fuPlanes );
+
+BOOL APIENTRY
+DrvValidateVersion(
+ ULONG ulVersion );
+
+#endif /* DRV_H */
--- /dev/null
+/**************************************************************************
+ *
+ * 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 "pipe/p_debug.h"
+#include "pipe/p_winsys.h"
+#include "pipe/p_screen.h"
+
+#include "shared/stw_device.h"
+#include "shared/stw_winsys.h"
+#include "shared/stw_pixelformat.h"
+
+
+struct stw_device *stw_dev = NULL;
+
+
+/**
+ * XXX: Dispatch pipe_winsys::flush_front_buffer to our
+ * stw_winsys::flush_front_buffer.
+ */
+static void
+st_flush_frontbuffer(struct pipe_winsys *ws,
+ struct pipe_surface *surf,
+ void *context_private )
+{
+ const struct stw_winsys *stw_winsys = stw_dev->stw_winsys;
+ struct pipe_winsys *winsys = stw_dev->screen->winsys;
+ HDC hdc = (HDC)context_private;
+
+ stw_winsys->flush_frontbuffer(winsys, surf, hdc);
+}
+
+
+boolean
+st_init(const struct stw_winsys *stw_winsys)
+{
+ static struct stw_device stw_dev_storage;
+
+ assert(!stw_dev);
+
+ stw_dev = &stw_dev_storage;
+ memset(stw_dev, 0, sizeof(*stw_dev));
+
+ stw_dev->stw_winsys = stw_winsys;
+
+ stw_dev->screen = stw_winsys->create_screen();
+ if(!stw_dev->screen)
+ goto error1;
+
+ /* XXX: pipe_winsys::flush_frontbuffer should go away */
+ stw_dev->screen->winsys->flush_frontbuffer = st_flush_frontbuffer;
+
+ pixelformat_init();
+
+ return TRUE;
+
+error1:
+ stw_dev = NULL;
+ return FALSE;
+}
+
+
+void
+st_cleanup(void)
+{
+ DHGLRC dhglrc;
+
+ if(!stw_dev)
+ return;
+
+ /* Ensure all contexts are destroyed */
+ for (dhglrc = 1; dhglrc <= DRV_CONTEXT_MAX; dhglrc++)
+ if (stw_dev->ctx_array[dhglrc - 1].hglrc)
+ DrvDeleteContext( dhglrc );
+
+ stw_dev = NULL;
+}
--- /dev/null
+/**************************************************************************
+ *
+ * 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 ST_DEVICE_H_
+#define ST_DEVICE_H_
+
+
+#include "icd/stw_icd.h"
+
+struct pipe_screen;
+
+
+struct drv_context
+{
+ HGLRC hglrc;
+};
+
+#define DRV_CONTEXT_MAX 32
+
+
+struct stw_device
+{
+ const struct stw_winsys *stw_winsys;
+
+ struct pipe_screen *screen;
+
+ struct drv_context ctx_array[DRV_CONTEXT_MAX];
+
+ DHGLRC ctx_current;
+};
+
+
+extern struct stw_device *stw_dev;
+
+
+#endif /* ST_DEVICE_H_ */
--- /dev/null
+/**************************************************************************
+ *
+ * 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 "main/context.h"
+#include "pipe/p_format.h"
+#include "state_tracker/st_context.h"
+#include "state_tracker/st_public.h"
+#include "stw_framebuffer.h"
+
+void
+framebuffer_resize(
+ struct stw_framebuffer *fb,
+ GLuint width,
+ GLuint height )
+{
+ if (fb->hbmDIB == NULL || fb->stfb->Base.Width != width || fb->stfb->Base.Height != height) {
+ if (fb->hbmDIB)
+ DeleteObject( fb->hbmDIB );
+
+ fb->hbmDIB = CreateCompatibleBitmap(
+ fb->hDC,
+ width,
+ height );
+ }
+
+ st_resize_framebuffer( fb->stfb, width, height );
+}
+
+static struct stw_framebuffer *fb_head = NULL;
+
+static LRESULT CALLBACK
+window_proc(
+ HWND hWnd,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam )
+{
+ struct stw_framebuffer *fb;
+
+ for (fb = fb_head; fb != NULL; fb = fb->next)
+ if (fb->hWnd == hWnd)
+ break;
+ assert( fb != NULL );
+
+ if (uMsg == WM_SIZE && wParam != SIZE_MINIMIZED)
+ framebuffer_resize( fb, LOWORD( lParam ), HIWORD( lParam ) );
+
+ return CallWindowProc( fb->WndProc, hWnd, uMsg, wParam, lParam );
+}
+
+/* Create a new framebuffer object which will correspond to the given HDC.
+ */
+struct stw_framebuffer *
+framebuffer_create(
+ HDC hdc,
+ GLvisual *visual,
+ GLuint width,
+ GLuint height )
+{
+ struct stw_framebuffer *fb;
+ enum pipe_format colorFormat, depthFormat, stencilFormat;
+
+ fb = CALLOC_STRUCT( stw_framebuffer );
+ if (fb == NULL)
+ return NULL;
+
+ /* Determine PIPE_FORMATs for buffers.
+ */
+ colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM;
+
+ if (visual->depthBits == 0)
+ depthFormat = PIPE_FORMAT_NONE;
+ else if (visual->depthBits <= 16)
+ depthFormat = PIPE_FORMAT_Z16_UNORM;
+ else if (visual->depthBits <= 24)
+ depthFormat = PIPE_FORMAT_S8Z24_UNORM;
+ else
+ depthFormat = PIPE_FORMAT_Z32_UNORM;
+
+ if (visual->stencilBits == 8) {
+ if (depthFormat == PIPE_FORMAT_S8Z24_UNORM)
+ stencilFormat = depthFormat;
+ else
+ stencilFormat = PIPE_FORMAT_S8_UNORM;
+ }
+ else {
+ stencilFormat = PIPE_FORMAT_NONE;
+ }
+
+ fb->stfb = st_create_framebuffer(
+ visual,
+ colorFormat,
+ depthFormat,
+ stencilFormat,
+ width,
+ height,
+ (void *) fb );
+
+ fb->cColorBits = GetDeviceCaps( hdc, BITSPIXEL );
+ fb->hDC = hdc;
+
+ /* Subclass a window associated with the device context.
+ */
+ fb->hWnd = WindowFromDC( hdc );
+ if (fb->hWnd != NULL) {
+ fb->WndProc = (WNDPROC) SetWindowLong(
+ fb->hWnd,
+ GWL_WNDPROC,
+ (LONG) window_proc );
+ }
+
+ fb->next = fb_head;
+ fb_head = fb;
+ return fb;
+}
+
+void
+framebuffer_destroy(
+ struct stw_framebuffer *fb )
+{
+ struct stw_framebuffer **link = &fb_head;
+ struct stw_framebuffer *pfb = fb_head;
+
+ while (pfb != NULL) {
+ if (pfb == fb) {
+ if (fb->hWnd != NULL) {
+ SetWindowLong(
+ fb->hWnd,
+ GWL_WNDPROC,
+ (LONG) fb->WndProc );
+ }
+
+ *link = fb->next;
+ FREE( fb );
+ return;
+ }
+
+ link = &pfb->next;
+ pfb = pfb->next;
+ }
+}
+
+/* Given an hdc, return the corresponding wgl_context.
+ */
+struct stw_framebuffer *
+framebuffer_from_hdc(
+ HDC hdc )
+{
+ struct stw_framebuffer *fb;
+
+ for (fb = fb_head; fb != NULL; fb = fb->next)
+ if (fb->hDC == hdc)
+ return fb;
+ return NULL;
+}
--- /dev/null
+/**************************************************************************
+ *
+ * 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_FRAMEBUFFER_H
+#define STW_FRAMEBUFFER_H
+
+#include "main/mtypes.h"
+
+/* Windows framebuffer, derived from gl_framebuffer.
+ */
+struct stw_framebuffer
+{
+ struct st_framebuffer *stfb;
+ HDC hDC;
+ int pixelformat;
+ BYTE cColorBits;
+ HDC dib_hDC;
+ HBITMAP hbmDIB;
+ HBITMAP hOldBitmap;
+ PBYTE pbPixels;
+ HWND hWnd;
+ WNDPROC WndProc;
+ struct stw_framebuffer *next;
+};
+
+struct stw_framebuffer *
+framebuffer_create(
+ HDC hdc,
+ GLvisual *visual,
+ GLuint width,
+ GLuint height );
+
+void
+framebuffer_destroy(
+ struct stw_framebuffer *fb );
+
+void
+framebuffer_resize(
+ struct stw_framebuffer *fb,
+ GLuint width,
+ GLuint height );
+
+struct stw_framebuffer *
+framebuffer_from_hdc(
+ HDC hdc );
+
+#endif /* STW_FRAMEBUFFER_H */
--- /dev/null
+/**************************************************************************
+ *
+ * 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 "pipe/p_debug.h"
+#include "stw_pixelformat.h"
+
+#define MAX_PIXELFORMATS 16
+
+static struct pixelformat_info pixelformats[MAX_PIXELFORMATS];
+static uint pixelformat_count = 0;
+static uint pixelformat_extended_count = 0;
+
+static void
+add_standard_pixelformats(
+ struct pixelformat_info **ppf,
+ uint flags )
+{
+ struct pixelformat_info *pf = *ppf;
+ struct pixelformat_color_info color24 = { 8, 0, 8, 8, 8, 16 };
+ struct pixelformat_alpha_info alpha8 = { 8, 24 };
+ struct pixelformat_alpha_info noalpha = { 0, 0 };
+ struct pixelformat_depth_info depth24s8 = { 24, 8 };
+ struct pixelformat_depth_info depth16 = { 16, 0 };
+
+ pf->flags = PF_FLAG_DOUBLEBUFFER | flags;
+ pf->color = color24;
+ pf->alpha = alpha8;
+ pf->depth = depth16;
+ pf++;
+
+ pf->flags = PF_FLAG_DOUBLEBUFFER | flags;
+ pf->color = color24;
+ pf->alpha = alpha8;
+ pf->depth = depth24s8;
+ pf++;
+
+ pf->flags = PF_FLAG_DOUBLEBUFFER | flags;
+ pf->color = color24;
+ pf->alpha = noalpha;
+ pf->depth = depth16;
+ pf++;
+
+ pf->flags = PF_FLAG_DOUBLEBUFFER | flags;
+ pf->color = color24;
+ pf->alpha = noalpha;
+ pf->depth = depth24s8;
+ pf++;
+
+ pf->flags = flags;
+ pf->color = color24;
+ pf->alpha = noalpha;
+ pf->depth = depth16;
+ pf++;
+
+ pf->flags = flags;
+ pf->color = color24;
+ pf->alpha = noalpha;
+ pf->depth = depth24s8;
+ pf++;
+
+ *ppf = pf;
+}
+
+void
+pixelformat_init( void )
+{
+ struct pixelformat_info *pf = pixelformats;
+
+ add_standard_pixelformats( &pf, 0 );
+ pixelformat_count = pf - pixelformats;
+
+ add_standard_pixelformats( &pf, PF_FLAG_MULTISAMPLED );
+ pixelformat_extended_count = pf - pixelformats;
+
+ assert( pixelformat_extended_count <= MAX_PIXELFORMATS );
+}
+
+uint
+pixelformat_get_count( void )
+{
+ return pixelformat_count;
+}
+
+uint
+pixelformat_get_extended_count( void )
+{
+ return pixelformat_extended_count;
+}
+
+const struct pixelformat_info *
+pixelformat_get_info( uint index )
+{
+ assert( index < pixelformat_extended_count );
+
+ return &pixelformats[index];
+}
--- /dev/null
+/**************************************************************************
+ *
+ * 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 PIXELFORMAT_H
+#define PIXELFORMAT_H
+
+#define PF_FLAG_DOUBLEBUFFER 0x00000001
+#define PF_FLAG_MULTISAMPLED 0x00000002
+
+struct pixelformat_color_info
+{
+ uint redbits;
+ uint redshift;
+ uint greenbits;
+ uint greenshift;
+ uint bluebits;
+ uint blueshift;
+};
+
+struct pixelformat_alpha_info
+{
+ uint alphabits;
+ uint alphashift;
+};
+
+struct pixelformat_depth_info
+{
+ uint depthbits;
+ uint stencilbits;
+};
+
+struct pixelformat_info
+{
+ uint flags;
+ struct pixelformat_color_info color;
+ struct pixelformat_alpha_info alpha;
+ struct pixelformat_depth_info depth;
+};
+
+void
+pixelformat_init( void );
+
+uint
+pixelformat_get_count( void );
+
+uint
+pixelformat_get_extended_count( void );
+
+const struct pixelformat_info *
+pixelformat_get_info( uint index );
+
+#endif /* PIXELFORMAT_H */
--- /dev/null
+/**************************************************************************
+ *
+ * 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.
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ *
+ * This is hopefully a temporary hack to define some needed dispatch
+ * table entries. Hopefully, I'll find a better solution. The
+ * dispatch table generation scripts ought to be making these dummy
+ * stubs as well.
+ */
+
+void gl_dispatch_stub_543(void){}
+void gl_dispatch_stub_544(void){}
+void gl_dispatch_stub_545(void){}
+void gl_dispatch_stub_546(void){}
+void gl_dispatch_stub_547(void){}
+void gl_dispatch_stub_548(void){}
+void gl_dispatch_stub_549(void){}
+void gl_dispatch_stub_550(void){}
+void gl_dispatch_stub_551(void){}
+void gl_dispatch_stub_552(void){}
+void gl_dispatch_stub_553(void){}
+void gl_dispatch_stub_554(void){}
+void gl_dispatch_stub_555(void){}
+void gl_dispatch_stub_556(void){}
+void gl_dispatch_stub_557(void){}
+void gl_dispatch_stub_558(void){}
+void gl_dispatch_stub_559(void){}
+void gl_dispatch_stub_560(void){}
+void gl_dispatch_stub_561(void){}
+void gl_dispatch_stub_565(void){}
+void gl_dispatch_stub_566(void){}
+void gl_dispatch_stub_577(void){}
+void gl_dispatch_stub_578(void){}
+void gl_dispatch_stub_603(void){}
+void gl_dispatch_stub_645(void){}
+void gl_dispatch_stub_646(void){}
+void gl_dispatch_stub_647(void){}
+void gl_dispatch_stub_648(void){}
+void gl_dispatch_stub_649(void){}
+void gl_dispatch_stub_650(void){}
+void gl_dispatch_stub_651(void){}
+void gl_dispatch_stub_652(void){}
+void gl_dispatch_stub_653(void){}
+void gl_dispatch_stub_733(void){}
+void gl_dispatch_stub_734(void){}
+void gl_dispatch_stub_735(void){}
+void gl_dispatch_stub_736(void){}
+void gl_dispatch_stub_737(void){}
+void gl_dispatch_stub_738(void){}
+void gl_dispatch_stub_744(void){}
+void gl_dispatch_stub_745(void){}
+void gl_dispatch_stub_746(void){}
+void gl_dispatch_stub_760(void){}
+void gl_dispatch_stub_761(void){}
+void gl_dispatch_stub_763(void){}
+void gl_dispatch_stub_765(void){}
+void gl_dispatch_stub_766(void){}
+void gl_dispatch_stub_767(void){}
+void gl_dispatch_stub_768(void){}
+
+void gl_dispatch_stub_562(void){}
+void gl_dispatch_stub_563(void){}
+void gl_dispatch_stub_564(void){}
+void gl_dispatch_stub_567(void){}
+void gl_dispatch_stub_568(void){}
+void gl_dispatch_stub_569(void){}
+void gl_dispatch_stub_580(void){}
+void gl_dispatch_stub_581(void){}
+void gl_dispatch_stub_606(void){}
+void gl_dispatch_stub_654(void){}
+void gl_dispatch_stub_655(void){}
+void gl_dispatch_stub_656(void){}
+void gl_dispatch_stub_739(void){}
+void gl_dispatch_stub_740(void){}
+void gl_dispatch_stub_741(void){}
+void gl_dispatch_stub_748(void){}
+void gl_dispatch_stub_749(void){}
+void gl_dispatch_stub_769(void){}
+void gl_dispatch_stub_770(void){}
+void gl_dispatch_stub_771(void){}
+void gl_dispatch_stub_772(void){}
+void gl_dispatch_stub_773(void){}
--- /dev/null
+/**************************************************************************
+ *
+ * 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_WINSYS_H
+#define STW_WINSYS_H
+
+#include <windows.h> /* for HDC */
+
+#include "pipe/p_compiler.h"
+
+struct pipe_screen;
+struct pipe_context;
+struct pipe_winsys;
+struct pipe_surface;
+
+struct stw_winsys
+{
+ struct pipe_screen *
+ (*create_screen)( void );
+
+ struct pipe_context *
+ (*create_context)( struct pipe_screen *screen );
+
+ void
+ (*flush_frontbuffer)( struct pipe_winsys *winsys,
+ struct pipe_surface *surf,
+ HDC hDC );
+};
+
+boolean
+st_init(const struct stw_winsys *stw_winsys);
+
+void
+st_cleanup(void);
+
+#endif /* STW_WINSYS_H */
+++ /dev/null
-/**************************************************************************
- *
- * 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 "pipe/p_debug.h"
-#include "pipe/p_winsys.h"
-#include "pipe/p_screen.h"
-
-#include "stw_device.h"
-#include "stw_winsys.h"
-#include "stw_pixelformat.h"
-
-
-struct stw_device *stw_dev = NULL;
-
-
-/**
- * XXX: Dispatch pipe_winsys::flush_front_buffer to our
- * stw_winsys::flush_front_buffer.
- */
-static void
-st_flush_frontbuffer(struct pipe_winsys *ws,
- struct pipe_surface *surf,
- void *context_private )
-{
- const struct stw_winsys *stw_winsys = stw_dev->stw_winsys;
- struct pipe_winsys *winsys = stw_dev->screen->winsys;
- HDC hdc = (HDC)context_private;
-
- stw_winsys->flush_frontbuffer(winsys, surf, hdc);
-}
-
-
-boolean
-st_init(const struct stw_winsys *stw_winsys)
-{
- static struct stw_device stw_dev_storage;
-
- assert(!stw_dev);
-
- stw_dev = &stw_dev_storage;
- memset(stw_dev, 0, sizeof(*stw_dev));
-
- stw_dev->stw_winsys = stw_winsys;
-
- stw_dev->screen = stw_winsys->create_screen();
- if(!stw_dev->screen)
- goto error1;
-
- /* XXX: pipe_winsys::flush_frontbuffer should go away */
- stw_dev->screen->winsys->flush_frontbuffer = st_flush_frontbuffer;
-
- pixelformat_init();
-
- return TRUE;
-
-error1:
- stw_dev = NULL;
- return FALSE;
-}
-
-
-void
-st_cleanup(void)
-{
- DHGLRC dhglrc;
-
- if(!stw_dev)
- return;
-
- /* Ensure all contexts are destroyed */
- for (dhglrc = 1; dhglrc <= DRV_CONTEXT_MAX; dhglrc++)
- if (stw_dev->ctx_array[dhglrc - 1].hglrc)
- DrvDeleteContext( dhglrc );
-
- stw_dev = NULL;
-}
+++ /dev/null
-/**************************************************************************
- *
- * 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 ST_DEVICE_H_
-#define ST_DEVICE_H_
-
-
-#include "stw_icd.h"
-
-struct pipe_screen;
-
-
-struct drv_context
-{
- HGLRC hglrc;
-};
-
-#define DRV_CONTEXT_MAX 32
-
-
-struct stw_device
-{
- const struct stw_winsys *stw_winsys;
-
- struct pipe_screen *screen;
-
- struct drv_context ctx_array[DRV_CONTEXT_MAX];
-
- DHGLRC ctx_current;
-};
-
-
-extern struct stw_device *stw_dev;
-
-
-#endif /* ST_DEVICE_H_ */
+++ /dev/null
-/**************************************************************************
- *
- * 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 "main/context.h"
-#include "pipe/p_format.h"
-#include "state_tracker/st_context.h"
-#include "state_tracker/st_public.h"
-#include "stw_framebuffer.h"
-
-void
-framebuffer_resize(
- struct stw_framebuffer *fb,
- GLuint width,
- GLuint height )
-{
- if (fb->hbmDIB == NULL || fb->stfb->Base.Width != width || fb->stfb->Base.Height != height) {
- if (fb->hbmDIB)
- DeleteObject( fb->hbmDIB );
-
- fb->hbmDIB = CreateCompatibleBitmap(
- fb->hDC,
- width,
- height );
- }
-
- st_resize_framebuffer( fb->stfb, width, height );
-}
-
-static struct stw_framebuffer *fb_head = NULL;
-
-static LRESULT CALLBACK
-window_proc(
- HWND hWnd,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam )
-{
- struct stw_framebuffer *fb;
-
- for (fb = fb_head; fb != NULL; fb = fb->next)
- if (fb->hWnd == hWnd)
- break;
- assert( fb != NULL );
-
- if (uMsg == WM_SIZE && wParam != SIZE_MINIMIZED)
- framebuffer_resize( fb, LOWORD( lParam ), HIWORD( lParam ) );
-
- return CallWindowProc( fb->WndProc, hWnd, uMsg, wParam, lParam );
-}
-
-/* Create a new framebuffer object which will correspond to the given HDC.
- */
-struct stw_framebuffer *
-framebuffer_create(
- HDC hdc,
- GLvisual *visual,
- GLuint width,
- GLuint height )
-{
- struct stw_framebuffer *fb;
- enum pipe_format colorFormat, depthFormat, stencilFormat;
-
- fb = CALLOC_STRUCT( stw_framebuffer );
- if (fb == NULL)
- return NULL;
-
- /* Determine PIPE_FORMATs for buffers.
- */
- colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM;
-
- if (visual->depthBits == 0)
- depthFormat = PIPE_FORMAT_NONE;
- else if (visual->depthBits <= 16)
- depthFormat = PIPE_FORMAT_Z16_UNORM;
- else if (visual->depthBits <= 24)
- depthFormat = PIPE_FORMAT_S8Z24_UNORM;
- else
- depthFormat = PIPE_FORMAT_Z32_UNORM;
-
- if (visual->stencilBits == 8) {
- if (depthFormat == PIPE_FORMAT_S8Z24_UNORM)
- stencilFormat = depthFormat;
- else
- stencilFormat = PIPE_FORMAT_S8_UNORM;
- }
- else {
- stencilFormat = PIPE_FORMAT_NONE;
- }
-
- fb->stfb = st_create_framebuffer(
- visual,
- colorFormat,
- depthFormat,
- stencilFormat,
- width,
- height,
- (void *) fb );
-
- fb->cColorBits = GetDeviceCaps( hdc, BITSPIXEL );
- fb->hDC = hdc;
-
- /* Subclass a window associated with the device context.
- */
- fb->hWnd = WindowFromDC( hdc );
- if (fb->hWnd != NULL) {
- fb->WndProc = (WNDPROC) SetWindowLong(
- fb->hWnd,
- GWL_WNDPROC,
- (LONG) window_proc );
- }
-
- fb->next = fb_head;
- fb_head = fb;
- return fb;
-}
-
-void
-framebuffer_destroy(
- struct stw_framebuffer *fb )
-{
- struct stw_framebuffer **link = &fb_head;
- struct stw_framebuffer *pfb = fb_head;
-
- while (pfb != NULL) {
- if (pfb == fb) {
- if (fb->hWnd != NULL) {
- SetWindowLong(
- fb->hWnd,
- GWL_WNDPROC,
- (LONG) fb->WndProc );
- }
-
- *link = fb->next;
- FREE( fb );
- return;
- }
-
- link = &pfb->next;
- pfb = pfb->next;
- }
-}
-
-/* Given an hdc, return the corresponding wgl_context.
- */
-struct stw_framebuffer *
-framebuffer_from_hdc(
- HDC hdc )
-{
- struct stw_framebuffer *fb;
-
- for (fb = fb_head; fb != NULL; fb = fb->next)
- if (fb->hDC == hdc)
- return fb;
- return NULL;
-}
+++ /dev/null
-/**************************************************************************
- *
- * 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_FRAMEBUFFER_H
-#define STW_FRAMEBUFFER_H
-
-#include "main/mtypes.h"
-
-/* Windows framebuffer, derived from gl_framebuffer.
- */
-struct stw_framebuffer
-{
- struct st_framebuffer *stfb;
- HDC hDC;
- int pixelformat;
- BYTE cColorBits;
- HDC dib_hDC;
- HBITMAP hbmDIB;
- HBITMAP hOldBitmap;
- PBYTE pbPixels;
- HWND hWnd;
- WNDPROC WndProc;
- struct stw_framebuffer *next;
-};
-
-struct stw_framebuffer *
-framebuffer_create(
- HDC hdc,
- GLvisual *visual,
- GLuint width,
- GLuint height );
-
-void
-framebuffer_destroy(
- struct stw_framebuffer *fb );
-
-void
-framebuffer_resize(
- struct stw_framebuffer *fb,
- GLuint width,
- GLuint height );
-
-struct stw_framebuffer *
-framebuffer_from_hdc(
- HDC hdc );
-
-#endif /* STW_FRAMEBUFFER_H */
+++ /dev/null
-/**************************************************************************
- *
- * 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 "pipe/p_debug.h"
-
-#include "stw_device.h"
-#include "stw_icd.h"
-#include "stw_wgl.h"
-
-
-static HGLRC
-_drv_lookup_hglrc( DHGLRC dhglrc )
-{
- if (dhglrc == 0 || dhglrc >= DRV_CONTEXT_MAX)
- return NULL;
- return stw_dev->ctx_array[dhglrc - 1].hglrc;
-}
-
-BOOL APIENTRY
-DrvCopyContext(
- DHGLRC dhrcSource,
- DHGLRC dhrcDest,
- UINT fuMask )
-{
- debug_printf( "%s\n", __FUNCTION__ );
-
- return FALSE;
-}
-
-DHGLRC APIENTRY
-DrvCreateLayerContext(
- 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;
- }
- }
-
- debug_printf( "%s( 0x%p, %d ) = %u\n", __FUNCTION__, hdc, iLayerPlane, dhglrc );
-
- return dhglrc;
-}
-
-DHGLRC APIENTRY
-DrvCreateContext(
- HDC hdc )
-{
- return DrvCreateLayerContext( hdc, 0 );
-}
-
-BOOL APIENTRY
-DrvDeleteContext(
- DHGLRC dhglrc )
-{
- HGLRC hglrc = _drv_lookup_hglrc( dhglrc );
- BOOL success = FALSE;
-
- if (hglrc != NULL) {
- success = wglDeleteContext( hglrc );
- if (success)
- stw_dev->ctx_array[dhglrc - 1].hglrc = NULL;
- }
-
- debug_printf( "%s( %u ) = %s\n", __FUNCTION__, dhglrc, success ? "TRUE" : "FALSE" );
-
- return success;
-}
-
-BOOL APIENTRY
-DrvDescribeLayerPlane(
- HDC hdc,
- INT iPixelFormat,
- INT iLayerPlane,
- UINT nBytes,
- LPLAYERPLANEDESCRIPTOR plpd )
-{
- debug_printf( "%s\n", __FUNCTION__ );
-
- return FALSE;
-}
-
-LONG APIENTRY
-DrvDescribePixelFormat(
- HDC hdc,
- INT iPixelFormat,
- ULONG cjpfd,
- PIXELFORMATDESCRIPTOR *ppfd )
-{
- LONG r;
-
- r = wglDescribePixelFormat( hdc, iPixelFormat, cjpfd, ppfd );
-
- debug_printf( "%s( 0x%p, %d, %u, 0x%p ) = %d\n", __FUNCTION__, hdc, iPixelFormat, cjpfd, ppfd, r );
-
- return r;
-}
-
-int APIENTRY
-DrvGetLayerPaletteEntries(
- HDC hdc,
- INT iLayerPlane,
- INT iStart,
- INT cEntries,
- COLORREF *pcr )
-{
- debug_printf( "%s\n", __FUNCTION__ );
-
- return 0;
-}
-
-PROC APIENTRY
-DrvGetProcAddress(
- LPCSTR lpszProc )
-{
- PROC r;
-
- r = wglGetProcAddress( lpszProc );
-
- debug_printf( "%s( \", __FUNCTION__%s\" ) = 0x%p\n", lpszProc, r );
-
- return r;
-}
-
-BOOL APIENTRY
-DrvRealizeLayerPalette(
- HDC hdc,
- INT iLayerPlane,
- BOOL bRealize )
-{
- debug_printf( "%s\n", __FUNCTION__ );
-
- return FALSE;
-}
-
-BOOL APIENTRY
-DrvReleaseContext(
- DHGLRC dhglrc )
-{
- BOOL success = FALSE;
-
- if (dhglrc == stw_dev->ctx_current) {
- HGLRC hglrc = _drv_lookup_hglrc( dhglrc );
-
- if (hglrc != NULL) {
- success = wglMakeCurrent( NULL, NULL );
- if (success)
- stw_dev->ctx_current = 0;
- }
- }
-
- debug_printf( "%s( %u ) = %s\n", __FUNCTION__, dhglrc, success ? "TRUE" : "FALSE" );
-
- return success;
-}
-
-void APIENTRY
-DrvSetCallbackProcs(
- INT nProcs,
- PROC *pProcs )
-{
- debug_printf( "%s( %d, 0x%p )\n", __FUNCTION__, nProcs, pProcs );
-
- return;
-}
-
-#define GPA_GL( NAME ) disp->NAME = gl##NAME
-
-static GLCLTPROCTABLE cpt;
-
-PGLCLTPROCTABLE APIENTRY
-DrvSetContext(
- HDC hdc,
- DHGLRC dhglrc,
- PFN_SETPROCTABLE pfnSetProcTable )
-{
- HGLRC hglrc = _drv_lookup_hglrc( dhglrc );
- GLDISPATCHTABLE *disp = &cpt.glDispatchTable;
-
- debug_printf( "%s( 0x%p, %u, 0x%p )\n", __FUNCTION__, hdc, dhglrc, pfnSetProcTable );
-
- if (hglrc == NULL)
- return NULL;
-
- if (!wglMakeCurrent( hdc, hglrc ))
- return NULL;
-
- memset( &cpt, 0, sizeof( cpt ) );
- cpt.cEntries = OPENGL_VERSION_110_ENTRIES;
-
- GPA_GL( NewList );
- GPA_GL( EndList );
- GPA_GL( CallList );
- GPA_GL( CallLists );
- GPA_GL( DeleteLists );
- GPA_GL( GenLists );
- GPA_GL( ListBase );
- GPA_GL( Begin );
- GPA_GL( Bitmap );
- GPA_GL( Color3b );
- GPA_GL( Color3bv );
- GPA_GL( Color3d );
- GPA_GL( Color3dv );
- GPA_GL( Color3f );
- GPA_GL( Color3fv );
- GPA_GL( Color3i );
- GPA_GL( Color3iv );
- GPA_GL( Color3s );
- GPA_GL( Color3sv );
- GPA_GL( Color3ub );
- GPA_GL( Color3ubv );
- GPA_GL( Color3ui );
- GPA_GL( Color3uiv );
- GPA_GL( Color3us );
- GPA_GL( Color3usv );
- GPA_GL( Color4b );
- GPA_GL( Color4bv );
- GPA_GL( Color4d );
- GPA_GL( Color4dv );
- GPA_GL( Color4f );
- GPA_GL( Color4fv );
- GPA_GL( Color4i );
- GPA_GL( Color4iv );
- GPA_GL( Color4s );
- GPA_GL( Color4sv );
- GPA_GL( Color4ub );
- GPA_GL( Color4ubv );
- GPA_GL( Color4ui );
- GPA_GL( Color4uiv );
- GPA_GL( Color4us );
- GPA_GL( Color4usv );
- GPA_GL( EdgeFlag );
- GPA_GL( EdgeFlagv );
- GPA_GL( End );
- GPA_GL( Indexd );
- GPA_GL( Indexdv );
- GPA_GL( Indexf );
- GPA_GL( Indexfv );
- GPA_GL( Indexi );
- GPA_GL( Indexiv );
- GPA_GL( Indexs );
- GPA_GL( Indexsv );
- GPA_GL( Normal3b );
- GPA_GL( Normal3bv );
- GPA_GL( Normal3d );
- GPA_GL( Normal3dv );
- GPA_GL( Normal3f );
- GPA_GL( Normal3fv );
- GPA_GL( Normal3i );
- GPA_GL( Normal3iv );
- GPA_GL( Normal3s );
- GPA_GL( Normal3sv );
- GPA_GL( RasterPos2d );
- GPA_GL( RasterPos2dv );
- GPA_GL( RasterPos2f );
- GPA_GL( RasterPos2fv );
- GPA_GL( RasterPos2i );
- GPA_GL( RasterPos2iv );
- GPA_GL( RasterPos2s );
- GPA_GL( RasterPos2sv );
- GPA_GL( RasterPos3d );
- GPA_GL( RasterPos3dv );
- GPA_GL( RasterPos3f );
- GPA_GL( RasterPos3fv );
- GPA_GL( RasterPos3i );
- GPA_GL( RasterPos3iv );
- GPA_GL( RasterPos3s );
- GPA_GL( RasterPos3sv );
- GPA_GL( RasterPos4d );
- GPA_GL( RasterPos4dv );
- GPA_GL( RasterPos4f );
- GPA_GL( RasterPos4fv );
- GPA_GL( RasterPos4i );
- GPA_GL( RasterPos4iv );
- GPA_GL( RasterPos4s );
- GPA_GL( RasterPos4sv );
- GPA_GL( Rectd );
- GPA_GL( Rectdv );
- GPA_GL( Rectf );
- GPA_GL( Rectfv );
- GPA_GL( Recti );
- GPA_GL( Rectiv );
- GPA_GL( Rects );
- GPA_GL( Rectsv );
- GPA_GL( TexCoord1d );
- GPA_GL( TexCoord1dv );
- GPA_GL( TexCoord1f );
- GPA_GL( TexCoord1fv );
- GPA_GL( TexCoord1i );
- GPA_GL( TexCoord1iv );
- GPA_GL( TexCoord1s );
- GPA_GL( TexCoord1sv );
- GPA_GL( TexCoord2d );
- GPA_GL( TexCoord2dv );
- GPA_GL( TexCoord2f );
- GPA_GL( TexCoord2fv );
- GPA_GL( TexCoord2i );
- GPA_GL( TexCoord2iv );
- GPA_GL( TexCoord2s );
- GPA_GL( TexCoord2sv );
- GPA_GL( TexCoord3d );
- GPA_GL( TexCoord3dv );
- GPA_GL( TexCoord3f );
- GPA_GL( TexCoord3fv );
- GPA_GL( TexCoord3i );
- GPA_GL( TexCoord3iv );
- GPA_GL( TexCoord3s );
- GPA_GL( TexCoord3sv );
- GPA_GL( TexCoord4d );
- GPA_GL( TexCoord4dv );
- GPA_GL( TexCoord4f );
- GPA_GL( TexCoord4fv );
- GPA_GL( TexCoord4i );
- GPA_GL( TexCoord4iv );
- GPA_GL( TexCoord4s );
- GPA_GL( TexCoord4sv );
- GPA_GL( Vertex2d );
- GPA_GL( Vertex2dv );
- GPA_GL( Vertex2f );
- GPA_GL( Vertex2fv );
- GPA_GL( Vertex2i );
- GPA_GL( Vertex2iv );
- GPA_GL( Vertex2s );
- GPA_GL( Vertex2sv );
- GPA_GL( Vertex3d );
- GPA_GL( Vertex3dv );
- GPA_GL( Vertex3f );
- GPA_GL( Vertex3fv );
- GPA_GL( Vertex3i );
- GPA_GL( Vertex3iv );
- GPA_GL( Vertex3s );
- GPA_GL( Vertex3sv );
- GPA_GL( Vertex4d );
- GPA_GL( Vertex4dv );
- GPA_GL( Vertex4f );
- GPA_GL( Vertex4fv );
- GPA_GL( Vertex4i );
- GPA_GL( Vertex4iv );
- GPA_GL( Vertex4s );
- GPA_GL( Vertex4sv );
- GPA_GL( ClipPlane );
- GPA_GL( ColorMaterial );
- GPA_GL( CullFace );
- GPA_GL( Fogf );
- GPA_GL( Fogfv );
- GPA_GL( Fogi );
- GPA_GL( Fogiv );
- GPA_GL( FrontFace );
- GPA_GL( Hint );
- GPA_GL( Lightf );
- GPA_GL( Lightfv );
- GPA_GL( Lighti );
- GPA_GL( Lightiv );
- GPA_GL( LightModelf );
- GPA_GL( LightModelfv );
- GPA_GL( LightModeli );
- GPA_GL( LightModeliv );
- GPA_GL( LineStipple );
- GPA_GL( LineWidth );
- GPA_GL( Materialf );
- GPA_GL( Materialfv );
- GPA_GL( Materiali );
- GPA_GL( Materialiv );
- GPA_GL( PointSize );
- GPA_GL( PolygonMode );
- GPA_GL( PolygonStipple );
- GPA_GL( Scissor );
- GPA_GL( ShadeModel );
- GPA_GL( TexParameterf );
- GPA_GL( TexParameterfv );
- GPA_GL( TexParameteri );
- GPA_GL( TexParameteriv );
- GPA_GL( TexImage1D );
- GPA_GL( TexImage2D );
- GPA_GL( TexEnvf );
- GPA_GL( TexEnvfv );
- GPA_GL( TexEnvi );
- GPA_GL( TexEnviv );
- GPA_GL( TexGend );
- GPA_GL( TexGendv );
- GPA_GL( TexGenf );
- GPA_GL( TexGenfv );
- GPA_GL( TexGeni );
- GPA_GL( TexGeniv );
- GPA_GL( FeedbackBuffer );
- GPA_GL( SelectBuffer );
- GPA_GL( RenderMode );
- GPA_GL( InitNames );
- GPA_GL( LoadName );
- GPA_GL( PassThrough );
- GPA_GL( PopName );
- GPA_GL( PushName );
- GPA_GL( DrawBuffer );
- GPA_GL( Clear );
- GPA_GL( ClearAccum );
- GPA_GL( ClearIndex );
- GPA_GL( ClearColor );
- GPA_GL( ClearStencil );
- GPA_GL( ClearDepth );
- GPA_GL( StencilMask );
- GPA_GL( ColorMask );
- GPA_GL( DepthMask );
- GPA_GL( IndexMask );
- GPA_GL( Accum );
- GPA_GL( Disable );
- GPA_GL( Enable );
- GPA_GL( Finish );
- GPA_GL( Flush );
- GPA_GL( PopAttrib );
- GPA_GL( PushAttrib );
- GPA_GL( Map1d );
- GPA_GL( Map1f );
- GPA_GL( Map2d );
- GPA_GL( Map2f );
- GPA_GL( MapGrid1d );
- GPA_GL( MapGrid1f );
- GPA_GL( MapGrid2d );
- GPA_GL( MapGrid2f );
- GPA_GL( EvalCoord1d );
- GPA_GL( EvalCoord1dv );
- GPA_GL( EvalCoord1f );
- GPA_GL( EvalCoord1fv );
- GPA_GL( EvalCoord2d );
- GPA_GL( EvalCoord2dv );
- GPA_GL( EvalCoord2f );
- GPA_GL( EvalCoord2fv );
- GPA_GL( EvalMesh1 );
- GPA_GL( EvalPoint1 );
- GPA_GL( EvalMesh2 );
- GPA_GL( EvalPoint2 );
- GPA_GL( AlphaFunc );
- GPA_GL( BlendFunc );
- GPA_GL( LogicOp );
- GPA_GL( StencilFunc );
- GPA_GL( StencilOp );
- GPA_GL( DepthFunc );
- GPA_GL( PixelZoom );
- GPA_GL( PixelTransferf );
- GPA_GL( PixelTransferi );
- GPA_GL( PixelStoref );
- GPA_GL( PixelStorei );
- GPA_GL( PixelMapfv );
- GPA_GL( PixelMapuiv );
- GPA_GL( PixelMapusv );
- GPA_GL( ReadBuffer );
- GPA_GL( CopyPixels );
- GPA_GL( ReadPixels );
- GPA_GL( DrawPixels );
- GPA_GL( GetBooleanv );
- GPA_GL( GetClipPlane );
- GPA_GL( GetDoublev );
- GPA_GL( GetError );
- GPA_GL( GetFloatv );
- GPA_GL( GetIntegerv );
- GPA_GL( GetLightfv );
- GPA_GL( GetLightiv );
- GPA_GL( GetMapdv );
- GPA_GL( GetMapfv );
- GPA_GL( GetMapiv );
- GPA_GL( GetMaterialfv );
- GPA_GL( GetMaterialiv );
- GPA_GL( GetPixelMapfv );
- GPA_GL( GetPixelMapuiv );
- GPA_GL( GetPixelMapusv );
- GPA_GL( GetPolygonStipple );
- GPA_GL( GetString );
- GPA_GL( GetTexEnvfv );
- GPA_GL( GetTexEnviv );
- GPA_GL( GetTexGendv );
- GPA_GL( GetTexGenfv );
- GPA_GL( GetTexGeniv );
- GPA_GL( GetTexImage );
- GPA_GL( GetTexParameterfv );
- GPA_GL( GetTexParameteriv );
- GPA_GL( GetTexLevelParameterfv );
- GPA_GL( GetTexLevelParameteriv );
- GPA_GL( IsEnabled );
- GPA_GL( IsList );
- GPA_GL( DepthRange );
- GPA_GL( Frustum );
- GPA_GL( LoadIdentity );
- GPA_GL( LoadMatrixf );
- GPA_GL( LoadMatrixd );
- GPA_GL( MatrixMode );
- GPA_GL( MultMatrixf );
- GPA_GL( MultMatrixd );
- GPA_GL( Ortho );
- GPA_GL( PopMatrix );
- GPA_GL( PushMatrix );
- GPA_GL( Rotated );
- GPA_GL( Rotatef );
- GPA_GL( Scaled );
- GPA_GL( Scalef );
- GPA_GL( Translated );
- GPA_GL( Translatef );
- GPA_GL( Viewport );
- GPA_GL( ArrayElement );
- GPA_GL( BindTexture );
- GPA_GL( ColorPointer );
- GPA_GL( DisableClientState );
- GPA_GL( DrawArrays );
- GPA_GL( DrawElements );
- GPA_GL( EdgeFlagPointer );
- GPA_GL( EnableClientState );
- GPA_GL( IndexPointer );
- GPA_GL( Indexub );
- GPA_GL( Indexubv );
- GPA_GL( InterleavedArrays );
- GPA_GL( NormalPointer );
- GPA_GL( PolygonOffset );
- GPA_GL( TexCoordPointer );
- GPA_GL( VertexPointer );
- GPA_GL( AreTexturesResident );
- GPA_GL( CopyTexImage1D );
- GPA_GL( CopyTexImage2D );
- GPA_GL( CopyTexSubImage1D );
- GPA_GL( CopyTexSubImage2D );
- GPA_GL( DeleteTextures );
- GPA_GL( GenTextures );
- GPA_GL( GetPointerv );
- GPA_GL( IsTexture );
- GPA_GL( PrioritizeTextures );
- GPA_GL( TexSubImage1D );
- GPA_GL( TexSubImage2D );
- GPA_GL( PopClientAttrib );
- GPA_GL( PushClientAttrib );
-
- return &cpt;
-}
-
-int APIENTRY
-DrvSetLayerPaletteEntries(
- HDC hdc,
- INT iLayerPlane,
- INT iStart,
- INT cEntries,
- CONST COLORREF *pcr )
-{
- debug_printf( "%s\n", __FUNCTION__ );
-
- return 0;
-}
-
-BOOL APIENTRY
-DrvSetPixelFormat(
- HDC hdc,
- LONG iPixelFormat )
-{
- PIXELFORMATDESCRIPTOR pfd;
- BOOL r;
-
- wglDescribePixelFormat( hdc, iPixelFormat, sizeof( pfd ), &pfd );
- r = wglSetPixelFormat( hdc, iPixelFormat, &pfd );
-
- debug_printf( "%s( 0x%p, %d ) = %s\n", __FUNCTION__, hdc, iPixelFormat, r ? "TRUE" : "FALSE" );
-
- return r;
-}
-
-BOOL APIENTRY
-DrvShareLists(
- DHGLRC dhglrc1,
- DHGLRC dhglrc2 )
-{
- debug_printf( "%s\n", __FUNCTION__ );
-
- return FALSE;
-}
-
-BOOL APIENTRY
-DrvSwapBuffers(
- HDC hdc )
-{
- debug_printf( "%s( 0x%p )\n", __FUNCTION__, hdc );
-
- return wglSwapBuffers( hdc );
-}
-
-BOOL APIENTRY
-DrvSwapLayerBuffers(
- HDC hdc,
- UINT fuPlanes )
-{
- debug_printf( "%s\n", __FUNCTION__ );
-
- return FALSE;
-}
-
-BOOL APIENTRY
-DrvValidateVersion(
- ULONG ulVersion )
-{
- debug_printf( "%s( %u )\n", __FUNCTION__, ulVersion );
-
- return ulVersion == 1;
-}
+++ /dev/null
-/**************************************************************************
- *
- * 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 DRV_H
-#define DRV_H
-
-
-#include <windows.h>
-
-#include "GL/gl.h"
-
-
-typedef ULONG DHGLRC;
-
-#define OPENGL_VERSION_110_ENTRIES 336
-
-struct __GLdispatchTableRec
-{
- void (GLAPIENTRY * NewList)(GLuint, GLenum);
- void (GLAPIENTRY * EndList)(void);
- void (GLAPIENTRY * CallList)(GLuint);
- void (GLAPIENTRY * CallLists)(GLsizei, GLenum, const GLvoid *);
- void (GLAPIENTRY * DeleteLists)(GLuint, GLsizei);
- GLuint (GLAPIENTRY * GenLists)(GLsizei);
- void (GLAPIENTRY * ListBase)(GLuint);
- void (GLAPIENTRY * Begin)(GLenum);
- void (GLAPIENTRY * Bitmap)(GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat, const GLubyte *);
- void (GLAPIENTRY * Color3b)(GLbyte, GLbyte, GLbyte);
- void (GLAPIENTRY * Color3bv)(const GLbyte *);
- void (GLAPIENTRY * Color3d)(GLdouble, GLdouble, GLdouble);
- void (GLAPIENTRY * Color3dv)(const GLdouble *);
- void (GLAPIENTRY * Color3f)(GLfloat, GLfloat, GLfloat);
- void (GLAPIENTRY * Color3fv)(const GLfloat *);
- void (GLAPIENTRY * Color3i)(GLint, GLint, GLint);
- void (GLAPIENTRY * Color3iv)(const GLint *);
- void (GLAPIENTRY * Color3s)(GLshort, GLshort, GLshort);
- void (GLAPIENTRY * Color3sv)(const GLshort *);
- void (GLAPIENTRY * Color3ub)(GLubyte, GLubyte, GLubyte);
- void (GLAPIENTRY * Color3ubv)(const GLubyte *);
- void (GLAPIENTRY * Color3ui)(GLuint, GLuint, GLuint);
- void (GLAPIENTRY * Color3uiv)(const GLuint *);
- void (GLAPIENTRY * Color3us)(GLushort, GLushort, GLushort);
- void (GLAPIENTRY * Color3usv)(const GLushort *);
- void (GLAPIENTRY * Color4b)(GLbyte, GLbyte, GLbyte, GLbyte);
- void (GLAPIENTRY * Color4bv)(const GLbyte *);
- void (GLAPIENTRY * Color4d)(GLdouble, GLdouble, GLdouble, GLdouble);
- void (GLAPIENTRY * Color4dv)(const GLdouble *);
- void (GLAPIENTRY * Color4f)(GLfloat, GLfloat, GLfloat, GLfloat);
- void (GLAPIENTRY * Color4fv)(const GLfloat *);
- void (GLAPIENTRY * Color4i)(GLint, GLint, GLint, GLint);
- void (GLAPIENTRY * Color4iv)(const GLint *);
- void (GLAPIENTRY * Color4s)(GLshort, GLshort, GLshort, GLshort);
- void (GLAPIENTRY * Color4sv)(const GLshort *);
- void (GLAPIENTRY * Color4ub)(GLubyte, GLubyte, GLubyte, GLubyte);
- void (GLAPIENTRY * Color4ubv)(const GLubyte *);
- void (GLAPIENTRY * Color4ui)(GLuint, GLuint, GLuint, GLuint);
- void (GLAPIENTRY * Color4uiv)(const GLuint *);
- void (GLAPIENTRY * Color4us)(GLushort, GLushort, GLushort, GLushort);
- void (GLAPIENTRY * Color4usv)(const GLushort *);
- void (GLAPIENTRY * EdgeFlag)(GLboolean);
- void (GLAPIENTRY * EdgeFlagv)(const GLboolean *);
- void (GLAPIENTRY * End)(void);
- void (GLAPIENTRY * Indexd)(GLdouble);
- void (GLAPIENTRY * Indexdv)(const GLdouble *);
- void (GLAPIENTRY * Indexf)(GLfloat);
- void (GLAPIENTRY * Indexfv)(const GLfloat *);
- void (GLAPIENTRY * Indexi)(GLint);
- void (GLAPIENTRY * Indexiv)(const GLint *);
- void (GLAPIENTRY * Indexs)(GLshort);
- void (GLAPIENTRY * Indexsv)(const GLshort *);
- void (GLAPIENTRY * Normal3b)(GLbyte, GLbyte, GLbyte);
- void (GLAPIENTRY * Normal3bv)(const GLbyte *);
- void (GLAPIENTRY * Normal3d)(GLdouble, GLdouble, GLdouble);
- void (GLAPIENTRY * Normal3dv)(const GLdouble *);
- void (GLAPIENTRY * Normal3f)(GLfloat, GLfloat, GLfloat);
- void (GLAPIENTRY * Normal3fv)(const GLfloat *);
- void (GLAPIENTRY * Normal3i)(GLint, GLint, GLint);
- void (GLAPIENTRY * Normal3iv)(const GLint *);
- void (GLAPIENTRY * Normal3s)(GLshort, GLshort, GLshort);
- void (GLAPIENTRY * Normal3sv)(const GLshort *);
- void (GLAPIENTRY * RasterPos2d)(GLdouble, GLdouble);
- void (GLAPIENTRY * RasterPos2dv)(const GLdouble *);
- void (GLAPIENTRY * RasterPos2f)(GLfloat, GLfloat);
- void (GLAPIENTRY * RasterPos2fv)(const GLfloat *);
- void (GLAPIENTRY * RasterPos2i)(GLint, GLint);
- void (GLAPIENTRY * RasterPos2iv)(const GLint *);
- void (GLAPIENTRY * RasterPos2s)(GLshort, GLshort);
- void (GLAPIENTRY * RasterPos2sv)(const GLshort *);
- void (GLAPIENTRY * RasterPos3d)(GLdouble, GLdouble, GLdouble);
- void (GLAPIENTRY * RasterPos3dv)(const GLdouble *);
- void (GLAPIENTRY * RasterPos3f)(GLfloat, GLfloat, GLfloat);
- void (GLAPIENTRY * RasterPos3fv)(const GLfloat *);
- void (GLAPIENTRY * RasterPos3i)(GLint, GLint, GLint);
- void (GLAPIENTRY * RasterPos3iv)(const GLint *);
- void (GLAPIENTRY * RasterPos3s)(GLshort, GLshort, GLshort);
- void (GLAPIENTRY * RasterPos3sv)(const GLshort *);
- void (GLAPIENTRY * RasterPos4d)(GLdouble, GLdouble, GLdouble, GLdouble);
- void (GLAPIENTRY * RasterPos4dv)(const GLdouble *);
- void (GLAPIENTRY * RasterPos4f)(GLfloat, GLfloat, GLfloat, GLfloat);
- void (GLAPIENTRY * RasterPos4fv)(const GLfloat *);
- void (GLAPIENTRY * RasterPos4i)(GLint, GLint, GLint, GLint);
- void (GLAPIENTRY * RasterPos4iv)(const GLint *);
- void (GLAPIENTRY * RasterPos4s)(GLshort, GLshort, GLshort, GLshort);
- void (GLAPIENTRY * RasterPos4sv)(const GLshort *);
- void (GLAPIENTRY * Rectd)(GLdouble, GLdouble, GLdouble, GLdouble);
- void (GLAPIENTRY * Rectdv)(const GLdouble *, const GLdouble *);
- void (GLAPIENTRY * Rectf)(GLfloat, GLfloat, GLfloat, GLfloat);
- void (GLAPIENTRY * Rectfv)(const GLfloat *, const GLfloat *);
- void (GLAPIENTRY * Recti)(GLint, GLint, GLint, GLint);
- void (GLAPIENTRY * Rectiv)(const GLint *, const GLint *);
- void (GLAPIENTRY * Rects)(GLshort, GLshort, GLshort, GLshort);
- void (GLAPIENTRY * Rectsv)(const GLshort *, const GLshort *);
- void (GLAPIENTRY * TexCoord1d)(GLdouble);
- void (GLAPIENTRY * TexCoord1dv)(const GLdouble *);
- void (GLAPIENTRY * TexCoord1f)(GLfloat);
- void (GLAPIENTRY * TexCoord1fv)(const GLfloat *);
- void (GLAPIENTRY * TexCoord1i)(GLint);
- void (GLAPIENTRY * TexCoord1iv)(const GLint *);
- void (GLAPIENTRY * TexCoord1s)(GLshort);
- void (GLAPIENTRY * TexCoord1sv)(const GLshort *);
- void (GLAPIENTRY * TexCoord2d)(GLdouble, GLdouble);
- void (GLAPIENTRY * TexCoord2dv)(const GLdouble *);
- void (GLAPIENTRY * TexCoord2f)(GLfloat, GLfloat);
- void (GLAPIENTRY * TexCoord2fv)(const GLfloat *);
- void (GLAPIENTRY * TexCoord2i)(GLint, GLint);
- void (GLAPIENTRY * TexCoord2iv)(const GLint *);
- void (GLAPIENTRY * TexCoord2s)(GLshort, GLshort);
- void (GLAPIENTRY * TexCoord2sv)(const GLshort *);
- void (GLAPIENTRY * TexCoord3d)(GLdouble, GLdouble, GLdouble);
- void (GLAPIENTRY * TexCoord3dv)(const GLdouble *);
- void (GLAPIENTRY * TexCoord3f)(GLfloat, GLfloat, GLfloat);
- void (GLAPIENTRY * TexCoord3fv)(const GLfloat *);
- void (GLAPIENTRY * TexCoord3i)(GLint, GLint, GLint);
- void (GLAPIENTRY * TexCoord3iv)(const GLint *);
- void (GLAPIENTRY * TexCoord3s)(GLshort, GLshort, GLshort);
- void (GLAPIENTRY * TexCoord3sv)(const GLshort *);
- void (GLAPIENTRY * TexCoord4d)(GLdouble, GLdouble, GLdouble, GLdouble);
- void (GLAPIENTRY * TexCoord4dv)(const GLdouble *);
- void (GLAPIENTRY * TexCoord4f)(GLfloat, GLfloat, GLfloat, GLfloat);
- void (GLAPIENTRY * TexCoord4fv)(const GLfloat *);
- void (GLAPIENTRY * TexCoord4i)(GLint, GLint, GLint, GLint);
- void (GLAPIENTRY * TexCoord4iv)(const GLint *);
- void (GLAPIENTRY * TexCoord4s)(GLshort, GLshort, GLshort, GLshort);
- void (GLAPIENTRY * TexCoord4sv)(const GLshort *);
- void (GLAPIENTRY * Vertex2d)(GLdouble, GLdouble);
- void (GLAPIENTRY * Vertex2dv)(const GLdouble *);
- void (GLAPIENTRY * Vertex2f)(GLfloat, GLfloat);
- void (GLAPIENTRY * Vertex2fv)(const GLfloat *);
- void (GLAPIENTRY * Vertex2i)(GLint, GLint);
- void (GLAPIENTRY * Vertex2iv)(const GLint *);
- void (GLAPIENTRY * Vertex2s)(GLshort, GLshort);
- void (GLAPIENTRY * Vertex2sv)(const GLshort *);
- void (GLAPIENTRY * Vertex3d)(GLdouble, GLdouble, GLdouble);
- void (GLAPIENTRY * Vertex3dv)(const GLdouble *);
- void (GLAPIENTRY * Vertex3f)(GLfloat, GLfloat, GLfloat);
- void (GLAPIENTRY * Vertex3fv)(const GLfloat *);
- void (GLAPIENTRY * Vertex3i)(GLint, GLint, GLint);
- void (GLAPIENTRY * Vertex3iv)(const GLint *);
- void (GLAPIENTRY * Vertex3s)(GLshort, GLshort, GLshort);
- void (GLAPIENTRY * Vertex3sv)(const GLshort *);
- void (GLAPIENTRY * Vertex4d)(GLdouble, GLdouble, GLdouble, GLdouble);
- void (GLAPIENTRY * Vertex4dv)(const GLdouble *);
- void (GLAPIENTRY * Vertex4f)(GLfloat, GLfloat, GLfloat, GLfloat);
- void (GLAPIENTRY * Vertex4fv)(const GLfloat *);
- void (GLAPIENTRY * Vertex4i)(GLint, GLint, GLint, GLint);
- void (GLAPIENTRY * Vertex4iv)(const GLint *);
- void (GLAPIENTRY * Vertex4s)(GLshort, GLshort, GLshort, GLshort);
- void (GLAPIENTRY * Vertex4sv)(const GLshort *);
- void (GLAPIENTRY * ClipPlane)(GLenum, const GLdouble *);
- void (GLAPIENTRY * ColorMaterial)(GLenum, GLenum);
- void (GLAPIENTRY * CullFace)(GLenum);
- void (GLAPIENTRY * Fogf)(GLenum, GLfloat);
- void (GLAPIENTRY * Fogfv)(GLenum, const GLfloat *);
- void (GLAPIENTRY * Fogi)(GLenum, GLint);
- void (GLAPIENTRY * Fogiv)(GLenum, const GLint *);
- void (GLAPIENTRY * FrontFace)(GLenum);
- void (GLAPIENTRY * Hint)(GLenum, GLenum);
- void (GLAPIENTRY * Lightf)(GLenum, GLenum, GLfloat);
- void (GLAPIENTRY * Lightfv)(GLenum, GLenum, const GLfloat *);
- void (GLAPIENTRY * Lighti)(GLenum, GLenum, GLint);
- void (GLAPIENTRY * Lightiv)(GLenum, GLenum, const GLint *);
- void (GLAPIENTRY * LightModelf)(GLenum, GLfloat);
- void (GLAPIENTRY * LightModelfv)(GLenum, const GLfloat *);
- void (GLAPIENTRY * LightModeli)(GLenum, GLint);
- void (GLAPIENTRY * LightModeliv)(GLenum, const GLint *);
- void (GLAPIENTRY * LineStipple)(GLint, GLushort);
- void (GLAPIENTRY * LineWidth)(GLfloat);
- void (GLAPIENTRY * Materialf)(GLenum, GLenum, GLfloat);
- void (GLAPIENTRY * Materialfv)(GLenum, GLenum, const GLfloat *);
- void (GLAPIENTRY * Materiali)(GLenum, GLenum, GLint);
- void (GLAPIENTRY * Materialiv)(GLenum, GLenum, const GLint *);
- void (GLAPIENTRY * PointSize)(GLfloat);
- void (GLAPIENTRY * PolygonMode)(GLenum, GLenum);
- void (GLAPIENTRY * PolygonStipple)(const GLubyte *);
- void (GLAPIENTRY * Scissor)(GLint, GLint, GLsizei, GLsizei);
- void (GLAPIENTRY * ShadeModel)(GLenum);
- void (GLAPIENTRY * TexParameterf)(GLenum, GLenum, GLfloat);
- void (GLAPIENTRY * TexParameterfv)(GLenum, GLenum, const GLfloat *);
- void (GLAPIENTRY * TexParameteri)(GLenum, GLenum, GLint);
- void (GLAPIENTRY * TexParameteriv)(GLenum, GLenum, const GLint *);
- void (GLAPIENTRY * TexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
- void (GLAPIENTRY * TexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
- void (GLAPIENTRY * TexEnvf)(GLenum, GLenum, GLfloat);
- void (GLAPIENTRY * TexEnvfv)(GLenum, GLenum, const GLfloat *);
- void (GLAPIENTRY * TexEnvi)(GLenum, GLenum, GLint);
- void (GLAPIENTRY * TexEnviv)(GLenum, GLenum, const GLint *);
- void (GLAPIENTRY * TexGend)(GLenum, GLenum, GLdouble);
- void (GLAPIENTRY * TexGendv)(GLenum, GLenum, const GLdouble *);
- void (GLAPIENTRY * TexGenf)(GLenum, GLenum, GLfloat);
- void (GLAPIENTRY * TexGenfv)(GLenum, GLenum, const GLfloat *);
- void (GLAPIENTRY * TexGeni)(GLenum, GLenum, GLint);
- void (GLAPIENTRY * TexGeniv)(GLenum, GLenum, const GLint *);
- void (GLAPIENTRY * FeedbackBuffer)(GLsizei, GLenum, GLfloat *);
- void (GLAPIENTRY * SelectBuffer)(GLsizei, GLuint *);
- GLint (GLAPIENTRY * RenderMode)(GLenum);
- void (GLAPIENTRY * InitNames)(void);
- void (GLAPIENTRY * LoadName)(GLuint);
- void (GLAPIENTRY * PassThrough)(GLfloat);
- void (GLAPIENTRY * PopName)(void);
- void (GLAPIENTRY * PushName)(GLuint);
- void (GLAPIENTRY * DrawBuffer)(GLenum);
- void (GLAPIENTRY * Clear)(GLbitfield);
- void (GLAPIENTRY * ClearAccum)(GLfloat, GLfloat, GLfloat, GLfloat);
- void (GLAPIENTRY * ClearIndex)(GLfloat);
- void (GLAPIENTRY * ClearColor)(GLclampf, GLclampf, GLclampf, GLclampf);
- void (GLAPIENTRY * ClearStencil)(GLint);
- void (GLAPIENTRY * ClearDepth)(GLclampd);
- void (GLAPIENTRY * StencilMask)(GLuint);
- void (GLAPIENTRY * ColorMask)(GLboolean, GLboolean, GLboolean, GLboolean);
- void (GLAPIENTRY * DepthMask)(GLboolean);
- void (GLAPIENTRY * IndexMask)(GLuint);
- void (GLAPIENTRY * Accum)(GLenum, GLfloat);
- void (GLAPIENTRY * Disable)(GLenum);
- void (GLAPIENTRY * Enable)(GLenum);
- void (GLAPIENTRY * Finish)(void);
- void (GLAPIENTRY * Flush)(void);
- void (GLAPIENTRY * PopAttrib)(void);
- void (GLAPIENTRY * PushAttrib)(GLbitfield);
- void (GLAPIENTRY * Map1d)(GLenum, GLdouble, GLdouble, GLint, GLint, const GLdouble *);
- void (GLAPIENTRY * Map1f)(GLenum, GLfloat, GLfloat, GLint, GLint, const GLfloat *);
- void (GLAPIENTRY * Map2d)(GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *);
- void (GLAPIENTRY * Map2f)(GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *);
- void (GLAPIENTRY * MapGrid1d)(GLint, GLdouble, GLdouble);
- void (GLAPIENTRY * MapGrid1f)(GLint, GLfloat, GLfloat);
- void (GLAPIENTRY * MapGrid2d)(GLint, GLdouble, GLdouble, GLint, GLdouble, GLdouble);
- void (GLAPIENTRY * MapGrid2f)(GLint, GLfloat, GLfloat, GLint, GLfloat, GLfloat);
- void (GLAPIENTRY * EvalCoord1d)(GLdouble);
- void (GLAPIENTRY * EvalCoord1dv)(const GLdouble *);
- void (GLAPIENTRY * EvalCoord1f)(GLfloat);
- void (GLAPIENTRY * EvalCoord1fv)(const GLfloat *);
- void (GLAPIENTRY * EvalCoord2d)(GLdouble, GLdouble);
- void (GLAPIENTRY * EvalCoord2dv)(const GLdouble *);
- void (GLAPIENTRY * EvalCoord2f)(GLfloat, GLfloat);
- void (GLAPIENTRY * EvalCoord2fv)(const GLfloat *);
- void (GLAPIENTRY * EvalMesh1)(GLenum, GLint, GLint);
- void (GLAPIENTRY * EvalPoint1)(GLint);
- void (GLAPIENTRY * EvalMesh2)(GLenum, GLint, GLint, GLint, GLint);
- void (GLAPIENTRY * EvalPoint2)(GLint, GLint);
- void (GLAPIENTRY * AlphaFunc)(GLenum, GLclampf);
- void (GLAPIENTRY * BlendFunc)(GLenum, GLenum);
- void (GLAPIENTRY * LogicOp)(GLenum);
- void (GLAPIENTRY * StencilFunc)(GLenum, GLint, GLuint);
- void (GLAPIENTRY * StencilOp)(GLenum, GLenum, GLenum);
- void (GLAPIENTRY * DepthFunc)(GLenum);
- void (GLAPIENTRY * PixelZoom)(GLfloat, GLfloat);
- void (GLAPIENTRY * PixelTransferf)(GLenum, GLfloat);
- void (GLAPIENTRY * PixelTransferi)(GLenum, GLint);
- void (GLAPIENTRY * PixelStoref)(GLenum, GLfloat);
- void (GLAPIENTRY * PixelStorei)(GLenum, GLint);
- void (GLAPIENTRY * PixelMapfv)(GLenum, GLint, const GLfloat *);
- void (GLAPIENTRY * PixelMapuiv)(GLenum, GLint, const GLuint *);
- void (GLAPIENTRY * PixelMapusv)(GLenum, GLint, const GLushort *);
- void (GLAPIENTRY * ReadBuffer)(GLenum);
- void (GLAPIENTRY * CopyPixels)(GLint, GLint, GLsizei, GLsizei, GLenum);
- void (GLAPIENTRY * ReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *);
- void (GLAPIENTRY * DrawPixels)(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
- void (GLAPIENTRY * GetBooleanv)(GLenum, GLboolean *);
- void (GLAPIENTRY * GetClipPlane)(GLenum, GLdouble *);
- void (GLAPIENTRY * GetDoublev)(GLenum, GLdouble *);
- GLenum (GLAPIENTRY * GetError)(void);
- void (GLAPIENTRY * GetFloatv)(GLenum, GLfloat *);
- void (GLAPIENTRY * GetIntegerv)(GLenum, GLint *);
- void (GLAPIENTRY * GetLightfv)(GLenum, GLenum, GLfloat *);
- void (GLAPIENTRY * GetLightiv)(GLenum, GLenum, GLint *);
- void (GLAPIENTRY * GetMapdv)(GLenum, GLenum, GLdouble *);
- void (GLAPIENTRY * GetMapfv)(GLenum, GLenum, GLfloat *);
- void (GLAPIENTRY * GetMapiv)(GLenum, GLenum, GLint *);
- void (GLAPIENTRY * GetMaterialfv)(GLenum, GLenum, GLfloat *);
- void (GLAPIENTRY * GetMaterialiv)(GLenum, GLenum, GLint *);
- void (GLAPIENTRY * GetPixelMapfv)(GLenum, GLfloat *);
- void (GLAPIENTRY * GetPixelMapuiv)(GLenum, GLuint *);
- void (GLAPIENTRY * GetPixelMapusv)(GLenum, GLushort *);
- void (GLAPIENTRY * GetPolygonStipple)(GLubyte *);
- const GLubyte * (GLAPIENTRY * GetString)(GLenum);
- void (GLAPIENTRY * GetTexEnvfv)(GLenum, GLenum, GLfloat *);
- void (GLAPIENTRY * GetTexEnviv)(GLenum, GLenum, GLint *);
- void (GLAPIENTRY * GetTexGendv)(GLenum, GLenum, GLdouble *);
- void (GLAPIENTRY * GetTexGenfv)(GLenum, GLenum, GLfloat *);
- void (GLAPIENTRY * GetTexGeniv)(GLenum, GLenum, GLint *);
- void (GLAPIENTRY * GetTexImage)(GLenum, GLint, GLenum, GLenum, GLvoid *);
- void (GLAPIENTRY * GetTexParameterfv)(GLenum, GLenum, GLfloat *);
- void (GLAPIENTRY * GetTexParameteriv)(GLenum, GLenum, GLint *);
- void (GLAPIENTRY * GetTexLevelParameterfv)(GLenum, GLint, GLenum, GLfloat *);
- void (GLAPIENTRY * GetTexLevelParameteriv)(GLenum, GLint, GLenum, GLint *);
- GLboolean (GLAPIENTRY * IsEnabled)(GLenum);
- GLboolean (GLAPIENTRY * IsList)(GLuint);
- void (GLAPIENTRY * DepthRange)(GLclampd, GLclampd);
- void (GLAPIENTRY * Frustum)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
- void (GLAPIENTRY * LoadIdentity)(void);
- void (GLAPIENTRY * LoadMatrixf)(const GLfloat *);
- void (GLAPIENTRY * LoadMatrixd)(const GLdouble *);
- void (GLAPIENTRY * MatrixMode)(GLenum);
- void (GLAPIENTRY * MultMatrixf)(const GLfloat *);
- void (GLAPIENTRY * MultMatrixd)(const GLdouble *);
- void (GLAPIENTRY * Ortho)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
- void (GLAPIENTRY * PopMatrix)(void);
- void (GLAPIENTRY * PushMatrix)(void);
- void (GLAPIENTRY * Rotated)(GLdouble, GLdouble, GLdouble, GLdouble);
- void (GLAPIENTRY * Rotatef)(GLfloat, GLfloat, GLfloat, GLfloat);
- void (GLAPIENTRY * Scaled)(GLdouble, GLdouble, GLdouble);
- void (GLAPIENTRY * Scalef)(GLfloat, GLfloat, GLfloat);
- void (GLAPIENTRY * Translated)(GLdouble, GLdouble, GLdouble);
- void (GLAPIENTRY * Translatef)(GLfloat, GLfloat, GLfloat);
- void (GLAPIENTRY * Viewport)(GLint, GLint, GLsizei, GLsizei);
- void (GLAPIENTRY * ArrayElement)(GLint);
- void (GLAPIENTRY * BindTexture)(GLenum, GLuint);
- void (GLAPIENTRY * ColorPointer)(GLint, GLenum, GLsizei, const GLvoid *);
- void (GLAPIENTRY * DisableClientState)(GLenum);
- void (GLAPIENTRY * DrawArrays)(GLenum, GLint, GLsizei);
- void (GLAPIENTRY * DrawElements)(GLenum, GLsizei, GLenum, const GLvoid *);
- void (GLAPIENTRY * EdgeFlagPointer)(GLsizei, const GLvoid *);
- void (GLAPIENTRY * EnableClientState)(GLenum);
- void (GLAPIENTRY * IndexPointer)(GLenum, GLsizei, const GLvoid *);
- void (GLAPIENTRY * Indexub)(GLubyte);
- void (GLAPIENTRY * Indexubv)(const GLubyte *);
- void (GLAPIENTRY * InterleavedArrays)(GLenum, GLsizei, const GLvoid *);
- void (GLAPIENTRY * NormalPointer)(GLenum, GLsizei, const GLvoid *);
- void (GLAPIENTRY * PolygonOffset)(GLfloat, GLfloat);
- void (GLAPIENTRY * TexCoordPointer)(GLint, GLenum, GLsizei, const GLvoid *);
- void (GLAPIENTRY * VertexPointer)(GLint, GLenum, GLsizei, const GLvoid *);
- GLboolean (GLAPIENTRY * AreTexturesResident)(GLsizei, const GLuint *, GLboolean *);
- void (GLAPIENTRY * CopyTexImage1D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint);
- void (GLAPIENTRY * CopyTexImage2D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
- void (GLAPIENTRY * CopyTexSubImage1D)(GLenum, GLint, GLint, GLint, GLint, GLsizei);
- void (GLAPIENTRY * CopyTexSubImage2D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
- void (GLAPIENTRY * DeleteTextures)(GLsizei, const GLuint *);
- void (GLAPIENTRY * GenTextures)(GLsizei, GLuint *);
- void (GLAPIENTRY * GetPointerv)(GLenum, GLvoid **);
- GLboolean (GLAPIENTRY * IsTexture)(GLuint);
- void (GLAPIENTRY * PrioritizeTextures)(GLsizei, const GLuint *, const GLclampf *);
- void (GLAPIENTRY * TexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *);
- void (GLAPIENTRY * TexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
- void (GLAPIENTRY * PopClientAttrib)(void);
- void (GLAPIENTRY * PushClientAttrib)(GLbitfield);
-};
-
-typedef struct __GLdispatchTableRec GLDISPATCHTABLE;
-
-typedef struct _GLCLTPROCTABLE
-{
- int cEntries;
- GLDISPATCHTABLE glDispatchTable;
-} GLCLTPROCTABLE, * PGLCLTPROCTABLE;
-
-typedef VOID (APIENTRY * PFN_SETPROCTABLE)(PGLCLTPROCTABLE);
-
-BOOL APIENTRY
-DrvCopyContext(
- DHGLRC dhrcSource,
- DHGLRC dhrcDest,
- UINT fuMask );
-
-DHGLRC APIENTRY
-DrvCreateLayerContext(
- HDC hdc,
- INT iLayerPlane );
-
-DHGLRC APIENTRY
-DrvCreateContext(
- HDC hdc );
-
-BOOL APIENTRY
-DrvDeleteContext(
- DHGLRC dhglrc );
-
-BOOL APIENTRY
-DrvDescribeLayerPlane(
- HDC hdc,
- INT iPixelFormat,
- INT iLayerPlane,
- UINT nBytes,
- LPLAYERPLANEDESCRIPTOR plpd );
-
-LONG APIENTRY
-DrvDescribePixelFormat(
- HDC hdc,
- INT iPixelFormat,
- ULONG cjpfd,
- PIXELFORMATDESCRIPTOR *ppfd );
-
-int APIENTRY
-DrvGetLayerPaletteEntries(
- HDC hdc,
- INT iLayerPlane,
- INT iStart,
- INT cEntries,
- COLORREF *pcr );
-
-PROC APIENTRY
-DrvGetProcAddress(
- LPCSTR lpszProc );
-
-BOOL APIENTRY
-DrvRealizeLayerPalette(
- HDC hdc,
- INT iLayerPlane,
- BOOL bRealize );
-
-BOOL APIENTRY
-DrvReleaseContext(
- DHGLRC dhglrc );
-
-void APIENTRY
-DrvSetCallbackProcs(
- INT nProcs,
- PROC *pProcs );
-
-PGLCLTPROCTABLE APIENTRY
-DrvSetContext(
- HDC hdc,
- DHGLRC dhglrc,
- PFN_SETPROCTABLE pfnSetProcTable );
-
-int APIENTRY
-DrvSetLayerPaletteEntries(
- HDC hdc,
- INT iLayerPlane,
- INT iStart,
- INT cEntries,
- CONST COLORREF *pcr );
-
-BOOL APIENTRY
-DrvSetPixelFormat(
- HDC hdc,
- LONG iPixelFormat );
-
-BOOL APIENTRY
-DrvShareLists(
- DHGLRC dhglrc1,
- DHGLRC dhglrc2 );
-
-BOOL APIENTRY
-DrvSwapBuffers(
- HDC hdc );
-
-BOOL APIENTRY
-DrvSwapLayerBuffers(
- HDC hdc,
- UINT fuPlanes );
-
-BOOL APIENTRY
-DrvValidateVersion(
- ULONG ulVersion );
-
-#endif /* DRV_H */
+++ /dev/null
-/**************************************************************************
- *
- * 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 "pipe/p_debug.h"
-#include "stw_pixelformat.h"
-
-#define MAX_PIXELFORMATS 16
-
-static struct pixelformat_info pixelformats[MAX_PIXELFORMATS];
-static uint pixelformat_count = 0;
-static uint pixelformat_extended_count = 0;
-
-static void
-add_standard_pixelformats(
- struct pixelformat_info **ppf,
- uint flags )
-{
- struct pixelformat_info *pf = *ppf;
- struct pixelformat_color_info color24 = { 8, 0, 8, 8, 8, 16 };
- struct pixelformat_alpha_info alpha8 = { 8, 24 };
- struct pixelformat_alpha_info noalpha = { 0, 0 };
- struct pixelformat_depth_info depth24s8 = { 24, 8 };
- struct pixelformat_depth_info depth16 = { 16, 0 };
-
- pf->flags = PF_FLAG_DOUBLEBUFFER | flags;
- pf->color = color24;
- pf->alpha = alpha8;
- pf->depth = depth16;
- pf++;
-
- pf->flags = PF_FLAG_DOUBLEBUFFER | flags;
- pf->color = color24;
- pf->alpha = alpha8;
- pf->depth = depth24s8;
- pf++;
-
- pf->flags = PF_FLAG_DOUBLEBUFFER | flags;
- pf->color = color24;
- pf->alpha = noalpha;
- pf->depth = depth16;
- pf++;
-
- pf->flags = PF_FLAG_DOUBLEBUFFER | flags;
- pf->color = color24;
- pf->alpha = noalpha;
- pf->depth = depth24s8;
- pf++;
-
- pf->flags = flags;
- pf->color = color24;
- pf->alpha = noalpha;
- pf->depth = depth16;
- pf++;
-
- pf->flags = flags;
- pf->color = color24;
- pf->alpha = noalpha;
- pf->depth = depth24s8;
- pf++;
-
- *ppf = pf;
-}
-
-void
-pixelformat_init( void )
-{
- struct pixelformat_info *pf = pixelformats;
-
- add_standard_pixelformats( &pf, 0 );
- pixelformat_count = pf - pixelformats;
-
- add_standard_pixelformats( &pf, PF_FLAG_MULTISAMPLED );
- pixelformat_extended_count = pf - pixelformats;
-
- assert( pixelformat_extended_count <= MAX_PIXELFORMATS );
-}
-
-uint
-pixelformat_get_count( void )
-{
- return pixelformat_count;
-}
-
-uint
-pixelformat_get_extended_count( void )
-{
- return pixelformat_extended_count;
-}
-
-const struct pixelformat_info *
-pixelformat_get_info( uint index )
-{
- assert( index < pixelformat_extended_count );
-
- return &pixelformats[index];
-}
+++ /dev/null
-/**************************************************************************
- *
- * 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 PIXELFORMAT_H
-#define PIXELFORMAT_H
-
-#define PF_FLAG_DOUBLEBUFFER 0x00000001
-#define PF_FLAG_MULTISAMPLED 0x00000002
-
-struct pixelformat_color_info
-{
- uint redbits;
- uint redshift;
- uint greenbits;
- uint greenshift;
- uint bluebits;
- uint blueshift;
-};
-
-struct pixelformat_alpha_info
-{
- uint alphabits;
- uint alphashift;
-};
-
-struct pixelformat_depth_info
-{
- uint depthbits;
- uint stencilbits;
-};
-
-struct pixelformat_info
-{
- uint flags;
- struct pixelformat_color_info color;
- struct pixelformat_alpha_info alpha;
- struct pixelformat_depth_info depth;
-};
-
-void
-pixelformat_init( void );
-
-uint
-pixelformat_get_count( void );
-
-uint
-pixelformat_get_extended_count( void );
-
-const struct pixelformat_info *
-pixelformat_get_info( uint index );
-
-#endif /* PIXELFORMAT_H */
+++ /dev/null
-/**************************************************************************
- *
- * 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.
- *
- **************************************************************************/
-
-/**
- * @file
- *
- * This is hopefully a temporary hack to define some needed dispatch
- * table entries. Hopefully, I'll find a better solution. The
- * dispatch table generation scripts ought to be making these dummy
- * stubs as well.
- */
-
-void gl_dispatch_stub_543(void){}
-void gl_dispatch_stub_544(void){}
-void gl_dispatch_stub_545(void){}
-void gl_dispatch_stub_546(void){}
-void gl_dispatch_stub_547(void){}
-void gl_dispatch_stub_548(void){}
-void gl_dispatch_stub_549(void){}
-void gl_dispatch_stub_550(void){}
-void gl_dispatch_stub_551(void){}
-void gl_dispatch_stub_552(void){}
-void gl_dispatch_stub_553(void){}
-void gl_dispatch_stub_554(void){}
-void gl_dispatch_stub_555(void){}
-void gl_dispatch_stub_556(void){}
-void gl_dispatch_stub_557(void){}
-void gl_dispatch_stub_558(void){}
-void gl_dispatch_stub_559(void){}
-void gl_dispatch_stub_560(void){}
-void gl_dispatch_stub_561(void){}
-void gl_dispatch_stub_565(void){}
-void gl_dispatch_stub_566(void){}
-void gl_dispatch_stub_577(void){}
-void gl_dispatch_stub_578(void){}
-void gl_dispatch_stub_603(void){}
-void gl_dispatch_stub_645(void){}
-void gl_dispatch_stub_646(void){}
-void gl_dispatch_stub_647(void){}
-void gl_dispatch_stub_648(void){}
-void gl_dispatch_stub_649(void){}
-void gl_dispatch_stub_650(void){}
-void gl_dispatch_stub_651(void){}
-void gl_dispatch_stub_652(void){}
-void gl_dispatch_stub_653(void){}
-void gl_dispatch_stub_733(void){}
-void gl_dispatch_stub_734(void){}
-void gl_dispatch_stub_735(void){}
-void gl_dispatch_stub_736(void){}
-void gl_dispatch_stub_737(void){}
-void gl_dispatch_stub_738(void){}
-void gl_dispatch_stub_744(void){}
-void gl_dispatch_stub_745(void){}
-void gl_dispatch_stub_746(void){}
-void gl_dispatch_stub_760(void){}
-void gl_dispatch_stub_761(void){}
-void gl_dispatch_stub_763(void){}
-void gl_dispatch_stub_765(void){}
-void gl_dispatch_stub_766(void){}
-void gl_dispatch_stub_767(void){}
-void gl_dispatch_stub_768(void){}
-
-void gl_dispatch_stub_562(void){}
-void gl_dispatch_stub_563(void){}
-void gl_dispatch_stub_564(void){}
-void gl_dispatch_stub_567(void){}
-void gl_dispatch_stub_568(void){}
-void gl_dispatch_stub_569(void){}
-void gl_dispatch_stub_580(void){}
-void gl_dispatch_stub_581(void){}
-void gl_dispatch_stub_606(void){}
-void gl_dispatch_stub_654(void){}
-void gl_dispatch_stub_655(void){}
-void gl_dispatch_stub_656(void){}
-void gl_dispatch_stub_739(void){}
-void gl_dispatch_stub_740(void){}
-void gl_dispatch_stub_741(void){}
-void gl_dispatch_stub_748(void){}
-void gl_dispatch_stub_749(void){}
-void gl_dispatch_stub_769(void){}
-void gl_dispatch_stub_770(void){}
-void gl_dispatch_stub_771(void){}
-void gl_dispatch_stub_772(void){}
-void gl_dispatch_stub_773(void){}
+++ /dev/null
-/**************************************************************************
- *
- * 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 "pipe/p_debug.h"
-
-WINGDIAPI BOOL APIENTRY
-wglUseFontBitmapsA(
- HDC hdc,
- DWORD first,
- DWORD count,
- DWORD listBase )
-{
- (void) hdc;
- (void) first;
- (void) count;
- (void) listBase;
-
- assert( 0 );
-
- return FALSE;
-}
-
-WINGDIAPI BOOL APIENTRY
-wglShareLists(
- HGLRC hglrc1,
- HGLRC hglrc2 )
-{
- (void) hglrc1;
- (void) hglrc2;
-
- assert( 0 );
-
- return FALSE;
-}
-
-WINGDIAPI BOOL APIENTRY
-wglUseFontBitmapsW(
- HDC hdc,
- DWORD first,
- DWORD count,
- DWORD listBase )
-{
- (void) hdc;
- (void) first;
- (void) count;
- (void) listBase;
-
- assert( 0 );
-
- return FALSE;
-}
-
-WINGDIAPI BOOL APIENTRY
-wglUseFontOutlinesA(
- HDC hdc,
- DWORD first,
- DWORD count,
- DWORD listBase,
- FLOAT deviation,
- FLOAT extrusion,
- int format,
- LPGLYPHMETRICSFLOAT lpgmf )
-{
- (void) hdc;
- (void) first;
- (void) count;
- (void) listBase;
- (void) deviation;
- (void) extrusion;
- (void) format;
- (void) lpgmf;
-
- assert( 0 );
-
- return FALSE;
-}
-
-WINGDIAPI BOOL APIENTRY
-wglUseFontOutlinesW(
- HDC hdc,
- DWORD first,
- DWORD count,
- DWORD listBase,
- FLOAT deviation,
- FLOAT extrusion,
- int format,
- LPGLYPHMETRICSFLOAT lpgmf )
-{
- (void) hdc;
- (void) first;
- (void) count;
- (void) listBase;
- (void) deviation;
- (void) extrusion;
- (void) format;
- (void) lpgmf;
-
- assert( 0 );
-
- return FALSE;
-}
-
-WINGDIAPI BOOL APIENTRY
-wglDescribeLayerPlane(
- HDC hdc,
- int iPixelFormat,
- int iLayerPlane,
- UINT nBytes,
- LPLAYERPLANEDESCRIPTOR plpd )
-{
- (void) hdc;
- (void) iPixelFormat;
- (void) iLayerPlane;
- (void) nBytes;
- (void) plpd;
-
- assert( 0 );
-
- return FALSE;
-}
-
-WINGDIAPI int APIENTRY
-wglSetLayerPaletteEntries(
- HDC hdc,
- int iLayerPlane,
- int iStart,
- int cEntries,
- CONST COLORREF *pcr )
-{
- (void) hdc;
- (void) iLayerPlane;
- (void) iStart;
- (void) cEntries;
- (void) pcr;
-
- assert( 0 );
-
- return 0;
-}
-
-WINGDIAPI int APIENTRY
-wglGetLayerPaletteEntries(
- HDC hdc,
- int iLayerPlane,
- int iStart,
- int cEntries,
- COLORREF *pcr )
-{
- (void) hdc;
- (void) iLayerPlane;
- (void) iStart;
- (void) cEntries;
- (void) pcr;
-
- assert( 0 );
-
- return 0;
-}
-
-WINGDIAPI BOOL APIENTRY
-wglRealizeLayerPalette(
- HDC hdc,
- int iLayerPlane,
- BOOL bRealize )
-{
- (void) hdc;
- (void) iLayerPlane;
- (void) bRealize;
-
- assert( 0 );
-
- return FALSE;
-}
+++ /dev/null
-/**************************************************************************
- *
- * 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 VMWARE 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_WGL_H_
-#define STW_WGL_H_
-
-
-#include <windows.h>
-
-#include "GL/gl.h"
-
-
-/*
- * Undeclared APIs exported by opengl32.dll
- */
-
-WINGDIAPI BOOL WINAPI
-wglSwapBuffers(HDC hdc);
-
-WINGDIAPI int WINAPI
-wglChoosePixelFormat(HDC hdc,
- CONST PIXELFORMATDESCRIPTOR *ppfd);
-
-WINGDIAPI int WINAPI
-wglDescribePixelFormat(HDC hdc,
- int iPixelFormat,
- UINT nBytes,
- LPPIXELFORMATDESCRIPTOR ppfd);
-
-WINGDIAPI int WINAPI
-wglGetPixelFormat(HDC hdc);
-
-WINGDIAPI BOOL WINAPI
-wglSetPixelFormat(HDC hdc,
- int iPixelFormat,
- CONST PIXELFORMATDESCRIPTOR *ppfd);
-
-
-#endif /* STW_WGL_H_ */
+++ /dev/null
-/**************************************************************************
- *
- * 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 "stw_wgl_arbextensionsstring.h"
-
-WINGDIAPI const char * APIENTRY
-wglGetExtensionsStringARB(
- HDC hdc )
-{
- (void) hdc;
-
- return
- "WGL_ARB_extensions_string "
- "WGL_ARB_multisample "
- "WGL_ARB_pixel_format";
-}
+++ /dev/null
-/**************************************************************************
- *
- * 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 WGL_ARBEXTENSIONSSTRING_H
-#define WGL_ARBEXTENSIONSSTRING_H
-
-WINGDIAPI const char * APIENTRY
-wglGetExtensionsStringARB(
- HDC hdc );
-
-#endif /* WGL_ARBEXTENSIONSSTRING_H */
+++ /dev/null
-/**************************************************************************
- *
- * 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 "stw_wgl_arbmultisample.h"
-
-int
-wgl_query_sample_buffers( void )
-{
- return 1;
-}
-
-int
-wgl_query_samples( void )
-{
- return 4;
-}
+++ /dev/null
-/**************************************************************************
- *
- * 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 WGL_ARBMULTISAMPLE_H
-#define WGL_ARBMULTISAMPLE_H
-
-#define WGL_SAMPLE_BUFFERS_ARB 0x2041
-#define WGL_SAMPLES_ARB 0x2042
-
-int
-wgl_query_sample_buffers( void );
-
-int
-wgl_query_samples( void );
-
-#endif /* WGL_ARBMULTISAMPLE_H */
+++ /dev/null
-/**************************************************************************
- *
- * 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 "pipe/p_compiler.h"
-#include "util/u_memory.h"
-#include "stw_pixelformat.h"
-#include "stw_wgl_arbmultisample.h"
-#include "stw_wgl_arbpixelformat.h"
-
-#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
-#define WGL_DRAW_TO_WINDOW_ARB 0x2001
-#define WGL_DRAW_TO_BITMAP_ARB 0x2002
-#define WGL_ACCELERATION_ARB 0x2003
-#define WGL_NEED_PALETTE_ARB 0x2004
-#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
-#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
-#define WGL_SWAP_METHOD_ARB 0x2007
-#define WGL_NUMBER_OVERLAYS_ARB 0x2008
-#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
-#define WGL_TRANSPARENT_ARB 0x200A
-#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
-#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
-#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
-#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
-#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
-#define WGL_SHARE_DEPTH_ARB 0x200C
-#define WGL_SHARE_STENCIL_ARB 0x200D
-#define WGL_SHARE_ACCUM_ARB 0x200E
-#define WGL_SUPPORT_GDI_ARB 0x200F
-#define WGL_SUPPORT_OPENGL_ARB 0x2010
-#define WGL_DOUBLE_BUFFER_ARB 0x2011
-#define WGL_STEREO_ARB 0x2012
-#define WGL_PIXEL_TYPE_ARB 0x2013
-#define WGL_COLOR_BITS_ARB 0x2014
-#define WGL_RED_BITS_ARB 0x2015
-#define WGL_RED_SHIFT_ARB 0x2016
-#define WGL_GREEN_BITS_ARB 0x2017
-#define WGL_GREEN_SHIFT_ARB 0x2018
-#define WGL_BLUE_BITS_ARB 0x2019
-#define WGL_BLUE_SHIFT_ARB 0x201A
-#define WGL_ALPHA_BITS_ARB 0x201B
-#define WGL_ALPHA_SHIFT_ARB 0x201C
-#define WGL_ACCUM_BITS_ARB 0x201D
-#define WGL_ACCUM_RED_BITS_ARB 0x201E
-#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
-#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
-#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
-#define WGL_DEPTH_BITS_ARB 0x2022
-#define WGL_STENCIL_BITS_ARB 0x2023
-#define WGL_AUX_BUFFERS_ARB 0x2024
-
-#define WGL_NO_ACCELERATION_ARB 0x2025
-#define WGL_GENERIC_ACCELERATION_ARB 0x2026
-#define WGL_FULL_ACCELERATION_ARB 0x2027
-
-#define WGL_SWAP_EXCHANGE_ARB 0x2028
-#define WGL_SWAP_COPY_ARB 0x2029
-#define WGL_SWAP_UNDEFINED_ARB 0x202A
-
-#define WGL_TYPE_RGBA_ARB 0x202B
-#define WGL_TYPE_COLORINDEX_ARB 0x202C
-
-static boolean
-query_attrib(
- int iPixelFormat,
- int iLayerPlane,
- int attrib,
- int *pvalue )
-{
- uint count;
- uint index;
- const struct pixelformat_info *pf;
-
- count = pixelformat_get_extended_count();
-
- if (attrib == WGL_NUMBER_PIXEL_FORMATS_ARB) {
- *pvalue = (int) count;
- return TRUE;
- }
-
- index = (uint) iPixelFormat - 1;
- if (index >= count)
- return FALSE;
-
- pf = pixelformat_get_info( index );
-
- switch (attrib) {
- case WGL_DRAW_TO_WINDOW_ARB:
- *pvalue = TRUE;
- return TRUE;
-
- case WGL_DRAW_TO_BITMAP_ARB:
- *pvalue = FALSE;
- return TRUE;
-
- case WGL_NEED_PALETTE_ARB:
- *pvalue = FALSE;
- return TRUE;
-
- case WGL_NEED_SYSTEM_PALETTE_ARB:
- *pvalue = FALSE;
- return TRUE;
-
- case WGL_SWAP_METHOD_ARB:
- if (pf->flags & PF_FLAG_DOUBLEBUFFER)
- *pvalue = WGL_SWAP_COPY_ARB;
- else
- *pvalue = WGL_SWAP_UNDEFINED_ARB;
- return TRUE;
-
- case WGL_SWAP_LAYER_BUFFERS_ARB:
- *pvalue = FALSE;
- return TRUE;
-
- case WGL_NUMBER_OVERLAYS_ARB:
- *pvalue = 0;
- return TRUE;
-
- case WGL_NUMBER_UNDERLAYS_ARB:
- *pvalue = 0;
- return TRUE;
- }
-
- if (iLayerPlane != 0)
- return FALSE;
-
- switch (attrib) {
- case WGL_ACCELERATION_ARB:
- *pvalue = WGL_FULL_ACCELERATION_ARB;
- break;
-
- case WGL_TRANSPARENT_ARB:
- *pvalue = FALSE;
- break;
-
- case WGL_TRANSPARENT_RED_VALUE_ARB:
- case WGL_TRANSPARENT_GREEN_VALUE_ARB:
- case WGL_TRANSPARENT_BLUE_VALUE_ARB:
- case WGL_TRANSPARENT_ALPHA_VALUE_ARB:
- case WGL_TRANSPARENT_INDEX_VALUE_ARB:
- break;
-
- case WGL_SHARE_DEPTH_ARB:
- case WGL_SHARE_STENCIL_ARB:
- case WGL_SHARE_ACCUM_ARB:
- *pvalue = TRUE;
- break;
-
- case WGL_SUPPORT_GDI_ARB:
- *pvalue = FALSE;
- break;
-
- case WGL_SUPPORT_OPENGL_ARB:
- *pvalue = TRUE;
- break;
-
- case WGL_DOUBLE_BUFFER_ARB:
- if (pf->flags & PF_FLAG_DOUBLEBUFFER)
- *pvalue = TRUE;
- else
- *pvalue = FALSE;
- break;
-
- case WGL_STEREO_ARB:
- *pvalue = FALSE;
- break;
-
- case WGL_PIXEL_TYPE_ARB:
- *pvalue = WGL_TYPE_RGBA_ARB;
- break;
-
- case WGL_COLOR_BITS_ARB:
- *pvalue = (int) (pf->color.redbits + pf->color.greenbits + pf->color.bluebits);
- break;
-
- case WGL_RED_BITS_ARB:
- *pvalue = (int) pf->color.redbits;
- break;
-
- case WGL_RED_SHIFT_ARB:
- *pvalue = (int) pf->color.redshift;
- break;
-
- case WGL_GREEN_BITS_ARB:
- *pvalue = (int) pf->color.greenbits;
- break;
-
- case WGL_GREEN_SHIFT_ARB:
- *pvalue = (int) pf->color.greenshift;
- break;
-
- case WGL_BLUE_BITS_ARB:
- *pvalue = (int) pf->color.bluebits;
- break;
-
- case WGL_BLUE_SHIFT_ARB:
- *pvalue = (int) pf->color.blueshift;
- break;
-
- case WGL_ALPHA_BITS_ARB:
- *pvalue = (int) pf->alpha.alphabits;
- break;
-
- case WGL_ALPHA_SHIFT_ARB:
- *pvalue = (int) pf->alpha.alphashift;
- break;
-
- case WGL_ACCUM_BITS_ARB:
- case WGL_ACCUM_RED_BITS_ARB:
- case WGL_ACCUM_GREEN_BITS_ARB:
- case WGL_ACCUM_BLUE_BITS_ARB:
- case WGL_ACCUM_ALPHA_BITS_ARB:
- *pvalue = 0;
- break;
-
- case WGL_DEPTH_BITS_ARB:
- *pvalue = (int) pf->depth.depthbits;
- break;
-
- case WGL_STENCIL_BITS_ARB:
- *pvalue = (int) pf->depth.stencilbits;
- break;
-
- case WGL_AUX_BUFFERS_ARB:
- *pvalue = 0;
- break;
-
- case WGL_SAMPLE_BUFFERS_ARB:
- if (pf->flags & PF_FLAG_MULTISAMPLED)
- *pvalue = wgl_query_sample_buffers();
- else
- *pvalue = 0;
- break;
-
- case WGL_SAMPLES_ARB:
- if (pf->flags & PF_FLAG_MULTISAMPLED)
- *pvalue = wgl_query_samples();
- else
- *pvalue = 0;
- break;
-
- default:
- return FALSE;
- }
-
- return TRUE;
-}
-
-struct attrib_match_info
-{
- int attribute;
- int weight;
- BOOL exact;
-};
-
-static struct attrib_match_info attrib_match[] = {
-
- /* WGL_ARB_pixel_format */
- { WGL_DRAW_TO_WINDOW_ARB, 0, TRUE },
- { WGL_DRAW_TO_BITMAP_ARB, 0, TRUE },
- { WGL_ACCELERATION_ARB, 0, TRUE },
- { WGL_NEED_PALETTE_ARB, 0, TRUE },
- { WGL_NEED_SYSTEM_PALETTE_ARB, 0, TRUE },
- { WGL_SWAP_LAYER_BUFFERS_ARB, 0, TRUE },
- { WGL_SWAP_METHOD_ARB, 0, TRUE },
- { WGL_NUMBER_OVERLAYS_ARB, 4, FALSE },
- { WGL_NUMBER_UNDERLAYS_ARB, 4, FALSE },
- /*{ WGL_SHARE_DEPTH_ARB, 0, TRUE },*/ /* no overlays -- ignore */
- /*{ WGL_SHARE_STENCIL_ARB, 0, TRUE },*/ /* no overlays -- ignore */
- /*{ WGL_SHARE_ACCUM_ARB, 0, TRUE },*/ /* no overlays -- ignore */
- { WGL_SUPPORT_GDI_ARB, 0, TRUE },
- { WGL_SUPPORT_OPENGL_ARB, 0, TRUE },
- { WGL_DOUBLE_BUFFER_ARB, 0, TRUE },
- { WGL_STEREO_ARB, 0, TRUE },
- { WGL_PIXEL_TYPE_ARB, 0, TRUE },
- { WGL_COLOR_BITS_ARB, 1, FALSE },
- { WGL_RED_BITS_ARB, 1, FALSE },
- { WGL_GREEN_BITS_ARB, 1, FALSE },
- { WGL_BLUE_BITS_ARB, 1, FALSE },
- { WGL_ALPHA_BITS_ARB, 1, FALSE },
- { WGL_ACCUM_BITS_ARB, 1, FALSE },
- { WGL_ACCUM_RED_BITS_ARB, 1, FALSE },
- { WGL_ACCUM_GREEN_BITS_ARB, 1, FALSE },
- { WGL_ACCUM_BLUE_BITS_ARB, 1, FALSE },
- { WGL_ACCUM_ALPHA_BITS_ARB, 1, FALSE },
- { WGL_DEPTH_BITS_ARB, 1, FALSE },
- { WGL_STENCIL_BITS_ARB, 1, FALSE },
- { WGL_AUX_BUFFERS_ARB, 2, FALSE },
-
- /* WGL_ARB_multisample */
- { WGL_SAMPLE_BUFFERS_ARB, 2, FALSE },
- { WGL_SAMPLES_ARB, 2, FALSE }
-};
-
-struct pixelformat_score
-{
- int points;
- uint index;
-};
-
-static BOOL
-score_pixelformats(
- struct pixelformat_score *scores,
- uint count,
- int attribute,
- int expected_value )
-{
- uint i;
- struct attrib_match_info *ami = NULL;
- uint index;
-
- /* Find out if a given attribute should be considered for score calculation.
- */
- for (i = 0; i < sizeof( attrib_match ) / sizeof( attrib_match[0] ); i++) {
- if (attrib_match[i].attribute == attribute) {
- ami = &attrib_match[i];
- break;
- }
- }
- if (ami == NULL)
- return TRUE;
-
- /* Iterate all pixelformats, query the requested attribute and calculate
- * score points.
- */
- for (index = 0; index < count; index++) {
- int actual_value;
-
- if (!query_attrib( index + 1, 0, attribute, &actual_value ))
- return FALSE;
-
- if (ami->exact) {
- /* For an exact match criteria, if the actual and expected values differ,
- * the score is set to 0 points, effectively removing the pixelformat
- * from a list of matching pixelformats.
- */
- if (actual_value != expected_value)
- scores[index].points = 0;
- }
- else {
- /* For a minimum match criteria, if the actual value is smaller than the expected
- * value, the pixelformat is rejected (score set to 0). However, if the actual
- * value is bigger, the pixelformat is given a penalty to favour pixelformats that
- * more closely match the expected values.
- */
- if (actual_value < expected_value)
- scores[index].points = 0;
- else if (actual_value > expected_value)
- scores[index].points -= (actual_value - expected_value) * ami->weight;
- }
- }
-
- return TRUE;
-}
-
-WINGDIAPI BOOL APIENTRY
-wglChoosePixelFormatARB(
- HDC hdc,
- const int *piAttribIList,
- const FLOAT *pfAttribFList,
- UINT nMaxFormats,
- int *piFormats,
- UINT *nNumFormats )
-{
- uint count;
- struct pixelformat_score *scores;
- uint i;
-
- *nNumFormats = 0;
-
- /* Allocate and initialize pixelformat score table -- better matches
- * have higher scores. Start with a high score and take out penalty
- * points for a mismatch when the match does not have to be exact.
- * Set a score to 0 if there is a mismatch for an exact match criteria.
- */
- count = pixelformat_get_extended_count();
- scores = (struct pixelformat_score *) MALLOC( count * sizeof( struct pixelformat_score ) );
- if (scores == NULL)
- return FALSE;
- for (i = 0; i < count; i++) {
- scores[i].points = 0x7fffffff;
- scores[i].index = i;
- }
-
- /* Given the attribute list calculate a score for each pixelformat.
- */
- if (piAttribIList != NULL) {
- while (*piAttribIList != 0) {
- if (!score_pixelformats( scores, count, piAttribIList[0], piAttribIList[1] )) {
- FREE( scores );
- return FALSE;
- }
- piAttribIList += 2;
- }
- }
- if (pfAttribFList != NULL) {
- while (*pfAttribFList != 0) {
- if (!score_pixelformats( scores, count, (int) pfAttribFList[0], (int) pfAttribFList[1] )) {
- FREE( scores );
- return FALSE;
- }
- pfAttribFList += 2;
- }
- }
-
- /* Bubble-sort the resulting scores. Pixelformats with higher scores go first.
- * TODO: Find out if there are any patent issues with it.
- */
- if (count > 1) {
- uint n = count;
- boolean swapped;
-
- do {
- swapped = FALSE;
- for (i = 1; i < n; i++) {
- if (scores[i - 1].points < scores[i].points) {
- struct pixelformat_score score = scores[i - 1];
-
- scores[i - 1] = scores[i];
- scores[i] = score;
- swapped = TRUE;
- }
- }
- n--;
- }
- while (swapped);
- }
-
- /* Return a list of pixelformats that are the best match.
- * Reject pixelformats with non-positive scores.
- */
- for (i = 0; i < count; i++) {
- if (scores[i].points > 0) {
- if (*nNumFormats < nMaxFormats)
- piFormats[*nNumFormats] = scores[i].index + 1;
- (*nNumFormats)++;
- }
- }
-
- FREE( scores );
- return TRUE;
-}
-
-WINGDIAPI BOOL APIENTRY
-wglGetPixelFormatAttribfvARB(
- HDC hdc,
- int iPixelFormat,
- int iLayerPlane,
- UINT nAttributes,
- const int *piAttributes,
- FLOAT *pfValues )
-{
- UINT i;
-
- (void) hdc;
-
- for (i = 0; i < nAttributes; i++) {
- int value;
-
- if (!query_attrib( iPixelFormat, iLayerPlane, piAttributes[i], &value ))
- return FALSE;
- pfValues[i] = (FLOAT) value;
- }
-
- return TRUE;
-}
-
-WINGDIAPI BOOL APIENTRY
-wglGetPixelFormatAttribivARB(
- HDC hdc,
- int iPixelFormat,
- int iLayerPlane,
- UINT nAttributes,
- const int *piAttributes,
- int *piValues )
-{
- UINT i;
-
- (void) hdc;
-
- for (i = 0; i < nAttributes; i++) {
- if (!query_attrib( iPixelFormat, iLayerPlane, piAttributes[i], &piValues[i] ))
- return FALSE;
- }
-
- return TRUE;
-}
+++ /dev/null
-/**************************************************************************
- *
- * 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 WGL_ARBPIXELFORMAT_H
-#define WGL_ARBPIXELFORMAT_H
-
-WINGDIAPI BOOL APIENTRY
-wglChoosePixelFormatARB(
- HDC hdc,
- const int *piAttribIList,
- const FLOAT *pfAttribFList,
- UINT nMaxFormats,
- int *piFormats,
- UINT *nNumFormats );
-
-WINGDIAPI BOOL APIENTRY
-wglGetPixelFormatAttribfvARB(
- HDC hdc,
- int iPixelFormat,
- int iLayerPlane,
- UINT nAttributes,
- const int *piAttributes,
- FLOAT *pfValues );
-
-WINGDIAPI BOOL APIENTRY
-wglGetPixelFormatAttribivARB(
- HDC hdc,
- int iPixelFormat,
- int iLayerPlane,
- UINT nAttributes,
- const int *piAttributes,
- int *piValues );
-
-#endif /* WGL_ARBPIXELFORMAT_H */
+++ /dev/null
-/**************************************************************************
- *
- * 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 "main/mtypes.h"
-#include "main/context.h"
-#include "pipe/p_compiler.h"
-#include "pipe/p_context.h"
-#include "state_tracker/st_context.h"
-#include "state_tracker/st_public.h"
-#include "stw_device.h"
-#include "stw_winsys.h"
-#include "stw_framebuffer.h"
-#include "stw_pixelformat.h"
-#include "stw_wgl_arbmultisample.h"
-#include "stw_wgl_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(
- HGLRC hglrcSrc,
- HGLRC hglrcDst,
- UINT mask )
-{
- (void) hglrcSrc;
- (void) hglrcDst;
- (void) mask;
-
- return FALSE;
-}
-
-WINGDIAPI HGLRC APIENTRY
-wglCreateContext(
- HDC hdc )
-{
- uint pfi;
- const struct pixelformat_info *pf;
- struct wgl_context *ctx;
- GLvisual *visual;
- struct pipe_context *pipe;
-
- pfi = wglGetPixelFormat( hdc );
- if (pfi == 0)
- return NULL;
-
- pf = pixelformat_get_info( pfi - 1 );
-
- ctx = CALLOC_STRUCT( wgl_context );
- if (ctx == NULL)
- return NULL;
-
- ctx->hdc = hdc;
- ctx->color_bits = GetDeviceCaps( ctx->hdc, BITSPIXEL );
-
- /* Create visual based on flags
- */
- visual = _mesa_create_visual(
- GL_TRUE,
- (pf->flags & PF_FLAG_DOUBLEBUFFER) ? GL_TRUE : GL_FALSE,
- GL_FALSE,
- pf->color.redbits,
- pf->color.greenbits,
- pf->color.bluebits,
- pf->alpha.alphabits,
- 0,
- pf->depth.depthbits,
- pf->depth.stencilbits,
- 0,
- 0,
- 0,
- 0,
- (pf->flags & PF_FLAG_MULTISAMPLED) ? wgl_query_samples() : 0 );
- if (visual == NULL) {
- FREE( ctx );
- return NULL;
- }
-
- pipe = stw_dev->stw_winsys->create_context( stw_dev->screen );
- if (!pipe) {
- _mesa_destroy_visual( visual );
- FREE( ctx );
- return NULL;
- }
-
- assert(!pipe->priv);
- pipe->priv = hdc;
-
- ctx->st = st_create_context( pipe, visual, NULL );
- if (ctx->st == NULL) {
- pipe->destroy( pipe );
- _mesa_destroy_visual( visual );
- FREE( ctx );
- return NULL;
- }
- ctx->st->ctx->DriverCtx = ctx;
-
- ctx->next = ctx_head;
- ctx_head = ctx;
-
- return (HGLRC) ctx;
-}
-
-WINGDIAPI HGLRC APIENTRY
-wglCreateLayerContext(
- HDC hdc,
- int iLayerPlane )
-{
- (void) hdc;
- (void) iLayerPlane;
-
- return NULL;
-}
-
-WINGDIAPI BOOL APIENTRY
-wglDeleteContext(
- HGLRC hglrc )
-{
- struct wgl_context **link = &ctx_head;
- struct wgl_context *ctx = ctx_head;
-
- while (ctx != NULL) {
- if (ctx == (struct wgl_context *) hglrc) {
- GLcontext *glctx = ctx->st->ctx;
- GET_CURRENT_CONTEXT( glcurctx );
- struct stw_framebuffer *fb;
-
- /* Unbind current if deleting current context.
- */
- if (glcurctx == glctx)
- st_make_current( NULL, NULL, NULL );
-
- fb = framebuffer_from_hdc( ctx->hdc );
- if (fb)
- framebuffer_destroy( fb );
-
- if (WindowFromDC( ctx->hdc ) != NULL)
- ReleaseDC( WindowFromDC( ctx->hdc ), ctx->hdc );
-
- st_destroy_context( ctx->st );
-
- *link = ctx->next;
- FREE( ctx );
- return TRUE;
- }
-
- link = &ctx->next;
- ctx = ctx->next;
- }
-
- return FALSE;
-}
-
-/* Find the width and height of the window named by hdc.
- */
-static void
-get_window_size( HDC hdc, GLuint *width, GLuint *height )
-{
- if (WindowFromDC( hdc )) {
- RECT rect;
-
- GetClientRect( WindowFromDC( hdc ), &rect );
- *width = rect.right - rect.left;
- *height = rect.bottom - rect.top;
- }
- else {
- *width = GetDeviceCaps( hdc, HORZRES );
- *height = GetDeviceCaps( hdc, VERTRES );
- }
-}
-
-WINGDIAPI HGLRC APIENTRY
-wglGetCurrentContext( VOID )
-{
- return current_hrc;
-}
-
-WINGDIAPI HDC APIENTRY
-wglGetCurrentDC( VOID )
-{
- return current_hdc;
-}
-
-WINGDIAPI BOOL APIENTRY
-wglMakeCurrent(
- HDC hdc,
- HGLRC hglrc )
-{
- struct wgl_context *ctx = ctx_head;
- GET_CURRENT_CONTEXT( glcurctx );
- struct stw_framebuffer *fb;
- GLuint width = 0;
- GLuint height = 0;
-
- current_hdc = hdc;
- current_hrc = hglrc;
-
- if (hdc == NULL || hglrc == NULL) {
- st_make_current( NULL, NULL, NULL );
- return TRUE;
- }
-
- while (ctx != NULL) {
- if (ctx == (struct wgl_context *) hglrc)
- break;
- ctx = ctx->next;
- }
- if (ctx == NULL)
- return FALSE;
-
- /* Return if already current.
- */
- if (glcurctx != NULL) {
- struct wgl_context *curctx = (struct wgl_context *) glcurctx->DriverCtx;
-
- if (curctx != NULL && curctx == ctx && ctx->hdc == hdc)
- return TRUE;
- }
-
- fb = framebuffer_from_hdc( hdc );
-
- if (hdc != NULL)
- get_window_size( hdc, &width, &height );
-
- /* Lazy creation of framebuffers.
- */
- if (fb == NULL && ctx != NULL && hdc != NULL) {
- GLvisual *visual = &ctx->st->ctx->Visual;
-
- fb = framebuffer_create( hdc, visual, width, height );
- if (fb == NULL)
- return FALSE;
-
- fb->dib_hDC = CreateCompatibleDC( hdc );
- fb->hbmDIB = NULL;
- fb->pbPixels = NULL;
- }
-
- if (ctx && fb) {
- st_make_current( ctx->st, fb->stfb, fb->stfb );
- framebuffer_resize( fb, width, height );
- ctx->hdc = hdc;
- ctx->st->pipe->priv = hdc;
- }
- else {
- /* Detach */
- st_make_current( NULL, NULL, NULL );
- }
-
- return TRUE;
-}
-
-struct wgl_context *
-wgl_context_from_hdc(
- HDC hdc )
-{
- struct wgl_context *ctx = ctx_head;
-
- while (ctx != NULL) {
- if (ctx->hdc == hdc)
- return ctx;
- ctx = ctx->next;
- }
- return NULL;
-}
-
-#include "stw_wgl.c"
+++ /dev/null
-/**************************************************************************
- *
- * 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 WGL_CONTEXT_H
-#define WGL_CONTEXT_H
-
-#include <windows.h>
-
-struct st_context;
-
-struct wgl_context
-{
- struct st_context *st;
- HDC hdc;
- DWORD color_bits;
- struct wgl_context *next;
-};
-
-struct wgl_context *
-wgl_context_from_hdc(HDC hdc );
-
-#endif /* WGL_CONTEXT_H */
+++ /dev/null
-/**************************************************************************
- *
- * 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 "glapi/glapi.h"
-#include "stw_wgl_arbextensionsstring.h"
-#include "stw_wgl_arbpixelformat.h"
-
-struct extension_entry
-{
- const char *name;
- PROC proc;
-};
-
-#define EXTENTRY(P) { #P, (PROC) P }
-
-static struct extension_entry extension_entries[] = {
-
- /* WGL_ARB_extensions_string */
- EXTENTRY( wglGetExtensionsStringARB ),
-
- /* WGL_ARB_pixel_format */
- EXTENTRY( wglChoosePixelFormatARB ),
- EXTENTRY( wglGetPixelFormatAttribfvARB ),
- EXTENTRY( wglGetPixelFormatAttribivARB ),
-
- { NULL, NULL }
-};
-
-WINGDIAPI PROC APIENTRY
-wglGetProcAddress(
- LPCSTR lpszProc )
-{
- struct extension_entry *entry;
-
- PROC p = (PROC) _glapi_get_proc_address( (const char *) lpszProc );
- if (p)
- return p;
-
- for (entry = extension_entries; entry->name; entry++)
- if (strcmp( lpszProc, entry->name ) == 0)
- return entry->proc;
-
- return NULL;
-}
+++ /dev/null
-/**************************************************************************
- *
- * 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 "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
-#include "stw_pixelformat.h"
-#include "stw_wgl.h"
-
-static uint currentpixelformat = 0;
-
-WINGDIAPI int APIENTRY
-wglChoosePixelFormat(
- HDC hdc,
- CONST PIXELFORMATDESCRIPTOR *ppfd )
-{
- uint count;
- uint index;
- uint bestindex;
- uint bestdelta;
-
- (void) hdc;
-
- count = pixelformat_get_count();
- bestindex = count;
- bestdelta = 0xffffffff;
-
- if (ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR ) || ppfd->nVersion != 1)
- return 0;
- if (ppfd->iPixelType != PFD_TYPE_RGBA)
- return 0;
- if (!(ppfd->dwFlags & PFD_DRAW_TO_WINDOW))
- return 0;
- if (!(ppfd->dwFlags & PFD_SUPPORT_OPENGL))
- return 0;
- if (ppfd->dwFlags & PFD_DRAW_TO_BITMAP)
- return 0;
- if (ppfd->dwFlags & PFD_SUPPORT_GDI)
- return 0;
- if (!(ppfd->dwFlags & PFD_STEREO_DONTCARE) && (ppfd->dwFlags & PFD_STEREO))
- return 0;
-
- for (index = 0; index < count; index++) {
- uint delta = 0;
- const struct pixelformat_info *pf = pixelformat_get_info( index );
-
- if (!(ppfd->dwFlags & PFD_DOUBLEBUFFER_DONTCARE)) {
- if ((ppfd->dwFlags & PFD_DOUBLEBUFFER) && !(pf->flags & PF_FLAG_DOUBLEBUFFER))
- continue;
- if (!(ppfd->dwFlags & PFD_DOUBLEBUFFER) && (pf->flags & PF_FLAG_DOUBLEBUFFER))
- continue;
- }
-
- if (ppfd->cColorBits != pf->color.redbits + pf->color.greenbits + pf->color.bluebits)
- delta += 8;
-
- if (ppfd->cDepthBits != pf->depth.depthbits)
- delta += 4;
-
- if (ppfd->cStencilBits != pf->depth.stencilbits)
- delta += 2;
-
- if (ppfd->cAlphaBits != pf->alpha.alphabits)
- delta++;
-
- if (delta < bestdelta) {
- bestindex = index;
- bestdelta = delta;
- if (bestdelta == 0)
- break;
- }
- }
-
- if (bestindex == count)
- return 0;
- return bestindex + 1;
-}
-
-WINGDIAPI int APIENTRY
-wglDescribePixelFormat(
- HDC hdc,
- int iPixelFormat,
- UINT nBytes,
- LPPIXELFORMATDESCRIPTOR ppfd )
-{
- uint count;
- uint index;
- const struct pixelformat_info *pf;
-
- (void) hdc;
-
- count = pixelformat_get_extended_count();
- index = (uint) iPixelFormat - 1;
-
- if (ppfd == NULL)
- return count;
- if (index >= count || nBytes != sizeof( PIXELFORMATDESCRIPTOR ))
- return 0;
-
- pf = pixelformat_get_info( index );
-
- ppfd->nSize = sizeof( PIXELFORMATDESCRIPTOR );
- ppfd->nVersion = 1;
- ppfd->dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
- if (pf->flags & PF_FLAG_DOUBLEBUFFER)
- ppfd->dwFlags |= PFD_DOUBLEBUFFER | PFD_SWAP_COPY;
- ppfd->iPixelType = PFD_TYPE_RGBA;
- ppfd->cColorBits = pf->color.redbits + pf->color.greenbits + pf->color.bluebits;
- ppfd->cRedBits = pf->color.redbits;
- ppfd->cRedShift = pf->color.redshift;
- ppfd->cGreenBits = pf->color.greenbits;
- ppfd->cGreenShift = pf->color.greenshift;
- ppfd->cBlueBits = pf->color.bluebits;
- ppfd->cBlueShift = pf->color.blueshift;
- ppfd->cAlphaBits = pf->alpha.alphabits;
- ppfd->cAlphaShift = pf->alpha.alphashift;
- ppfd->cAccumBits = 0;
- ppfd->cAccumRedBits = 0;
- ppfd->cAccumGreenBits = 0;
- ppfd->cAccumBlueBits = 0;
- ppfd->cAccumAlphaBits = 0;
- ppfd->cDepthBits = pf->depth.depthbits;
- ppfd->cStencilBits = pf->depth.stencilbits;
- ppfd->cAuxBuffers = 0;
- ppfd->iLayerType = 0;
- ppfd->bReserved = 0;
- ppfd->dwLayerMask = 0;
- ppfd->dwVisibleMask = 0;
- ppfd->dwDamageMask = 0;
-
- return count;
-}
-
-WINGDIAPI int APIENTRY
-wglGetPixelFormat(
- HDC hdc )
-{
- (void) hdc;
-
- return currentpixelformat;
-}
-
-WINGDIAPI BOOL APIENTRY
-wglSetPixelFormat(
- HDC hdc,
- int iPixelFormat,
- const PIXELFORMATDESCRIPTOR *ppfd )
-{
- uint count;
- uint index;
-
- (void) hdc;
-
- count = pixelformat_get_extended_count();
- index = (uint) iPixelFormat - 1;
-
- if (index >= count || ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR ))
- return FALSE;
-
- currentpixelformat = index + 1;
- return TRUE;
-}
+++ /dev/null
-/**************************************************************************
- *
- * 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 "pipe/p_winsys.h"
-#include "pipe/p_screen.h"
-#include "pipe/p_context.h"
-#include "state_tracker/st_context.h"
-#include "state_tracker/st_public.h"
-#include "stw_winsys.h"
-#include "stw_device.h"
-#include "stw_framebuffer.h"
-#include "stw_wgl.h"
-
-WINGDIAPI BOOL APIENTRY
-wglSwapBuffers(
- HDC hdc )
-{
- struct stw_framebuffer *fb;
- struct pipe_surface *surf;
-
- fb = framebuffer_from_hdc( hdc );
- if (fb == NULL)
- return FALSE;
-
- /* If we're swapping the buffer associated with the current context
- * we have to flush any pending rendering commands first.
- */
- st_notify_swapbuffers( fb->stfb );
-
- st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT, &surf );
-
- stw_dev->stw_winsys->flush_frontbuffer(stw_dev->screen->winsys,
- surf,
- hdc );
-
- return TRUE;
-}
-
-WINGDIAPI BOOL APIENTRY
-wglSwapLayerBuffers(
- HDC hdc,
- UINT fuPlanes )
-{
- (void) hdc;
- (void) fuPlanes;
-
- return FALSE;
-}
+++ /dev/null
-/**************************************************************************
- *
- * 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_WINSYS_H
-#define STW_WINSYS_H
-
-#include <windows.h> /* for HDC */
-
-#include "pipe/p_compiler.h"
-
-struct pipe_screen;
-struct pipe_context;
-struct pipe_winsys;
-struct pipe_surface;
-
-struct stw_winsys
-{
- struct pipe_screen *
- (*create_screen)( void );
-
- struct pipe_context *
- (*create_context)( struct pipe_screen *screen );
-
- void
- (*flush_frontbuffer)( struct pipe_winsys *winsys,
- struct pipe_surface *surf,
- HDC hDC );
-};
-
-boolean
-st_init(const struct stw_winsys *stw_winsys);
-
-void
-st_cleanup(void);
-
-#endif /* STW_WINSYS_H */
--- /dev/null
+/**************************************************************************
+ *
+ * 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 "pipe/p_debug.h"
+
+WINGDIAPI BOOL APIENTRY
+wglUseFontBitmapsA(
+ HDC hdc,
+ DWORD first,
+ DWORD count,
+ DWORD listBase )
+{
+ (void) hdc;
+ (void) first;
+ (void) count;
+ (void) listBase;
+
+ assert( 0 );
+
+ return FALSE;
+}
+
+WINGDIAPI BOOL APIENTRY
+wglShareLists(
+ HGLRC hglrc1,
+ HGLRC hglrc2 )
+{
+ (void) hglrc1;
+ (void) hglrc2;
+
+ assert( 0 );
+
+ return FALSE;
+}
+
+WINGDIAPI BOOL APIENTRY
+wglUseFontBitmapsW(
+ HDC hdc,
+ DWORD first,
+ DWORD count,
+ DWORD listBase )
+{
+ (void) hdc;
+ (void) first;
+ (void) count;
+ (void) listBase;
+
+ assert( 0 );
+
+ return FALSE;
+}
+
+WINGDIAPI BOOL APIENTRY
+wglUseFontOutlinesA(
+ HDC hdc,
+ DWORD first,
+ DWORD count,
+ DWORD listBase,
+ FLOAT deviation,
+ FLOAT extrusion,
+ int format,
+ LPGLYPHMETRICSFLOAT lpgmf )
+{
+ (void) hdc;
+ (void) first;
+ (void) count;
+ (void) listBase;
+ (void) deviation;
+ (void) extrusion;
+ (void) format;
+ (void) lpgmf;
+
+ assert( 0 );
+
+ return FALSE;
+}
+
+WINGDIAPI BOOL APIENTRY
+wglUseFontOutlinesW(
+ HDC hdc,
+ DWORD first,
+ DWORD count,
+ DWORD listBase,
+ FLOAT deviation,
+ FLOAT extrusion,
+ int format,
+ LPGLYPHMETRICSFLOAT lpgmf )
+{
+ (void) hdc;
+ (void) first;
+ (void) count;
+ (void) listBase;
+ (void) deviation;
+ (void) extrusion;
+ (void) format;
+ (void) lpgmf;
+
+ assert( 0 );
+
+ return FALSE;
+}
+
+WINGDIAPI BOOL APIENTRY
+wglDescribeLayerPlane(
+ HDC hdc,
+ int iPixelFormat,
+ int iLayerPlane,
+ UINT nBytes,
+ LPLAYERPLANEDESCRIPTOR plpd )
+{
+ (void) hdc;
+ (void) iPixelFormat;
+ (void) iLayerPlane;
+ (void) nBytes;
+ (void) plpd;
+
+ assert( 0 );
+
+ return FALSE;
+}
+
+WINGDIAPI int APIENTRY
+wglSetLayerPaletteEntries(
+ HDC hdc,
+ int iLayerPlane,
+ int iStart,
+ int cEntries,
+ CONST COLORREF *pcr )
+{
+ (void) hdc;
+ (void) iLayerPlane;
+ (void) iStart;
+ (void) cEntries;
+ (void) pcr;
+
+ assert( 0 );
+
+ return 0;
+}
+
+WINGDIAPI int APIENTRY
+wglGetLayerPaletteEntries(
+ HDC hdc,
+ int iLayerPlane,
+ int iStart,
+ int cEntries,
+ COLORREF *pcr )
+{
+ (void) hdc;
+ (void) iLayerPlane;
+ (void) iStart;
+ (void) cEntries;
+ (void) pcr;
+
+ assert( 0 );
+
+ return 0;
+}
+
+WINGDIAPI BOOL APIENTRY
+wglRealizeLayerPalette(
+ HDC hdc,
+ int iLayerPlane,
+ BOOL bRealize )
+{
+ (void) hdc;
+ (void) iLayerPlane;
+ (void) bRealize;
+
+ assert( 0 );
+
+ return FALSE;
+}
--- /dev/null
+/**************************************************************************
+ *
+ * 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 VMWARE 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_WGL_H_
+#define STW_WGL_H_
+
+
+#include <windows.h>
+
+#include "GL/gl.h"
+
+
+/*
+ * Undeclared APIs exported by opengl32.dll
+ */
+
+WINGDIAPI BOOL WINAPI
+wglSwapBuffers(HDC hdc);
+
+WINGDIAPI int WINAPI
+wglChoosePixelFormat(HDC hdc,
+ CONST PIXELFORMATDESCRIPTOR *ppfd);
+
+WINGDIAPI int WINAPI
+wglDescribePixelFormat(HDC hdc,
+ int iPixelFormat,
+ UINT nBytes,
+ LPPIXELFORMATDESCRIPTOR ppfd);
+
+WINGDIAPI int WINAPI
+wglGetPixelFormat(HDC hdc);
+
+WINGDIAPI BOOL WINAPI
+wglSetPixelFormat(HDC hdc,
+ int iPixelFormat,
+ CONST PIXELFORMATDESCRIPTOR *ppfd);
+
+
+#endif /* STW_WGL_H_ */
--- /dev/null
+/**************************************************************************
+ *
+ * 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 "stw_wgl_arbextensionsstring.h"
+
+WINGDIAPI const char * APIENTRY
+wglGetExtensionsStringARB(
+ HDC hdc )
+{
+ (void) hdc;
+
+ return
+ "WGL_ARB_extensions_string "
+ "WGL_ARB_multisample "
+ "WGL_ARB_pixel_format";
+}
--- /dev/null
+/**************************************************************************
+ *
+ * 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 WGL_ARBEXTENSIONSSTRING_H
+#define WGL_ARBEXTENSIONSSTRING_H
+
+WINGDIAPI const char * APIENTRY
+wglGetExtensionsStringARB(
+ HDC hdc );
+
+#endif /* WGL_ARBEXTENSIONSSTRING_H */
--- /dev/null
+/**************************************************************************
+ *
+ * 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 "stw_wgl_arbmultisample.h"
+
+int
+wgl_query_sample_buffers( void )
+{
+ return 1;
+}
+
+int
+wgl_query_samples( void )
+{
+ return 4;
+}
--- /dev/null
+/**************************************************************************
+ *
+ * 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 WGL_ARBMULTISAMPLE_H
+#define WGL_ARBMULTISAMPLE_H
+
+#define WGL_SAMPLE_BUFFERS_ARB 0x2041
+#define WGL_SAMPLES_ARB 0x2042
+
+int
+wgl_query_sample_buffers( void );
+
+int
+wgl_query_samples( void );
+
+#endif /* WGL_ARBMULTISAMPLE_H */
--- /dev/null
+/**************************************************************************
+ *
+ * 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 "pipe/p_compiler.h"
+#include "util/u_memory.h"
+#include "shared/stw_pixelformat.h"
+#include "stw_wgl_arbmultisample.h"
+#include "stw_wgl_arbpixelformat.h"
+
+#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
+#define WGL_DRAW_TO_WINDOW_ARB 0x2001
+#define WGL_DRAW_TO_BITMAP_ARB 0x2002
+#define WGL_ACCELERATION_ARB 0x2003
+#define WGL_NEED_PALETTE_ARB 0x2004
+#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
+#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
+#define WGL_SWAP_METHOD_ARB 0x2007
+#define WGL_NUMBER_OVERLAYS_ARB 0x2008
+#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
+#define WGL_TRANSPARENT_ARB 0x200A
+#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
+#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
+#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
+#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
+#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
+#define WGL_SHARE_DEPTH_ARB 0x200C
+#define WGL_SHARE_STENCIL_ARB 0x200D
+#define WGL_SHARE_ACCUM_ARB 0x200E
+#define WGL_SUPPORT_GDI_ARB 0x200F
+#define WGL_SUPPORT_OPENGL_ARB 0x2010
+#define WGL_DOUBLE_BUFFER_ARB 0x2011
+#define WGL_STEREO_ARB 0x2012
+#define WGL_PIXEL_TYPE_ARB 0x2013
+#define WGL_COLOR_BITS_ARB 0x2014
+#define WGL_RED_BITS_ARB 0x2015
+#define WGL_RED_SHIFT_ARB 0x2016
+#define WGL_GREEN_BITS_ARB 0x2017
+#define WGL_GREEN_SHIFT_ARB 0x2018
+#define WGL_BLUE_BITS_ARB 0x2019
+#define WGL_BLUE_SHIFT_ARB 0x201A
+#define WGL_ALPHA_BITS_ARB 0x201B
+#define WGL_ALPHA_SHIFT_ARB 0x201C
+#define WGL_ACCUM_BITS_ARB 0x201D
+#define WGL_ACCUM_RED_BITS_ARB 0x201E
+#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
+#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
+#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
+#define WGL_DEPTH_BITS_ARB 0x2022
+#define WGL_STENCIL_BITS_ARB 0x2023
+#define WGL_AUX_BUFFERS_ARB 0x2024
+
+#define WGL_NO_ACCELERATION_ARB 0x2025
+#define WGL_GENERIC_ACCELERATION_ARB 0x2026
+#define WGL_FULL_ACCELERATION_ARB 0x2027
+
+#define WGL_SWAP_EXCHANGE_ARB 0x2028
+#define WGL_SWAP_COPY_ARB 0x2029
+#define WGL_SWAP_UNDEFINED_ARB 0x202A
+
+#define WGL_TYPE_RGBA_ARB 0x202B
+#define WGL_TYPE_COLORINDEX_ARB 0x202C
+
+static boolean
+query_attrib(
+ int iPixelFormat,
+ int iLayerPlane,
+ int attrib,
+ int *pvalue )
+{
+ uint count;
+ uint index;
+ const struct pixelformat_info *pf;
+
+ count = pixelformat_get_extended_count();
+
+ if (attrib == WGL_NUMBER_PIXEL_FORMATS_ARB) {
+ *pvalue = (int) count;
+ return TRUE;
+ }
+
+ index = (uint) iPixelFormat - 1;
+ if (index >= count)
+ return FALSE;
+
+ pf = pixelformat_get_info( index );
+
+ switch (attrib) {
+ case WGL_DRAW_TO_WINDOW_ARB:
+ *pvalue = TRUE;
+ return TRUE;
+
+ case WGL_DRAW_TO_BITMAP_ARB:
+ *pvalue = FALSE;
+ return TRUE;
+
+ case WGL_NEED_PALETTE_ARB:
+ *pvalue = FALSE;
+ return TRUE;
+
+ case WGL_NEED_SYSTEM_PALETTE_ARB:
+ *pvalue = FALSE;
+ return TRUE;
+
+ case WGL_SWAP_METHOD_ARB:
+ if (pf->flags & PF_FLAG_DOUBLEBUFFER)
+ *pvalue = WGL_SWAP_COPY_ARB;
+ else
+ *pvalue = WGL_SWAP_UNDEFINED_ARB;
+ return TRUE;
+
+ case WGL_SWAP_LAYER_BUFFERS_ARB:
+ *pvalue = FALSE;
+ return TRUE;
+
+ case WGL_NUMBER_OVERLAYS_ARB:
+ *pvalue = 0;
+ return TRUE;
+
+ case WGL_NUMBER_UNDERLAYS_ARB:
+ *pvalue = 0;
+ return TRUE;
+ }
+
+ if (iLayerPlane != 0)
+ return FALSE;
+
+ switch (attrib) {
+ case WGL_ACCELERATION_ARB:
+ *pvalue = WGL_FULL_ACCELERATION_ARB;
+ break;
+
+ case WGL_TRANSPARENT_ARB:
+ *pvalue = FALSE;
+ break;
+
+ case WGL_TRANSPARENT_RED_VALUE_ARB:
+ case WGL_TRANSPARENT_GREEN_VALUE_ARB:
+ case WGL_TRANSPARENT_BLUE_VALUE_ARB:
+ case WGL_TRANSPARENT_ALPHA_VALUE_ARB:
+ case WGL_TRANSPARENT_INDEX_VALUE_ARB:
+ break;
+
+ case WGL_SHARE_DEPTH_ARB:
+ case WGL_SHARE_STENCIL_ARB:
+ case WGL_SHARE_ACCUM_ARB:
+ *pvalue = TRUE;
+ break;
+
+ case WGL_SUPPORT_GDI_ARB:
+ *pvalue = FALSE;
+ break;
+
+ case WGL_SUPPORT_OPENGL_ARB:
+ *pvalue = TRUE;
+ break;
+
+ case WGL_DOUBLE_BUFFER_ARB:
+ if (pf->flags & PF_FLAG_DOUBLEBUFFER)
+ *pvalue = TRUE;
+ else
+ *pvalue = FALSE;
+ break;
+
+ case WGL_STEREO_ARB:
+ *pvalue = FALSE;
+ break;
+
+ case WGL_PIXEL_TYPE_ARB:
+ *pvalue = WGL_TYPE_RGBA_ARB;
+ break;
+
+ case WGL_COLOR_BITS_ARB:
+ *pvalue = (int) (pf->color.redbits + pf->color.greenbits + pf->color.bluebits);
+ break;
+
+ case WGL_RED_BITS_ARB:
+ *pvalue = (int) pf->color.redbits;
+ break;
+
+ case WGL_RED_SHIFT_ARB:
+ *pvalue = (int) pf->color.redshift;
+ break;
+
+ case WGL_GREEN_BITS_ARB:
+ *pvalue = (int) pf->color.greenbits;
+ break;
+
+ case WGL_GREEN_SHIFT_ARB:
+ *pvalue = (int) pf->color.greenshift;
+ break;
+
+ case WGL_BLUE_BITS_ARB:
+ *pvalue = (int) pf->color.bluebits;
+ break;
+
+ case WGL_BLUE_SHIFT_ARB:
+ *pvalue = (int) pf->color.blueshift;
+ break;
+
+ case WGL_ALPHA_BITS_ARB:
+ *pvalue = (int) pf->alpha.alphabits;
+ break;
+
+ case WGL_ALPHA_SHIFT_ARB:
+ *pvalue = (int) pf->alpha.alphashift;
+ break;
+
+ case WGL_ACCUM_BITS_ARB:
+ case WGL_ACCUM_RED_BITS_ARB:
+ case WGL_ACCUM_GREEN_BITS_ARB:
+ case WGL_ACCUM_BLUE_BITS_ARB:
+ case WGL_ACCUM_ALPHA_BITS_ARB:
+ *pvalue = 0;
+ break;
+
+ case WGL_DEPTH_BITS_ARB:
+ *pvalue = (int) pf->depth.depthbits;
+ break;
+
+ case WGL_STENCIL_BITS_ARB:
+ *pvalue = (int) pf->depth.stencilbits;
+ break;
+
+ case WGL_AUX_BUFFERS_ARB:
+ *pvalue = 0;
+ break;
+
+ case WGL_SAMPLE_BUFFERS_ARB:
+ if (pf->flags & PF_FLAG_MULTISAMPLED)
+ *pvalue = wgl_query_sample_buffers();
+ else
+ *pvalue = 0;
+ break;
+
+ case WGL_SAMPLES_ARB:
+ if (pf->flags & PF_FLAG_MULTISAMPLED)
+ *pvalue = wgl_query_samples();
+ else
+ *pvalue = 0;
+ break;
+
+ default:
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+struct attrib_match_info
+{
+ int attribute;
+ int weight;
+ BOOL exact;
+};
+
+static struct attrib_match_info attrib_match[] = {
+
+ /* WGL_ARB_pixel_format */
+ { WGL_DRAW_TO_WINDOW_ARB, 0, TRUE },
+ { WGL_DRAW_TO_BITMAP_ARB, 0, TRUE },
+ { WGL_ACCELERATION_ARB, 0, TRUE },
+ { WGL_NEED_PALETTE_ARB, 0, TRUE },
+ { WGL_NEED_SYSTEM_PALETTE_ARB, 0, TRUE },
+ { WGL_SWAP_LAYER_BUFFERS_ARB, 0, TRUE },
+ { WGL_SWAP_METHOD_ARB, 0, TRUE },
+ { WGL_NUMBER_OVERLAYS_ARB, 4, FALSE },
+ { WGL_NUMBER_UNDERLAYS_ARB, 4, FALSE },
+ /*{ WGL_SHARE_DEPTH_ARB, 0, TRUE },*/ /* no overlays -- ignore */
+ /*{ WGL_SHARE_STENCIL_ARB, 0, TRUE },*/ /* no overlays -- ignore */
+ /*{ WGL_SHARE_ACCUM_ARB, 0, TRUE },*/ /* no overlays -- ignore */
+ { WGL_SUPPORT_GDI_ARB, 0, TRUE },
+ { WGL_SUPPORT_OPENGL_ARB, 0, TRUE },
+ { WGL_DOUBLE_BUFFER_ARB, 0, TRUE },
+ { WGL_STEREO_ARB, 0, TRUE },
+ { WGL_PIXEL_TYPE_ARB, 0, TRUE },
+ { WGL_COLOR_BITS_ARB, 1, FALSE },
+ { WGL_RED_BITS_ARB, 1, FALSE },
+ { WGL_GREEN_BITS_ARB, 1, FALSE },
+ { WGL_BLUE_BITS_ARB, 1, FALSE },
+ { WGL_ALPHA_BITS_ARB, 1, FALSE },
+ { WGL_ACCUM_BITS_ARB, 1, FALSE },
+ { WGL_ACCUM_RED_BITS_ARB, 1, FALSE },
+ { WGL_ACCUM_GREEN_BITS_ARB, 1, FALSE },
+ { WGL_ACCUM_BLUE_BITS_ARB, 1, FALSE },
+ { WGL_ACCUM_ALPHA_BITS_ARB, 1, FALSE },
+ { WGL_DEPTH_BITS_ARB, 1, FALSE },
+ { WGL_STENCIL_BITS_ARB, 1, FALSE },
+ { WGL_AUX_BUFFERS_ARB, 2, FALSE },
+
+ /* WGL_ARB_multisample */
+ { WGL_SAMPLE_BUFFERS_ARB, 2, FALSE },
+ { WGL_SAMPLES_ARB, 2, FALSE }
+};
+
+struct pixelformat_score
+{
+ int points;
+ uint index;
+};
+
+static BOOL
+score_pixelformats(
+ struct pixelformat_score *scores,
+ uint count,
+ int attribute,
+ int expected_value )
+{
+ uint i;
+ struct attrib_match_info *ami = NULL;
+ uint index;
+
+ /* Find out if a given attribute should be considered for score calculation.
+ */
+ for (i = 0; i < sizeof( attrib_match ) / sizeof( attrib_match[0] ); i++) {
+ if (attrib_match[i].attribute == attribute) {
+ ami = &attrib_match[i];
+ break;
+ }
+ }
+ if (ami == NULL)
+ return TRUE;
+
+ /* Iterate all pixelformats, query the requested attribute and calculate
+ * score points.
+ */
+ for (index = 0; index < count; index++) {
+ int actual_value;
+
+ if (!query_attrib( index + 1, 0, attribute, &actual_value ))
+ return FALSE;
+
+ if (ami->exact) {
+ /* For an exact match criteria, if the actual and expected values differ,
+ * the score is set to 0 points, effectively removing the pixelformat
+ * from a list of matching pixelformats.
+ */
+ if (actual_value != expected_value)
+ scores[index].points = 0;
+ }
+ else {
+ /* For a minimum match criteria, if the actual value is smaller than the expected
+ * value, the pixelformat is rejected (score set to 0). However, if the actual
+ * value is bigger, the pixelformat is given a penalty to favour pixelformats that
+ * more closely match the expected values.
+ */
+ if (actual_value < expected_value)
+ scores[index].points = 0;
+ else if (actual_value > expected_value)
+ scores[index].points -= (actual_value - expected_value) * ami->weight;
+ }
+ }
+
+ return TRUE;
+}
+
+WINGDIAPI BOOL APIENTRY
+wglChoosePixelFormatARB(
+ HDC hdc,
+ const int *piAttribIList,
+ const FLOAT *pfAttribFList,
+ UINT nMaxFormats,
+ int *piFormats,
+ UINT *nNumFormats )
+{
+ uint count;
+ struct pixelformat_score *scores;
+ uint i;
+
+ *nNumFormats = 0;
+
+ /* Allocate and initialize pixelformat score table -- better matches
+ * have higher scores. Start with a high score and take out penalty
+ * points for a mismatch when the match does not have to be exact.
+ * Set a score to 0 if there is a mismatch for an exact match criteria.
+ */
+ count = pixelformat_get_extended_count();
+ scores = (struct pixelformat_score *) MALLOC( count * sizeof( struct pixelformat_score ) );
+ if (scores == NULL)
+ return FALSE;
+ for (i = 0; i < count; i++) {
+ scores[i].points = 0x7fffffff;
+ scores[i].index = i;
+ }
+
+ /* Given the attribute list calculate a score for each pixelformat.
+ */
+ if (piAttribIList != NULL) {
+ while (*piAttribIList != 0) {
+ if (!score_pixelformats( scores, count, piAttribIList[0], piAttribIList[1] )) {
+ FREE( scores );
+ return FALSE;
+ }
+ piAttribIList += 2;
+ }
+ }
+ if (pfAttribFList != NULL) {
+ while (*pfAttribFList != 0) {
+ if (!score_pixelformats( scores, count, (int) pfAttribFList[0], (int) pfAttribFList[1] )) {
+ FREE( scores );
+ return FALSE;
+ }
+ pfAttribFList += 2;
+ }
+ }
+
+ /* Bubble-sort the resulting scores. Pixelformats with higher scores go first.
+ * TODO: Find out if there are any patent issues with it.
+ */
+ if (count > 1) {
+ uint n = count;
+ boolean swapped;
+
+ do {
+ swapped = FALSE;
+ for (i = 1; i < n; i++) {
+ if (scores[i - 1].points < scores[i].points) {
+ struct pixelformat_score score = scores[i - 1];
+
+ scores[i - 1] = scores[i];
+ scores[i] = score;
+ swapped = TRUE;
+ }
+ }
+ n--;
+ }
+ while (swapped);
+ }
+
+ /* Return a list of pixelformats that are the best match.
+ * Reject pixelformats with non-positive scores.
+ */
+ for (i = 0; i < count; i++) {
+ if (scores[i].points > 0) {
+ if (*nNumFormats < nMaxFormats)
+ piFormats[*nNumFormats] = scores[i].index + 1;
+ (*nNumFormats)++;
+ }
+ }
+
+ FREE( scores );
+ return TRUE;
+}
+
+WINGDIAPI BOOL APIENTRY
+wglGetPixelFormatAttribfvARB(
+ HDC hdc,
+ int iPixelFormat,
+ int iLayerPlane,
+ UINT nAttributes,
+ const int *piAttributes,
+ FLOAT *pfValues )
+{
+ UINT i;
+
+ (void) hdc;
+
+ for (i = 0; i < nAttributes; i++) {
+ int value;
+
+ if (!query_attrib( iPixelFormat, iLayerPlane, piAttributes[i], &value ))
+ return FALSE;
+ pfValues[i] = (FLOAT) value;
+ }
+
+ return TRUE;
+}
+
+WINGDIAPI BOOL APIENTRY
+wglGetPixelFormatAttribivARB(
+ HDC hdc,
+ int iPixelFormat,
+ int iLayerPlane,
+ UINT nAttributes,
+ const int *piAttributes,
+ int *piValues )
+{
+ UINT i;
+
+ (void) hdc;
+
+ for (i = 0; i < nAttributes; i++) {
+ if (!query_attrib( iPixelFormat, iLayerPlane, piAttributes[i], &piValues[i] ))
+ return FALSE;
+ }
+
+ return TRUE;
+}
--- /dev/null
+/**************************************************************************
+ *
+ * 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 WGL_ARBPIXELFORMAT_H
+#define WGL_ARBPIXELFORMAT_H
+
+WINGDIAPI BOOL APIENTRY
+wglChoosePixelFormatARB(
+ HDC hdc,
+ const int *piAttribIList,
+ const FLOAT *pfAttribFList,
+ UINT nMaxFormats,
+ int *piFormats,
+ UINT *nNumFormats );
+
+WINGDIAPI BOOL APIENTRY
+wglGetPixelFormatAttribfvARB(
+ HDC hdc,
+ int iPixelFormat,
+ int iLayerPlane,
+ UINT nAttributes,
+ const int *piAttributes,
+ FLOAT *pfValues );
+
+WINGDIAPI BOOL APIENTRY
+wglGetPixelFormatAttribivARB(
+ HDC hdc,
+ int iPixelFormat,
+ int iLayerPlane,
+ UINT nAttributes,
+ const int *piAttributes,
+ int *piValues );
+
+#endif /* WGL_ARBPIXELFORMAT_H */
--- /dev/null
+/**************************************************************************
+ *
+ * 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 "main/mtypes.h"
+#include "main/context.h"
+#include "pipe/p_compiler.h"
+#include "pipe/p_context.h"
+#include "state_tracker/st_context.h"
+#include "state_tracker/st_public.h"
+#include "shared/stw_device.h"
+#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"
+
+static struct wgl_context *ctx_head = NULL;
+
+static HDC current_hdc = NULL;
+static HGLRC current_hrc = NULL;
+
+WINGDIAPI BOOL APIENTRY
+wglCopyContext(
+ HGLRC hglrcSrc,
+ HGLRC hglrcDst,
+ UINT mask )
+{
+ (void) hglrcSrc;
+ (void) hglrcDst;
+ (void) mask;
+
+ return FALSE;
+}
+
+WINGDIAPI HGLRC APIENTRY
+wglCreateContext(
+ HDC hdc )
+{
+ uint pfi;
+ const struct pixelformat_info *pf;
+ struct wgl_context *ctx;
+ GLvisual *visual;
+ struct pipe_context *pipe;
+
+ pfi = wglGetPixelFormat( hdc );
+ if (pfi == 0)
+ return NULL;
+
+ pf = pixelformat_get_info( pfi - 1 );
+
+ ctx = CALLOC_STRUCT( wgl_context );
+ if (ctx == NULL)
+ return NULL;
+
+ ctx->hdc = hdc;
+ ctx->color_bits = GetDeviceCaps( ctx->hdc, BITSPIXEL );
+
+ /* Create visual based on flags
+ */
+ visual = _mesa_create_visual(
+ GL_TRUE,
+ (pf->flags & PF_FLAG_DOUBLEBUFFER) ? GL_TRUE : GL_FALSE,
+ GL_FALSE,
+ pf->color.redbits,
+ pf->color.greenbits,
+ pf->color.bluebits,
+ pf->alpha.alphabits,
+ 0,
+ pf->depth.depthbits,
+ pf->depth.stencilbits,
+ 0,
+ 0,
+ 0,
+ 0,
+ (pf->flags & PF_FLAG_MULTISAMPLED) ? wgl_query_samples() : 0 );
+ if (visual == NULL) {
+ FREE( ctx );
+ return NULL;
+ }
+
+ pipe = stw_dev->stw_winsys->create_context( stw_dev->screen );
+ if (!pipe) {
+ _mesa_destroy_visual( visual );
+ FREE( ctx );
+ return NULL;
+ }
+
+ assert(!pipe->priv);
+ pipe->priv = hdc;
+
+ ctx->st = st_create_context( pipe, visual, NULL );
+ if (ctx->st == NULL) {
+ pipe->destroy( pipe );
+ _mesa_destroy_visual( visual );
+ FREE( ctx );
+ return NULL;
+ }
+ ctx->st->ctx->DriverCtx = ctx;
+
+ ctx->next = ctx_head;
+ ctx_head = ctx;
+
+ return (HGLRC) ctx;
+}
+
+WINGDIAPI HGLRC APIENTRY
+wglCreateLayerContext(
+ HDC hdc,
+ int iLayerPlane )
+{
+ (void) hdc;
+ (void) iLayerPlane;
+
+ return NULL;
+}
+
+WINGDIAPI BOOL APIENTRY
+wglDeleteContext(
+ HGLRC hglrc )
+{
+ struct wgl_context **link = &ctx_head;
+ struct wgl_context *ctx = ctx_head;
+
+ while (ctx != NULL) {
+ if (ctx == (struct wgl_context *) hglrc) {
+ GLcontext *glctx = ctx->st->ctx;
+ GET_CURRENT_CONTEXT( glcurctx );
+ struct stw_framebuffer *fb;
+
+ /* Unbind current if deleting current context.
+ */
+ if (glcurctx == glctx)
+ st_make_current( NULL, NULL, NULL );
+
+ fb = framebuffer_from_hdc( ctx->hdc );
+ if (fb)
+ framebuffer_destroy( fb );
+
+ if (WindowFromDC( ctx->hdc ) != NULL)
+ ReleaseDC( WindowFromDC( ctx->hdc ), ctx->hdc );
+
+ st_destroy_context( ctx->st );
+
+ *link = ctx->next;
+ FREE( ctx );
+ return TRUE;
+ }
+
+ link = &ctx->next;
+ ctx = ctx->next;
+ }
+
+ return FALSE;
+}
+
+/* Find the width and height of the window named by hdc.
+ */
+static void
+get_window_size( HDC hdc, GLuint *width, GLuint *height )
+{
+ if (WindowFromDC( hdc )) {
+ RECT rect;
+
+ GetClientRect( WindowFromDC( hdc ), &rect );
+ *width = rect.right - rect.left;
+ *height = rect.bottom - rect.top;
+ }
+ else {
+ *width = GetDeviceCaps( hdc, HORZRES );
+ *height = GetDeviceCaps( hdc, VERTRES );
+ }
+}
+
+WINGDIAPI HGLRC APIENTRY
+wglGetCurrentContext( VOID )
+{
+ return current_hrc;
+}
+
+WINGDIAPI HDC APIENTRY
+wglGetCurrentDC( VOID )
+{
+ return current_hdc;
+}
+
+WINGDIAPI BOOL APIENTRY
+wglMakeCurrent(
+ HDC hdc,
+ HGLRC hglrc )
+{
+ struct wgl_context *ctx = ctx_head;
+ GET_CURRENT_CONTEXT( glcurctx );
+ struct stw_framebuffer *fb;
+ GLuint width = 0;
+ GLuint height = 0;
+
+ current_hdc = hdc;
+ current_hrc = hglrc;
+
+ if (hdc == NULL || hglrc == NULL) {
+ st_make_current( NULL, NULL, NULL );
+ return TRUE;
+ }
+
+ while (ctx != NULL) {
+ if (ctx == (struct wgl_context *) hglrc)
+ break;
+ ctx = ctx->next;
+ }
+ if (ctx == NULL)
+ return FALSE;
+
+ /* Return if already current.
+ */
+ if (glcurctx != NULL) {
+ struct wgl_context *curctx = (struct wgl_context *) glcurctx->DriverCtx;
+
+ if (curctx != NULL && curctx == ctx && ctx->hdc == hdc)
+ return TRUE;
+ }
+
+ fb = framebuffer_from_hdc( hdc );
+
+ if (hdc != NULL)
+ get_window_size( hdc, &width, &height );
+
+ /* Lazy creation of framebuffers.
+ */
+ if (fb == NULL && ctx != NULL && hdc != NULL) {
+ GLvisual *visual = &ctx->st->ctx->Visual;
+
+ fb = framebuffer_create( hdc, visual, width, height );
+ if (fb == NULL)
+ return FALSE;
+
+ fb->dib_hDC = CreateCompatibleDC( hdc );
+ fb->hbmDIB = NULL;
+ fb->pbPixels = NULL;
+ }
+
+ if (ctx && fb) {
+ st_make_current( ctx->st, fb->stfb, fb->stfb );
+ framebuffer_resize( fb, width, height );
+ ctx->hdc = hdc;
+ ctx->st->pipe->priv = hdc;
+ }
+ else {
+ /* Detach */
+ st_make_current( NULL, NULL, NULL );
+ }
+
+ return TRUE;
+}
+
+struct wgl_context *
+wgl_context_from_hdc(
+ HDC hdc )
+{
+ struct wgl_context *ctx = ctx_head;
+
+ while (ctx != NULL) {
+ if (ctx->hdc == hdc)
+ return ctx;
+ ctx = ctx->next;
+ }
+ return NULL;
+}
+
+#include "stw_wgl.c"
--- /dev/null
+/**************************************************************************
+ *
+ * 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 WGL_CONTEXT_H
+#define WGL_CONTEXT_H
+
+#include <windows.h>
+
+struct st_context;
+
+struct wgl_context
+{
+ struct st_context *st;
+ HDC hdc;
+ DWORD color_bits;
+ struct wgl_context *next;
+};
+
+struct wgl_context *
+wgl_context_from_hdc(HDC hdc );
+
+#endif /* WGL_CONTEXT_H */
--- /dev/null
+/**************************************************************************
+ *
+ * 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 "glapi/glapi.h"
+#include "stw_wgl_arbextensionsstring.h"
+#include "stw_wgl_arbpixelformat.h"
+
+struct extension_entry
+{
+ const char *name;
+ PROC proc;
+};
+
+#define EXTENTRY(P) { #P, (PROC) P }
+
+static struct extension_entry extension_entries[] = {
+
+ /* WGL_ARB_extensions_string */
+ EXTENTRY( wglGetExtensionsStringARB ),
+
+ /* WGL_ARB_pixel_format */
+ EXTENTRY( wglChoosePixelFormatARB ),
+ EXTENTRY( wglGetPixelFormatAttribfvARB ),
+ EXTENTRY( wglGetPixelFormatAttribivARB ),
+
+ { NULL, NULL }
+};
+
+WINGDIAPI PROC APIENTRY
+wglGetProcAddress(
+ LPCSTR lpszProc )
+{
+ struct extension_entry *entry;
+
+ PROC p = (PROC) _glapi_get_proc_address( (const char *) lpszProc );
+ if (p)
+ return p;
+
+ for (entry = extension_entries; entry->name; entry++)
+ if (strcmp( lpszProc, entry->name ) == 0)
+ return entry->proc;
+
+ return NULL;
+}
--- /dev/null
+/**************************************************************************
+ *
+ * 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 "pipe/p_compiler.h"
+#include "pipe/p_debug.h"
+#include "shared/stw_pixelformat.h"
+#include "stw_wgl.h"
+
+static uint currentpixelformat = 0;
+
+WINGDIAPI int APIENTRY
+wglChoosePixelFormat(
+ HDC hdc,
+ CONST PIXELFORMATDESCRIPTOR *ppfd )
+{
+ uint count;
+ uint index;
+ uint bestindex;
+ uint bestdelta;
+
+ (void) hdc;
+
+ count = pixelformat_get_count();
+ bestindex = count;
+ bestdelta = 0xffffffff;
+
+ if (ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR ) || ppfd->nVersion != 1)
+ return 0;
+ if (ppfd->iPixelType != PFD_TYPE_RGBA)
+ return 0;
+ if (!(ppfd->dwFlags & PFD_DRAW_TO_WINDOW))
+ return 0;
+ if (!(ppfd->dwFlags & PFD_SUPPORT_OPENGL))
+ return 0;
+ if (ppfd->dwFlags & PFD_DRAW_TO_BITMAP)
+ return 0;
+ if (ppfd->dwFlags & PFD_SUPPORT_GDI)
+ return 0;
+ if (!(ppfd->dwFlags & PFD_STEREO_DONTCARE) && (ppfd->dwFlags & PFD_STEREO))
+ return 0;
+
+ for (index = 0; index < count; index++) {
+ uint delta = 0;
+ const struct pixelformat_info *pf = pixelformat_get_info( index );
+
+ if (!(ppfd->dwFlags & PFD_DOUBLEBUFFER_DONTCARE)) {
+ if ((ppfd->dwFlags & PFD_DOUBLEBUFFER) && !(pf->flags & PF_FLAG_DOUBLEBUFFER))
+ continue;
+ if (!(ppfd->dwFlags & PFD_DOUBLEBUFFER) && (pf->flags & PF_FLAG_DOUBLEBUFFER))
+ continue;
+ }
+
+ if (ppfd->cColorBits != pf->color.redbits + pf->color.greenbits + pf->color.bluebits)
+ delta += 8;
+
+ if (ppfd->cDepthBits != pf->depth.depthbits)
+ delta += 4;
+
+ if (ppfd->cStencilBits != pf->depth.stencilbits)
+ delta += 2;
+
+ if (ppfd->cAlphaBits != pf->alpha.alphabits)
+ delta++;
+
+ if (delta < bestdelta) {
+ bestindex = index;
+ bestdelta = delta;
+ if (bestdelta == 0)
+ break;
+ }
+ }
+
+ if (bestindex == count)
+ return 0;
+ return bestindex + 1;
+}
+
+WINGDIAPI int APIENTRY
+wglDescribePixelFormat(
+ HDC hdc,
+ int iPixelFormat,
+ UINT nBytes,
+ LPPIXELFORMATDESCRIPTOR ppfd )
+{
+ uint count;
+ uint index;
+ const struct pixelformat_info *pf;
+
+ (void) hdc;
+
+ count = pixelformat_get_extended_count();
+ index = (uint) iPixelFormat - 1;
+
+ if (ppfd == NULL)
+ return count;
+ if (index >= count || nBytes != sizeof( PIXELFORMATDESCRIPTOR ))
+ return 0;
+
+ pf = pixelformat_get_info( index );
+
+ ppfd->nSize = sizeof( PIXELFORMATDESCRIPTOR );
+ ppfd->nVersion = 1;
+ ppfd->dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
+ if (pf->flags & PF_FLAG_DOUBLEBUFFER)
+ ppfd->dwFlags |= PFD_DOUBLEBUFFER | PFD_SWAP_COPY;
+ ppfd->iPixelType = PFD_TYPE_RGBA;
+ ppfd->cColorBits = pf->color.redbits + pf->color.greenbits + pf->color.bluebits;
+ ppfd->cRedBits = pf->color.redbits;
+ ppfd->cRedShift = pf->color.redshift;
+ ppfd->cGreenBits = pf->color.greenbits;
+ ppfd->cGreenShift = pf->color.greenshift;
+ ppfd->cBlueBits = pf->color.bluebits;
+ ppfd->cBlueShift = pf->color.blueshift;
+ ppfd->cAlphaBits = pf->alpha.alphabits;
+ ppfd->cAlphaShift = pf->alpha.alphashift;
+ ppfd->cAccumBits = 0;
+ ppfd->cAccumRedBits = 0;
+ ppfd->cAccumGreenBits = 0;
+ ppfd->cAccumBlueBits = 0;
+ ppfd->cAccumAlphaBits = 0;
+ ppfd->cDepthBits = pf->depth.depthbits;
+ ppfd->cStencilBits = pf->depth.stencilbits;
+ ppfd->cAuxBuffers = 0;
+ ppfd->iLayerType = 0;
+ ppfd->bReserved = 0;
+ ppfd->dwLayerMask = 0;
+ ppfd->dwVisibleMask = 0;
+ ppfd->dwDamageMask = 0;
+
+ return count;
+}
+
+WINGDIAPI int APIENTRY
+wglGetPixelFormat(
+ HDC hdc )
+{
+ (void) hdc;
+
+ return currentpixelformat;
+}
+
+WINGDIAPI BOOL APIENTRY
+wglSetPixelFormat(
+ HDC hdc,
+ int iPixelFormat,
+ const PIXELFORMATDESCRIPTOR *ppfd )
+{
+ uint count;
+ uint index;
+
+ (void) hdc;
+
+ count = pixelformat_get_extended_count();
+ index = (uint) iPixelFormat - 1;
+
+ if (index >= count || ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR ))
+ return FALSE;
+
+ currentpixelformat = index + 1;
+ return TRUE;
+}
--- /dev/null
+/**************************************************************************
+ *
+ * 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 "pipe/p_winsys.h"
+#include "pipe/p_screen.h"
+#include "pipe/p_context.h"
+#include "state_tracker/st_context.h"
+#include "state_tracker/st_public.h"
+#include "shared/stw_winsys.h"
+#include "shared/stw_device.h"
+#include "shared/stw_framebuffer.h"
+#include "stw_wgl.h"
+
+WINGDIAPI BOOL APIENTRY
+wglSwapBuffers(
+ HDC hdc )
+{
+ struct stw_framebuffer *fb;
+ struct pipe_surface *surf;
+
+ fb = framebuffer_from_hdc( hdc );
+ if (fb == NULL)
+ return FALSE;
+
+ /* If we're swapping the buffer associated with the current context
+ * we have to flush any pending rendering commands first.
+ */
+ st_notify_swapbuffers( fb->stfb );
+
+ st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT, &surf );
+
+ stw_dev->stw_winsys->flush_frontbuffer(stw_dev->screen->winsys,
+ surf,
+ hdc );
+
+ return TRUE;
+}
+
+WINGDIAPI BOOL APIENTRY
+wglSwapLayerBuffers(
+ HDC hdc,
+ UINT fuPlanes )
+{
+ (void) hdc;
+ (void) fuPlanes;
+
+ return FALSE;
+}