summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/glheader.h12
-rw-r--r--src/mesa/main/texutil.c4
2 files changed, 13 insertions, 3 deletions
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
index 0324b42ffd9..596bd2d01ee 100644
--- a/src/mesa/main/glheader.h
+++ b/src/mesa/main/glheader.h
@@ -1,4 +1,4 @@
-/* $Id: glheader.h,v 1.20 2001/05/14 23:11:12 brianp Exp $ */
+/* $Id: glheader.h,v 1.21 2001/06/15 15:22:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -241,5 +241,15 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC
#endif
+/*
+ * Sometimes we treat GLfloats as GLints. On x86 systems, moving a float
+ * as a int (thereby using integer registers instead of fp registers) is
+ * a performance win. Typically, this can be done with ordinary casts.
+ * But with gcc's -fstrict-aliasing flag (which defaults to on in gcc 3.0)
+ * these casts generate warnings.
+ * The following union typedef is used to solve that.
+ */
+typedef union { GLfloat f; GLint i; } fi_type;
+
#endif /* GLHEADER_H */
diff --git a/src/mesa/main/texutil.c b/src/mesa/main/texutil.c
index e7c8fa7608a..6231f589af2 100644
--- a/src/mesa/main/texutil.c
+++ b/src/mesa/main/texutil.c
@@ -1,4 +1,4 @@
-/* $Id: texutil.c,v 1.24 2001/05/02 21:02:38 brianp Exp $ */
+/* $Id: texutil.c,v 1.25 2001/06/15 15:22:08 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -415,7 +415,7 @@ CONVERT_ARGB4444( texsubimage3d )
dst = (s >> 1) | ((s & 1) << 15); }
#define CONVERT_TEXEL_DWORD( dst, src ) \
- { const GLuint s = *(GLuint *)src; \
+ { const GLuint s = ((fi_type *)src)->i; \
dst = (((s & 0xfffefffe) >> 1) | \
((s & 0x00010001) << 15)); }