diff options
author | Brian Paul <[email protected]> | 2001-05-14 23:11:12 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2001-05-14 23:11:12 +0000 |
commit | 0ab16e01348a8feceda9ee55f14b035e400d3c01 (patch) | |
tree | a48d883fe84f5ac2e4bc8edff078fad97648bf2c /src | |
parent | 649971518c6b79bc510d3a15b025250a7f947def (diff) |
New IFLOOR, ICEIL macros from Josh Vanderhoof. Fixes problems with
IFLOOR(1.99999)==2, for example. Moved some macros from config.h to glheader.h
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/config.h | 34 | ||||
-rw-r--r-- | src/mesa/main/glheader.h | 27 | ||||
-rw-r--r-- | src/mesa/swrast/s_texture.c | 21 |
3 files changed, 39 insertions, 43 deletions
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 4a10ffa5f1f..cf57106a330 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -1,4 +1,4 @@ -/* $Id: config.h,v 1.30 2001/05/14 16:25:18 brianp Exp $ */ +/* $Id: config.h,v 1.31 2001/05/14 23:11:12 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -179,34 +179,4 @@ #define ACOMP 3 - -/* - * Language/compiler stuff - */ - -/* Some compilers don't like some of Mesa's const usage */ -#ifdef NO_CONST -# define CONST -#else -# define CONST const -#endif - - -/* Function inlining */ -#if defined(__GNUC__) -# define INLINE __inline__ -#elif defined(__MSC__) -# define INLINE __inline -#else -# define INLINE -#endif - - -#ifdef DEBUG -# define ASSERT(X) assert(X) -#else -# define ASSERT(X) -#endif - - -#endif +#endif /* CONFIG_H */ diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 394ce24dae3..0324b42ffd9 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -1,4 +1,4 @@ -/* $Id: glheader.h,v 1.19 2001/03/29 16:50:32 brianp Exp $ */ +/* $Id: glheader.h,v 1.20 2001/05/14 23:11:12 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -216,5 +216,30 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC #endif +/* Function inlining */ +#if defined(__GNUC__) +# define INLINE __inline__ +#elif defined(__MSC__) +# define INLINE __inline +#else +# define INLINE +#endif + + +/* Some compilers don't like some of Mesa's const usage */ +#ifdef NO_CONST +# define CONST +#else +# define CONST const +#endif + + +#ifdef DEBUG +# define ASSERT(X) assert(X) +#else +# define ASSERT(X) +#endif + + #endif /* GLHEADER_H */ diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index 8415fb3ec90..ae18bff0dee 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.28 2001/05/03 14:11:53 brianp Exp $ */ +/* $Id: s_texture.c,v 1.29 2001/05/14 23:11:13 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -187,12 +187,13 @@ /* * Note, the FRAC macro has to work perfectly. Otherwise you'll sometimes - * see 1-pixel bands of improperly weighted linear-sampled texels. - * In particular, #define FRAC(f) ((f) - IFLOOR(f)) doesn't work. + * see 1-pixel bands of improperly weighted linear-sampled texels. The + * tests/texwrap.c demo is a good test. * Also note, FRAC(x) doesn't truly return the fractional part of x for x < 0. * Instead, if x < 0 then FRAC(x) = 1 - true_frac(x). */ -#define FRAC(f) ((f) - floor(f)) +#define FRAC(f) ((f) - IFLOOR(f)) + /* @@ -321,7 +322,7 @@ sample_1d_linear(GLcontext *ctx, } { - const GLfloat a = FRAC(u + 1.0F); + const GLfloat a = FRAC(u); /* compute sample weights in fixed point in [0,WEIGHT_SCALE] */ const GLint w0 = IROUND_POS((1.0F-a) * WEIGHT_SCALE); const GLint w1 = IROUND_POS( a * WEIGHT_SCALE); @@ -619,8 +620,8 @@ sample_2d_linear(GLcontext *ctx, } { - const GLfloat a = FRAC(u - 1.0); - const GLfloat b = FRAC(v - 1.0); + const GLfloat a = FRAC(u); + const GLfloat b = FRAC(v); /* compute sample weights in fixed point in [0,WEIGHT_SCALE] */ const GLint w00 = IROUND_POS((1.0F-a) * (1.0F-b) * WEIGHT_SCALE); const GLint w10 = IROUND_POS( a * (1.0F-b) * WEIGHT_SCALE); @@ -1047,9 +1048,9 @@ sample_3d_linear(GLcontext *ctx, } { - const GLfloat a = FRAC(u + 1.0F); - const GLfloat b = FRAC(v + 1.0F); - const GLfloat c = FRAC(w + 1.0F); + const GLfloat a = FRAC(u); + const GLfloat b = FRAC(v); + const GLfloat c = FRAC(w); /* compute sample weights in fixed point in [0,WEIGHT_SCALE] */ GLint w000 = IROUND_POS((1.0F-a) * (1.0F-b) * (1.0F-c) * WEIGHT_SCALE); GLint w100 = IROUND_POS( a * (1.0F-b) * (1.0F-c) * WEIGHT_SCALE); |