From 452a592ca4b1bac78eee53fb9f2f1deac7832840 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 31 May 2008 18:14:09 +0900 Subject: mesa: Apply MSVC portability fixes from Alan Hourihane. --- src/mesa/main/api_validate.c | 2 +- src/mesa/main/dlist.c | 2 +- src/mesa/main/drawpix.c | 2 +- src/mesa/main/framebuffer.c | 2 +- src/mesa/main/get.c | 4 ++-- src/mesa/main/image.c | 6 +++--- src/mesa/main/light.c | 2 +- src/mesa/main/mipmap.c | 2 +- src/mesa/main/pixel.c | 2 +- src/mesa/main/pixel.h | 42 ------------------------------------------ src/mesa/main/texenvprogram.c | 10 +++++----- 11 files changed, 17 insertions(+), 59 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 5a19993976..98dfbb105f 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -131,7 +131,7 @@ _mesa_validate_DrawElements(GLcontext *ctx, } /* make sure count doesn't go outside buffer bounds */ - if (indexBytes > ctx->Array.ElementArrayBufferObj->Size) { + if (indexBytes > (GLuint) ctx->Array.ElementArrayBufferObj->Size) { _mesa_warning(ctx, "glDrawElements index out of buffer bounds"); return GL_FALSE; } diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 4f56d46831..f7660930a9 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -5109,7 +5109,7 @@ save_Indexfv(const GLfloat * v) static void GLAPIENTRY save_EdgeFlag(GLboolean x) { - save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? 1.0 : 0.0); + save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? (GLfloat)1.0 : (GLfloat)0.0); } static void GLAPIENTRY diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index d69e51ae31..ac97bc1ff9 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -218,7 +218,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height, if (ctx->RenderMode == GL_RENDER) { /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */ - const GLfloat epsilon = 0.0001; + const GLfloat epsilon = (const GLfloat)0.0001; GLint x = IFLOOR(ctx->Current.RasterPos[0] + epsilon - xorig); GLint y = IFLOOR(ctx->Current.RasterPos[1] + epsilon - yorig); diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index b2ec679a54..af78363ad3 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -69,7 +69,7 @@ compute_depth_max(struct gl_framebuffer *fb) fb->_DepthMaxF = (GLfloat) fb->_DepthMax; /* Minimum resolvable depth value, for polygon offset */ - fb->_MRD = 1.0 / fb->_DepthMaxF; + fb->_MRD = (GLfloat)1.0 / fb->_DepthMaxF; } diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index ae6afef17d..5202c3ddac 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -2137,7 +2137,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = (GLfloat)(ctx->DrawBuffer->Visual.depthBits); break; case GL_DEPTH_CLEAR_VALUE: - params[0] = ctx->Depth.Clear; + params[0] = (GLfloat)ctx->Depth.Clear; break; case GL_DEPTH_FUNC: params[0] = ENUM_TO_FLOAT(ctx->Depth.Func); @@ -2940,7 +2940,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE); ASSERT(n <= 100); for (i = 0; i < n; i++) - params[i] = ENUM_TO_INT(formats[i]); + params[i] = (GLfloat)(ENUM_TO_INT(formats[i])); } break; case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 651ebe1b7c..1a6e864b98 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1650,7 +1650,7 @@ _mesa_apply_stencil_transfer_ops(const GLcontext *ctx, GLuint n, GLuint mask = ctx->PixelMaps.StoS.Size - 1; GLuint i; for (i = 0; i < n; i++) { - stencil[i] = ctx->PixelMaps.StoS.Map[ stencil[i] & mask ]; + stencil[i] = (GLstencil)ctx->PixelMaps.StoS.Map[ stencil[i] & mask ]; } } } @@ -4161,7 +4161,7 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n, const GLuint mask = ctx->PixelMaps.StoS.Size - 1; GLuint i; for (i = 0; i < n; i++) { - indexes[i] = ctx->PixelMaps.StoS.Map[ indexes[i] & mask ]; + indexes[i] = (GLuint)ctx->PixelMaps.StoS.Map[ indexes[i] & mask ]; } } @@ -4513,7 +4513,7 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, if (needClamp) { GLuint i; for (i = 0; i < n; i++) { - depthValues[i] = CLAMP(depthValues[i], 0.0, 1.0); + depthValues[i] = (GLfloat)CLAMP(depthValues[i], 0.0, 1.0); } } diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 94625b9f91..10ee088a2d 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1129,7 +1129,7 @@ compute_light_positions( GLcontext *ctx ) } else { /* positional light w/ homogeneous coordinate, divide by W */ - GLfloat wInv = 1.0 / light->_Position[3]; + GLfloat wInv = (GLfloat)1.0 / light->_Position[3]; light->_Position[0] *= wInv; light->_Position[1] *= wInv; light->_Position[2] *= wInv; diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index ebc3c9ace4..13d90e78fe 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -292,7 +292,7 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, GLfloat *dst = (GLfloat *) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { - dst[i] = rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4; + dst[i] = (GLfloat)(rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4); } } diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index 2b42490a11..c98506b2bb 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -114,7 +114,7 @@ store_pixelmap(GLcontext *ctx, GLenum map, GLsizei mapsize, /* special case */ ctx->PixelMaps.StoS.Size = mapsize; for (i = 0; i < mapsize; i++) { - ctx->PixelMaps.StoS.Map[i] = IROUND(values[i]); + ctx->PixelMaps.StoS.Map[i] = (GLfloat)IROUND(values[i]); } break; case GL_PIXEL_MAP_I_TO_I: diff --git a/src/mesa/main/pixel.h b/src/mesa/main/pixel.h index 32e2bd1075..cb6c5262a3 100644 --- a/src/mesa/main/pixel.h +++ b/src/mesa/main/pixel.h @@ -69,48 +69,6 @@ _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ); /*@}*/ -/** \name Pixel processing functions */ -/*@{*/ - -extern void -_mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4], - GLfloat rScale, GLfloat gScale, - GLfloat bScale, GLfloat aScale, - GLfloat rBias, GLfloat gBias, - GLfloat bBias, GLfloat aBias); - -extern void -_mesa_map_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]); - - -extern void -_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]); - - -extern void -_mesa_lookup_rgba_float(const struct gl_color_table *table, - GLuint n, GLfloat rgba[][4]); - -extern void -_mesa_lookup_rgba_ubyte(const struct gl_color_table *table, - GLuint n, GLubyte rgba[][4]); - - -extern void -_mesa_map_ci_to_rgba(const GLcontext *ctx, - GLuint n, const GLuint index[], GLfloat rgba[][4]); - - -extern void -_mesa_map_ci8_to_rgba8(const GLcontext *ctx, GLuint n, const GLubyte index[], - GLubyte rgba[][4]); - - -extern void -_mesa_scale_and_bias_depth(const GLcontext *ctx, GLuint n, - GLfloat depthValues[]); - - extern void _mesa_update_pixel( GLcontext *ctx, GLuint newstate ); diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index bfb22bbf02..5f7634b460 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -916,14 +916,14 @@ emit_texenv(struct texenv_fragment_program *p, GLuint unit) */ if (alpha_shift || rgb_shift) { if (rgb_shift == alpha_shift) { - shift = register_scalar_const(p, 1<