diff options
author | Brian Paul <[email protected]> | 2009-06-16 18:25:52 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-06-16 18:25:52 -0600 |
commit | 8d482227915552c414e13743652e6794c4313ae2 (patch) | |
tree | 27bb35b40ec242836320180370d7fd5fa3820f41 /src/mesa/main | |
parent | 4ef1f8e3b52a06fcf58f78c9c36738531b91dbac (diff) | |
parent | 6b917d0b1787280f976c2f0d1ead0e5d7587a3e9 (diff) |
Merge branch 'mesa_7_5_branch'
Conflicts:
src/mesa/main/api_validate.c
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/api_validate.c | 2 | ||||
-rw-r--r-- | src/mesa/main/macros.h | 14 | ||||
-rw-r--r-- | src/mesa/main/texenv.c | 4 | ||||
-rw-r--r-- | src/mesa/main/texenvprogram.c | 1 | ||||
-rw-r--r-- | src/mesa/main/texformat_tmp.h | 28 | ||||
-rw-r--r-- | src/mesa/main/texgetimage.c | 6 | ||||
-rw-r--r-- | src/mesa/main/viewport.c | 4 |
7 files changed, 30 insertions, 29 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 15076712502..b2f11ffbfe3 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -60,7 +60,7 @@ max_buffer_index(GLcontext *ctx, GLuint count, GLenum type, { const GLubyte *map = NULL; GLuint max = 0; - GLint i; + GLuint i; if (elementBuf->Name) { /* elements are in a user-defined buffer object. need to map it */ diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index 01d59dd42da..59def651a39 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/texenv.c b/src/mesa/main/texenv.c index 4d511f2f7ed..4c04a7ed375 100644 --- a/src/mesa/main/texenv.c +++ b/src/mesa/main/texenv.c @@ -959,7 +959,7 @@ void GLAPIENTRY _mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param ) { const struct gl_texture_unit *texUnit; - GLint i; + GLuint i; GLint temp = 0; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -1006,7 +1006,7 @@ void GLAPIENTRY _mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param ) { const struct gl_texture_unit *texUnit; - GLint i; + GLuint i; GLint temp = 0; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index a70d069bd9c..b92ba2542d2 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -877,6 +877,7 @@ static struct ureg get_source( struct texenv_fragment_program *p, default: assert(0); + return undef; } } diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index f3b2fb9c9c4..eb160deff93 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -1347,13 +1347,13 @@ static void FETCH(f_ycbcr)( const struct gl_texture_image *texImage, const GLubyte cb = *src0 & 0xff; /* chroma U */ 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); + const GLubyte y = (i & 1) ? y1 : y0; /* choose even/odd luminance */ + 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); @@ -1388,13 +1388,13 @@ static void FETCH(f_ycbcr_rev)( const struct gl_texture_image *texImage, const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma V */ 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); + const GLubyte y = (i & 1) ? y1 : y0; /* choose even/odd luminance */ + 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 70a25080cb0..02409d80098 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -73,11 +73,11 @@ 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; + cs = (GLfloat)(1.055 * _mesa_pow(cl, 0.41666) - 0.055); } return cs; } diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c index ead856d32c3..50e0402d278 100644 --- a/src/mesa/main/viewport.c +++ b/src/mesa/main/viewport.c @@ -73,8 +73,8 @@ _mesa_set_viewport(GLcontext *ctx, GLint x, GLint y, } /* clamp width and height to the implementation dependent range */ - width = CLAMP(width, 1, (GLsizei) ctx->Const.MaxViewportWidth); - height = CLAMP(height, 1, (GLsizei) ctx->Const.MaxViewportHeight); + width = MIN2(width, (GLsizei) ctx->Const.MaxViewportWidth); + height = MIN2(height, (GLsizei) ctx->Const.MaxViewportHeight); ctx->Viewport.X = x; ctx->Viewport.Width = width; |