diff options
author | Ian Romanick <[email protected]> | 2009-06-22 18:22:51 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2009-07-09 16:07:05 -0700 |
commit | fcd3572edf5eed47d87774150c2097e0d6245bd2 (patch) | |
tree | aea02f0d980348503f47f239870c141fbb3a4c3c /src/mesa/main | |
parent | 78af70be3727945d2d81a07b99d5a794f1114c05 (diff) |
mesa: From float type modifier from values to large for singles
The values 2147483648.0 and 4294967294.0 are too larget to be stored in single
precision floats. Forcing these to be singles causes bits to be lost, which
results in errors in some pixel transfer tests.
This fixes bug #22344.
(cherry picked from commit 70e72070fce6aa1e0918dcc62c1949465cee69f7)
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/macros.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index 59def651a39..4ca7957ffad 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -83,28 +83,28 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256]; /** Convert GLuint in [0,4294967295] to GLfloat in [0.0,1.0] */ -#define UINT_TO_FLOAT(U) ((GLfloat) (U) * (1.0F / 4294967295.0F)) +#define UINT_TO_FLOAT(U) ((GLfloat) (U) * (1.0F / 4294967295.0)) /** Convert GLfloat in [0.0,1.0] to GLuint in [0,4294967295] */ -#define FLOAT_TO_UINT(X) ((GLuint) ((X) * 4294967295.0F)) +#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)) +#define INT_TO_FLOAT(I) ((2.0F * (I) + 1.0F) * (1.0F/4294967294.0)) /** 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 ) +#define FLOAT_TO_INT(X) ( (((GLint) (4294967294.0 * (X))) - 1) / 2 ) */ /* a close approximation: */ -#define FLOAT_TO_INT(X) ( (GLint) (2147483647.0F * (X)) ) +#define FLOAT_TO_INT(X) ( (GLint) (2147483647.0 * (X)) ) /** Convert GLint in [-2147483648,2147483647] to GLfloat in [-1.0,1.0], texture/fb data */ -#define INT_TO_FLOAT_TEX(I) ((I) == -2147483648 ? -1.0F : (I) * (1.0F/2147483647.0F)) +#define INT_TO_FLOAT_TEX(I) ((I) == -2147483648 ? -1.0F : (I) * (1.0F/2147483647.0)) /** Convert GLfloat in [-1.0,1.0] to GLint in [-2147483648,2147483647], texture/fb data */ -#define FLOAT_TO_INT_TEX(X) ( (GLint) (2147483647.0F * (X)) ) +#define FLOAT_TO_INT_TEX(X) ( (GLint) (2147483647.0 * (X)) ) #define BYTE_TO_UBYTE(b) ((GLubyte) ((b) < 0 ? 0 : (GLubyte) (b))) |