summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2008-05-31 18:14:09 +0900
committerKeith Whitwell <[email protected]>2008-09-23 17:20:38 -0700
commit452a592ca4b1bac78eee53fb9f2f1deac7832840 (patch)
tree64f12521f97de549005661c9e680769ff1e9ce84 /src/mesa
parent9118b02fd0e4c5c472d7dbf211eec350a1d37ea4 (diff)
mesa: Apply MSVC portability fixes from Alan Hourihane.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/api_validate.c2
-rw-r--r--src/mesa/main/dlist.c2
-rw-r--r--src/mesa/main/drawpix.c2
-rw-r--r--src/mesa/main/framebuffer.c2
-rw-r--r--src/mesa/main/get.c4
-rw-r--r--src/mesa/main/image.c6
-rw-r--r--src/mesa/main/light.c2
-rw-r--r--src/mesa/main/mipmap.c2
-rw-r--r--src/mesa/main/pixel.c2
-rw-r--r--src/mesa/main/pixel.h42
-rw-r--r--src/mesa/main/texenvprogram.c10
-rw-r--r--src/mesa/shader/prog_execute.c6
-rw-r--r--src/mesa/shader/prog_statevars.c4
-rw-r--r--src/mesa/shader/prog_uniform.c2
-rw-r--r--src/mesa/vbo/vbo_exec_array.c2
-rw-r--r--src/mesa/vbo/vbo_split_inplace.c2
16 files changed, 25 insertions, 67 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 5a199939760..98dfbb105f5 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 4f56d468312..f7660930a9c 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 d69e51ae31f..ac97bc1ff9e 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 b2ec679a549..af78363ad3a 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 ae6afef17da..5202c3ddacd 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 651ebe1b7c0..1a6e864b98d 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 94625b9f916..10ee088a2da 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 ebc3c9ace40..13d90e78fe4 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 2b42490a110..c98506b2bb0 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 32e2bd10753..cb6c5262a39 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 bfb22bbf02c..5f7634b4609 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<<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 );
diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c
index e9957d3a5f0..32b6ff4fd42 100644
--- a/src/mesa/shader/prog_execute.c
+++ b/src/mesa/shader/prog_execute.c
@@ -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;
diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c
index 93ee2d20290..971eb25a491 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 0b1d0232a06..f57df3d86dc 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 7541de675c9..68c555ae8f1 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 958afccd0c0..fbc856e93b0 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;