swrast: silence double->float assignment warnings

Reported by Karl Schultz.
This commit is contained in:
Brian Paul 2010-01-27 17:00:32 -07:00
parent 4e5364d6fc
commit 880411c72a
11 changed files with 53 additions and 52 deletions

View file

@ -220,11 +220,11 @@
#if defined(DO_ATTRIBS)
/* compute attributes at left-most fragment */
span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 0.5, iy + 0.5, wPlane);
span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 0.5F, iy + 0.5F, wPlane);
ATTRIB_LOOP_BEGIN
GLuint c;
for (c = 0; c < 4; c++) {
span.attrStart[attr][c] = solve_plane(ix + 0.5, iy + 0.5, attrPlane[attr][c]);
span.attrStart[attr][c] = solve_plane(ix + 0.5F, iy + 0.5F, attrPlane[attr][c]);
}
ATTRIB_LOOP_END
#endif
@ -328,11 +328,11 @@
#if defined(DO_ATTRIBS)
/* compute attributes at left-most fragment */
span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 1.5, iy + 0.5, wPlane);
span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 1.5, 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.5, attrPlane[attr][c]);
span.attrStart[attr][c] = solve_plane(ix + 1.5, iy + 0.5F, attrPlane[attr][c]);
}
ATTRIB_LOOP_END
#endif

View file

@ -37,7 +37,7 @@
/* XXX this would have to change for accum buffers with more or less
* than 16 bits per color channel.
*/
#define ACCUM_SCALE16 32767.0
#define ACCUM_SCALE16 32767.0F
/*

View file

@ -146,8 +146,8 @@ _swrast_alpha_test(const GLcontext *ctx, SWspan *span)
ALPHA_TEST(FixedToInt(alpha), alpha += alphaStep);
}
else {
const GLfloat alphaStep = span->alphaStep;
GLfloat alpha = span->alpha;
const GLfloat alphaStep = FIXED_TO_FLOAT(span->alphaStep);
GLfloat alpha = FIXED_TO_FLOAT(span->alpha);
const GLfloat ref = ctx->Color.AlphaRef;
ALPHA_TEST(alpha, alpha += alphaStep);
}

View file

@ -82,10 +82,11 @@ apply_swizzle(GLfloat values[4], GLuint swizzle)
break;
case GL_SWIZZLE_STQ_DQ_ATI:
/* make sure q is not 0 to avoid problems later with infinite values (texture lookup)? */
if (q == 0.0F) q = 0.000000001;
if (q == 0.0F)
q = 0.000000001F;
values[0] = s / q;
values[1] = t / q;
values[2] = 1 / q;
values[2] = 1.0 / q;
break;
}
values[3] = 0.0;
@ -171,27 +172,27 @@ apply_dst_mod(GLuint optype, GLuint mod, GLfloat * val)
val[i] = 8 * val[i];
break;
case GL_HALF_BIT_ATI:
val[i] = val[i] * 0.5;
val[i] = val[i] * 0.5F;
break;
case GL_QUARTER_BIT_ATI:
val[i] = val[i] * 0.25;
val[i] = val[i] * 0.25F;
break;
case GL_EIGHTH_BIT_ATI:
val[i] = val[i] * 0.125;
val[i] = val[i] * 0.125F;
break;
}
if (has_sat) {
if (val[i] < 0.0)
val[i] = 0;
else if (val[i] > 1.0)
val[i] = 1.0;
if (val[i] < 0.0F)
val[i] = 0.0F;
else if (val[i] > 1.0F)
val[i] = 1.0F;
}
else {
if (val[i] < -8.0)
val[i] = -8.0;
else if (val[i] > 8.0)
val[i] = 8.0;
if (val[i] < -8.0F)
val[i] = -8.0F;
else if (val[i] > 8.0F)
val[i] = 8.0F;
}
}
}

View file

@ -149,26 +149,26 @@ _swrast_update_polygon( GLcontext *ctx )
if (ctx->Polygon.CullFlag) {
switch (ctx->Polygon.CullFaceMode) {
case GL_BACK:
backface_sign = -1.0;
backface_sign = -1.0F;
break;
case GL_FRONT:
backface_sign = 1.0;
backface_sign = 1.0F;
break;
case GL_FRONT_AND_BACK:
/* fallthrough */
default:
backface_sign = 0.0;
backface_sign = 0.0F;
}
}
else {
backface_sign = 0.0;
backface_sign = 0.0F;
}
SWRAST_CONTEXT(ctx)->_BackfaceCullSign = backface_sign;
/* This is for front/back-face determination, but not for culling */
SWRAST_CONTEXT(ctx)->_BackfaceSign
= (ctx->Polygon.FrontFace == GL_CW) ? -1.0 : 1.0;
= (ctx->Polygon.FrontFace == GL_CW) ? -1.0F : 1.0F;
}

View file

@ -172,14 +172,14 @@ _swrast_fog_rgba_span( const GLcontext *ctx, SWspan *span )
/* compute (scaled) fog color */
if (span->array->ChanType == GL_UNSIGNED_BYTE) {
rFog = ctx->Fog.Color[RCOMP] * 255.0;
gFog = ctx->Fog.Color[GCOMP] * 255.0;
bFog = ctx->Fog.Color[BCOMP] * 255.0;
rFog = ctx->Fog.Color[RCOMP] * 255.0F;
gFog = ctx->Fog.Color[GCOMP] * 255.0F;
bFog = ctx->Fog.Color[BCOMP] * 255.0F;
}
else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
rFog = ctx->Fog.Color[RCOMP] * 65535.0;
gFog = ctx->Fog.Color[GCOMP] * 65535.0;
bFog = ctx->Fog.Color[BCOMP] * 65535.0;
rFog = ctx->Fog.Color[RCOMP] * 65535.0F;
gFog = ctx->Fog.Color[GCOMP] * 65535.0F;
bFog = ctx->Fog.Color[BCOMP] * 65535.0F;
}
else {
rFog = ctx->Fog.Color[RCOMP];

View file

@ -156,8 +156,8 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine,
if (program->OriginUpperLeft)
wpos[1] = ctx->DrawBuffer->Height - 1 - wpos[1];
if (!program->PixelCenterInteger) {
wpos[0] += 0.5;
wpos[1] += 0.5;
wpos[0] += 0.5F;
wpos[1] += 0.5F;
}
/* Setup pointer to input attributes */
@ -172,7 +172,7 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine,
/* if running a GLSL program (not ARB_fragment_program) */
if (ctx->Shader.CurrentProgram) {
/* Store front/back facing value */
machine->Attribs[FRAG_ATTRIB_FACE][col][0] = 1.0 - span->facing;
machine->Attribs[FRAG_ATTRIB_FACE][col][0] = 1.0F - span->facing;
}
machine->CurElement = col;

View file

@ -125,16 +125,16 @@ sprite_point(GLcontext *ctx, const SWvertex *vert)
GLfloat s, r, dsdx;
/* texcoord / pointcoord interpolants */
s = 0.0;
dsdx = 1.0 / size;
s = 0.0F;
dsdx = 1.0F / size;
if (ctx->Point.SpriteOrigin == GL_LOWER_LEFT) {
dtdy = 1.0 / size;
t0 = 0.5 * dtdy;
dtdy = 1.0F / size;
t0 = 0.5F * dtdy;
}
else {
/* GL_UPPER_LEFT */
dtdy = -1.0 / size;
t0 = 1.0 + 0.5 * dtdy;
dtdy = -1.0F / size;
t0 = 1.0F + 0.5F * dtdy;
}
ATTRIB_LOOP_BEGIN

View file

@ -645,7 +645,7 @@ interpolate_wpos(GLcontext *ctx, SWspan *span)
{
GLfloat (*wpos)[4] = span->array->attribs[FRAG_ATTRIB_WPOS];
GLuint i;
const GLfloat zScale = 1.0 / ctx->DrawBuffer->_DepthMaxF;
const GLfloat zScale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
GLfloat w, dw;
if (span->arrayMask & SPAN_XY) {

View file

@ -316,18 +316,18 @@ texture_combine( GLcontext *ctx, GLuint unit, GLuint n,
/* (a * b) + (c * d) - 0.5 */
for (i = 0; i < n; i++) {
rgba[i][RCOMP] = (arg0[i][RCOMP] * arg1[i][RCOMP] +
arg2[i][RCOMP] * arg3[i][RCOMP] - 0.5) * scaleRGB;
arg2[i][RCOMP] * arg3[i][RCOMP] - 0.5F) * scaleRGB;
rgba[i][GCOMP] = (arg0[i][GCOMP] * arg1[i][GCOMP] +
arg2[i][GCOMP] * arg3[i][GCOMP] - 0.5) * scaleRGB;
arg2[i][GCOMP] * arg3[i][GCOMP] - 0.5F) * scaleRGB;
rgba[i][BCOMP] = (arg0[i][BCOMP] * arg1[i][BCOMP] +
arg2[i][BCOMP] * arg3[i][BCOMP] - 0.5) * scaleRGB;
arg2[i][BCOMP] * arg3[i][BCOMP] - 0.5F) * scaleRGB;
}
}
else {
for (i = 0; i < n; i++) {
rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5) * scaleRGB;
rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5) * scaleRGB;
rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5) * scaleRGB;
rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5F) * scaleRGB;
rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5F) * scaleRGB;
rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5F) * scaleRGB;
}
}
break;
@ -385,11 +385,11 @@ texture_combine( GLcontext *ctx, GLuint unit, GLuint n,
case GL_MODULATE_SIGNED_ADD_ATI:
for (i = 0; i < n; i++) {
rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) +
arg1[i][RCOMP] - 0.5) * scaleRGB;
arg1[i][RCOMP] - 0.5F) * scaleRGB;
rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) +
arg1[i][GCOMP] - 0.5) * scaleRGB;
arg1[i][GCOMP] - 0.5F) * scaleRGB;
rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) +
arg1[i][BCOMP] - 0.5) * scaleRGB;
arg1[i][BCOMP] - 0.5F) * scaleRGB;
}
break;
case GL_MODULATE_SUBTRACT_ATI:
@ -456,7 +456,7 @@ texture_combine( GLcontext *ctx, GLuint unit, GLuint n,
for (i = 0; i < n; i++) {
rgba[i][ACOMP] = (arg0[i][ACOMP] * arg1[i][ACOMP] +
arg2[i][ACOMP] * arg3[i][ACOMP] -
0.5) * scaleA;
0.5F) * scaleA;
}
}
else {

View file

@ -445,7 +445,7 @@ clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max,
switch (wrapMode) {
case GL_CLAMP:
/* Not exactly what the spec says, but it matches NVIDIA output */
fcol = CLAMP(coord - 0.5F, 0.0, max-1);
fcol = CLAMP(coord - 0.5F, 0.0F, max - 1);
i0 = IFLOOR(fcol);
i1 = i0 + 1;
break;