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
This commit is contained in:
parent
649971518c
commit
0ab16e0134
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue