mesa: Apply MSVC portability fixes from Alan Hourihane.

This commit is contained in:
José Fonseca
2008-05-31 18:14:09 +09:00
committed by Keith Whitwell
parent 9118b02fd0
commit 452a592ca4
16 changed files with 25 additions and 67 deletions

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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:

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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:

View File

@@ -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 );

View File

@@ -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<<rgb_shift);
shift = register_scalar_const(p, (GLfloat)(1<<rgb_shift));
}
else {
shift = register_const4f(p,
1<<rgb_shift,
1<<rgb_shift,
1<<rgb_shift,
1<<alpha_shift);
(GLfloat)(1<<rgb_shift),
(GLfloat)(1<<rgb_shift),
(GLfloat)(1<<rgb_shift),
(GLfloat)(1<<alpha_shift));
}
return emit_arith( p, OPCODE_MUL, dest, WRITEMASK_XYZW,
saturate, out, shift, undef );

View File

@@ -93,7 +93,7 @@ get_register_pointer(const struct prog_src_register *source,
source->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;

View File

@@ -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: {

View File

@@ -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;

View File

@@ -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: {

View File

@@ -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;