-# $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
light.c \
lines.c \
matrix.c \
- mmath.c \
nvprogram.c \
nvfragparse.c \
nvvertexec.c \
-/* $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
#include "glheader.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "array_cache/ac_context.h"
-/* $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
#include "glheader.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_translate.h"
/*\r
* Mesa 3-D graphics library\r
- * Version: 5.0\r
+ * Version: 5.1\r
* \r
- * Copyright (C) 1999 Brian Paul All Rights Reserved.\r
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.\r
* \r
* Permission is hereby granted, free of charge, to any person obtaining a\r
* copy of this software and associated documentation files (the "Software"),\r
#include "extensions.h"\r
#include "macros.h"\r
#include "matrix.h"\r
-#include "mmath.h"\r
#include "texformat.h"\r
#include "texstore.h"\r
#include "array_cache/acache.h"\r
#ifndef INTERNAL_H_included\r
#define INTERNAL_H_included\r
\r
-#include "../mmath.h"\r
+#include "../macros.h"\r
\r
/*\r
* general purpose defines, etc.\r
-/* $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"),
#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"
-/* $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"),
#include "imports.h"
#include "macros.h"
#include "colormac.h"
-#include "mmath.h"
#include "math/m_translate.h"
#include "swrast_setup/swrast_setup.h"
-/* $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"),
#include "imports.h"
#include "macros.h"
#include "matrix.h"
-#include "mmath.h"
#include "mtypes.h"
#include "texformat.h"
#include "texstore.h"
-/* $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
#include "imports.h"
#include "macros.h"
#include "matrix.h"
-#include "mmath.h"
#include "mtypes.h"
#include "texformat.h"
#include "texstore.h"
-/* $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
#include "config.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "xfonts.h"
#include "xmesaP.h"
-/* $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
#include "glthread.h"
#include "imports.h"
#include "matrix.h"
-#include "mmath.h"
#include "mtypes.h"
#include "macros.h"
#include "texformat.h"
-/* $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
#include "glxheader.h"
#include "depth.h"
#include "macros.h"
-#include "mmath.h"
#include "mtypes.h"
#include "xmesaP.h"
-/* $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
#include "depth.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "xmesaP.h"
# 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"),
light.c \
lines.c \
matrix.c \
- mmath.c \
pixel.c \
points.c \
polygon.c \
light.c \\r
lines.c \\r
matrix.c \\r
- mmath.c \\r
pixel.c \\r
points.c \\r
polygon.c \\r
-# $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
light.c \
lines.c \
matrix.c \
- mmath.c \
nvprogram.c \
nvfragparse.c \
nvvertexec.c \
-# $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
light.c \
lines.c \
matrix.c \
- mmath.c \
nvprogram.c \
nvfragparse.c \
nvvertexec.c \
light.c \
lines.c \
matrix.c \
- mmath.c \
pixel.c \
points.c \
polygon.c \
light.c \
lines.c \
matrix.c \
- mmath.c \
nvprogram.c \
nvfragparse.c \
nvvertexec.c \
-/* $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"),
#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)
-/* $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"),
#include "colormac.h"
#include "light.h"
#include "macros.h"
-#include "mmath.h"
#include "mtypes.h"
-/* $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"),
#include "context.h"
#include "depth.h"
#include "enums.h"
-#include "macros.h"
#include "stencil.h"
#include "state.h"
#include "mtypes.h"
-/* $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.
*
#include "clip.h"
#include "context.h"
#include "macros.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_xform.h"
-/* $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"),
#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
} 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 */
-/* $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
#include "context.h"
#include "image.h"
#include "macros.h"
-#include "mmath.h"
#include "state.h"
-/* $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
#include "hash.h"
#include "light.h"
#include "macros.h"
-#include "mmath.h"
#include "simple_list.h"
#include "state.h"
#include "teximage.h"
#endif
+/* ubyte -> float conversion */
+GLfloat _mesa_ubyte_to_float_color_tab[256];
+
static void
free_shared_state( GLcontext *ctx, struct gl_shared_state *ss );
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 );
_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();
-/* $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
#include "drawpix.h"
#include "feedback.h"
#include "macros.h"
-#include "mmath.h"
#include "state.h"
#include "mtypes.h"
-/* $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
#include "enable.h"
#include "light.h"
#include "macros.h"
-#include "mmath.h"
#include "simple_list.h"
#include "mtypes.h"
#include "enums.h"
-/* $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"),
#include "context.h"
#include "eval.h"
#include "macros.h"
-#include "mmath.h"
#include "mtypes.h"
}
if (data) {
for (i=0;i<n;i++) {
- v[i] = ROUNDF(data[i]);
+ v[i] = IROUND(data[i]);
}
}
break;
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:
-/* $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"),
#include "enums.h"
#include "feedback.h"
#include "macros.h"
-#include "mmath.h"
#include "mtypes.h"
-/* $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
#include "extensions.h"
#include "get.h"
#include "macros.h"
-#include "mmath.h"
#include "mtypes.h"
#include "texcompress.h"
#include "math/m_matrix.h"
-/* $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"),
* 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.
*/
-/* $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"),
#include "context.h"
#include "image.h"
#include "histogram.h"
-#include "mmath.h"
/*
-/* $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"),
#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.
-/* $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"),
*/
-#include "glheader.h"
-#include "mtypes.h"
-#include "context.h"
#include "imports.h"
+#include "context.h"
#define MAXSTRING 4000 /* for vsnprintf() */
* rand and RAND_MAX
*/
+
+/**********************************************************************
+ * Memory
+ */
+
void *
_mesa_malloc(size_t bytes)
{
}
+/**********************************************************************
+ * Math
+ */
+
double
_mesa_sin(double a)
{
double
-_mesa_sqrt(double x)
+_mesa_sqrtd(double x)
{
#if defined(XFree86LOADER) && defined(IN_MODULE)
return xf86sqrt(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)
{
}
+/*
+ * 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 )
{
}
+/**********************************************************************
+ * String
+ */
+
char *
_mesa_strstr( const char *haystack, const char *needle )
{
}
+/**********************************************************************
+ * I/O
+ */
+
int
_mesa_sprintf( char *str, const char *fmt, ... )
{
}
+/**********************************************************************
+ * Diagnostics
+ */
+
void
_mesa_warning( GLcontext *ctx, const char *fmtString, ... )
{
/*
* 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;
-/* $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"),
#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))
#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 );
_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 );
-/* $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"),
#include "enums.h"
#include "light.h"
#include "macros.h"
-#include "mmath.h"
#include "simple_list.h"
#include "mtypes.h"
#include "math/m_xform.h"
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)" );
-/* $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"),
#include "depth.h"
#include "lines.h"
#include "macros.h"
-#include "mmath.h"
#include "texstate.h"
#include "mtypes.h"
-/* $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
* 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
+/*
+ * 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 { \
-
-/* 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)) )
} 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
-/* $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"),
#include "enums.h"
#include "macros.h"
#include "matrix.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_matrix.h"
-/* $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
* 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)
-/* $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
#include "hash.h"
#include "imports.h"
#include "macros.h"
-#include "mmath.h"
#include "mtypes.h"
#include "nvfragprog.h"
#include "nvfragparse.h"
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 == '$');
}
return i;
}
- /* punctuation */
+ /* punctuation character */
if (str[i]) {
token[0] = str[i++];
token[1] = 0;
/* 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;
}
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;
}
}
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))
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;
-/* $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
#include "mtypes.h"
#include "nvvertexec.h"
#include "nvvertprog.h"
-#include "mmath.h"
#include "math/m_matrix.h"
-/* $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"),
#include "glheader.h"
#include "context.h"
#include "macros.h"
-#include "mmath.h"
#include "points.h"
#include "texstate.h"
#include "mtypes.h"
-/* $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"),
#include "feedback.h"
#include "light.h"
#include "macros.h"
-#include "mmath.h"
#include "rastpos.h"
#include "state.h"
#include "simple_list.h"
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 );
-/* $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"),
#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"
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);
}
}
-/* $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"),
#include "context.h"
#include "image.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "texformat.h"
#include "teximage.h"
-/* $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
#include "image.h"
#include "imports.h"
#include "macros.h"
-#include "mmath.h"
#include "state.h"
#include "texcompress.h"
#include "texformat.h"
-/* $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"),
#include "glheader.h"
+#include "colormac.h"
#include "context.h"
#include "enums.h"
#include "image.h"
-/* $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"),
#include "dlist.h"
#include "light.h"
#include "macros.h"
-#include "mmath.h"
#include "state.h"
#include "texstate.h"
#include "mtypes.h"
-/* $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"),
#include "context.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "m_matrix.h"
#include "m_xform.h"
-/* $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
#include "imports.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "m_matrix.h"
}
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 */
-/* $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"),
{
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);
{
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);
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);
-/* $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
#include "glheader.h"
#include "mtypes.h" /* GLchan hack */
#include "colormac.h"
-#include "mmath.h"
#include "m_translate.h"
-/* $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"),
#include "glheader.h"
#include "macros.h"
-#include "mmath.h"
#include "m_eval.h"
#include "m_matrix.h"
-/* $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
#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
-/* $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
#include "colormac.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "s_aatriangle.h"
#include "s_context.h"
#include "s_span.h"
-/* $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
#include "glheader.h"
#include "context.h"
#include "macros.h"
-#include "mmath.h"
#include "imports.h"
#include "s_accum.h"
-/* $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
#include "context.h"
#include "colormac.h"
#include "macros.h"
-#include "mmath.h"
#include "s_alpha.h"
#include "s_context.h"
-/* $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
#include "glheader.h"
#include "image.h"
#include "macros.h"
-#include "mmath.h"
#include "pixel.h"
#include "s_context.h"
-/* $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
#include "image.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "pixel.h"
#include "s_context.h"
-/* $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"),
#include "enums.h"
#include "feedback.h"
#include "macros.h"
-#include "mmath.h"
#include "s_context.h"
#include "s_feedback.h"
-/* $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
#include "colormac.h"
#include "context.h"
#include "macros.h"
-#include "mmath.h"
#include "s_context.h"
#include "s_fog.h"
-/* $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
#include "glheader.h"
#include "colormac.h"
#include "macros.h"
-#include "mmath.h"
#include "s_aaline.h"
#include "s_context.h"
#include "s_depth.h"
-/* $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
#include "context.h"
#include "nvfragprog.h"
#include "macros.h"
-#include "mmath.h"
#include "s_nvfragprog.h"
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:
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]];
{
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;
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;
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 );
}
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;
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;
{
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;
-/* $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
#include "colormac.h"
#include "context.h"
#include "macros.h"
-#include "mmath.h"
#include "texstate.h"
#include "s_context.h"
#include "s_feedback.h"
-/* $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.
*
#include "colormac.h"
#include "context.h"
#include "macros.h"
-#include "mmath.h"
#include "imports.h"
#include "s_alpha.h"
-/* $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"),
+#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"
-/* $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
#include "context.h"
#include "colormac.h"
#include "macros.h"
-#include "mmath.h"
#include "imports.h"
#include "texformat.h"
#include "teximage.h"
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) {
-/* $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
#include "colormac.h"
#include "imports.h"
#include "macros.h"
-#include "mmath.h"
#include "texformat.h"
#include "teximage.h"
#include "texstate.h"
-/* $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
(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;
}
-/* $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"),
#include "context.h"
#include "imports.h"
#include "macros.h"
-#include "mmath.h"
#include "mtypes.h"
#include "state.h"
-/* $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"),
#include "context.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "state.h"
#include "mtypes.h"
-/* $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"),
#include "context.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_eval.h"
-/* $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"),
#include "context.h"
#include "dlist.h"
#include "debug.h"
-#include "mmath.h"
+#include "macros.h"
#include "imports.h"
#include "state.h"
-/* $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"),
#include "colormac.h"
#include "context.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_translate.h"
-/* $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"),
#include "context.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_eval.h"
-/* $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"),
#include "dlist.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "light.h"
#include "state.h"
#include "mtypes.h"
-/* $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"),
#include "light.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "state.h"
#include "mtypes.h"
-/* $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"),
#include "glheader.h"
#include "context.h"
#include "imports.h"
-#include "mmath.h"
#include "state.h"
#include "mtypes.h"
-/* $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
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; \
} \
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. \
*/ \
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] ); \
ii = newvert; \
} \
} \
- else if (NEGATIVE(dpI)) \
+ else if (IS_NEGATIVE(dpI)) \
return; \
} \
} while (0)
-/* $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"),
#include "context.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_xform.h"
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;
-/* $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"),
#include "light.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "simple_list.h"
#include "mtypes.h"
-/* $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"),
#include "context.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_xform.h"
-/* $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"),
/* 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));
}
}
-/* $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
#include "light.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "simple_list.h"
#include "mtypes.h"
#include "nvvertprog.h"
-/* $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"),
#include "macros.h"
#include "imports.h"
#include "mtypes.h"
-#include "mmath.h"
#include "math/m_matrix.h"
#include "math/m_xform.h"
/**********************************************************************/
-#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]
-/* $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"),
#include "colormac.h"
#include "context.h"
#include "macros.h"
-#include "mmath.h"
#include "imports.h"
#include "mtypes.h"
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]);
}
}
}
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]);
}
}
}
-/* $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
#include "context.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_xform.h"
-/* $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
#include "context.h"
#include "macros.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "math/m_xform.h"
#include "api_arrayelt.h"
#include "context.h"
#include "imports.h"
-#include "mmath.h"
#include "mtypes.h"
#include "enums.h"
#include "glapi.h"
*/
#include "imports.h"
-#include "mmath.h"
#include "simple_list.h"
#include "tnl_vtxfmt.h"