summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-06-15 19:19:29 +0100
committerJosé Fonseca <jfonseca@vmware.com>2009-06-15 19:19:29 +0100
commit6214c7262fe2d31553a4974022e08a7715693014 (patch)
treee328cf205f27622ba821322a6e9217846b48479b
parent37f2117cd132527ebf89f9294b2f35db87326460 (diff)
mesa: Use type modifier for float constants.
-rw-r--r--src/mesa/main/macros.h14
-rw-r--r--src/mesa/main/texformat_tmp.h24
-rw-r--r--src/mesa/main/texgetimage.c4
3 files changed, 21 insertions, 21 deletions
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 01d59dd42d..59def651a3 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -55,7 +55,7 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
/** Convert GLbyte in [-128,127] to GLfloat in [-1.0,1.0], texture/fb data */
-#define BYTE_TO_FLOAT_TEX(B) ((B) == -128 ? -1.0 : (B) * (1.0F/127.0F))
+#define BYTE_TO_FLOAT_TEX(B) ((B) == -128 ? -1.0F : (B) * (1.0F/127.0F))
/** Convert GLfloat in [-1.0,1.0] to GLbyte in [-128,127], texture/fb data */
#define FLOAT_TO_BYTE_TEX(X) ( (GLint) (127.0F * (X)) )
@@ -65,7 +65,7 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
#define USHORT_TO_FLOAT(S) ((GLfloat) (S) * (1.0F / 65535.0F))
/** Convert GLfloat in [0.0,1.0] to GLushort in [0, 65535] */
-#define FLOAT_TO_USHORT(X) ((GLuint) ((X) * 65535.0))
+#define FLOAT_TO_USHORT(X) ((GLuint) ((X) * 65535.0F))
/** Convert GLshort in [-32768,32767] to GLfloat in [-1.0,1.0] */
@@ -76,7 +76,7 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
/** Convert GLshort in [-32768,32767] to GLfloat in [-1.0,1.0], texture/fb data */
-#define SHORT_TO_FLOAT_TEX(S) ((S) == -32768 ? -1.0 : (S) * (1.0F/32767.0F))
+#define SHORT_TO_FLOAT_TEX(S) ((S) == -32768 ? -1.0F : (S) * (1.0F/32767.0F))
/** Convert GLfloat in [-1.0,1.0] to GLshort in [-32768,32767], texture/fb data */
#define FLOAT_TO_SHORT_TEX(X) ( (GLint) (32767.0F * (X)) )
@@ -86,7 +86,7 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
#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))
+#define FLOAT_TO_UINT(X) ((GLuint) ((X) * 4294967295.0F))
/** Convert GLint in [-2147483648,2147483647] to GLfloat in [-1.0,1.0] */
@@ -97,11 +97,11 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
#define FLOAT_TO_INT(X) ( (((GLint) (4294967294.0F * (X))) - 1) / 2 )
*/
/* a close approximation: */
-#define FLOAT_TO_INT(X) ( (GLint) (2147483647.0 * (X)) )
+#define FLOAT_TO_INT(X) ( (GLint) (2147483647.0F * (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.0 : (I) * (1.0F/2147483647.0))
+#define INT_TO_FLOAT_TEX(I) ((I) == -2147483648 ? -1.0F : (I) * (1.0F/2147483647.0F))
/** 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)) )
@@ -120,7 +120,7 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
#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) )
+ us = ( (GLushort) IROUND( CLAMP((f), 0.0F, 1.0F) * 65535.0F) )
#define CLAMPED_FLOAT_TO_USHORT(us, f) \
us = ( (GLushort) IROUND( (f) * 65535.0F) )
diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h
index f3b2fb9c9c..1020624faa 100644
--- a/src/mesa/main/texformat_tmp.h
+++ b/src/mesa/main/texformat_tmp.h
@@ -1348,12 +1348,12 @@ static void FETCH(f_ycbcr)( const struct gl_texture_image *texImage,
const GLubyte y1 = (*src1 >> 8) & 0xff; /* luminance */
const GLubyte cr = *src1 & 0xff; /* chroma V */
const GLfloat y = (i & 1) ? y1 : y0; /* choose even/odd luminance */
- GLfloat r = 1.164 * (y - 16) + 1.596 * (cr - 128);
- GLfloat g = 1.164 * (y - 16) - 0.813 * (cr - 128) - 0.391 * (cb - 128);
- GLfloat b = 1.164 * (y - 16) + 2.018 * (cb - 128);
- r *= (1.0 / 255.0F);
- g *= (1.0 / 255.0F);
- b *= (1.0 / 255.0F);
+ GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128);
+ GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128);
+ GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128);
+ r *= (1.0F / 255.0F);
+ g *= (1.0F / 255.0F);
+ b *= (1.0F / 255.0F);
texel[RCOMP] = CLAMP(r, 0.0F, 1.0F);
texel[GCOMP] = CLAMP(g, 0.0F, 1.0F);
texel[BCOMP] = CLAMP(b, 0.0F, 1.0F);
@@ -1389,12 +1389,12 @@ static void FETCH(f_ycbcr_rev)( const struct gl_texture_image *texImage,
const GLubyte y1 = *src1 & 0xff; /* luminance */
const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma U */
const GLfloat y = (i & 1) ? y1 : y0; /* choose even/odd luminance */
- GLfloat r = 1.164 * (y - 16) + 1.596 * (cr - 128);
- GLfloat g = 1.164 * (y - 16) - 0.813 * (cr - 128) - 0.391 * (cb - 128);
- GLfloat b = 1.164 * (y - 16) + 2.018 * (cb - 128);
- r *= (1.0 / 255.0F);
- g *= (1.0 / 255.0F);
- b *= (1.0 / 255.0F);
+ GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128);
+ GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128);
+ GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128);
+ r *= (1.0F / 255.0F);
+ g *= (1.0F / 255.0F);
+ b *= (1.0F / 255.0F);
texel[RCOMP] = CLAMP(r, 0.0F, 1.0F);
texel[GCOMP] = CLAMP(g, 0.0F, 1.0F);
texel[BCOMP] = CLAMP(b, 0.0F, 1.0F);
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 70a25080cb..58421c8528 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -73,8 +73,8 @@ linear_to_nonlinear(GLfloat cl)
{
/* can't have values outside [0, 1] */
GLfloat cs;
- if (cl < 0.0031308) {
- cs = 12.92 * cl;
+ if (cl < 0.0031308f) {
+ cs = 12.92f * cl;
}
else {
cs = 1.055 * _mesa_pow(cl, 0.41666) - 0.055;