Put back reactos specific changes from old mesa32 directory.
authorGregor Anich <blight@blight.eu.org>
Fri, 4 Nov 2005 14:52:02 +0000 (14:52 +0000)
committerGregor Anich <blight@blight.eu.org>
Fri, 4 Nov 2005 14:52:02 +0000 (14:52 +0000)
svn path=/trunk/; revision=18991

13 files changed:
reactos/lib/mesa32/README.ReactOS [new file with mode: 0644]
reactos/lib/mesa32/include/GL/gl.h
reactos/lib/mesa32/include/GL/mesa_wgl.h
reactos/lib/mesa32/include/GL/wmesa.h
reactos/lib/mesa32/mesa32.def [new file with mode: 0644]
reactos/lib/mesa32/mesa32.xml [new file with mode: 0644]
reactos/lib/mesa32/src/drivers/windows/gdi/wmesa.c
reactos/lib/mesa32/src/drivers/windows/gdi/wmesadef.h
reactos/lib/mesa32/src/main/glheader.h
reactos/lib/mesa32/src/main/texcompress_s3tc.c
reactos/lib/mesa32/src/main/texformat_tmp.h
reactos/lib/mesa32/src/x86/common_x86.c
reactos/lib/mesa32/src/x86/glapi_x86.S

diff --git a/reactos/lib/mesa32/README.ReactOS b/reactos/lib/mesa32/README.ReactOS
new file mode 100644 (file)
index 0000000..bed2fc3
--- /dev/null
@@ -0,0 +1,8 @@
+This is Mesa-6.2 (http://www.mesa3d.org/) with an ICD interface.
+
+The ICD functions are in src/drivers/windows/icd/icd.c
+I have created a new Makefile for ReactOS which will build Mesa with the ICD
+interface. I have not adjusted the Visual C++ project/workspace files.
+
+ --blight
index 3f3f310..2bfdb69 100644 (file)
@@ -53,9 +53,9 @@
 #endif
 
 #if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__))
-#  if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
+#  if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
 #    define GLAPI __declspec(dllexport)
-#  elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
+#  elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
 #    define GLAPI __declspec(dllimport)
 #  else /* for use with static link lib build of Win32 edition only */
 #    define GLAPI extern
index a331bb3..2147376 100644 (file)
@@ -32,7 +32,7 @@
 #define _mesa_wgl_h_
 
 
-#include <gl/gl.h>
+#include <GL/gl.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -40,10 +40,10 @@ extern "C" {
 
 
 #if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN32__))
-#  if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
+#  if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
 #    define GLAPI __declspec(dllexport)
 #    define WGLAPI __declspec(dllexport)
-#  elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
+#  elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
 #    define GLAPI __declspec(dllimport)
 #    define WGLAPI __declspec(dllimport)
 #  else /* for use with static link lib build of Win32 edition only */
index 79b3c82..0a6e8b6 100644 (file)
@@ -50,7 +50,7 @@ extern "C" {
 #endif
 
 
-#include "gl\gl.h"
+#include "GL/gl.h"
 
 #if defined(_MSV_VER) && !defined(__GNUC__)
 #  pragma warning (disable:4273)
diff --git a/reactos/lib/mesa32/mesa32.def b/reactos/lib/mesa32/mesa32.def
new file mode 100644 (file)
index 0000000..263b9d4
--- /dev/null
@@ -0,0 +1,110 @@
+DESCRIPTION 'Mesa (OpenGL driver) for Win32'
+VERSION 6.1
+
+EXPORTS
+;
+; ICD API
+       DrvCopyContext
+       DrvCreateContext
+       DrvCreateLayerContext
+       DrvDeleteContext
+       DrvDescribeLayerPlane
+       DrvDescribePixelFormat
+       DrvGetLayerPaletteEntries
+       DrvGetProcAddress
+       DrvReleaseContext
+       DrvRealizeLayerPalette
+       DrvSetContext
+       DrvSetLayerPaletteEntries
+       DrvSetPixelFormat
+       DrvShareLists
+       DrvSwapBuffers
+       DrvSwapLayerBuffers
+       DrvValidateVersion
+
+;
+; Mesa internals - mostly for OSMESA
+       _ac_CreateContext
+       _ac_DestroyContext
+       _ac_InvalidateState
+       _glapi_get_context
+       _glapi_get_proc_address
+       _mesa_buffer_data
+       _mesa_buffer_map
+       _mesa_buffer_subdata
+       _mesa_bzero
+       _mesa_calloc
+       _mesa_choose_tex_format
+       _mesa_compressed_texture_size
+       _mesa_create_framebuffer
+       _mesa_create_visual
+       _mesa_delete_buffer_object
+       _mesa_delete_texture_object
+       _mesa_destroy_framebuffer
+       _mesa_destroy_visual
+       _mesa_enable_1_3_extensions
+       _mesa_enable_1_4_extensions
+       _mesa_enable_1_5_extensions
+       _mesa_enable_sw_extensions
+       _mesa_error
+       _mesa_free
+       _mesa_free_context_data
+       _mesa_get_current_context
+       _mesa_init_default_imports
+       _mesa_init_driver_functions
+       _mesa_initialize_context
+       _mesa_make_current
+       _mesa_memcpy
+       _mesa_memset
+       _mesa_new_buffer_object
+       _mesa_new_texture_object
+       _mesa_problem
+       _mesa_ResizeBuffersMESA
+       _mesa_store_compressed_teximage1d
+       _mesa_store_compressed_teximage2d
+       _mesa_store_compressed_teximage3d
+       _mesa_store_compressed_texsubimage1d
+       _mesa_store_compressed_texsubimage2d
+       _mesa_store_compressed_texsubimage3d
+       _mesa_store_teximage1d
+       _mesa_store_teximage2d
+       _mesa_store_teximage3d
+       _mesa_store_texsubimage1d
+       _mesa_store_texsubimage2d
+       _mesa_store_texsubimage3d
+       _mesa_strcmp
+       _mesa_test_proxy_teximage
+       _mesa_Viewport
+       _swrast_Accum
+       _swrast_alloc_buffers
+       _swrast_Bitmap
+       _swrast_CopyPixels
+       _swrast_DrawBuffer
+       _swrast_DrawPixels
+       _swrast_GetDeviceDriverReference
+       _swrast_Clear
+       _swrast_choose_line
+       _swrast_choose_triangle
+       _swrast_CopyColorSubTable
+       _swrast_CopyColorTable
+       _swrast_CopyConvolutionFilter1D
+       _swrast_CopyConvolutionFilter2D
+       _swrast_copy_teximage1d
+       _swrast_copy_teximage2d
+       _swrast_copy_texsubimage1d
+       _swrast_copy_texsubimage2d
+       _swrast_copy_texsubimage3d
+       _swrast_CreateContext
+       _swrast_DestroyContext
+       _swrast_InvalidateState
+       _swrast_ReadPixels
+       _swrast_zbuffer_address
+       _swsetup_Wakeup
+       _swsetup_CreateContext
+       _swsetup_DestroyContext
+       _swsetup_InvalidateState
+       _tnl_CreateContext
+       _tnl_DestroyContext
+       _tnl_InvalidateState
+       _tnl_MakeCurrent
+       _tnl_run_pipeline
diff --git a/reactos/lib/mesa32/mesa32.xml b/reactos/lib/mesa32/mesa32.xml
new file mode 100644 (file)
index 0000000..f0ebc93
--- /dev/null
@@ -0,0 +1,209 @@
+<module name="mesa32" type="win32dll" baseaddress="${BASEADDRESS_MESA32}" installbase="system32" installname="mesa32.dll" allowwarnings="true">
+       <importlibrary definition="mesa32.def" />
+       <linkerflag>-Wl,--enable-stdcall-fixup</linkerflag>
+       <include base="mesa32">include</include>
+       <include base="mesa32">src</include>
+       <include base="mesa32">src/main</include>
+       <include base="mesa32">src/glapi</include>
+       <include base="mesa32">src/math</include>
+       <include base="mesa32">src/tnl</include>
+       <include base="mesa32">src/shader</include>
+       <include base="mesa32">src/swrast</include>
+       <include base="mesa32">src/swrast_setup</include>
+       <define name="BUILD_GL32" />
+       <define name="_OPENGL32_" />
+       <define name="STDCALL_API" />
+       <define name="USE_MGL_NAMESPACE" />
+       <define name="USE_X86_ASM" />
+       <define name="USE_MMX_ASM" />
+       <define name="USE_SSE_ASM" />
+       <define name="USE_3DNOW_ASM" />
+       <define name="__USE_W32API" />
+       <library>ntdll</library>
+       <library>kernel32</library>
+       <library>gdi32</library>
+       <directory name="src">
+               <directory name="array_cache">
+                       <file>ac_context.c</file>
+                       <file>ac_import.c</file>
+               </directory>
+               <directory name="drivers">
+                       <directory name="common">
+                               <file>driverfuncs.c</file>
+                       </directory>
+                       <directory name="windows">
+                               <directory name="gdi">
+                                       <file>wmesa.c</file>
+                               </directory>
+                               <directory name="icd">
+                                       <file>icd.c</file>
+                               </directory>
+                       </directory>
+               </directory>
+               <directory name="glapi">
+                       <file>glapi.c</file>
+                       <file>glthread.c</file>
+               </directory>
+               <directory name="main">
+                       <file>api_arrayelt.c</file>
+                       <file>api_loopback.c</file>
+                       <file>api_noop.c</file>
+                       <file>api_validate.c</file>
+                       <file>accum.c</file>
+                       <file>attrib.c</file>
+                       <file>blend.c</file>
+                       <file>bufferobj.c</file>
+                       <file>buffers.c</file>
+                       <file>clip.c</file>
+                       <file>colortab.c</file>
+                       <file>context.c</file>
+                       <file>convolve.c</file>
+                       <file>debug.c</file>
+                       <file>depth.c</file>
+                       <file>dispatch.c</file>
+                       <file>dlist.c</file>
+                       <file>drawpix.c</file>
+                       <file>enable.c</file>
+                       <file>enums.c</file>
+                       <file>eval.c</file>
+                       <file>extensions.c</file>
+                       <file>feedback.c</file>
+                       <file>fog.c</file>
+                       <file>get.c</file>
+                       <file>hash.c</file>
+                       <file>hint.c</file>
+                       <file>histogram.c</file>
+                       <file>image.c</file>
+                       <file>imports.c</file>
+                       <file>light.c</file>
+                       <file>lines.c</file>
+                       <file>matrix.c</file>
+                       <file>occlude.c</file>
+                       <file>pixel.c</file>
+                       <file>points.c</file>
+                       <file>polygon.c</file>
+                       <file>rastpos.c</file>
+                       <file>state.c</file>
+                       <file>stencil.c</file>
+                       <file>texcompress.c</file>
+                       <file>texcompress_s3tc.c</file>
+                       <file>texcompress_fxt1.c</file>
+                       <file>texformat.c</file>
+                       <file>teximage.c</file>
+                       <file>texobj.c</file>
+                       <file>texstate.c</file>
+                       <file>texstore.c</file>
+                       <file>varray.c</file>
+                       <file>vtxfmt.c</file>
+               </directory>
+               <directory name="math">
+                       <file>m_debug_clip.c</file>
+                       <file>m_debug_norm.c</file>
+                       <file>m_debug_xform.c</file>
+                       <file>m_eval.c</file>
+                       <file>m_matrix.c</file>
+                       <file>m_translate.c</file>
+                       <file>m_vector.c</file>
+                       <file>m_xform.c</file>
+               </directory>
+               <directory name="swrast">
+                       <file>s_fragprog_to_c.c</file>
+                       <file>s_aaline.c</file>
+                       <file>s_aatriangle.c</file>
+                       <file>s_accum.c</file>
+                       <file>s_alpha.c</file>
+                       <file>s_alphabuf.c</file>
+                       <file>s_auxbuffer.c</file>
+                       <file>s_bitmap.c</file>
+                       <file>s_blend.c</file>
+                       <file>s_buffers.c</file>
+                       <file>s_copypix.c</file>
+                       <file>s_context.c</file>
+                       <file>s_depth.c</file>
+                       <file>s_drawpix.c</file>
+                       <file>s_feedback.c</file>
+                       <file>s_fog.c</file>
+                       <file>s_imaging.c</file>
+                       <file>s_lines.c</file>
+                       <file>s_logic.c</file>
+                       <file>s_masking.c</file>
+                       <file>s_nvfragprog.c</file>
+                       <file>s_pixeltex.c</file>
+                       <file>s_points.c</file>
+                       <file>s_readpix.c</file>
+                       <file>s_span.c</file>
+                       <file>s_stencil.c</file>
+                       <file>s_tcc.c</file>
+                       <file>s_texture.c</file>
+                       <file>s_texstore.c</file>
+                       <file>s_triangle.c</file>
+                       <file>s_zoom.c</file>
+               </directory>
+               <directory name="swrast_setup">
+                       <file>ss_context.c</file>
+                       <file>ss_triangle.c</file>
+               </directory>
+               <directory name="shader">
+                       <file>arbfragparse.c</file>
+                       <file>arbprogparse.c</file>
+                       <file>arbprogram.c</file>
+                       <file>arbvertparse.c</file>
+                       <file>grammar_mesa.c</file>
+                       <file>nvfragparse.c</file>
+                       <file>nvprogram.c</file>
+                       <file>nvvertexec.c</file>
+                       <file>nvvertparse.c</file>
+                       <file>program.c</file>
+               </directory>
+               <directory name="tnl">
+                       <file>t_array_api.c</file>
+                       <file>t_array_import.c</file>
+                       <file>t_context.c</file>
+                       <file>t_pipeline.c</file>
+                       <file>t_save_api.c</file>
+                       <file>t_save_loopback.c</file>
+                       <file>t_save_playback.c</file>
+                       <file>t_vb_fog.c</file>
+                       <file>t_vb_light.c</file>
+                       <file>t_vb_normals.c</file>
+                       <file>t_vb_points.c</file>
+                       <file>t_vb_program.c</file>
+                       <file>t_vb_render.c</file>
+                       <file>t_vb_texgen.c</file>
+                       <file>t_vb_texmat.c</file>
+                       <file>t_vb_vertex.c</file>
+                       <file>t_vertex.c</file>
+                       <file>t_vertex_c.c</file>
+                       <file>t_vertex_codegen.c</file>
+                       <file>t_vtx_api.c</file>
+                       <file>t_vtx_generic.c</file>
+                       <file>t_vtx_eval.c</file>
+                       <file>t_vtx_exec.c</file>
+                       <file>t_vtx_x86.c</file>
+                       <file>t_vtx_x86_gcc.S</file>
+               </directory>
+               <directory name="x86">
+                       <file>3dnow.c</file>
+                       <file>3dnow_normal.S</file>
+                       <file>3dnow_xform1.S</file>
+                       <file>3dnow_xform2.S</file>
+                       <file>3dnow_xform3.S</file>
+                       <file>3dnow_xform4.S</file>
+                       <file>common_x86.c</file>
+                       <file>common_x86_asm.S</file>
+                       <file>glapi_x86.S</file>
+                       <file>mmx_blend.S</file>
+                       <file>sse.c</file>
+                       <file>sse_normal.S</file>
+                       <file>sse_xform1.S</file>
+                       <file>sse_xform2.S</file>
+                       <file>sse_xform3.S</file>
+                       <file>sse_xform4.S</file>
+                       <file>x86.c</file>
+                       <file>x86_xform2.S</file>
+                       <file>x86_xform3.S</file>
+                       <file>x86_xform4.S</file>
+                       <file>x86_cliptest.S</file>
+               </directory>
+       </directory>
+</module>
index ea13a31..09040c5 100644 (file)
@@ -18,7 +18,7 @@
  * Updated for Mesa 4.0 by Karl Schultz (kschultz@sourceforge.net)
  */
 
-#ifdef NDEBUG
+#if defined(NDEBUG) && defined(_MSC_VER)
 #pragma auto_inline(on)
 #pragma inline_depth(255)
 #pragma inline_recursion(on)
@@ -72,7 +72,7 @@
 /* Stereo and parallel not tested for Mesa 4.0. */
 #define NO_STEREO
 #if !defined(NO_STEREO)
-#include "gl\glu.h"
+#include "GL/glu.h"
 #include "stereo.h"
 #endif
 
@@ -112,6 +112,8 @@ WMesaContext WC = NULL;
 
 #if defined(_MSC_VER) && _MSC_VER >= 1200
 #define FORCEINLINE __forceinline
+#elif defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
+#define FORCEINLINE __attribute__((always_inline))
 #else
 #define FORCEINLINE __inline
 #endif
@@ -470,7 +472,7 @@ static void clear(GLcontext* ctx, GLbitfield mask,
    mask &= ~DD_BACK_LEFT_BIT; 
 #endif // DDRAW 
 #else 
-   DWORD   dwColor; 
+   DWORD   dwColor = 0
    WORD    wColor; 
    BYTE    bColor; 
    LPDWORD lpdw = (LPDWORD)Current->pbPixels; 
@@ -521,8 +523,6 @@ static void clear(GLcontext* ctx, GLbitfield mask,
          GetGValue(Current->clearpixel), 
          GetBValue(Current->clearpixel)); 
    }
-   else
-       dwColor = 0;
 
    if (nBypp != 3) 
    { 
index 3c267aa..d43e990 100644 (file)
@@ -70,7 +70,7 @@
 
 
 #include <windows.h>
-#include <GL\gl.h>
+#include <GL/gl.h>
 #include "context.h"
 #ifdef DDRAW
 #define DIRECTDRAW_VERSION 0x0100
index 025b3a5..e1315af 100644 (file)
 #      pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */
 #    endif
 #  endif
-#  if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
+#  if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
 #    define GLAPI __declspec(dllexport)
 #    define WGLAPI __declspec(dllexport)
-#  elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
+#  elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
 #    define GLAPI __declspec(dllimport)
 #    define WGLAPI __declspec(dllimport)
 #  else /* for use with static link lib build of Win32 edition only */
index 572cdd2..9644c5d 100644 (file)
@@ -286,7 +286,7 @@ fetch_texel_2d_f_rgb_dxt1( const struct gl_texture_image *texImage,
                             GLint i, GLint j, GLint k, GLfloat *texel )
 {
    /* just sample as GLchan and convert to float here */
-   GLchan rgba[4];
+   GLchan rgba[4] = {0, 0, 0, 0};
    fetch_texel_2d_rgb_dxt1(texImage, i, j, k, rgba);
    texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
    texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
@@ -308,7 +308,7 @@ fetch_texel_2d_f_rgba_dxt1( const struct gl_texture_image *texImage,
                             GLint i, GLint j, GLint k, GLfloat *texel )
 {
    /* just sample as GLchan and convert to float here */
-   GLchan rgba[4];
+   GLchan rgba[4] = {0, 0, 0, 0};
    fetch_texel_2d_rgba_dxt1(texImage, i, j, k, rgba);
    texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
    texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
@@ -330,7 +330,7 @@ fetch_texel_2d_f_rgba_dxt3( const struct gl_texture_image *texImage,
                             GLint i, GLint j, GLint k, GLfloat *texel )
 {
    /* just sample as GLchan and convert to float here */
-   GLchan rgba[4];
+   GLchan rgba[4] = {0, 0, 0, 0};
    fetch_texel_2d_rgba_dxt3(texImage, i, j, k, rgba);
    texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
    texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
@@ -352,7 +352,7 @@ fetch_texel_2d_f_rgba_dxt5( const struct gl_texture_image *texImage,
                             GLint i, GLint j, GLint k, GLfloat *texel )
 {
    /* just sample as GLchan and convert to float here */
-   GLchan rgba[4];
+   GLchan rgba[4] = {0, 0, 0, 0};
    fetch_texel_2d_rgba_dxt5(texImage, i, j, k, rgba);
    texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
    texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
index d341c78..5a920a8 100644 (file)
@@ -1,6 +1,7 @@
+/* $XFree86$ */
 /*
  * Mesa 3-D graphics library
- * Version:  6.1
+ * Version:  6.2
  *
  * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved.
  *
 #if DIM == 1
 
 #define CHAN_SRC( t, i, j, k, sz )                                     \
-       ((void) (j), (void) (k),                                        \
-        ((GLchan *)(t)->Data + (i) * (sz)))
+       ((GLchan *)(t)->Data + (i) * (sz))
 #define UBYTE_SRC( t, i, j, k, sz )                                    \
-       ((void) (j), (void) (k),                                        \
-        ((GLubyte *)(t)->Data + (i) * (sz)))
+       ((GLubyte *)(t)->Data + (i) * (sz))
 #define USHORT_SRC( t, i, j, k )                                       \
-       ((void) (j), (void) (k),                                        \
-        ((GLushort *)(t)->Data + (i)))
+       ((GLushort *)(t)->Data + (i))
 #define UINT_SRC( t, i, j, k )                                         \
-       ((void) (j), (void) (k),                                        \
-        ((GLuint *)(t)->Data + (i)))
+       ((GLuint *)(t)->Data + (i))
 #define FLOAT_SRC( t, i, j, k, sz )                                    \
-       ((void) (j), (void) (k),                                        \
-        ((GLfloat *)(t)->Data + (i) * (sz)))
+       ((GLfloat *)(t)->Data + (i) * (sz))
 #define HALF_SRC( t, i, j, k, sz )                                     \
-       ((void) (j), (void) (k),                                        \
-        ((GLhalfARB *)(t)->Data + (i) * (sz)))
+       ((GLhalfARB *)(t)->Data + (i) * (sz))
 
 #define FETCH(x) fetch_texel_1d_##x
 
 #elif DIM == 2
 
 #define CHAN_SRC( t, i, j, k, sz )                                     \
-       ((void) (k),                                                    \
-        ((GLchan *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz)))
+       ((GLchan *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))
 #define UBYTE_SRC( t, i, j, k, sz )                                    \
-       ((void) (k),                                                    \
-        ((GLubyte *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz)))
+       ((GLubyte *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))
 #define USHORT_SRC( t, i, j, k )                                       \
-       ((void) (k),                                                    \
-        ((GLushort *)(t)->Data + ((t)->RowStride * (j) + (i))))
+       ((GLushort *)(t)->Data + ((t)->RowStride * (j) + (i)))
 #define UINT_SRC( t, i, j, k )                                         \
-       ((void) (k),                                                    \
-        ((GLuint *)(t)->Data + ((t)->RowStride * (j) + (i))))
+       ((GLuint *)(t)->Data + ((t)->RowStride * (j) + (i)))
 #define FLOAT_SRC( t, i, j, k, sz )                                    \
-       ((void) (k),                                                    \
-        ((GLfloat *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz)))
+       ((GLfloat *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))
 #define HALF_SRC( t, i, j, k, sz )                                     \
-       ((void) (k),                                                    \
-        ((GLhalfARB *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz)))
+       ((GLhalfARB *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))
 
 #define FETCH(x) fetch_texel_2d_##x
 
@@ -1023,9 +1012,9 @@ static void FETCH(ci8)( const struct gl_texture_image *texImage,
                        GLint i, GLint j, GLint k, GLchan *texel )
 {
    const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
-   const GLuint index = *src;
    const struct gl_color_table *palette;
    const GLchan *table;
+   GLuint index;
    GET_CURRENT_CONTEXT(ctx);
 
    if (ctx->Texture.SharedPalette) {
@@ -1039,6 +1028,9 @@ static void FETCH(ci8)( const struct gl_texture_image *texImage,
    ASSERT(palette->Type != GL_FLOAT);
    table = (const GLchan *) palette->Table;
 
+   /* Mask the index against size of palette to avoid going out of bounds */
+   index = (*src) & (palette->Size - 1);
+
    switch (palette->Format) {
       case GL_ALPHA:
          texel[RCOMP] =
index 90fa7e4..b8ff39d 100644 (file)
@@ -132,6 +132,36 @@ static void sigfpe_handler( int signal, struct sigcontext sc )
 }
 #endif /* __linux__ && _POSIX_SOURCE && X86_FXSR_MAGIC */
 
+#if defined(WIN32)
+#ifndef STATUS_FLOAT_MULTIPLE_TRAPS
+# define STATUS_FLOAT_MULTIPLE_TRAPS (0xC00002B5L)
+#endif
+static LONG WINAPI ExceptionFilter(LPEXCEPTION_POINTERS exp)
+{
+   PEXCEPTION_RECORD rec = exp->ExceptionRecord;
+   PCONTEXT ctx = exp->ContextRecord;
+
+   if ( rec->ExceptionCode == EXCEPTION_ILLEGAL_INSTRUCTION ) {
+      message( "EXCEPTION_ILLEGAL_INSTRUCTION, " );
+      _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM);
+   } else if ( rec->ExceptionCode == STATUS_FLOAT_MULTIPLE_TRAPS ) {
+      message( "STATUS_FLOAT_MULTIPLE_TRAPS, " );
+      /* Windows seems to clear the exception flag itself, we just have to increment Eip */
+   } else {
+      message( "UNEXPECTED EXCEPTION (0x%08x), terminating!" );
+      return EXCEPTION_EXECUTE_HANDLER;
+   }
+
+   if ( (ctx->ContextFlags & CONTEXT_CONTROL) != CONTEXT_CONTROL ) {
+      message( "Context does not contain control registers, terminating!" );
+      return EXCEPTION_EXECUTE_HANDLER;
+   }
+   ctx->Eip += 3;
+
+   return EXCEPTION_CONTINUE_EXECUTION;
+}
+#endif /* WIN32 */
+
 /* If we're running on a processor that can do SSE, let's see if we
  * are allowed to or not.  This will catch 2.4.0 or later kernels that
  * haven't been configured for a Pentium III but are running on one,
@@ -226,6 +256,44 @@ static void check_os_sse_support( void )
       if (ret || !enabled)
          _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM);
    }
+#elif defined(WIN32)
+   LPTOP_LEVEL_EXCEPTION_FILTER oldFilter;
+
+   /* Install our ExceptionFilter */
+   oldFilter = SetUnhandledExceptionFilter( ExceptionFilter );
+
+   if ( cpu_has_xmm ) {
+      message( "Testing OS support for SSE... " );
+
+      _mesa_test_os_sse_support();
+
+      if ( cpu_has_xmm ) {
+        message( "yes.\n" );
+      } else {
+        message( "no!\n" );
+      }
+   }
+
+   if ( cpu_has_xmm ) {
+      message( "Testing OS support for SSE unmasked exceptions... " );
+
+      _mesa_test_os_sse_exception_support();
+
+      if ( cpu_has_xmm ) {
+        message( "yes.\n" );
+      } else {
+        message( "no!\n" );
+      }
+   }
+
+   /* Restore previous exception filter */
+   SetUnhandledExceptionFilter( oldFilter );
+
+   if ( cpu_has_xmm ) {
+      message( "Tests of OS support for SSE passed.\n" );
+   } else {
+      message( "Tests of OS support for SSE failed!\n" );
+   }
 #else
    /* Do nothing on other platforms for now.
     */
index 0d4d19d..c0e427e 100644 (file)
@@ -29,7 +29,7 @@
 #include "assyntax.h"
 #include "glapioffsets.h"
 
-#ifndef __WIN32__
+#if 1 //ndef __WIN32__
 
 #if defined(STDCALL_API)
 # if defined(USE_MGL_NAMESPACE)