Add explicit casts, fix constant types, fix variable types.
Fixes about 340 warnings in MSFT Visual Studio.
mask |= BUFFER_BIT_BACK_RIGHT;
break;
default:
- if (drawbuffer < 0 || drawbuffer >= ctx->Const.MaxDrawBuffers) {
+ if (drawbuffer < 0 || drawbuffer >= (GLint)ctx->Const.MaxDrawBuffers) {
mask = INVALID_MASK;
}
else if (att[BUFFER_COLOR0 + drawbuffer].Renderbuffer) {
* floating point state var. This will not always work. We'll
* need a new ctx->Driver.ClearBuffer() hook....
*/
- GLfloat clearSave[4];
+ GLclampf clearSave[4];
/* save color */
COPY_4V(clearSave, ctx->Color.ClearColor);
/* set color */
- COPY_4V(ctx->Color.ClearColor, value);
+ COPY_4V_CAST(ctx->Color.ClearColor, value, GLclampf);
if (ctx->Driver.ClearColor)
ctx->Driver.ClearColor(ctx, ctx->Color.ClearColor);
/* clear buffer(s) */
* floating point state var. This will not always work. We'll
* need a new ctx->Driver.ClearBuffer() hook....
*/
- GLfloat clearSave[4];
+ GLclampf clearSave[4];
/* save color */
COPY_4V(clearSave, ctx->Color.ClearColor);
/* set color */
- COPY_4V(ctx->Color.ClearColor, value);
+ COPY_4V_CAST(ctx->Color.ClearColor, value, GLclampf);
if (ctx->Driver.ClearColor)
ctx->Driver.ClearColor(ctx, ctx->Color.ClearColor);
/* clear buffer(s) */
* XXX in the future we may have a new ctx->Driver.ClearBuffer()
* hook instead.
*/
- const GLfloat clearSave = ctx->Depth.Clear;
+ const GLclampd clearSave = ctx->Depth.Clear;
ctx->Depth.Clear = *value;
if (ctx->Driver.ClearDepth)
ctx->Driver.ClearDepth(ctx, *value);
return;
}
else if (mask) {
- GLfloat clearSave[4];
+ GLclampf clearSave[4];
/* save color */
COPY_4V(clearSave, ctx->Color.ClearColor);
/* set color */
- COPY_4V(ctx->Color.ClearColor, value);
+ COPY_4V_CAST(ctx->Color.ClearColor, value, GLclampf);
if (ctx->Driver.ClearColor)
ctx->Driver.ClearColor(ctx, ctx->Color.ClearColor);
/* clear buffer(s) */
{
/* save current clear values */
- const GLfloat clearDepthSave = ctx->Depth.Clear;
+ const GLclampd clearDepthSave = ctx->Depth.Clear;
const GLuint clearStencilSave = ctx->Stencil.Clear;
/* set new clear values */
/* chop off [t, 1] part */
ASSERT(t >= 0.0 && t <= 1.0);
*dstX1 = maxValue;
- bias = (*srcX0 < *srcX1) ? 0.5 : -0.5;
+ bias = (*srcX0 < *srcX1) ? 0.5F : -0.5F;
*srcX1 = *srcX0 + (GLint) (t * (*srcX1 - *srcX0) + bias);
}
else if (*dstX0 > maxValue) {
/* chop off [t, 1] part */
ASSERT(t >= 0.0 && t <= 1.0);
*dstX0 = maxValue;
- bias = (*srcX0 < *srcX1) ? -0.5 : 0.5;
+ bias = (*srcX0 < *srcX1) ? -0.5F : 0.5F;
*srcX0 = *srcX1 + (GLint) (t * (*srcX0 - *srcX1) + bias);
}
}
/* chop off [0, t] part */
ASSERT(t >= 0.0 && t <= 1.0);
*dstX0 = minValue;
- bias = (*srcX0 < *srcX1) ? 0.5 : -0.5; /* flipped??? */
+ bias = (*srcX0 < *srcX1) ? 0.5F : -0.5F; /* flipped??? */
*srcX0 = *srcX0 + (GLint) (t * (*srcX1 - *srcX0) + bias);
}
else if (*dstX1 < minValue) {
/* chop off [0, t] part */
ASSERT(t >= 0.0 && t <= 1.0);
*dstX1 = minValue;
- bias = (*srcX0 < *srcX1) ? 0.5 : -0.5;
+ bias = (*srcX0 < *srcX1) ? 0.5F : -0.5F;
*srcX1 = *srcX1 + (GLint) (t * (*srcX0 - *srcX1) + bias);
}
}
/** Convert GLuint in [0,4294967295] to GLfloat in [0.0,1.0] */
-#define UINT_TO_FLOAT(U) ((GLfloat) (U) * (1.0F / 4294967295.0))
+#define UINT_TO_FLOAT(U) ((GLfloat) ((U) * (1.0F / 4294967295.0)))
/** Convert GLfloat in [0.0,1.0] to GLuint in [0,4294967295] */
#define FLOAT_TO_UINT(X) ((GLuint) ((X) * 4294967295.0))
/** Convert GLint in [-2147483648,2147483647] to GLfloat in [-1.0,1.0] */
-#define INT_TO_FLOAT(I) ((2.0F * (I) + 1.0F) * (1.0F/4294967294.0))
+#define INT_TO_FLOAT(I) ((GLfloat) ((2.0F * (I) + 1.0F) * (1.0F/4294967294.0)))
/** Convert GLfloat in [-1.0,1.0] to GLint in [-2147483648,2147483647] */
/* causes overflow:
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- const GLuint maxLevels = _mesa_max_texture_levels(ctx, target);
+ const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
GLenum baseFormat;
if (maxLevels == 0) {
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- const GLuint maxLevels = _mesa_max_texture_levels(ctx, target);
+ const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
if (maxLevels == 0) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImage(target=0x%x)",
inst->DstReg.Index + 1);
}
if (inst->SrcReg[0].File == PROGRAM_TEMPORARY) {
- program->NumTemporaries = MAX2(program->NumTemporaries,
+ program->NumTemporaries = MAX2((GLint)program->NumTemporaries,
inst->SrcReg[0].Index + 1);
}
if (inst->SrcReg[1].File == PROGRAM_TEMPORARY) {
- program->NumTemporaries = MAX2(program->NumTemporaries,
+ program->NumTemporaries = MAX2((GLint)program->NumTemporaries,
inst->SrcReg[1].Index + 1);
}
if (inst->SrcReg[2].File == PROGRAM_TEMPORARY) {
- program->NumTemporaries = MAX2(program->NumTemporaries,
+ program->NumTemporaries = MAX2((GLint)program->NumTemporaries,
inst->SrcReg[2].Index + 1);
}
}
if (inst->CondUpdate) {
if (writeMask & WRITEMASK_X)
- machine->CondCodes[0] = generate_cc(value[0]);
+ machine->CondCodes[0] = generate_cc((float)value[0]);
if (writeMask & WRITEMASK_Y)
- machine->CondCodes[1] = generate_cc(value[1]);
+ machine->CondCodes[1] = generate_cc((float)value[1]);
if (writeMask & WRITEMASK_Z)
- machine->CondCodes[2] = generate_cc(value[2]);
+ machine->CondCodes[2] = generate_cc((float)value[2]);
if (writeMask & WRITEMASK_W)
- machine->CondCodes[3] = generate_cc(value[3]);
+ machine->CondCodes[3] = generate_cc((float)value[3]);
#if DEBUG_PROG
printf("CondCodes=(%s,%s,%s,%s) for:\n",
_mesa_condcode_string(machine->CondCodes[0]),
val = -FLT_MAX;
}
else {
- val = log(a[0]) * 1.442695F;
+ val = (float)(log(a[0]) * 1.442695F);
}
result[0] = result[1] = result[2] = result[3] = val;
store_vector4(inst, machine, result);
/* The fast LOG2 macro doesn't meet the precision
* requirements.
*/
- q[2] = (log(t[0]) * 1.442695F);
+ q[2] = (float)(log(t[0]) * 1.442695F);
}
}
else {
{
/* first check if this is a duplicate constant */
GLint pos;
- for (pos = 0; pos < paramList->NumParameters; pos++) {
+ for (pos = 0; pos < (GLint)paramList->NumParameters; pos++) {
const GLfloat *pvals = paramList->ParameterValues[pos];
if (pvals[0] == values[0] &&
pvals[1] == values[1] &&
if (start >= end)
return GL_FALSE; /* degenerate case */
- if (end - start > MAX_FOR_LOOP_UNROLL_ITERATIONS) {
+ if ((GLuint)(end - start) > MAX_FOR_LOOP_UNROLL_ITERATIONS) {
slang_info_log_print(A->log,
"Note: 'for (%s=%d; %s<%d; ++%s)' is too"
" many iterations to unroll",
}
parse_identifier_str(ctx, &flt);
- flt = strdup(flt);
+ flt = _mesa_strdup(flt);
if (!flt) {
return 0;
}
#if defined(DO_ATTRIBS)
/* compute attributes at left-most fragment */
- span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 1.5, iy + 0.5F, wPlane);
+ span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 1.5F, iy + 0.5F, wPlane);
ATTRIB_LOOP_BEGIN
GLuint c;
for (c = 0; c < 4; c++) {
- span.attrStart[attr][c] = solve_plane(ix + 1.5, iy + 0.5F, attrPlane[attr][c]);
+ span.attrStart[attr][c] = solve_plane(ix + 1.5F, iy + 0.5F, attrPlane[attr][c]);
}
ATTRIB_LOOP_END
#endif
q = 0.000000001F;
values[0] = s / q;
values[1] = t / q;
- values[2] = 1.0 / q;
+ values[2] = 1.0F / q;
break;
}
values[3] = 0.0;
val[i] = 1 - val[i];
if (mod & GL_BIAS_BIT_ATI)
- val[i] = val[i] - 0.5;
+ val[i] = val[i] - 0.5F;
if (mod & GL_2X_BIT_ATI)
val[i] = 2 * val[i];
UNCLAMPED_FLOAT_TO_USHORT(clearColor[BCOMP], ctx->Color.ClearColor[2]);
UNCLAMPED_FLOAT_TO_USHORT(clearColor[ACOMP], ctx->Color.ClearColor[3]);
for (i = 0; i < width; i++) {
- COPY_4V(span.array->rgba[i], clearColor);
+ COPY_4V_CAST(span.array->rgba[i], clearColor, GLchan);
}
}
else {
(arg0[i][GCOMP] - 0.5F) * (arg1[i][GCOMP] - 0.5F) +
(arg0[i][BCOMP] - 0.5F) * (arg1[i][BCOMP] - 0.5F))
* 4.0F * scaleRGB;
- dot = CLAMP(dot, 0.0, 1.0F);
+ dot = CLAMP(dot, 0.0F, 1.0F);
rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = dot;
}
break;
swsetup->last_index_bitset)) {
DECLARE_RENDERINPUTS(index_bitset);
struct tnl_attr_map map[_TNL_ATTRIB_MAX];
- int i, e = 0;
+ unsigned int i, e = 0;
swsetup->intColors = intColors;
saved_index[1] = v[1]->attrib[FRAG_ATTRIB_CI][0];
saved_index[2] = v[2]->attrib[FRAG_ATTRIB_CI][0];
- SS_IND(v[0]->attrib[FRAG_ATTRIB_CI][0], (GLuint) vbindex[e0]);
- SS_IND(v[1]->attrib[FRAG_ATTRIB_CI][0], (GLuint) vbindex[e1]);
- SS_IND(v[2]->attrib[FRAG_ATTRIB_CI][0], (GLuint) vbindex[e2]);
+ SS_IND(v[0]->attrib[FRAG_ATTRIB_CI][0], vbindex[e0]);
+ SS_IND(v[1]->attrib[FRAG_ATTRIB_CI][0], vbindex[e1]);
+ SS_IND(v[2]->attrib[FRAG_ATTRIB_CI][0], vbindex[e2]);
}
}
}
offset += MAX2(dzdx, dzdy) * ctx->Polygon.OffsetFactor;
}
/* new Z values */
- oz0 = CLAMP(v[0]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0, max);
- oz1 = CLAMP(v[1]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0, max);
- oz2 = CLAMP(v[2]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0, max);
+ oz0 = CLAMP(v[0]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max);
+ oz1 = CLAMP(v[1]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max);
+ oz2 = CLAMP(v[2]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max);
}
}
_tnl_vbo_draw_prims );
return;
}
- else if (max_index + max_basevertex > max) {
+ else if ((GLint)max_index + max_basevertex > max) {
/* The software TNL pipeline has a fixed amount of storage for
* vertices and it is necessary to split incoming drawing commands
* if they exceed that limit.