From 452a592ca4b1bac78eee53fb9f2f1deac7832840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= 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 +++++----- src/mesa/shader/prog_execute.c | 6 +++--- src/mesa/shader/prog_statevars.c | 4 ++-- src/mesa/shader/prog_uniform.c | 2 +- src/mesa/vbo/vbo_exec_array.c | 2 +- src/mesa/vbo/vbo_split_inplace.c | 2 +- 16 files changed, 25 insertions(+), 67 deletions(-) (limited to 'src') 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<File == PROGRAM_STATE_VAR || source->File == PROGRAM_UNIFORM); params = machine->CurProgram->Parameters; - if (reg < 0 || reg >= params->NumParameters) + if (reg < 0 || reg >= (GLint)params->NumParameters) return ZeroVec; else return params->ParameterValues[reg]; @@ -228,7 +228,7 @@ fetch_vector4_deriv(GLcontext * ctx, const struct gl_program_machine *machine, char xOrY, GLfloat result[4]) { - if (source->File == PROGRAM_INPUT && source->Index < machine->NumDeriv) { + if (source->File == PROGRAM_INPUT && source->Index < (GLint)machine->NumDeriv) { const GLint col = machine->CurElement; const GLfloat w = machine->Attribs[FRAG_ATTRIB_WPOS][col][3]; const GLfloat invQ = 1.0f / w; @@ -507,7 +507,7 @@ _mesa_execute_program(GLcontext * ctx, { const GLuint numInst = program->NumInstructions; const GLuint maxExec = 10000; - GLint pc, numExec = 0; + GLuint pc, numExec = 0; machine->CurProgram = program; diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c index 93ee2d2029..971eb25a49 100644 --- a/src/mesa/shader/prog_statevars.c +++ b/src/mesa/shader/prog_statevars.c @@ -427,8 +427,8 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], value[0] = (ctx->Fog.End == ctx->Fog.Start) ? 1.0f : (GLfloat)(-1.0F / (ctx->Fog.End - ctx->Fog.Start)); value[1] = ctx->Fog.End * -value[0]; - value[2] = ctx->Fog.Density * ONE_DIV_LN2; - value[3] = ctx->Fog.Density * ONE_DIV_SQRT_LN2; + value[2] = (GLfloat)(ctx->Fog.Density * ONE_DIV_LN2); + value[3] = (GLfloat)(ctx->Fog.Density * ONE_DIV_SQRT_LN2); return; case STATE_LIGHT_SPOT_DIR_NORMALIZED: { diff --git a/src/mesa/shader/prog_uniform.c b/src/mesa/shader/prog_uniform.c index 0b1d0232a0..f57df3d86d 100644 --- a/src/mesa/shader/prog_uniform.c +++ b/src/mesa/shader/prog_uniform.c @@ -135,7 +135,7 @@ _mesa_longest_uniform_name(const struct gl_uniform_list *list) GLuint i; for (i = 0; list && i < list->NumUniforms; i++) { GLuint len = _mesa_strlen(list->Uniforms[i].Name); - if (len > max) + if (len > (GLuint)max) max = len; } return max; diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 7541de675c..68c555ae8f 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -40,7 +40,7 @@ static void get_minmax_index( GLuint count, GLuint type, GLuint *min_index, GLuint *max_index) { - GLint i; + GLuint i; switch(type) { case GL_UNSIGNED_INT: { diff --git a/src/mesa/vbo/vbo_split_inplace.c b/src/mesa/vbo/vbo_split_inplace.c index 958afccd0c..fbc856e93b 100644 --- a/src/mesa/vbo/vbo_split_inplace.c +++ b/src/mesa/vbo/vbo_split_inplace.c @@ -58,7 +58,7 @@ struct split_context { static void flush_vertex( struct split_context *split ) { - GLint min_index, max_index; + GLuint min_index, max_index; if (!split->dstprim_nr) return; -- cgit v1.2.3