summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/Makefile.X113
-rw-r--r--src/mesa/array_cache/ac_context.c3
-rw-r--r--src/mesa/array_cache/ac_import.c3
-rw-r--r--src/mesa/drivers/dos/dmesa.c5
-rw-r--r--src/mesa/drivers/dos/internal.h2
-rw-r--r--src/mesa/drivers/glide/fxdd.c8
-rw-r--r--src/mesa/drivers/glide/fxvb.c7
-rw-r--r--src/mesa/drivers/osmesa/osmesa.c5
-rw-r--r--src/mesa/drivers/windows/wmesa.c3
-rw-r--r--src/mesa/drivers/x11/fakeglx.c3
-rw-r--r--src/mesa/drivers/x11/xm_api.c3
-rw-r--r--src/mesa/drivers/x11/xm_line.c3
-rw-r--r--src/mesa/drivers/x11/xm_tri.c3
-rw-r--r--src/mesa/main/Makefile.BeOS-R55
-rw-r--r--src/mesa/main/Makefile.DJ1
-rw-r--r--src/mesa/main/Makefile.OSMesa163
-rw-r--r--src/mesa/main/Makefile.X113
-rw-r--r--src/mesa/main/Makefile.ugl1
-rw-r--r--src/mesa/main/Makefile.win1
-rw-r--r--src/mesa/main/api_eval.c7
-rw-r--r--src/mesa/main/api_noop.c7
-rw-r--r--src/mesa/main/buffers.c7
-rw-r--r--src/mesa/main/clip.c5
-rw-r--r--src/mesa/main/colormac.h70
-rw-r--r--src/mesa/main/colortab.c3
-rw-r--r--src/mesa/main/context.c13
-rw-r--r--src/mesa/main/drawpix.c3
-rw-r--r--src/mesa/main/enable.c3
-rw-r--r--src/mesa/main/eval.c21
-rw-r--r--src/mesa/main/feedback.c7
-rw-r--r--src/mesa/main/get.c3
-rw-r--r--src/mesa/main/glheader.h9
-rw-r--r--src/mesa/main/histogram.c7
-rw-r--r--src/mesa/main/image.c13
-rw-r--r--src/mesa/main/imports.c161
-rw-r--r--src/mesa/main/imports.h456
-rw-r--r--src/mesa/main/light.c15
-rw-r--r--src/mesa/main/lines.c7
-rw-r--r--src/mesa/main/macros.h235
-rw-r--r--src/mesa/main/matrix.c7
-rw-r--r--src/mesa/main/mtypes.h29
-rw-r--r--src/mesa/main/nvfragparse.c18
-rw-r--r--src/mesa/main/nvvertexec.c3
-rw-r--r--src/mesa/main/points.c7
-rw-r--r--src/mesa/main/rastpos.c11
-rw-r--r--src/mesa/main/state.c12
-rw-r--r--src/mesa/main/texformat.c7
-rw-r--r--src/mesa/main/teximage.c3
-rw-r--r--src/mesa/main/texutil.c7
-rw-r--r--src/mesa/main/varray.c7
-rw-r--r--src/mesa/math/m_debug_norm.c7
-rw-r--r--src/mesa/math/m_matrix.c5
-rw-r--r--src/mesa/math/m_norm_tmp.h12
-rw-r--r--src/mesa/math/m_translate.c3
-rw-r--r--src/mesa/math/m_xform.c7
-rw-r--r--src/mesa/swrast/s_aaline.c4
-rw-r--r--src/mesa/swrast/s_aatriangle.c3
-rw-r--r--src/mesa/swrast/s_accum.c3
-rw-r--r--src/mesa/swrast/s_alpha.c3
-rw-r--r--src/mesa/swrast/s_bitmap.c3
-rw-r--r--src/mesa/swrast/s_drawpix.c3
-rw-r--r--src/mesa/swrast/s_feedback.c7
-rw-r--r--src/mesa/swrast/s_fog.c3
-rw-r--r--src/mesa/swrast/s_lines.c3
-rw-r--r--src/mesa/swrast/s_nvfragprog.c32
-rw-r--r--src/mesa/swrast/s_points.c3
-rw-r--r--src/mesa/swrast/s_span.c5
-rw-r--r--src/mesa/swrast/s_texstore.c9
-rw-r--r--src/mesa/swrast/s_texture.c5
-rw-r--r--src/mesa/swrast/s_triangle.c3
-rw-r--r--src/mesa/swrast/s_zoom.c4
-rw-r--r--src/mesa/tnl/t_array_api.c7
-rw-r--r--src/mesa/tnl/t_array_import.c7
-rw-r--r--src/mesa/tnl/t_eval_api.c7
-rw-r--r--src/mesa/tnl/t_imm_dlist.c6
-rw-r--r--src/mesa/tnl/t_imm_elt.c7
-rw-r--r--src/mesa/tnl/t_imm_eval.c7
-rw-r--r--src/mesa/tnl/t_imm_exec.c7
-rw-r--r--src/mesa/tnl/t_imm_fixup.c7
-rw-r--r--src/mesa/tnl/t_pipeline.c7
-rw-r--r--src/mesa/tnl/t_vb_cliptmp.h10
-rw-r--r--src/mesa/tnl/t_vb_fog.c11
-rw-r--r--src/mesa/tnl/t_vb_light.c7
-rw-r--r--src/mesa/tnl/t_vb_normals.c7
-rw-r--r--src/mesa/tnl/t_vb_points.c8
-rw-r--r--src/mesa/tnl/t_vb_program.c3
-rw-r--r--src/mesa/tnl/t_vb_render.c19
-rw-r--r--src/mesa/tnl/t_vb_texgen.c9
-rw-r--r--src/mesa/tnl/t_vb_texmat.c3
-rw-r--r--src/mesa/tnl/t_vb_vertex.c3
-rw-r--r--src/mesa/tnl/t_vtx_exec.c1
-rw-r--r--src/mesa/tnl/t_vtx_x86.c1
92 files changed, 1085 insertions, 414 deletions
diff --git a/src/mesa/Makefile.X11 b/src/mesa/Makefile.X11
index 9ccaafc9d8..7a8e8f0b41 100644
--- a/src/mesa/Makefile.X11
+++ b/src/mesa/Makefile.X11
@@ -1,4 +1,4 @@
-# $Id: Makefile.X11,v 1.73 2003/01/14 04:55:45 brianp Exp $
+# $Id: Makefile.X11,v 1.74 2003/03/01 01:50:20 brianp Exp $
# Mesa 3-D graphics library
# Version: 5.0
@@ -55,7 +55,6 @@ CORE_SOURCES = \
light.c \
lines.c \
matrix.c \
- mmath.c \
nvprogram.c \
nvfragparse.c \
nvvertexec.c \
diff --git a/src/mesa/array_cache/ac_context.c b/src/mesa/array_cache/ac_context.c
index a09a55cd53..28d4b225fe 100644
--- a/src/mesa/array_cache/ac_context.c
+++ b/src/mesa/array_cache/ac_context.c
@@ -1,4 +1,4 @@
-/* $Id: ac_context.c,v 1.10 2003/01/14 04:55:46 brianp Exp $ */
+/* $Id: ac_context.c,v 1.11 2003/03/01 01:50:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -30,7 +30,6 @@
#include "glheader.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "array_cache/ac_context.h"
diff --git a/src/mesa/array_cache/ac_import.c b/src/mesa/array_cache/ac_import.c
index f8b92a4ee5..58d2c246d0 100644
--- a/src/mesa/array_cache/ac_import.c
+++ b/src/mesa/array_cache/ac_import.c
@@ -1,4 +1,4 @@
-/* $Id: ac_import.c,v 1.22 2003/01/14 04:55:46 brianp Exp $ */
+/* $Id: ac_import.c,v 1.23 2003/03/01 01:50:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -30,7 +30,6 @@
#include "glheader.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_translate.h"
diff --git a/src/mesa/drivers/dos/dmesa.c b/src/mesa/drivers/dos/dmesa.c
index a72973832a..5202bbd6b1 100644
--- a/src/mesa/drivers/dos/dmesa.c
+++ b/src/mesa/drivers/dos/dmesa.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 5.0
+ * Version: 5.1
*
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -39,7 +39,6 @@
#include "extensions.h"
#include "macros.h"
#include "matrix.h"
-#include "mmath.h"
#include "texformat.h"
#include "texstore.h"
#include "array_cache/acache.h"
diff --git a/src/mesa/drivers/dos/internal.h b/src/mesa/drivers/dos/internal.h
index 304a7377ba..f6dc0e4b41 100644
--- a/src/mesa/drivers/dos/internal.h
+++ b/src/mesa/drivers/dos/internal.h
@@ -34,7 +34,7 @@
#ifndef INTERNAL_H_included
#define INTERNAL_H_included
-#include "../mmath.h"
+#include "../macros.h"
/*
* general purpose defines, etc.
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
index fd099e7e11..906424810a 100644
--- a/src/mesa/drivers/glide/fxdd.c
+++ b/src/mesa/drivers/glide/fxdd.c
@@ -1,10 +1,10 @@
-/* $Id: fxdd.c,v 1.95 2003/01/08 21:32:36 brianp Exp $ */
+/* $Id: fxdd.c,v 1.96 2003/03/01 01:50:23 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.0
+ * Version: 5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -45,7 +45,7 @@
#include "fxdrv.h"
#include "enums.h"
#include "extensions.h"
-#include "mmath.h"
+#include "macros.h"
#include "texstore.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
diff --git a/src/mesa/drivers/glide/fxvb.c b/src/mesa/drivers/glide/fxvb.c
index d14e53d21d..f807048b09 100644
--- a/src/mesa/drivers/glide/fxvb.c
+++ b/src/mesa/drivers/glide/fxvb.c
@@ -1,10 +1,10 @@
-/* $Id: fxvb.c,v 1.16 2002/11/04 20:29:04 brianp Exp $ */
+/* $Id: fxvb.c,v 1.17 2003/03/01 01:50:23 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.0
+ * Version: 5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -40,7 +40,6 @@
#include "imports.h"
#include "macros.h"
#include "colormac.h"
-#include "mmath.h"
#include "math/m_translate.h"
#include "swrast_setup/swrast_setup.h"
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index 5901ae29a0..25efb7ef4a 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -1,10 +1,10 @@
-/* $Id: osmesa.c,v 1.99 2003/02/25 19:25:54 brianp Exp $ */
+/* $Id: osmesa.c,v 1.100 2003/03/01 01:50:23 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -45,7 +45,6 @@
#include "imports.h"
#include "macros.h"
#include "matrix.h"
-#include "mmath.h"
#include "mtypes.h"
#include "texformat.h"
#include "texstore.h"
diff --git a/src/mesa/drivers/windows/wmesa.c b/src/mesa/drivers/windows/wmesa.c
index 4baa547f28..456050b9fc 100644
--- a/src/mesa/drivers/windows/wmesa.c
+++ b/src/mesa/drivers/windows/wmesa.c
@@ -1,4 +1,4 @@
-/* $Id: wmesa.c,v 1.43 2003/01/30 15:47:06 kschultz Exp $ */
+/* $Id: wmesa.c,v 1.44 2003/03/01 01:50:24 brianp Exp $ */
/*
* Windows (Win32) device driver for Mesa 3.4
@@ -39,7 +39,6 @@
#include "imports.h"
#include "macros.h"
#include "matrix.h"
-#include "mmath.h"
#include "mtypes.h"
#include "texformat.h"
#include "texstore.h"
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index b9a7ce4c6d..86a328a066 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -1,4 +1,4 @@
-/* $Id: fakeglx.c,v 1.79 2003/02/25 19:25:58 brianp Exp $ */
+/* $Id: fakeglx.c,v 1.80 2003/03/01 01:50:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -49,7 +49,6 @@
#include "config.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "xfonts.h"
#include "xmesaP.h"
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index d1d2bce49d..80db1212da 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -1,4 +1,4 @@
-/* $Id: xm_api.c,v 1.53 2003/02/17 16:35:56 brianp Exp $ */
+/* $Id: xm_api.c,v 1.54 2003/03/01 01:50:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -71,7 +71,6 @@
#include "glthread.h"
#include "imports.h"
#include "matrix.h"
-#include "mmath.h"
#include "mtypes.h"
#include "macros.h"
#include "texformat.h"
diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c
index 1855fad99e..7b629f0b49 100644
--- a/src/mesa/drivers/x11/xm_line.c
+++ b/src/mesa/drivers/x11/xm_line.c
@@ -1,4 +1,4 @@
-/* $Id: xm_line.c,v 1.22 2003/02/17 16:35:57 brianp Exp $ */
+/* $Id: xm_line.c,v 1.23 2003/03/01 01:50:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -35,7 +35,6 @@
#include "glxheader.h"
#include "depth.h"
#include "macros.h"
-#include "mmath.h"
#include "mtypes.h"
#include "xmesaP.h"
diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c
index d34cac53fe..602eba41e6 100644
--- a/src/mesa/drivers/x11/xm_tri.c
+++ b/src/mesa/drivers/x11/xm_tri.c
@@ -1,4 +1,4 @@
-/* $Id: xm_tri.c,v 1.31 2003/02/17 16:36:01 brianp Exp $ */
+/* $Id: xm_tri.c,v 1.32 2003/03/01 01:50:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -36,7 +36,6 @@
#include "depth.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "xmesaP.h"
diff --git a/src/mesa/main/Makefile.BeOS-R5 b/src/mesa/main/Makefile.BeOS-R5
index 97d814c917..8ae0efcf1d 100644
--- a/src/mesa/main/Makefile.BeOS-R5
+++ b/src/mesa/main/Makefile.BeOS-R5
@@ -1,7 +1,7 @@
# Mesa 3-D graphics library
-# Version: 4.1
+# Version: 5.1
#
-# Copyright (C) 1995-2002 Brian Paul All Rights Reserved.
+# Copyright (C) 1995-2003 Brian Paul 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"),
@@ -90,7 +90,6 @@ MESA_CORE_SRCS = \
light.c \
lines.c \
matrix.c \
- mmath.c \
pixel.c \
points.c \
polygon.c \
diff --git a/src/mesa/main/Makefile.DJ b/src/mesa/main/Makefile.DJ
index e2714f9088..2a3c6a79b7 100644
--- a/src/mesa/main/Makefile.DJ
+++ b/src/mesa/main/Makefile.DJ
@@ -130,7 +130,6 @@ CORE_SOURCES = \
light.c \
lines.c \
matrix.c \
- mmath.c \
pixel.c \
points.c \
polygon.c \
diff --git a/src/mesa/main/Makefile.OSMesa16 b/src/mesa/main/Makefile.OSMesa16
index c1899e70ac..7a7b0f11bf 100644
--- a/src/mesa/main/Makefile.OSMesa16
+++ b/src/mesa/main/Makefile.OSMesa16
@@ -1,4 +1,4 @@
-# $Id: Makefile.OSMesa16,v 1.11 2003/01/14 04:55:45 brianp Exp $
+# $Id: Makefile.OSMesa16,v 1.12 2003/03/01 01:50:20 brianp Exp $
# Mesa 3-D graphics library
# Version: 5.0
@@ -56,7 +56,6 @@ CORE_SOURCES = \
light.c \
lines.c \
matrix.c \
- mmath.c \
nvprogram.c \
nvfragparse.c \
nvvertexec.c \
diff --git a/src/mesa/main/Makefile.X11 b/src/mesa/main/Makefile.X11
index 9ccaafc9d8..7a8e8f0b41 100644
--- a/src/mesa/main/Makefile.X11
+++ b/src/mesa/main/Makefile.X11
@@ -1,4 +1,4 @@
-# $Id: Makefile.X11,v 1.73 2003/01/14 04:55:45 brianp Exp $
+# $Id: Makefile.X11,v 1.74 2003/03/01 01:50:20 brianp Exp $
# Mesa 3-D graphics library
# Version: 5.0
@@ -55,7 +55,6 @@ CORE_SOURCES = \
light.c \
lines.c \
matrix.c \
- mmath.c \
nvprogram.c \
nvfragparse.c \
nvvertexec.c \
diff --git a/src/mesa/main/Makefile.ugl b/src/mesa/main/Makefile.ugl
index 95d880984f..bcecd7afb7 100644
--- a/src/mesa/main/Makefile.ugl
+++ b/src/mesa/main/Makefile.ugl
@@ -85,7 +85,6 @@ GL_SOURCES = \
light.c \
lines.c \
matrix.c \
- mmath.c \
pixel.c \
points.c \
polygon.c \
diff --git a/src/mesa/main/Makefile.win b/src/mesa/main/Makefile.win
index ebb59e76cd..2acbce0ced 100644
--- a/src/mesa/main/Makefile.win
+++ b/src/mesa/main/Makefile.win
@@ -45,7 +45,6 @@ CORE_SRCS = \
light.c \
lines.c \
matrix.c \
- mmath.c \
nvprogram.c \
nvfragparse.c \
nvvertexec.c \
diff --git a/src/mesa/main/api_eval.c b/src/mesa/main/api_eval.c
index 3b29ac62b9..254f814988 100644
--- a/src/mesa/main/api_eval.c
+++ b/src/mesa/main/api_eval.c
@@ -1,10 +1,10 @@
-/* $Id: api_eval.c,v 1.3 2002/10/29 20:28:42 brianp Exp $ */
+/* $Id: api_eval.c,v 1.4 2003/03/01 01:50:20 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -31,7 +31,6 @@
#include "api_eval.h"
#include "context.h"
#include "macros.h"
-#include "mmath.h"
#include "math/m_eval.h"
static void do_EvalCoord1f(GLcontext* ctx, GLfloat u)
diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c
index 6a4226294c..ff96605f1b 100644
--- a/src/mesa/main/api_noop.c
+++ b/src/mesa/main/api_noop.c
@@ -1,10 +1,10 @@
-/* $Id: api_noop.c,v 1.11 2003/01/14 04:55:45 brianp Exp $ */
+/* $Id: api_noop.c,v 1.12 2003/03/01 01:50:20 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -32,7 +32,6 @@
#include "colormac.h"
#include "light.h"
#include "macros.h"
-#include "mmath.h"
#include "mtypes.h"
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 14994c61f7..ab579b3d33 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -1,10 +1,10 @@
-/* $Id: buffers.c,v 1.42 2002/10/24 23:57:19 brianp Exp $ */
+/* $Id: buffers.c,v 1.43 2003/03/01 01:50:20 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -33,7 +33,6 @@
#include "context.h"
#include "depth.h"
#include "enums.h"
-#include "macros.h"
#include "stencil.h"
#include "state.h"
#include "mtypes.h"
diff --git a/src/mesa/main/clip.c b/src/mesa/main/clip.c
index 79565a0fb3..8f701bb712 100644
--- a/src/mesa/main/clip.c
+++ b/src/mesa/main/clip.c
@@ -1,8 +1,8 @@
-/* $Id: clip.c,v 1.26 2002/10/24 23:57:19 brianp Exp $ */
+/* $Id: clip.c,v 1.27 2003/03/01 01:50:20 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 5.1
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
@@ -29,7 +29,6 @@
#include "clip.h"
#include "context.h"
#include "macros.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_xform.h"
diff --git a/src/mesa/main/colormac.h b/src/mesa/main/colormac.h
index 7fdd0b3b9d..7f6b922f62 100644
--- a/src/mesa/main/colormac.h
+++ b/src/mesa/main/colormac.h
@@ -1,10 +1,10 @@
-/* $Id: colormac.h,v 1.11 2002/04/04 16:51:52 brianp Exp $ */
+/* $Id: colormac.h,v 1.12 2003/03/01 01:50:20 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -34,12 +34,9 @@
#define COLORMAC_H
-#include "glheader.h"
+#include "imports.h"
#include "config.h"
#include "macros.h"
-#include "mmath.h"
-/* Do not reference mtypes.h from this file.
- */
#if CHAN_BITS == 8
@@ -133,4 +130,63 @@ do { \
} while (0)
+
+/* Generic color packing macros
+ * XXX We may move these into texutil.h at some point.
+ */
+
+#define PACK_COLOR_8888( a, b, c, d ) \
+ (((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
+
+#define PACK_COLOR_888( a, b, c ) \
+ (((a) << 16) | ((b) << 8) | (c))
+
+#define PACK_COLOR_565( a, b, c ) \
+ ((((a) & 0xf8) << 8) | (((b) & 0xfc) << 3) | (((c) & 0xf8) >> 3))
+
+#define PACK_COLOR_1555( a, b, c, d ) \
+ ((((b) & 0xf8) << 7) | (((c) & 0xf8) << 2) | (((d) & 0xf8) >> 3) | \
+ ((a) ? 0x8000 : 0))
+
+#define PACK_COLOR_4444( a, b, c, d ) \
+ ((((a) & 0xf0) << 8) | (((b) & 0xf0) << 4) | ((c) & 0xf0) | ((d) >> 4))
+
+#define PACK_COLOR_88( a, b ) \
+ (((a) << 8) | (b))
+
+#define PACK_COLOR_332( a, b, c ) \
+ (((a) & 0xe0) | (((b) & 0xe0) >> 3) | (((c) & 0xc0) >> 6))
+
+
+#ifdef MESA_BIG_ENDIAN
+
+#define PACK_COLOR_8888_LE( a, b, c, d ) PACK_COLOR_8888( d, c, b, a )
+
+#define PACK_COLOR_565_LE( a, b, c ) \
+ (((a) & 0xf8) | (((b) & 0xe0) >> 5) | (((b) & 0x1c) << 11) | \
+ (((c) & 0xf8) << 5))
+
+#define PACK_COLOR_1555_LE( a, b, c, d ) \
+ ((((b) & 0xf8) >> 1) | (((c) & 0xc0) >> 6) | (((c) & 0x38) << 10) | \
+ (((d) & 0xf8) << 5) | ((a) ? 0x80 : 0))
+
+#define PACK_COLOR_4444_LE( a, b, c, d ) PACK_COLOR_4444( c, d, a, b )
+
+#define PACK_COLOR_88_LE( a, b ) PACK_COLOR_88( b, a )
+
+#else /* little endian */
+
+#define PACK_COLOR_8888_LE( a, b, c, d ) PACK_COLOR_8888( a, b, c, d )
+
+#define PACK_COLOR_565_LE( a, b, c ) PACK_COLOR_565( a, b, c )
+
+#define PACK_COLOR_1555_LE( a, b, c, d ) PACK_COLOR_1555( a, b, c, d )
+
+#define PACK_COLOR_4444_LE( a, b, c, d ) PACK_COLOR_4444( a, b, c, d )
+
+#define PACK_COLOR_88_LE( a, b ) PACK_COLOR_88( a, b )
+
+#endif /* endianness */
+
+
#endif /* COLORMAC_H */
diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c
index 184aa8eff2..0a785743c0 100644
--- a/src/mesa/main/colortab.c
+++ b/src/mesa/main/colortab.c
@@ -1,4 +1,4 @@
-/* $Id: colortab.c,v 1.48 2003/01/26 14:37:16 brianp Exp $ */
+/* $Id: colortab.c,v 1.49 2003/03/01 01:50:20 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -31,7 +31,6 @@
#include "context.h"
#include "image.h"
#include "macros.h"
-#include "mmath.h"
#include "state.h"
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 7430d94410..b9bbe65193 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.193 2003/01/26 14:37:15 brianp Exp $ */
+/* $Id: context.c,v 1.194 2003/03/01 01:50:20 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -41,7 +41,6 @@
#include "hash.h"
#include "light.h"
#include "macros.h"
-#include "mmath.h"
#include "simple_list.h"
#include "state.h"
#include "teximage.h"
@@ -81,6 +80,9 @@ int MESA_DEBUG_FLAGS = 0;
#endif
+/* ubyte -> float conversion */
+GLfloat _mesa_ubyte_to_float_color_tab[256];
+
static void
free_shared_state( GLcontext *ctx, struct gl_shared_state *ss );
@@ -556,6 +558,8 @@ one_time_init( GLcontext *ctx )
static GLboolean alreadyCalled = GL_FALSE;
_glthread_LOCK_MUTEX(OneTimeLock);
if (!alreadyCalled) {
+ GLuint i;
+
/* do some implementation tests */
assert( sizeof(GLbyte) == 1 );
assert( sizeof(GLshort) >= 2 );
@@ -567,7 +571,10 @@ one_time_init( GLcontext *ctx )
_mesa_init_lists();
_math_init();
- _mesa_init_math();
+
+ for (i = 0; i < 256; i++) {
+ _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
+ }
#ifdef USE_SPARC_ASM
_mesa_init_sparc_glapi_relocs();
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index 1dbeefa23b..f5d780e2ae 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -1,4 +1,4 @@
-/* $Id: drawpix.c,v 1.63 2002/10/24 23:57:20 brianp Exp $ */
+/* $Id: drawpix.c,v 1.64 2003/03/01 01:50:20 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -31,7 +31,6 @@
#include "drawpix.h"
#include "feedback.h"
#include "macros.h"
-#include "mmath.h"
#include "state.h"
#include "mtypes.h"
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index f343c2099a..eb46976abb 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1,4 +1,4 @@
-/* $Id: enable.c,v 1.74 2003/01/26 14:37:16 brianp Exp $ */
+/* $Id: enable.c,v 1.75 2003/03/01 01:50:20 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -30,7 +30,6 @@
#include "enable.h"
#include "light.h"
#include "macros.h"
-#include "mmath.h"
#include "simple_list.h"
#include "mtypes.h"
#include "enums.h"
diff --git a/src/mesa/main/eval.c b/src/mesa/main/eval.c
index 30767a6277..d207d14b20 100644
--- a/src/mesa/main/eval.c
+++ b/src/mesa/main/eval.c
@@ -1,10 +1,10 @@
-/* $Id: eval.c,v 1.24 2002/10/24 23:57:20 brianp Exp $ */
+/* $Id: eval.c,v 1.25 2003/03/01 01:50:20 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -44,7 +44,6 @@
#include "context.h"
#include "eval.h"
#include "macros.h"
-#include "mmath.h"
#include "mtypes.h"
@@ -705,7 +704,7 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v )
}
if (data) {
for (i=0;i<n;i++) {
- v[i] = ROUNDF(data[i]);
+ v[i] = IROUND(data[i]);
}
}
break;
@@ -720,14 +719,14 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v )
break;
case GL_DOMAIN:
if (map1d) {
- v[0] = ROUNDF(map1d->u1);
- v[1] = ROUNDF(map1d->u2);
+ v[0] = IROUND(map1d->u1);
+ v[1] = IROUND(map1d->u2);
}
else {
- v[0] = ROUNDF(map2d->u1);
- v[1] = ROUNDF(map2d->u2);
- v[2] = ROUNDF(map2d->v1);
- v[3] = ROUNDF(map2d->v2);
+ v[0] = IROUND(map2d->u1);
+ v[1] = IROUND(map2d->u2);
+ v[2] = IROUND(map2d->v1);
+ v[3] = IROUND(map2d->v2);
}
break;
default:
diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c
index 330fd7d2be..6bd336b5f7 100644
--- a/src/mesa/main/feedback.c
+++ b/src/mesa/main/feedback.c
@@ -1,10 +1,10 @@
-/* $Id: feedback.c,v 1.27 2002/10/24 23:57:20 brianp Exp $ */
+/* $Id: feedback.c,v 1.28 2003/03/01 01:50:20 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -31,7 +31,6 @@
#include "enums.h"
#include "feedback.h"
#include "macros.h"
-#include "mmath.h"
#include "mtypes.h"
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 011ec4d64c..54f2832846 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1,4 +1,4 @@
-/* $Id: get.c,v 1.105 2003/01/26 14:37:16 brianp Exp $ */
+/* $Id: get.c,v 1.106 2003/03/01 01:50:21 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -33,7 +33,6 @@
#include "extensions.h"
#include "get.h"
#include "macros.h"
-#include "mmath.h"
#include "mtypes.h"
#include "texcompress.h"
#include "math/m_matrix.h"
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
index b27f8d2f78..c203b91598 100644
--- a/src/mesa/main/glheader.h
+++ b/src/mesa/main/glheader.h
@@ -1,10 +1,10 @@
-/* $Id: glheader.h,v 1.29 2002/10/30 19:44:41 brianp Exp $ */
+/* $Id: glheader.h,v 1.30 2003/03/01 01:50:21 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 5.0
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -35,11 +35,10 @@
* Other Mesa source files should _not_ directly include any system
* headers. This allows Mesa to be integrated into XFree86 and
* allows system-dependent hacks/work-arounds to be collected in one place.
+ * XXX actually, a lot of system-dependent stuff is now in imports.[ch].
*
* If you touch this file, everything gets recompiled!
*
- * This file should be included before any other header in the .c files.
- *
* Put compiler/OS/assembly pragmas and macros here to avoid
* cluttering other source files.
*/
diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c
index 134463956e..2eca44f02f 100644
--- a/src/mesa/main/histogram.c
+++ b/src/mesa/main/histogram.c
@@ -1,10 +1,10 @@
-/* $Id: histogram.c,v 1.11 2002/10/24 23:57:21 brianp Exp $ */
+/* $Id: histogram.c,v 1.12 2003/03/01 01:50:21 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -30,7 +30,6 @@
#include "context.h"
#include "image.h"
#include "histogram.h"
-#include "mmath.h"
/*
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 3830b0318e..b36c804e53 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -1,10 +1,10 @@
-/* $Id: image.c,v 1.69 2002/10/24 23:57:21 brianp Exp $ */
+/* $Id: image.c,v 1.70 2003/03/01 01:50:21 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -31,11 +31,16 @@
#include "imports.h"
#include "histogram.h"
#include "macros.h"
-#include "mmath.h"
#include "pixel.h"
#include "mtypes.h"
+
+/* Compute ceiling of integer quotient of A divided by B: */
+#define CEILING( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )
+
+
+
/*
* These are the image packing parameters for Mesa's internal images.
* That is, _mesa_unpack_image() returns image data in this format.
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 80bee830da..e9d579e764 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -1,10 +1,10 @@
-/* $Id: imports.c,v 1.31 2003/02/08 15:56:34 brianp Exp $ */
+/* $Id: imports.c,v 1.32 2003/03/01 01:50:21 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -46,10 +46,8 @@
*/
-#include "glheader.h"
-#include "mtypes.h"
-#include "context.h"
#include "imports.h"
+#include "context.h"
#define MAXSTRING 4000 /* for vsnprintf() */
@@ -73,6 +71,11 @@ extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg);
* rand and RAND_MAX
*/
+
+/**********************************************************************
+ * Memory
+ */
+
void *
_mesa_malloc(size_t bytes)
{
@@ -224,6 +227,10 @@ _mesa_bzero( void *dst, size_t n )
}
+/**********************************************************************
+ * Math
+ */
+
double
_mesa_sin(double a)
{
@@ -247,7 +254,7 @@ _mesa_cos(double a)
double
-_mesa_sqrt(double x)
+_mesa_sqrtd(double x)
{
#if defined(XFree86LOADER) && defined(IN_MODULE)
return xf86sqrt(x);
@@ -257,6 +264,95 @@ _mesa_sqrt(double x)
}
+/*
+ * A High Speed, Low Precision Square Root
+ * by Paul Lalonde and Robert Dawson
+ * from "Graphics Gems", Academic Press, 1990
+ *
+ * SPARC implementation of a fast square root by table
+ * lookup.
+ * SPARC floating point format is as follows:
+ *
+ * BIT 31 30 23 22 0
+ * sign exponent mantissa
+ */
+static short sqrttab[0x100]; /* declare table of square roots */
+
+static void init_sqrt_table(void)
+{
+#if defined(USE_IEEE) && !defined(DEBUG)
+ unsigned short i;
+ fi_type fi; /* to access the bits of a float in C quickly */
+ /* we use a union defined in glheader.h */
+
+ for(i=0; i<= 0x7f; i++) {
+ fi.i = 0;
+
+ /*
+ * Build a float with the bit pattern i as mantissa
+ * and an exponent of 0, stored as 127
+ */
+
+ fi.i = (i << 16) | (127 << 23);
+ fi.f = _mesa_sqrtd(fi.f);
+
+ /*
+ * Take the square root then strip the first 7 bits of
+ * the mantissa into the table
+ */
+
+ sqrttab[i] = (fi.i & 0x7fffff) >> 16;
+
+ /*
+ * Repeat the process, this time with an exponent of
+ * 1, stored as 128
+ */
+
+ fi.i = 0;
+ fi.i = (i << 16) | (128 << 23);
+ fi.f = sqrt(fi.f);
+ sqrttab[i+0x80] = (fi.i & 0x7fffff) >> 16;
+ }
+#else
+ (void) sqrttab; /* silence compiler warnings */
+#endif /*HAVE_FAST_MATH*/
+}
+
+
+float
+_mesa_sqrtf( float x )
+{
+#if defined(USE_IEEE) && !defined(DEBUG)
+ fi_type num;
+ /* to access the bits of a float in C
+ * we use a union from glheader.h */
+
+ short e; /* the exponent */
+ if (x == 0.0F) return 0.0F; /* check for square root of 0 */
+ num.f = x;
+ e = (num.i >> 23) - 127; /* get the exponent - on a SPARC the */
+ /* exponent is stored with 127 added */
+ num.i &= 0x7fffff; /* leave only the mantissa */
+ if (e & 0x01) num.i |= 0x800000;
+ /* the exponent is odd so we have to */
+ /* look it up in the second half of */
+ /* the lookup table, so we set the */
+ /* high bit */
+ e >>= 1; /* divide the exponent by two */
+ /* note that in C the shift */
+ /* operators are sign preserving */
+ /* for signed operands */
+ /* Do the table lookup, based on the quaternary mantissa,
+ * then reconstruct the result back into a float
+ */
+ num.i = ((sqrttab[num.i >> 16]) << 16) | ((e + 127) << 23);
+ return num.f;
+#else
+ return (float) _mesa_sqrtd((double) x);
+#endif
+}
+
+
double
_mesa_pow(double x, double y)
{
@@ -268,6 +364,25 @@ _mesa_pow(double x, double y)
}
+/*
+ * Return number of bits set in given GLuint.
+ */
+unsigned int
+_mesa_bitcount(unsigned int n)
+{
+ unsigned int bits;
+ for (bits = 0; n > 0; n = n >> 1) {
+ bits += (n & 1);
+ }
+ return bits;
+}
+
+
+
+/**********************************************************************
+ * Environment vars
+ */
+
char *
_mesa_getenv( const char *var )
{
@@ -279,6 +394,10 @@ _mesa_getenv( const char *var )
}
+/**********************************************************************
+ * String
+ */
+
char *
_mesa_strstr( const char *haystack, const char *needle )
{
@@ -389,6 +508,10 @@ _mesa_strtod( const char *s, char **end )
}
+/**********************************************************************
+ * I/O
+ */
+
int
_mesa_sprintf( char *str, const char *fmt, ... )
{
@@ -421,6 +544,10 @@ _mesa_printf( const char *fmtString, ... )
}
+/**********************************************************************
+ * Diagnostics
+ */
+
void
_mesa_warning( GLcontext *ctx, const char *fmtString, ... )
{
@@ -673,12 +800,34 @@ default_GetDrawablePrivate(__GLcontext *gc)
/*
* Initialize a __GLimports object to point to the functions in
* this file. This is to be called from device drivers.
+ * Also, do some one-time initializations.
* Input: imports - the object to init
* driverCtx - pointer to device driver-specific data
*/
void
_mesa_init_default_imports(__GLimports *imports, void *driverCtx)
{
+ /* XXX maybe move this one-time init stuff into context.c */
+ static GLboolean initialized = GL_FALSE;
+ if (!initialized) {
+ init_sqrt_table();
+
+#if defined(_FPU_GETCW) && defined(_FPU_SETCW)
+ {
+ const char *debug = _mesa_getenv("MESA_DEBUG");
+ if (debug && _mesa_strcmp(debug, "FP")==0) {
+ /* die on FP exceptions */
+ fpu_control_t mask;
+ _FPU_GETCW(mask);
+ mask &= ~(_FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM
+ | _FPU_MASK_OM | _FPU_MASK_UM);
+ _FPU_SETCW(mask);
+ }
+ }
+#endif
+ initialized = GL_TRUE;
+ }
+
imports->malloc = default_malloc;
imports->calloc = default_calloc;
imports->realloc = default_realloc;
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index 8ebc982172..741cdbf519 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -1,10 +1,10 @@
-/* $Id: imports.h,v 1.12 2003/02/08 15:56:34 brianp Exp $ */
+/* $Id: imports.h,v 1.13 2003/03/01 01:50:21 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -35,6 +35,25 @@
#define IMPORTS_H
+/* XXX some of the stuff in glheader.h should be moved into this file.
+ */
+#include "glheader.h"
+
+
+/**********************************************************************
+ * General macros
+ */
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+
+
+/**********************************************************************
+ * Memory macros
+ */
+
#define MALLOC(BYTES) _mesa_malloc(BYTES)
#define CALLOC(BYTES) _mesa_calloc(BYTES)
#define MALLOC_STRUCT(T) (struct T *) _mesa_malloc(sizeof(struct T))
@@ -99,6 +118,428 @@ extern void _ext_mesa_free_pixelbuffer( void *pb );
#endif
+
+/**********************************************************************
+ * Math macros
+ */
+
+#define MAX_GLUSHORT 0xffff
+#define MAX_GLUINT 0xffffffff
+
+#ifndef M_PI
+#define M_PI (3.1415926)
+#endif
+
+/* Degrees to radians conversion: */
+#define DEG2RAD (M_PI/180.0)
+
+
+/***
+ *** USE_IEEE: Determine if we're using IEEE floating point
+ ***/
+#if defined(__i386__) || defined(__sparc__) || defined(__s390x__) || \
+ defined(__powerpc__) || \
+ ( defined(__alpha__) && ( defined(__IEEE_FLOAT) || !defined(VMS) ) )
+#define USE_IEEE
+#define IEEE_ONE 0x3f800000
+#endif
+
+
+/***
+ *** SQRTF: single-precision square root
+ ***/
+#ifdef DEBUG
+# define SQRTF(X) ((float)_mesa_sqrtd((float) X))
+#elif defined(__WATCOMC__) && defined(USE_X86_ASM)
+float asm_sqrt (float x);
+#pragma aux asm_sqrt = \
+ "fsqrt" \
+ parm [8087] \
+ value [8087] \
+ modify exact [];
+# define SQRTF(X) asm_sqrt(X)
+#else
+# define SQRTF(X) _mesa_sqrtf(X)
+#endif
+
+
+/***
+ *** LOG2: Log base 2 of float
+ ***/
+#ifdef USE_IEEE
+#if 0
+/* This is pretty fast, but not accurate enough (only 2 fractional bits).
+ * Based on code from http://www.stereopsis.com/log2.html
+ */
+static INLINE GLfloat LOG2(GLfloat x)
+{
+ const GLfloat y = x * x * x * x;
+ const GLuint ix = *((GLuint *) &y);
+ const GLuint exp = (ix >> 23) & 0xFF;
+ const GLint log2 = ((GLint) exp) - 127;
+ return (GLfloat) log2 * (1.0 / 4.0); /* 4, because of x^4 above */
+}
+#endif
+/* Pretty fast, and accurate.
+ * Based on code from http://www.flipcode.com/totd/
+ */
+static INLINE GLfloat LOG2(GLfloat val)
+{
+ GLint *exp_ptr = (GLint *) &val;
+ GLint x = *exp_ptr;
+ const GLint log_2 = ((x >> 23) & 255) - 128;
+ x &= ~(255 << 23);
+ x += 127 << 23;
+ *exp_ptr = x;
+ val = ((-1.0f/3) * val + 2) * val - 2.0f/3;
+ return val + log_2;
+}
+#elif defined(XFree86LOADER) && defined(IN_MODULE)
+#define LOG2(x) ((GLfloat) (xf86log(x) * 1.442695))
+#else
+/*
+ * NOTE: log_base_2(x) = log(x) / log(2)
+ * NOTE: 1.442695 = 1/log(2).
+ */
+#define LOG2(x) ((GLfloat) (log(x) * 1.442695F))
+#endif
+
+
+/***
+ *** IS_INF_OR_NAN: test if float is infinite or NaN
+ ***/
+#ifdef USE_IEEE
+static INLINE int IS_INF_OR_NAN( float x )
+{
+ fi_type tmp;
+ tmp.f = x;
+ return !(int)((unsigned int)((tmp.i & 0x7fffffff)-0x7f800000) >> 31);
+}
+#elif defined(isfinite)
+#define IS_INF_OR_NAN(x) (!isfinite(x))
+#elif defined(finite)
+#define IS_INF_OR_NAN(x) (!finite(x))
+#elif __VMS
+#define IS_INF_OR_NAN(x) (!finite(x))
+#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define IS_INF_OR_NAN(x) (!isfinite(x))
+#else
+#define IS_INF_OR_NAN(x) (!finite(x))
+#endif
+
+
+/***
+ *** IS_NEGATIVE: test if float is negative
+ ***/
+#if defined(USE_IEEE)
+#define GET_FLOAT_BITS(x) ((fi_type *) &(x))->i
+#define IS_NEGATIVE(x) (GET_FLOAT_BITS(x) & (1<<31))
+#else
+#define IS_NEGATIVE(x) (x < 0.0F)
+#endif
+
+
+/***
+ *** DIFFERENT_SIGNS: test if two floats have opposite signs
+ ***/
+#if defined(USE_IEEE)
+#define DIFFERENT_SIGNS(x,y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1<<31))
+#else
+/* Could just use (x*y<0) except for the flatshading requirements.
+ * Maybe there's a better way?
+ */
+#define DIFFERENT_SIGNS(x,y) ((x) * (y) <= 0.0F && (x) - (y) != 0.0F)
+#endif
+
+
+/***
+ *** CEILF: ceiling of float
+ *** FLOORF: floor of float
+ *** FABSF: absolute value of float
+ ***/
+#if defined(__sparc__) || defined(__NeXT__) /* XXX improve? */
+#define CEILF(x) ceil(x)
+#define FLOORF(x) floor(x)
+#define FABSF(x) fabs(x)
+#elif defined(__WIN32__) || defined(__IBMC__) || defined(__IBMCPP__)
+#define CEILF(x) ((GLfloat) ceil(x))
+#define FLOORF(x) ((GLfloat) floor(x))
+#define FABSF(x) ((GLfloat) fabs(x))
+#elif defined(XFree86LOADER) && defined(IN_MODULE)
+#define CEILF(x) ((GLfloat) xf86ceil(x))
+#define FLOORF(x) ((GLfloat) xf86floor(x))
+#define FABSF(x) ((GLfloat) xf86fabs(x))
+#else
+#define CEILF(x) ceilf(x)
+#define FLOORF(x) floorf(x)
+#define FABSF(x) fabsf(x)
+#endif
+
+
+/***
+ *** IROUND: return (as an integer) float rounded to nearest integer
+ ***/
+#if defined(USE_SPARC_ASM) && defined(__GNUC__) && defined(__sparc__)
+static INLINE int iround(float f)
+{
+ int r;
+ __asm__ ("fstoi %1, %0" : "=f" (r) : "f" (f));
+ return r;
+}
+#define IROUND(x) iround(x)
+#elif defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__)
+static INLINE int iround(float f)
+{
+ int r;
+ __asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st");
+ return r;
+}
+#define IROUND(x) iround(x)
+#elif defined(USE_X86_ASM) && defined(__MSC__) && defined(__WIN32__)
+static INLINE int iround(float f)
+{
+ int r;
+ _asm {
+ fld f
+ fistp r
+ }
+ return r;
+}
+#define IROUND(x) iround(x)
+#elif defined(USE_X86_ASM) && defined(__WATCOMC__)
+long iround(float f);
+#pragma aux iround = \
+ "push eax" \
+ "fistp dword ptr [esp]" \
+ "pop eax" \
+ parm [8087] \
+ value [eax] \
+ modify exact [eax];
+
+#define IROUND(x) iround(x)
+#else
+#define IROUND(f) ((int) (((f) >= 0.0F) ? ((f) + 0.5F) : ((f) - 0.5F)))
+#endif
+
+
+/***
+ *** IROUND_POS: return (as an integer) positive float rounded to nearest int
+ ***/
+#ifdef DEBUG
+#define IROUND_POS(f) (assert((f) >= 0.0F), IROUND(f))
+#else
+#define IROUND_POS(f) (IROUND(f))
+#endif
+
+
+/***
+ *** IFLOOR: return (as an integer) floor of float
+ ***/
+#if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__)
+/*
+ * IEEE floor for computers that round to nearest or even.
+ * 'f' must be between -4194304 and 4194303.
+ * This floor operation is done by "(iround(f + .5) + iround(f - .5)) >> 1",
+ * but uses some IEEE specific tricks for better speed.
+ * Contributed by Josh Vanderhoof
+ */
+static INLINE int ifloor(float f)
+{
+ int ai, bi;
+ double af, bf;
+ af = (3 << 22) + 0.5 + (double)f;
+ bf = (3 << 22) + 0.5 - (double)f;
+ /* GCC generates an extra fstp/fld without this. */
+ __asm__ ("fstps %0" : "=m" (ai) : "t" (af) : "st");
+ __asm__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st");
+ return (ai - bi) >> 1;
+}
+#define IFLOOR(x) ifloor(x)
+#elif defined(USE_IEEE)
+static INLINE int ifloor(float f)
+{
+ int ai, bi;
+ double af, bf;
+ fi_type u;
+
+ af = (3 << 22) + 0.5 + (double)f;
+ bf = (3 << 22) + 0.5 - (double)f;
+ u.f = af; ai = u.i;
+ u.f = bf; bi = u.i;
+ return (ai - bi) >> 1;
+}
+#define IFLOOR(x) ifloor(x)
+#else
+static INLINE int ifloor(float f)
+{
+ int i = IROUND(f);
+ return (i > f) ? i - 1 : i;
+}
+#define IFLOOR(x) ifloor(x)
+#endif
+
+
+/***
+ *** ICEIL: return (as an integer) ceiling of float
+ ***/
+#if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__)
+/*
+ * IEEE ceil for computers that round to nearest or even.
+ * 'f' must be between -4194304 and 4194303.
+ * This ceil operation is done by "(iround(f + .5) + iround(f - .5) + 1) >> 1",
+ * but uses some IEEE specific tricks for better speed.
+ * Contributed by Josh Vanderhoof
+ */
+static INLINE int iceil(float f)
+{
+ int ai, bi;
+ double af, bf;
+ af = (3 << 22) + 0.5 + (double)f;
+ bf = (3 << 22) + 0.5 - (double)f;
+ /* GCC generates an extra fstp/fld without this. */
+ __asm__ ("fstps %0" : "=m" (ai) : "t" (af) : "st");
+ __asm__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st");
+ return (ai - bi + 1) >> 1;
+}
+#define ICEIL(x) iceil(x)
+#elif defined(USE_IEEE)
+static INLINE int iceil(float f)
+{
+ int ai, bi;
+ double af, bf;
+ fi_type u;
+ af = (3 << 22) + 0.5 + (double)f;
+ bf = (3 << 22) + 0.5 - (double)f;
+ u.f = af; ai = u.i;
+ u.f = bf; bi = u.i;
+ return (ai - bi + 1) >> 1;
+}
+#define ICEIL(x) iceil(x)
+#else
+static INLINE int iceil(float f)
+{
+ int i = IROUND(f);
+ return (i < f) ? i + 1 : i;
+}
+#define ICEIL(x) iceil(x)
+#endif
+
+
+/***
+ *** UNCLAMPED_FLOAT_TO_UBYTE: map float from {0,1} to ubyte in [0,255]
+ *** CLAMPED_FLOAT_TO_UBYTE: map float in [0,1] to ubyte in [0,255]
+ ***/
+#if defined(USE_IEEE) && !defined(DEBUG)
+#define IEEE_0996 0x3f7f0000 /* 0.996 or so */
+/* This function/macro is sensitive to precision. Test very carefully
+ * if you change it!
+ */
+#define UNCLAMPED_FLOAT_TO_UBYTE(UB, F) \
+ do { \
+ fi_type __tmp; \
+ __tmp.f = (F); \
+ UB = ((__tmp.i >= IEEE_0996) \
+ ? ((GLint)__tmp.i < 0) ? (GLubyte)0 : (GLubyte)255 \
+ : (__tmp.f = __tmp.f*(255.0F/256.0F) + 32768.0F, \
+ (GLubyte)__tmp.i)); \
+ } while (0)
+#define CLAMPED_FLOAT_TO_UBYTE(ub, f) \
+ UNCLAMPED_FLOAT_TO_UBYTE(ub, f)
+#else
+#define UNCLAMPED_FLOAT_TO_UBYTE(ub, f) \
+ ub = ((GLubyte) IROUND(CLAMP((f), 0.0F, 1.0F) * 255.0F))
+#define CLAMPED_FLOAT_TO_UBYTE(ub, f) \
+ ub = ((GLubyte) IROUND((f) * 255.0F))
+#endif
+
+
+/***
+ *** COPY_FLOAT: copy a float from src to dest, avoid slow FP regs if possible
+ ***/
+#if defined(USE_IEEE) && !defined(DEBUG)
+#define COPY_FLOAT( dst, src ) \
+ ((fi_type *) &(dst))->i = ((fi_type *) &(src))->i
+#else
+#define COPY_FLOAT( dst, src ) (dst) = (src)
+#endif
+
+
+/***
+ *** START_FAST_MATH: Set x86 FPU to faster, 32-bit precision mode (and save
+ *** original mode to a temporary).
+ *** END_FAST_MATH: Restore x86 FPU to original mode.
+ ***/
+#if defined(__GNUC__) && defined(__i386__)
+/*
+ * Set the x86 FPU control word to guarentee only 32 bits of precision
+ * are stored in registers. Allowing the FPU to store more introduces
+ * differences between situations where numbers are pulled out of memory
+ * vs. situations where the compiler is able to optimize register usage.
+ *
+ * In the worst case, we force the compiler to use a memory access to
+ * truncate the float, by specifying the 'volatile' keyword.
+ */
+/* Hardware default: All exceptions masked, extended double precision,
+ * round to nearest (IEEE compliant):
+ */
+#define DEFAULT_X86_FPU 0x037f
+/* All exceptions masked, single precision, round to nearest:
+ */
+#define FAST_X86_FPU 0x003f
+/* The fldcw instruction will cause any pending FP exceptions to be
+ * raised prior to entering the block, and we clear any pending
+ * exceptions before exiting the block. Hence, asm code has free
+ * reign over the FPU while in the fast math block.
+ */
+#if defined(NO_FAST_MATH)
+#define START_FAST_MATH(x) \
+do { \
+ static GLuint mask = DEFAULT_X86_FPU; \
+ __asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \
+ __asm__ ( "fldcw %0" : : "m" (mask) ); \
+} while (0)
+#else
+#define START_FAST_MATH(x) \
+do { \
+ static GLuint mask = FAST_X86_FPU; \
+ __asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \
+ __asm__ ( "fldcw %0" : : "m" (mask) ); \
+} while (0)
+#endif
+/* Restore original FPU mode, and clear any exceptions that may have
+ * occurred in the FAST_MATH block.
+ */
+#define END_FAST_MATH(x) \
+do { \
+ __asm__ ( "fnclex ; fldcw %0" : : "m" (*&(x)) ); \
+} while (0)
+
+#elif defined(__WATCOMC__) && !defined(NO_FAST_MATH)
+void _wacom_start_fast_math(unsigned short *x);
+#pragma aux _wacom_start_fast_math = \
+ "fstcw word ptr [esi]" \
+ "or word ptr [esi], 0x3f" \
+ "fldcw word ptr [esi]" \
+ parm [esi] \
+ modify exact [];
+void _wacom_end_fast_math(unsigned short *x);
+#pragma aux _wacom_end_fast_math = \
+ "fldcw word ptr [esi]" \
+ parm [esi] \
+ modify exact [];
+#define START_FAST_MATH(x) _wacom_start_fast_math(& x)
+#define END_FAST_MATH(x) _wacom_end_fast_math(& x)
+#else
+#define START_FAST_MATH(x) x = 0
+#define END_FAST_MATH(x) (void)(x)
+#endif
+
+
+
+/**********************************************************************
+ * Functions
+ */
+
extern void *
_mesa_malloc( size_t bytes );
@@ -137,11 +578,20 @@ extern double
_mesa_cos(double a);
extern double
-_mesa_sqrt(double x);
+_mesa_sqrtd(double x);
+
+extern float
+_mesa_sqrtf(float x);
extern double
_mesa_pow(double x, double y);
+extern float
+_mesa_log2(float x);
+
+extern unsigned int
+_mesa_bitcount(unsigned int n);
+
extern char *
_mesa_getenv( const char *var );
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 201938d4aa..c7fa7018d3 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -1,10 +1,10 @@
-/* $Id: light.c,v 1.54 2002/10/25 21:06:29 brianp Exp $ */
+/* $Id: light.c,v 1.55 2003/03/01 01:50:21 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -32,7 +32,6 @@
#include "enums.h"
#include "light.h"
#include "macros.h"
-#include "mmath.h"
#include "simple_list.h"
#include "mtypes.h"
#include "math/m_xform.h"
@@ -963,12 +962,12 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
params[3] = FLOAT_TO_INT( ctx->Light.Material[f].Emission[3] );
break;
case GL_SHININESS:
- *params = ROUNDF( ctx->Light.Material[f].Shininess );
+ *params = IROUND( ctx->Light.Material[f].Shininess );
break;
case GL_COLOR_INDEXES:
- params[0] = ROUNDF( ctx->Light.Material[f].AmbientIndex );
- params[1] = ROUNDF( ctx->Light.Material[f].DiffuseIndex );
- params[2] = ROUNDF( ctx->Light.Material[f].SpecularIndex );
+ params[0] = IROUND( ctx->Light.Material[f].AmbientIndex );
+ params[1] = IROUND( ctx->Light.Material[f].DiffuseIndex );
+ params[2] = IROUND( ctx->Light.Material[f].SpecularIndex );
break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialfv(pname)" );
diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c
index 0a33e1399e..821b17e0b5 100644
--- a/src/mesa/main/lines.c
+++ b/src/mesa/main/lines.c
@@ -1,10 +1,10 @@
-/* $Id: lines.c,v 1.30 2002/10/24 23:57:21 brianp Exp $ */
+/* $Id: lines.c,v 1.31 2003/03/01 01:50:21 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -30,7 +30,6 @@
#include "depth.h"
#include "lines.h"
#include "macros.h"
-#include "mmath.h"
#include "texstate.h"
#include "mtypes.h"
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 4fc93936ac..0be9510995 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -1,4 +1,4 @@
-/* $Id: macros.h,v 1.30 2002/10/18 17:02:00 kschultz Exp $ */
+/* $Id: macros.h,v 1.31 2003/03/01 01:50:21 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -29,34 +29,79 @@
* A collection of useful macros.
*/
-
#ifndef MACROS_H
#define MACROS_H
+#include "imports.h"
+
-#include "glheader.h"
-/* Do not reference mtypes.h from this file.
+/*
+ * Integer / float conversion for colors, normals, etc.
*/
+/* Convert GLubyte in [0,255] to GLfloat in [0.0,1.0] */
+extern GLfloat _mesa_ubyte_to_float_color_tab[256];
+#define UBYTE_TO_FLOAT(u) _mesa_ubyte_to_float_color_tab[(unsigned int)(u)]
-/* Limits: */
-#define MAX_GLUSHORT 0xffff
-#define MAX_GLUINT 0xffffffff
+/* Convert GLfloat in [0.0,1.0] to GLubyte in [0,255] */
+#define FLOAT_TO_UBYTE(X) ((GLubyte) (GLint) ((X) * 255.0F))
-/* Pi */
-#ifndef M_PI
-#define M_PI (3.1415926)
-#endif
+/* Convert GLbyte in [-128,127] to GLfloat in [-1.0,1.0] */
+#define BYTE_TO_FLOAT(B) ((2.0F * (B) + 1.0F) * (1.0F/255.0F))
+/* Convert GLfloat in [-1.0,1.0] to GLbyte in [-128,127] */
+#define FLOAT_TO_BYTE(X) ( (((GLint) (255.0F * (X))) - 1) / 2 )
-/* Degrees to radians conversion: */
-#define DEG2RAD (M_PI/180.0)
+/* Convert GLushort in [0,65536] to GLfloat in [0.0,1.0] */
+#define USHORT_TO_FLOAT(S) ((GLfloat) (S) * (1.0F / 65535.0F))
-#ifndef NULL
-#define NULL 0
-#endif
+/* Convert GLfloat in [0.0,1.0] to GLushort in [0,65536] */
+#define FLOAT_TO_USHORT(X) ((GLushort) (GLint) ((X) * 65535.0F))
+
+
+/* Convert GLshort in [-32768,32767] to GLfloat in [-1.0,1.0] */
+#define SHORT_TO_FLOAT(S) ((2.0F * (S) + 1.0F) * (1.0F/65535.0F))
+
+/* Convert GLfloat in [0.0,1.0] to GLshort in [-32768,32767] */
+#define FLOAT_TO_SHORT(X) ( (((GLint) (65535.0F * (X))) - 1) / 2 )
+
+
+/* Convert GLuint in [0,4294967295] to GLfloat in [0.0,1.0] */
+#define UINT_TO_FLOAT(U) ((GLfloat) (U) * (1.0F / 4294967295.0F))
+
+/* Convert GLfloat in [0.0,1.0] to GLuint in [0,4294967295] */
+#define FLOAT_TO_UINT(X) ((GLuint) ((X) * 4294967295.0))
+
+
+/* Convert GLint in [-2147483648,2147483647] to GLfloat in [-1.0,1.0] */
+#define INT_TO_FLOAT(I) ((2.0F * (I) + 1.0F) * (1.0F/4294967294.0F))
+
+/* Convert GLfloat in [-1.0,1.0] to GLint in [-2147483648,2147483647] */
+/* causes overflow:
+#define FLOAT_TO_INT(X) ( (((GLint) (4294967294.0F * (X))) - 1) / 2 )
+*/
+/* a close approximation: */
+#define FLOAT_TO_INT(X) ( (GLint) (2147483647.0 * (X)) )
+
+
+#define BYTE_TO_UBYTE(b) ((GLubyte) ((b) < 0 ? 0 : (GLubyte) (b)))
+#define SHORT_TO_UBYTE(s) ((GLubyte) ((s) < 0 ? 0 : (GLubyte) ((s) >> 7)))
+#define USHORT_TO_UBYTE(s) ((GLubyte) ((s) >> 8))
+#define INT_TO_UBYTE(i) ((GLubyte) ((i) < 0 ? 0 : (GLubyte) ((i) >> 23)))
+#define UINT_TO_UBYTE(i) ((GLubyte) ((i) >> 24))
+
+
+#define BYTE_TO_USHORT(b) ((b) < 0 ? 0 : ((GLushort) (((b) * 65535) / 255)))
+#define UBYTE_TO_USHORT(b) (((GLushort) (b) << 8) | (GLushort) (b))
+#define SHORT_TO_USHORT(s) ((s) < 0 ? 0 : ((GLushort) (((s) * 65535 / 32767))))
+#define INT_TO_USHORT(i) ((i) < 0 ? 0 : ((GLushort) ((i) >> 15)))
+#define UINT_TO_USHORT(i) ((i) < 0 ? 0 : ((GLushort) ((i) >> 16)))
+#define UNCLAMPED_FLOAT_TO_USHORT(us, f) \
+ us = ( (GLushort) IROUND( CLAMP((f), 0.0, 1.0) * 65535.0F) )
+#define CLAMPED_FLOAT_TO_USHORT(us, f) \
+ us = ( (GLushort) IROUND( (f) * 65535.0F) )
/* Stepping a GLfloat pointer by a byte stride
@@ -389,6 +434,79 @@ do { \
+/*
+ * Linear interpolation
+ * NOTE: OUT argument is evaluated twice!
+ * NOTE: Be wary of using *coord++ as an argument to any of these macros!
+ */
+#define LINTERP(T, OUT, IN) ((OUT) + (T) * ((IN) - (OUT)))
+
+/* Can do better with integer math:
+ */
+#define INTERP_UB( t, dstub, outub, inub ) \
+do { \
+ GLfloat inf = UBYTE_TO_FLOAT( inub ); \
+ GLfloat outf = UBYTE_TO_FLOAT( outub ); \
+ GLfloat dstf = LINTERP( t, outf, inf ); \
+ UNCLAMPED_FLOAT_TO_UBYTE( dstub, dstf ); \
+} while (0)
+
+#define INTERP_CHAN( t, dstc, outc, inc ) \
+do { \
+ GLfloat inf = CHAN_TO_FLOAT( inc ); \
+ GLfloat outf = CHAN_TO_FLOAT( outc ); \
+ GLfloat dstf = LINTERP( t, outf, inf ); \
+ UNCLAMPED_FLOAT_TO_CHAN( dstc, dstf ); \
+} while (0)
+
+#define INTERP_UI( t, dstui, outui, inui ) \
+ dstui = (GLuint) (GLint) LINTERP( (t), (GLfloat) (outui), (GLfloat) (inui) )
+
+#define INTERP_F( t, dstf, outf, inf ) \
+ dstf = LINTERP( t, outf, inf )
+
+#define INTERP_4F( t, dst, out, in ) \
+do { \
+ dst[0] = LINTERP( (t), (out)[0], (in)[0] ); \
+ dst[1] = LINTERP( (t), (out)[1], (in)[1] ); \
+ dst[2] = LINTERP( (t), (out)[2], (in)[2] ); \
+ dst[3] = LINTERP( (t), (out)[3], (in)[3] ); \
+} while (0)
+
+#define INTERP_3F( t, dst, out, in ) \
+do { \
+ dst[0] = LINTERP( (t), (out)[0], (in)[0] ); \
+ dst[1] = LINTERP( (t), (out)[1], (in)[1] ); \
+ dst[2] = LINTERP( (t), (out)[2], (in)[2] ); \
+} while (0)
+
+#define INTERP_4CHAN( t, dst, out, in ) \
+do { \
+ INTERP_CHAN( (t), (dst)[0], (out)[0], (in)[0] ); \
+ INTERP_CHAN( (t), (dst)[1], (out)[1], (in)[1] ); \
+ INTERP_CHAN( (t), (dst)[2], (out)[2], (in)[2] ); \
+ INTERP_CHAN( (t), (dst)[3], (out)[3], (in)[3] ); \
+} while (0)
+
+#define INTERP_3CHAN( t, dst, out, in ) \
+do { \
+ INTERP_CHAN( (t), (dst)[0], (out)[0], (in)[0] ); \
+ INTERP_CHAN( (t), (dst)[1], (out)[1], (in)[1] ); \
+ INTERP_CHAN( (t), (dst)[2], (out)[2], (in)[2] ); \
+} while (0)
+
+#define INTERP_SZ( t, vec, to, out, in, sz ) \
+do { \
+ switch (sz) { \
+ case 4: vec[to][3] = LINTERP( (t), (vec)[out][3], (vec)[in][3] ); \
+ case 3: vec[to][2] = LINTERP( (t), (vec)[out][2], (vec)[in][2] ); \
+ case 2: vec[to][1] = LINTERP( (t), (vec)[out][1], (vec)[in][1] ); \
+ case 1: vec[to][0] = LINTERP( (t), (vec)[out][0], (vec)[in][0] ); \
+ } \
+} while(0)
+
+
+
/* Assign scalers to short vectors: */
#define ASSIGN_2V( V, V0, V1 ) \
do { \
@@ -413,22 +531,6 @@ do { \
-
-/* Absolute value (for Int, Float, Double): */
-#define ABSI(X) ((X) < 0 ? -(X) : (X))
-#define ABSF(X) ((X) < 0.0F ? -(X) : (X))
-#define ABSD(X) ((X) < 0.0 ? -(X) : (X))
-
-
-
-/* Round a floating-point value to the nearest integer: */
-#define ROUNDF(X) ( (X)<0.0F ? ((GLint) ((X)-0.5F)) : ((GLint) ((X)+0.5F)) )
-
-
-/* Compute ceiling of integer quotient of A divided by B: */
-#define CEILING( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )
-
-
/* Clamp X to [MIN,MAX]: */
#define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) )
@@ -465,63 +567,24 @@ do { \
} while (0)
+/* Normalize a 3-element vector to unit length. */
+#define NORMALIZE_3FV( V ) \
+do { \
+ GLfloat len = (GLfloat) LEN_SQUARED_3FV(V); \
+ if (len) { \
+ len = (GLfloat) (1.0 / SQRTF(len)); \
+ (V)[0] = (GLfloat) ((V)[0] * len); \
+ (V)[1] = (GLfloat) ((V)[1] * len); \
+ (V)[2] = (GLfloat) ((V)[2] * len); \
+ } \
+} while(0)
-/* Generic color packing macros
- * XXX We may move these into texutil.h at some point.
- */
-
-#define PACK_COLOR_8888( a, b, c, d ) \
- (((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
-
-#define PACK_COLOR_888( a, b, c ) \
- (((a) << 16) | ((b) << 8) | (c))
-
-#define PACK_COLOR_565( a, b, c ) \
- ((((a) & 0xf8) << 8) | (((b) & 0xfc) << 3) | (((c) & 0xf8) >> 3))
-
-#define PACK_COLOR_1555( a, b, c, d ) \
- ((((b) & 0xf8) << 7) | (((c) & 0xf8) << 2) | (((d) & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-
-#define PACK_COLOR_4444( a, b, c, d ) \
- ((((a) & 0xf0) << 8) | (((b) & 0xf0) << 4) | ((c) & 0xf0) | ((d) >> 4))
-
-#define PACK_COLOR_88( a, b ) \
- (((a) << 8) | (b))
-
-#define PACK_COLOR_332( a, b, c ) \
- (((a) & 0xe0) | (((b) & 0xe0) >> 3) | (((c) & 0xc0) >> 6))
-
-
-#ifdef MESA_BIG_ENDIAN
-
-#define PACK_COLOR_8888_LE( a, b, c, d ) PACK_COLOR_8888( d, c, b, a )
-
-#define PACK_COLOR_565_LE( a, b, c ) \
- (((a) & 0xf8) | (((b) & 0xe0) >> 5) | (((b) & 0x1c) << 11) | \
- (((c) & 0xf8) << 5))
-
-#define PACK_COLOR_1555_LE( a, b, c, d ) \
- ((((b) & 0xf8) >> 1) | (((c) & 0xc0) >> 6) | (((c) & 0x38) << 10) | \
- (((d) & 0xf8) << 5) | ((a) ? 0x80 : 0))
-
-#define PACK_COLOR_4444_LE( a, b, c, d ) PACK_COLOR_4444( c, d, a, b )
-
-#define PACK_COLOR_88_LE( a, b ) PACK_COLOR_88( b, a )
-
-#else /* little endian */
-
-#define PACK_COLOR_8888_LE( a, b, c, d ) PACK_COLOR_8888( a, b, c, d )
-
-#define PACK_COLOR_565_LE( a, b, c ) PACK_COLOR_565( a, b, c )
-
-#define PACK_COLOR_1555_LE( a, b, c, d ) PACK_COLOR_1555( a, b, c, d )
-
-#define PACK_COLOR_4444_LE( a, b, c, d ) PACK_COLOR_4444( a, b, c, d )
+#define LEN_3FV( V ) (SQRTF((V)[0]*(V)[0]+(V)[1]*(V)[1]+(V)[2]*(V)[2]))
+#define LEN_2FV( V ) (SQRTF((V)[0]*(V)[0]+(V)[1]*(V)[1]))
-#define PACK_COLOR_88_LE( a, b ) PACK_COLOR_88( a, b )
+#define LEN_SQUARED_3FV( V ) ((V)[0]*(V)[0]+(V)[1]*(V)[1]+(V)[2]*(V)[2])
+#define LEN_SQUARED_2FV( V ) ((V)[0]*(V)[0]+(V)[1]*(V)[1])
-#endif /* endianness */
#endif
diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c
index 0b5f001402..af046a3c8f 100644
--- a/src/mesa/main/matrix.c
+++ b/src/mesa/main/matrix.c
@@ -1,10 +1,10 @@
-/* $Id: matrix.c,v 1.45 2002/10/24 23:57:21 brianp Exp $ */
+/* $Id: matrix.c,v 1.46 2003/03/01 01:50:21 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -42,7 +42,6 @@
#include "enums.h"
#include "macros.h"
#include "matrix.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_matrix.h"
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 7ca6f61118..acac82bc88 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.104 2003/02/23 04:07:28 brianp Exp $ */
+/* $Id: mtypes.h,v 1.105 2003/03/01 01:50:22 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -109,6 +109,33 @@ typedef GLuint GLdepth; /* Must be 32-bits! */
* Fixed point data type:
*/
typedef int GLfixed;
+/*
+ * Fixed point arithmetic macros
+ */
+#ifdef FIXED_14
+#define FIXED_ONE 0x00004000
+#define FIXED_HALF 0x00002000
+#define FIXED_FRAC_MASK 0x00003FFF
+#define FIXED_SCALE 16384.0f
+#define FIXED_SHIFT 14
+#else
+#define FIXED_ONE 0x00000800
+#define FIXED_HALF 0x00000400
+#define FIXED_FRAC_MASK 0x000007FF
+#define FIXED_SCALE 2048.0f
+#define FIXED_SHIFT 11
+#endif
+#define FIXED_INT_MASK (~FIXED_FRAC_MASK)
+#define FIXED_EPSILON 1
+#define FloatToFixed(X) (IROUND((X) * FIXED_SCALE))
+#define IntToFixed(I) ((I) << FIXED_SHIFT)
+#define FixedToInt(X) ((X) >> FIXED_SHIFT)
+#define FixedToUns(X) (((unsigned int)(X)) >> FIXED_SHIFT)
+#define FixedCeil(X) (((X) + FIXED_ONE - FIXED_EPSILON) & FIXED_INT_MASK)
+#define FixedFloor(X) ((X) & FIXED_INT_MASK)
+#define FixedToFloat(X) ((X) * (1.0F / FIXED_SCALE))
+#define PosFloatToFixed(X) FloatToFixed(X)
+#define SignedFloatToFixed(X) FloatToFixed(X)
diff --git a/src/mesa/main/nvfragparse.c b/src/mesa/main/nvfragparse.c
index 97cc9dd6bb..f7eda38cc4 100644
--- a/src/mesa/main/nvfragparse.c
+++ b/src/mesa/main/nvfragparse.c
@@ -1,4 +1,4 @@
-/* $Id: nvfragparse.c,v 1.11 2003/02/26 01:28:15 brianp Exp $ */
+/* $Id: nvfragparse.c,v 1.12 2003/03/01 01:50:22 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -36,7 +36,6 @@
#include "hash.h"
#include "imports.h"
#include "macros.h"
-#include "mmath.h"
#include "mtypes.h"
#include "nvfragprog.h"
#include "nvfragparse.h"
@@ -201,7 +200,10 @@ MatchInstruction(const GLubyte *token)
static GLboolean IsLetter(GLubyte b)
{
- return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || (b == '_');
+ return (b >= 'a' && b <= 'z') ||
+ (b >= 'A' && b <= 'Z') ||
+ (b == '_') ||
+ (b == '$');
}
@@ -264,7 +266,7 @@ GetToken(const GLubyte *str, GLubyte *token)
return i;
}
- /* punctuation */
+ /* punctuation character */
if (str[i]) {
token[0] = str[i++];
token[1] = 0;
@@ -618,6 +620,9 @@ Parse_TextureImageId(struct parse_state *parseState,
/* update record of referenced texture units */
parseState->program->TexturesUsed[*texUnit] |= (1 << *texTargetIndex);
+ if (_mesa_bitcount(parseState->program->TexturesUsed[*texUnit]) > 1) {
+ RETURN_ERROR1("Only one texture target can be used per texture unit.");
+ }
return GL_TRUE;
}
@@ -840,6 +845,9 @@ Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum)
if (_mesa_strcmp((const char *) token, OutputRegisters[j]) == 0) {
*outputRegNum = FP_OUTPUT_REG_START + j;
parseState->outputsWritten |= (1 << j);
+ if ((parseState->outputsWritten & 0x3) == 0x3) {
+ RETURN_ERROR1("Illegal to write to both o[COLR] and o[COLH]");
+ }
break;
}
}
@@ -1138,6 +1146,7 @@ Parse_InstructionSequence(struct parse_state *parseState,
GLfloat value[7]; /* yes, 7 to be safe */
if (!Parse_Identifier(parseState, id))
RETURN_ERROR;
+ /* XXX make sure id is not a reserved identifer, like R9 */
if (!Parse_String(parseState, "="))
RETURN_ERROR1("Expected =");
if (!Parse_VectorOrScalarConstant(parseState, value))
@@ -1154,6 +1163,7 @@ Parse_InstructionSequence(struct parse_state *parseState,
GLfloat value[7] = {0, 0, 0, 0, 0, 0, 0}; /* yes, to be safe */
if (!Parse_Identifier(parseState, id))
RETURN_ERROR;
+ /* XXX make sure id is not a reserved identifer, like R9 */
if (Parse_String(parseState, "=")) {
if (!Parse_VectorOrScalarConstant(parseState, value))
RETURN_ERROR;
diff --git a/src/mesa/main/nvvertexec.c b/src/mesa/main/nvvertexec.c
index 59fc9690d0..72ebcffca9 100644
--- a/src/mesa/main/nvvertexec.c
+++ b/src/mesa/main/nvvertexec.c
@@ -1,4 +1,4 @@
-/* $Id: nvvertexec.c,v 1.1 2003/01/14 04:55:46 brianp Exp $ */
+/* $Id: nvvertexec.c,v 1.2 2003/03/01 01:50:22 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -37,7 +37,6 @@
#include "mtypes.h"
#include "nvvertexec.h"
#include "nvvertprog.h"
-#include "mmath.h"
#include "math/m_matrix.h"
diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c
index f162da4b5b..9f9e3ad554 100644
--- a/src/mesa/main/points.c
+++ b/src/mesa/main/points.c
@@ -1,10 +1,10 @@
-/* $Id: points.c,v 1.34 2002/10/24 23:57:21 brianp Exp $ */
+/* $Id: points.c,v 1.35 2003/03/01 01:50:22 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -28,7 +28,6 @@
#include "glheader.h"
#include "context.h"
#include "macros.h"
-#include "mmath.h"
#include "points.h"
#include "texstate.h"
#include "mtypes.h"
diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c
index bb03c45697..2ca7b22a9b 100644
--- a/src/mesa/main/rastpos.c
+++ b/src/mesa/main/rastpos.c
@@ -1,10 +1,10 @@
-/* $Id: rastpos.c,v 1.39 2002/10/24 23:57:21 brianp Exp $ */
+/* $Id: rastpos.c,v 1.40 2003/03/01 01:50:22 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -32,7 +32,6 @@
#include "feedback.h"
#include "light.h"
#include "macros.h"
-#include "mmath.h"
#include "rastpos.h"
#include "state.h"
#include "simple_list.h"
@@ -321,8 +320,8 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT)
ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0];
else
- ctx->Current.RasterDistance = (GLfloat)
- GL_SQRT( eye[0]*eye[0] + eye[1]*eye[1] + eye[2]*eye[2] );
+ ctx->Current.RasterDistance =
+ SQRTF( eye[0]*eye[0] + eye[1]*eye[1] + eye[2]*eye[2] );
/* apply projection matrix: clip = Proj * eye */
TRANSFORM_POINT( clip, ctx->ProjectionMatrixStack.Top->m, eye );
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 14b62bc434..1051bda11d 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1,10 +1,10 @@
-/* $Id: state.c,v 1.98 2003/01/14 04:55:46 brianp Exp $ */
+/* $Id: state.c,v 1.99 2003/03/01 01:50:22 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 5.0
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -51,10 +51,10 @@
#include "fog.h"
#include "hint.h"
#include "histogram.h"
+#include "imports.h"
#include "light.h"
#include "lines.h"
#include "matrix.h"
-#include "mmath.h"
#include "pixel.h"
#include "points.h"
#include "polygon.h"
@@ -601,9 +601,9 @@ update_modelview_scale( GLcontext *ctx )
GLfloat f = m[2] * m[2] + m[6] * m[6] + m[10] * m[10];
if (f < 1e-12) f = 1.0;
if (ctx->_NeedEyeCoords)
- ctx->_ModelViewInvScale = (GLfloat) (1.0/GL_SQRT(f));
+ ctx->_ModelViewInvScale = 1.0F / SQRTF(f);
else
- ctx->_ModelViewInvScale = (GLfloat) GL_SQRT(f);
+ ctx->_ModelViewInvScale = SQRTF(f);
}
}
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index 0700f85d0d..c529031f9f 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -1,10 +1,10 @@
-/* $Id: texformat.c,v 1.18 2002/10/29 20:28:47 brianp Exp $ */
+/* $Id: texformat.c,v 1.19 2003/03/01 01:50:22 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -32,7 +32,6 @@
#include "context.h"
#include "image.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "texformat.h"
#include "teximage.h"
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index e7a087c0f4..3397a865cd 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1,4 +1,4 @@
-/* $Id: teximage.c,v 1.125 2003/01/08 16:24:05 brianp Exp $ */
+/* $Id: teximage.c,v 1.126 2003/03/01 01:50:22 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -30,7 +30,6 @@
#include "image.h"
#include "imports.h"
#include "macros.h"
-#include "mmath.h"
#include "state.h"
#include "texcompress.h"
#include "texformat.h"
diff --git a/src/mesa/main/texutil.c b/src/mesa/main/texutil.c
index 660f7ec63f..26eda819bf 100644
--- a/src/mesa/main/texutil.c
+++ b/src/mesa/main/texutil.c
@@ -1,10 +1,10 @@
-/* $Id: texutil.c,v 1.34 2002/10/29 20:28:53 brianp Exp $ */
+/* $Id: texutil.c,v 1.35 2003/03/01 01:50:22 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -36,6 +36,7 @@
#include "glheader.h"
+#include "colormac.h"
#include "context.h"
#include "enums.h"
#include "image.h"
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 1b540eff44..889584780f 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1,10 +1,10 @@
-/* $Id: varray.c,v 1.47 2002/10/24 23:57:21 brianp Exp $ */
+/* $Id: varray.c,v 1.48 2003/03/01 01:50:22 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -31,7 +31,6 @@
#include "dlist.h"
#include "light.h"
#include "macros.h"
-#include "mmath.h"
#include "state.h"
#include "texstate.h"
#include "mtypes.h"
diff --git a/src/mesa/math/m_debug_norm.c b/src/mesa/math/m_debug_norm.c
index 9e3f16f13c..0786ad05ee 100644
--- a/src/mesa/math/m_debug_norm.c
+++ b/src/mesa/math/m_debug_norm.c
@@ -1,10 +1,10 @@
-/* $Id: m_debug_norm.c,v 1.12 2002/12/04 14:24:44 brianp Exp $ */
+/* $Id: m_debug_norm.c,v 1.13 2003/03/01 01:50:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -31,7 +31,6 @@
#include "context.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "m_matrix.h"
#include "m_xform.h"
diff --git a/src/mesa/math/m_matrix.c b/src/mesa/math/m_matrix.c
index f0692ba115..95a77e6a08 100644
--- a/src/mesa/math/m_matrix.c
+++ b/src/mesa/math/m_matrix.c
@@ -1,4 +1,4 @@
-/* $Id: m_matrix.c,v 1.15 2003/01/08 16:42:47 brianp Exp $ */
+/* $Id: m_matrix.c,v 1.16 2003/03/01 01:50:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -38,7 +38,6 @@
#include "imports.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "m_matrix.h"
@@ -606,7 +605,7 @@ _math_matrix_rotate( GLmatrix *mat,
}
if (!optimized) {
- const GLfloat mag = (GLfloat) GL_SQRT(x * x + y * y + z * z);
+ const GLfloat mag = SQRTF(x * x + y * y + z * z);
if (mag <= 1.0e-4) {
/* no rotation, leave mat as-is */
diff --git a/src/mesa/math/m_norm_tmp.h b/src/mesa/math/m_norm_tmp.h
index 55861e8ca3..2da7bbd676 100644
--- a/src/mesa/math/m_norm_tmp.h
+++ b/src/mesa/math/m_norm_tmp.h
@@ -1,10 +1,10 @@
-/* $Id: m_norm_tmp.h,v 1.12 2002/10/24 23:57:24 brianp Exp $ */
+/* $Id: m_norm_tmp.h,v 1.13 2003/03/01 01:50:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -69,7 +69,7 @@ TAG(transform_normalize_normals)( const GLmatrix *mat,
{
GLdouble len = tx*tx + ty*ty + tz*tz;
if (len > 1e-20) {
- GLdouble scale = 1.0 / GL_SQRT(len);
+ GLdouble scale = 1.0F / SQRTF(len);
out[i][0] = (GLfloat) (tx * scale);
out[i][1] = (GLfloat) (ty * scale);
out[i][2] = (GLfloat) (tz * scale);
@@ -136,7 +136,7 @@ TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat,
{
GLdouble len = tx*tx + ty*ty + tz*tz;
if (len > 1e-20) {
- GLdouble scale = 1.0 / GL_SQRT(len);
+ GLdouble scale = 1.0F / SQRTF(len);
out[i][0] = (GLfloat) (tx * scale);
out[i][1] = (GLfloat) (ty * scale);
out[i][2] = (GLfloat) (tz * scale);
@@ -323,7 +323,7 @@ TAG(normalize_normals)( const GLmatrix *mat,
const GLfloat x = from[0], y = from[1], z = from[2];
GLdouble len = x * x + y * y + z * z;
if (len > 1e-50) {
- len = 1.0 / GL_SQRT(len);
+ len = 1.0F / SQRTF(len);
out[i][0] = (GLfloat) (x * len);
out[i][1] = (GLfloat) (y * len);
out[i][2] = (GLfloat) (z * len);
diff --git a/src/mesa/math/m_translate.c b/src/mesa/math/m_translate.c
index ffd4d6a017..0c4a1b1631 100644
--- a/src/mesa/math/m_translate.c
+++ b/src/mesa/math/m_translate.c
@@ -1,4 +1,4 @@
-/* $Id: m_translate.c,v 1.10 2002/10/24 23:57:24 brianp Exp $ */
+/* $Id: m_translate.c,v 1.11 2003/03/01 01:50:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -32,7 +32,6 @@
#include "glheader.h"
#include "mtypes.h" /* GLchan hack */
#include "colormac.h"
-#include "mmath.h"
#include "m_translate.h"
diff --git a/src/mesa/math/m_xform.c b/src/mesa/math/m_xform.c
index beda08c589..a6813d29e9 100644
--- a/src/mesa/math/m_xform.c
+++ b/src/mesa/math/m_xform.c
@@ -1,10 +1,10 @@
-/* $Id: m_xform.c,v 1.18 2002/10/24 23:57:24 brianp Exp $ */
+/* $Id: m_xform.c,v 1.19 2003/03/01 01:50:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -37,7 +37,6 @@
#include "glheader.h"
#include "macros.h"
-#include "mmath.h"
#include "m_eval.h"
#include "m_matrix.h"
diff --git a/src/mesa/swrast/s_aaline.c b/src/mesa/swrast/s_aaline.c
index 5d391a2ad3..8221a55447 100644
--- a/src/mesa/swrast/s_aaline.c
+++ b/src/mesa/swrast/s_aaline.c
@@ -1,4 +1,4 @@
-/* $Id: s_aaline.c,v 1.19 2003/02/28 15:08:49 brianp Exp $ */
+/* $Id: s_aaline.c,v 1.20 2003/03/01 01:50:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -26,12 +26,12 @@
#include "glheader.h"
+#include "imports.h"
#include "swrast/s_aaline.h"
#include "swrast/s_context.h"
#include "swrast/s_span.h"
#include "swrast/swrast.h"
#include "mtypes.h"
-#include "mmath.h"
#define SUB_PIXEL 4
diff --git a/src/mesa/swrast/s_aatriangle.c b/src/mesa/swrast/s_aatriangle.c
index 1b179bc613..7b41573a4e 100644
--- a/src/mesa/swrast/s_aatriangle.c
+++ b/src/mesa/swrast/s_aatriangle.c
@@ -1,4 +1,4 @@
-/* $Id: s_aatriangle.c,v 1.29 2003/01/25 18:57:13 brianp Exp $ */
+/* $Id: s_aatriangle.c,v 1.30 2003/03/01 01:50:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -34,7 +34,6 @@
#include "colormac.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "s_aatriangle.h"
#include "s_context.h"
#include "s_span.h"
diff --git a/src/mesa/swrast/s_accum.c b/src/mesa/swrast/s_accum.c
index b42440060e..2af2714bd6 100644
--- a/src/mesa/swrast/s_accum.c
+++ b/src/mesa/swrast/s_accum.c
@@ -1,4 +1,4 @@
-/* $Id: s_accum.c,v 1.20 2002/10/30 19:49:30 brianp Exp $ */
+/* $Id: s_accum.c,v 1.21 2003/03/01 01:50:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -28,7 +28,6 @@
#include "glheader.h"
#include "context.h"
#include "macros.h"
-#include "mmath.h"
#include "imports.h"
#include "s_accum.h"
diff --git a/src/mesa/swrast/s_alpha.c b/src/mesa/swrast/s_alpha.c
index 5cbfe8617a..35ec7e9dcc 100644
--- a/src/mesa/swrast/s_alpha.c
+++ b/src/mesa/swrast/s_alpha.c
@@ -1,4 +1,4 @@
-/* $Id: s_alpha.c,v 1.12 2002/10/04 19:10:12 brianp Exp $ */
+/* $Id: s_alpha.c,v 1.13 2003/03/01 01:50:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -33,7 +33,6 @@
#include "context.h"
#include "colormac.h"
#include "macros.h"
-#include "mmath.h"
#include "s_alpha.h"
#include "s_context.h"
diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c
index 9194fc7c34..49cc59ceef 100644
--- a/src/mesa/swrast/s_bitmap.c
+++ b/src/mesa/swrast/s_bitmap.c
@@ -1,4 +1,4 @@
-/* $Id: s_bitmap.c,v 1.20 2002/11/25 20:26:59 brianp Exp $ */
+/* $Id: s_bitmap.c,v 1.21 2003/03/01 01:50:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -33,7 +33,6 @@
#include "glheader.h"
#include "image.h"
#include "macros.h"
-#include "mmath.h"
#include "pixel.h"
#include "s_context.h"
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index ddf864793e..1050816698 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -1,4 +1,4 @@
-/* $Id: s_drawpix.c,v 1.45 2003/02/25 19:26:00 brianp Exp $ */
+/* $Id: s_drawpix.c,v 1.46 2003/03/01 01:50:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -31,7 +31,6 @@
#include "image.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "pixel.h"
#include "s_context.h"
diff --git a/src/mesa/swrast/s_feedback.c b/src/mesa/swrast/s_feedback.c
index f25b179a2c..614820cc4c 100644
--- a/src/mesa/swrast/s_feedback.c
+++ b/src/mesa/swrast/s_feedback.c
@@ -1,10 +1,10 @@
-/* $Id: s_feedback.c,v 1.9 2001/09/19 20:30:44 kschultz Exp $ */
+/* $Id: s_feedback.c,v 1.10 2003/03/01 01:50:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -30,7 +30,6 @@
#include "enums.h"
#include "feedback.h"
#include "macros.h"
-#include "mmath.h"
#include "s_context.h"
#include "s_feedback.h"
diff --git a/src/mesa/swrast/s_fog.c b/src/mesa/swrast/s_fog.c
index c43ef60a30..7a97193e1e 100644
--- a/src/mesa/swrast/s_fog.c
+++ b/src/mesa/swrast/s_fog.c
@@ -1,4 +1,4 @@
-/* $Id: s_fog.c,v 1.23 2002/08/07 00:45:07 brianp Exp $ */
+/* $Id: s_fog.c,v 1.24 2003/03/01 01:50:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -29,7 +29,6 @@
#include "colormac.h"
#include "context.h"
#include "macros.h"
-#include "mmath.h"
#include "s_context.h"
#include "s_fog.h"
diff --git a/src/mesa/swrast/s_lines.c b/src/mesa/swrast/s_lines.c
index 7fb5ef246f..b21b39d61f 100644
--- a/src/mesa/swrast/s_lines.c
+++ b/src/mesa/swrast/s_lines.c
@@ -1,4 +1,4 @@
-/* $Id: s_lines.c,v 1.34 2003/01/20 15:21:41 brianp Exp $ */
+/* $Id: s_lines.c,v 1.35 2003/03/01 01:50:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -28,7 +28,6 @@
#include "glheader.h"
#include "colormac.h"
#include "macros.h"
-#include "mmath.h"
#include "s_aaline.h"
#include "s_context.h"
#include "s_depth.h"
diff --git a/src/mesa/swrast/s_nvfragprog.c b/src/mesa/swrast/s_nvfragprog.c
index 738c78274e..97f65c0479 100644
--- a/src/mesa/swrast/s_nvfragprog.c
+++ b/src/mesa/swrast/s_nvfragprog.c
@@ -1,4 +1,4 @@
-/* $Id: s_nvfragprog.c,v 1.4 2003/02/25 19:29:43 brianp Exp $ */
+/* $Id: s_nvfragprog.c,v 1.5 2003/03/01 01:50:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -31,7 +31,6 @@
#include "context.h"
#include "nvfragprog.h"
#include "macros.h"
-#include "mmath.h"
#include "s_nvfragprog.h"
@@ -47,7 +46,7 @@ fetch_texel( GLcontext *ctx, const GLfloat texcoord[4], GLuint unit,
const GLfloat *lambda = NULL;
GLchan rgba[4];
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- const struct gl_texture_object *texObj;
+ const struct gl_texture_object *texObj = NULL;
switch (targetIndex) {
case TEXTURE_1D_INDEX:
@@ -147,20 +146,7 @@ fetch_vector1( const struct fp_src_register *source,
const struct fp_machine *machine,
GLfloat result[4] )
{
- const GLfloat *src;
-
- /*
- if (source->RelAddr) {
- GLint reg = source->Register + machine->AddressReg;
- if (reg < VP_PROG_REG_START || reg > VP_PROG_REG_END)
- src = zero;
- else
- src = machine->Registers[reg];
- }
- else
- */
-
- src = machine->Registers[source->Register];
+ const GLfloat *src = machine->Registers[source->Register];
result[0] = src[source->Swizzle[0]];
@@ -300,7 +286,7 @@ execute_program(GLcontext *ctx, const struct fragment_program *program)
{
GLfloat a[4], result[4];
fetch_vector1( &inst->SrcReg[0], machine, a );
- result[0] = result[1] = result[2] = result[3] = cos(a[0]);
+ result[0] = result[1] = result[2] = result[3] = _mesa_cos(a[0]);
store_vector4( inst, machine, result );
}
break;
@@ -363,7 +349,7 @@ execute_program(GLcontext *ctx, const struct fragment_program *program)
GLfloat a[4], result[4];
fetch_vector1( &inst->SrcReg[0], machine, a );
result[0] = result[1] = result[2] = result[3] =
- (GLfloat) pow(2.0, a[0]);
+ (GLfloat) _mesa_pow(2.0, a[0]);
store_vector4( inst, machine, result );
}
break;
@@ -419,7 +405,7 @@ execute_program(GLcontext *ctx, const struct fragment_program *program)
a[1] = 0.0F;
result[0] = 1.0F;
result[1] = a[0];
- result[2] = (a[0] > 0.0) ? pow(2.0, a[3]) : 0.0F;
+ result[2] = (a[0] > 0.0) ? _mesa_pow(2.0, a[3]) : 0.0F;
result[3] = 1.0F;
store_vector4( inst, machine, result );
}
@@ -561,7 +547,7 @@ execute_program(GLcontext *ctx, const struct fragment_program *program)
fetch_vector1( &inst->SrcReg[0], machine, a );
fetch_vector1( &inst->SrcReg[1], machine, b );
result[0] = result[1] = result[2] = result[3]
- = pow(a[0], b[0]);
+ = _mesa_pow(a[0], b[0]);
store_vector4( inst, machine, result );
}
break;
@@ -597,7 +583,7 @@ execute_program(GLcontext *ctx, const struct fragment_program *program)
GLfloat a[4], result[4];
fetch_vector1( &inst->SrcReg[0], machine, a );
result[0] = result[1] = result[2] = result[3]
- = 1.0F / GL_SQRT(a[0]);
+ = 1.0F / SQRTF(a[0]);
store_vector4( inst, machine, result );
}
break;
@@ -647,7 +633,7 @@ execute_program(GLcontext *ctx, const struct fragment_program *program)
{
GLfloat a[4], result[4];
fetch_vector1( &inst->SrcReg[0], machine, a );
- result[0] = result[1] = result[2] = result[3] = sin(a[0]);
+ result[0] = result[1] = result[2] = result[3] = _mesa_sin(a[0]);
store_vector4( inst, machine, result );
}
break;
diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c
index 0c060f16ef..2bbd169b74 100644
--- a/src/mesa/swrast/s_points.c
+++ b/src/mesa/swrast/s_points.c
@@ -1,4 +1,4 @@
-/* $Id: s_points.c,v 1.19 2002/06/15 03:03:11 brianp Exp $ */
+/* $Id: s_points.c,v 1.20 2003/03/01 01:50:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -29,7 +29,6 @@
#include "colormac.h"
#include "context.h"
#include "macros.h"
-#include "mmath.h"
#include "texstate.h"
#include "s_context.h"
#include "s_feedback.h"
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index e65d19c9d3..d408151803 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -1,8 +1,8 @@
-/* $Id: s_span.c,v 1.55 2003/02/27 18:15:18 brianp Exp $ */
+/* $Id: s_span.c,v 1.56 2003/03/01 01:50:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 5.0.1
+ * Version: 5.1
*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
*
@@ -36,7 +36,6 @@
#include "colormac.h"
#include "context.h"
#include "macros.h"
-#include "mmath.h"
#include "imports.h"
#include "s_alpha.h"
diff --git a/src/mesa/swrast/s_texstore.c b/src/mesa/swrast/s_texstore.c
index ed8c3f9d32..e87945ab42 100644
--- a/src/mesa/swrast/s_texstore.c
+++ b/src/mesa/swrast/s_texstore.c
@@ -1,10 +1,10 @@
-/* $Id: s_texstore.c,v 1.9 2002/10/24 23:57:24 brianp Exp $ */
+/* $Id: s_texstore.c,v 1.10 2003/03/01 01:50:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -38,11 +38,12 @@
+#include "glheader.h"
+#include "imports.h"
#include "colormac.h"
#include "context.h"
#include "convolve.h"
#include "image.h"
-#include "imports.h"
#include "macros.h"
#include "texformat.h"
#include "teximage.h"
diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c
index f99075fc54..e63f49c742 100644
--- a/src/mesa/swrast/s_texture.c
+++ b/src/mesa/swrast/s_texture.c
@@ -1,4 +1,4 @@
-/* $Id: s_texture.c,v 1.81 2003/02/27 19:40:45 kschultz Exp $ */
+/* $Id: s_texture.c,v 1.82 2003/03/01 01:50:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -29,7 +29,6 @@
#include "context.h"
#include "colormac.h"
#include "macros.h"
-#include "mmath.h"
#include "imports.h"
#include "texformat.h"
#include "teximage.h"
@@ -2065,7 +2064,7 @@ choose_cube_face(const struct gl_texture_object *texObj,
const GLfloat ry = texcoord[1];
const GLfloat rz = texcoord[2];
const struct gl_texture_image **imgArray;
- const GLfloat arx = ABSF(rx), ary = ABSF(ry), arz = ABSF(rz);
+ const GLfloat arx = FABSF(rx), ary = FABSF(ry), arz = FABSF(rz);
GLfloat sc, tc, ma;
if (arx > ary && arx > arz) {
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c
index 324a51582c..76a45b96b5 100644
--- a/src/mesa/swrast/s_triangle.c
+++ b/src/mesa/swrast/s_triangle.c
@@ -1,4 +1,4 @@
-/* $Id: s_triangle.c,v 1.66 2002/12/18 15:02:19 brianp Exp $ */
+/* $Id: s_triangle.c,v 1.67 2003/03/01 01:50:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -36,7 +36,6 @@
#include "colormac.h"
#include "imports.h"
#include "macros.h"
-#include "mmath.h"
#include "texformat.h"
#include "teximage.h"
#include "texstate.h"
diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c
index 852905f681..f4fde9b31e 100644
--- a/src/mesa/swrast/s_zoom.c
+++ b/src/mesa/swrast/s_zoom.c
@@ -1,4 +1,4 @@
-/* $Id: s_zoom.c,v 1.22 2003/02/25 19:26:02 brianp Exp $ */
+/* $Id: s_zoom.c,v 1.23 2003/03/01 01:50:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -297,7 +297,7 @@ _mesa_write_zoomed_stencil_span( GLcontext *ctx,
(void) skipPixels; /* XXX this shouldn't be ignored */
/* compute width of output row */
- m = (GLint) ABSF( n * ctx->Pixel.ZoomX );
+ m = (GLint) FABSF( n * ctx->Pixel.ZoomX );
if (m==0) {
return;
}
diff --git a/src/mesa/tnl/t_array_api.c b/src/mesa/tnl/t_array_api.c
index ac46e615bc..19cb19b716 100644
--- a/src/mesa/tnl/t_array_api.c
+++ b/src/mesa/tnl/t_array_api.c
@@ -1,10 +1,10 @@
-/* $Id: t_array_api.c,v 1.30 2003/02/17 16:36:07 brianp Exp $ */
+/* $Id: t_array_api.c,v 1.31 2003/03/01 01:50:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -35,7 +35,6 @@
#include "context.h"
#include "imports.h"
#include "macros.h"
-#include "mmath.h"
#include "mtypes.h"
#include "state.h"
diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c
index 5e22fa61e6..2a8506aa42 100644
--- a/src/mesa/tnl/t_array_import.c
+++ b/src/mesa/tnl/t_array_import.c
@@ -1,10 +1,10 @@
-/* $Id: t_array_import.c,v 1.27 2002/10/29 20:29:01 brianp Exp $ */
+/* $Id: t_array_import.c,v 1.28 2003/03/01 01:50:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -31,7 +31,6 @@
#include "context.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "state.h"
#include "mtypes.h"
diff --git a/src/mesa/tnl/t_eval_api.c b/src/mesa/tnl/t_eval_api.c
index feddf2619a..1824fc3fa9 100644
--- a/src/mesa/tnl/t_eval_api.c
+++ b/src/mesa/tnl/t_eval_api.c
@@ -1,10 +1,10 @@
-/* $Id: t_eval_api.c,v 1.12 2002/10/24 23:57:25 brianp Exp $ */
+/* $Id: t_eval_api.c,v 1.13 2003/03/01 01:50:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -34,7 +34,6 @@
#include "context.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_eval.h"
diff --git a/src/mesa/tnl/t_imm_dlist.c b/src/mesa/tnl/t_imm_dlist.c
index 39cd0d4f16..a9ae72cee0 100644
--- a/src/mesa/tnl/t_imm_dlist.c
+++ b/src/mesa/tnl/t_imm_dlist.c
@@ -1,10 +1,10 @@
-/* $Id: t_imm_dlist.c,v 1.45 2003/01/14 04:55:47 brianp Exp $ */
+/* $Id: t_imm_dlist.c,v 1.46 2003/03/01 01:50:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -32,7 +32,7 @@
#include "context.h"
#include "dlist.h"
#include "debug.h"
-#include "mmath.h"
+#include "macros.h"
#include "imports.h"
#include "state.h"
diff --git a/src/mesa/tnl/t_imm_elt.c b/src/mesa/tnl/t_imm_elt.c
index fbac523cb6..c5f740373e 100644
--- a/src/mesa/tnl/t_imm_elt.c
+++ b/src/mesa/tnl/t_imm_elt.c
@@ -1,10 +1,10 @@
-/* $Id: t_imm_elt.c,v 1.20 2002/10/29 20:29:02 brianp Exp $ */
+/* $Id: t_imm_elt.c,v 1.21 2003/03/01 01:50:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -31,7 +31,6 @@
#include "colormac.h"
#include "context.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_translate.h"
diff --git a/src/mesa/tnl/t_imm_eval.c b/src/mesa/tnl/t_imm_eval.c
index ba8d6903e4..f9f942aeea 100644
--- a/src/mesa/tnl/t_imm_eval.c
+++ b/src/mesa/tnl/t_imm_eval.c
@@ -1,10 +1,10 @@
-/* $Id: t_imm_eval.c,v 1.27 2002/10/29 20:29:02 brianp Exp $ */
+/* $Id: t_imm_eval.c,v 1.28 2003/03/01 01:50:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -34,7 +34,6 @@
#include "context.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_eval.h"
diff --git a/src/mesa/tnl/t_imm_exec.c b/src/mesa/tnl/t_imm_exec.c
index fb149a123d..97f49762ad 100644
--- a/src/mesa/tnl/t_imm_exec.c
+++ b/src/mesa/tnl/t_imm_exec.c
@@ -1,10 +1,10 @@
-/* $Id: t_imm_exec.c,v 1.43 2002/10/24 23:57:25 brianp Exp $ */
+/* $Id: t_imm_exec.c,v 1.44 2003/03/01 01:50:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -37,7 +37,6 @@
#include "dlist.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "light.h"
#include "state.h"
#include "mtypes.h"
diff --git a/src/mesa/tnl/t_imm_fixup.c b/src/mesa/tnl/t_imm_fixup.c
index fbbac432a3..8cb263363e 100644
--- a/src/mesa/tnl/t_imm_fixup.c
+++ b/src/mesa/tnl/t_imm_fixup.c
@@ -1,10 +1,10 @@
-/* $Id: t_imm_fixup.c,v 1.39 2002/10/29 20:29:03 brianp Exp $ */
+/* $Id: t_imm_fixup.c,v 1.40 2003/03/01 01:50:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -38,7 +38,6 @@
#include "light.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "state.h"
#include "mtypes.h"
diff --git a/src/mesa/tnl/t_pipeline.c b/src/mesa/tnl/t_pipeline.c
index 08702a4269..5ac7539d65 100644
--- a/src/mesa/tnl/t_pipeline.c
+++ b/src/mesa/tnl/t_pipeline.c
@@ -1,10 +1,10 @@
-/* $Id: t_pipeline.c,v 1.25 2002/10/29 20:29:03 brianp Exp $ */
+/* $Id: t_pipeline.c,v 1.26 2003/03/01 01:50:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -30,7 +30,6 @@
#include "glheader.h"
#include "context.h"
#include "imports.h"
-#include "mmath.h"
#include "state.h"
#include "mtypes.h"
diff --git a/src/mesa/tnl/t_vb_cliptmp.h b/src/mesa/tnl/t_vb_cliptmp.h
index 7b952404fb..5f22012f9d 100644
--- a/src/mesa/tnl/t_vb_cliptmp.h
+++ b/src/mesa/tnl/t_vb_cliptmp.h
@@ -1,4 +1,4 @@
-/* $Id: t_vb_cliptmp.h,v 1.16 2002/10/29 20:29:03 brianp Exp $ */
+/* $Id: t_vb_cliptmp.h,v 1.17 2003/03/01 01:50:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -44,7 +44,7 @@ do { \
GLfloat dp = CLIP_DOTPROD(idx, A, B, C, D ); \
\
clipmask[idxPrev] |= PLANE; \
- if (!NEGATIVE(dpPrev)) { \
+ if (!IS_NEGATIVE(dpPrev)) { \
outlist[outcount++] = idxPrev; \
clipmask[idxPrev] &= ~PLANE; \
} \
@@ -53,7 +53,7 @@ do { \
GLuint newvert = VB->LastClipped++; \
VB->ClipMask[newvert] = 0; \
outlist[outcount++] = newvert; \
- if (NEGATIVE(dp)) { \
+ if (IS_NEGATIVE(dp)) { \
/* Going out of bounds. Avoid division by zero as we \
* know dp != dpPrev from DIFFERENT_SIGNS, above. \
*/ \
@@ -95,7 +95,7 @@ do { \
if (DIFFERENT_SIGNS(dpI, dpJ)) { \
GLuint newvert = VB->LastClipped++; \
VB->ClipMask[newvert] = 0; \
- if (NEGATIVE(dpJ)) { \
+ if (IS_NEGATIVE(dpJ)) { \
GLfloat t = dpI / (dpI - dpJ); \
VB->ClipMask[jj] |= PLANE; \
INTERP_4F( t, coord[newvert], coord[ii], coord[jj] ); \
@@ -109,7 +109,7 @@ do { \
ii = newvert; \
} \
} \
- else if (NEGATIVE(dpI)) \
+ else if (IS_NEGATIVE(dpI)) \
return; \
} \
} while (0)
diff --git a/src/mesa/tnl/t_vb_fog.c b/src/mesa/tnl/t_vb_fog.c
index 0464e5b256..dedd4c5302 100644
--- a/src/mesa/tnl/t_vb_fog.c
+++ b/src/mesa/tnl/t_vb_fog.c
@@ -1,10 +1,10 @@
-/* $Id: t_vb_fog.c,v 1.19 2002/10/29 20:29:03 brianp Exp $ */
+/* $Id: t_vb_fog.c,v 1.20 2003/03/01 01:50:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -33,7 +33,6 @@
#include "context.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_xform.h"
@@ -105,14 +104,14 @@ static void make_win_fog_coords( GLcontext *ctx, GLvector4f *out,
else
d = 1.0F / (ctx->Fog.End - ctx->Fog.Start);
for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) {
- GLfloat f = (end - ABSF(*v)) * d;
+ GLfloat f = (end - FABSF(*v)) * d;
data[i][0] = CLAMP(f, 0.0F, 1.0F);
}
break;
case GL_EXP:
d = ctx->Fog.Density;
for ( i = 0 ; i < n ; i++, STRIDE_F(v,stride))
- NEG_EXP( data[i][0], d * ABSF(*v) );
+ NEG_EXP( data[i][0], d * FABSF(*v) );
break;
case GL_EXP2:
d = ctx->Fog.Density*ctx->Fog.Density;
diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c
index 934ddb8d7b..cdaf0379ed 100644
--- a/src/mesa/tnl/t_vb_light.c
+++ b/src/mesa/tnl/t_vb_light.c
@@ -1,10 +1,10 @@
-/* $Id: t_vb_light.c,v 1.19 2002/10/24 23:57:25 brianp Exp $ */
+/* $Id: t_vb_light.c,v 1.20 2003/03/01 01:50:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -31,7 +31,6 @@
#include "light.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "simple_list.h"
#include "mtypes.h"
diff --git a/src/mesa/tnl/t_vb_normals.c b/src/mesa/tnl/t_vb_normals.c
index 9152d7f325..1fbff7e9e4 100644
--- a/src/mesa/tnl/t_vb_normals.c
+++ b/src/mesa/tnl/t_vb_normals.c
@@ -1,10 +1,10 @@
-/* $Id: t_vb_normals.c,v 1.17 2002/10/29 20:29:04 brianp Exp $ */
+/* $Id: t_vb_normals.c,v 1.18 2003/03/01 01:50:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -33,7 +33,6 @@
#include "context.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_xform.h"
diff --git a/src/mesa/tnl/t_vb_points.c b/src/mesa/tnl/t_vb_points.c
index 5bf1be12a6..a631bad39d 100644
--- a/src/mesa/tnl/t_vb_points.c
+++ b/src/mesa/tnl/t_vb_points.c
@@ -1,10 +1,10 @@
-/* $Id: t_vb_points.c,v 1.10 2002/10/29 20:29:04 brianp Exp $ */
+/* $Id: t_vb_points.c,v 1.11 2003/03/01 01:50:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -60,7 +60,7 @@ static GLboolean run_point_stage( GLcontext *ctx,
/* XXX do threshold and min/max clamping here? */
for (i = 0; i < VB->Count; i++) {
const GLfloat dist = -eye[i][2];
- /* GLfloat dist = GL_SQRT(pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2]);*/
+ /* GLfloat dist = SQRTF(pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2]);*/
size[i][0] = pointSize / (p0 + dist * (p1 + dist * p2));
}
}
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index f445953e9f..5a8dcb982a 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_program.c,v 1.17 2003/01/14 04:55:47 brianp Exp $ */
+/* $Id: t_vb_program.c,v 1.18 2003/03/01 01:50:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -41,7 +41,6 @@
#include "light.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "simple_list.h"
#include "mtypes.h"
#include "nvvertprog.h"
diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c
index e0536c8933..c0e2bf26b0 100644
--- a/src/mesa/tnl/t_vb_render.c
+++ b/src/mesa/tnl/t_vb_render.c
@@ -1,10 +1,10 @@
-/* $Id: t_vb_render.c,v 1.33 2002/10/29 20:29:04 brianp Exp $ */
+/* $Id: t_vb_render.c,v 1.34 2003/03/01 01:50:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.0.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -46,7 +46,6 @@
#include "macros.h"
#include "imports.h"
#include "mtypes.h"
-#include "mmath.h"
#include "math/m_matrix.h"
#include "math/m_xform.h"
@@ -60,18 +59,6 @@
/**********************************************************************/
-#if defined(USE_IEEE)
-#define NEGATIVE(x) (GET_FLOAT_BITS(x) & (1<<31))
-#define DIFFERENT_SIGNS(x,y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1<<31))
-#else
-#define NEGATIVE(x) (x < 0)
-#define DIFFERENT_SIGNS(x,y) (x * y <= 0 && x - y != 0)
-/* Could just use (x*y<0) except for the flatshading requirements.
- * Maybe there's a better way?
- */
-#endif
-
-
#define W(i) coord[i][3]
#define Z(i) coord[i][2]
#define Y(i) coord[i][1]
diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c
index f175970f4d..74ad17356b 100644
--- a/src/mesa/tnl/t_vb_texgen.c
+++ b/src/mesa/tnl/t_vb_texgen.c
@@ -1,10 +1,10 @@
-/* $Id: t_vb_texgen.c,v 1.16 2003/01/14 04:55:47 brianp Exp $ */
+/* $Id: t_vb_texgen.c,v 1.17 2003/03/01 01:50:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul 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"),
@@ -33,7 +33,6 @@
#include "colormac.h"
#include "context.h"
#include "macros.h"
-#include "mmath.h"
#include "imports.h"
#include "mtypes.h"
@@ -114,7 +113,7 @@ static void build_m3( GLfloat f[][3], GLfloat m[],
fz = f[i][2] = u[2] - norm[2] * two_nu;
m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F);
if (m[i] != 0.0F) {
- m[i] = 0.5F / (GLfloat) GL_SQRT(m[i]);
+ m[i] = 0.5F / SQRTF(m[i]);
}
}
}
@@ -143,7 +142,7 @@ static void build_m2( GLfloat f[][3], GLfloat m[],
fz = f[i][2] = u[2] - norm[2] * two_nu;
m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F);
if (m[i] != 0.0F) {
- m[i] = 0.5F / (GLfloat) GL_SQRT(m[i]);
+ m[i] = 0.5F / SQRTF(m[i]);
}
}
}
diff --git a/src/mesa/tnl/t_vb_texmat.c b/src/mesa/tnl/t_vb_texmat.c
index 06a678a18d..b92eaae53f 100644
--- a/src/mesa/tnl/t_vb_texmat.c
+++ b/src/mesa/tnl/t_vb_texmat.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_texmat.c,v 1.11 2003/01/14 04:55:47 brianp Exp $ */
+/* $Id: t_vb_texmat.c,v 1.12 2003/03/01 01:50:28 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -33,7 +33,6 @@
#include "context.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_xform.h"
diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c
index 9e9e1a9362..56aee97796 100644
--- a/src/mesa/tnl/t_vb_vertex.c
+++ b/src/mesa/tnl/t_vb_vertex.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_vertex.c,v 1.17 2002/10/31 17:14:37 brianp Exp $ */
+/* $Id: t_vb_vertex.c,v 1.18 2003/03/01 01:50:28 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -33,7 +33,6 @@
#include "context.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_xform.h"
diff --git a/src/mesa/tnl/t_vtx_exec.c b/src/mesa/tnl/t_vtx_exec.c
index 7e9db78925..5b2f713cc1 100644
--- a/src/mesa/tnl/t_vtx_exec.c
+++ b/src/mesa/tnl/t_vtx_exec.c
@@ -35,7 +35,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "api_arrayelt.h"
#include "context.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "enums.h"
#include "glapi.h"
diff --git a/src/mesa/tnl/t_vtx_x86.c b/src/mesa/tnl/t_vtx_x86.c
index 7a55db72df..3211662dae 100644
--- a/src/mesa/tnl/t_vtx_x86.c
+++ b/src/mesa/tnl/t_vtx_x86.c
@@ -32,7 +32,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "imports.h"
-#include "mmath.h"
#include "simple_list.h"
#include "tnl_vtxfmt.h"