From eee762258e7b026b33888d8661f3c2095f61307a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 22 Jan 2013 17:44:41 -0700 Subject: [PATCH] swrast: silence a bunch of MSVC warnings MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: José Fonseca --- src/mesa/swrast/s_texfilter.c | 38 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 0a91cca06b0..953300f655d 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -1647,14 +1647,14 @@ sample_2d_ewa(struct gl_context *ctx, GLfloat rgba[]) { GLint level = lod > 0 ? lod : 0; - GLfloat scaling = 1.0 / (1 << level); + GLfloat scaling = 1.0f / (1 << level); const struct gl_texture_image *img = tObj->Image[0][level]; const struct gl_texture_image *mostDetailedImage = tObj->Image[0][tObj->BaseLevel]; const struct swrast_texture_image *swImg = swrast_texture_image_const(mostDetailedImage); - GLfloat tex_u=-0.5 + texcoord[0] * swImg->WidthScale * scaling; - GLfloat tex_v=-0.5 + texcoord[1] * swImg->HeightScale * scaling; + GLfloat tex_u = -0.5f + texcoord[0] * swImg->WidthScale * scaling; + GLfloat tex_v = -0.5f + texcoord[1] * swImg->HeightScale * scaling; GLfloat ux = dudx * scaling; GLfloat vx = dvdx * scaling; @@ -1667,20 +1667,20 @@ sample_2d_ewa(struct gl_context *ctx, GLfloat A = vx*vx+vy*vy+1; GLfloat B = -2*(ux*vx+uy*vy); GLfloat C = ux*ux+uy*uy+1; - GLfloat F = A*C-B*B/4.0; + GLfloat F = A*C-B*B/4.0f; /* check if it is an ellipse */ /* ASSERT(F > 0.0); */ /* Compute the ellipse's (u,v) bounding box in texture space */ - GLfloat d = -B*B+4.0*C*A; - GLfloat box_u = 2.0 / d * sqrt(d*C*F); /* box_u -> half of bbox with */ - GLfloat box_v = 2.0 / d * sqrt(A*d*F); /* box_v -> half of bbox height */ + GLfloat d = -B*B+4.0f*C*A; + GLfloat box_u = 2.0f / d * sqrtf(d*C*F); /* box_u -> half of bbox with */ + GLfloat box_v = 2.0f / d * sqrtf(A*d*F); /* box_v -> half of bbox height */ - GLint u0 = floor(tex_u - box_u); - GLint u1 = ceil (tex_u + box_u); - GLint v0 = floor(tex_v - box_v); - GLint v1 = ceil (tex_v + box_v); + GLint u0 = (GLint) floorf(tex_u - box_u); + GLint u1 = (GLint) ceilf (tex_u + box_u); + GLint v0 = (GLint) floorf(tex_v - box_v); + GLint v1 = (GLint) ceilf (tex_v + box_v); GLfloat num[4] = {0.0F, 0.0F, 0.0F, 0.0F}; GLfloat newCoord[2]; @@ -1692,7 +1692,7 @@ sample_2d_ewa(struct gl_context *ctx, /* Scale ellipse formula to directly index the Filter Lookup Table. * i.e. scale so that F = WEIGHT_LUT_SIZE-1 */ - double formScale = (double) (WEIGHT_LUT_SIZE - 1) / F; + GLfloat formScale = (GLfloat) (WEIGHT_LUT_SIZE - 1) / F; A *= formScale; B *= formScale; C *= formScale; @@ -1715,7 +1715,7 @@ sample_2d_ewa(struct gl_context *ctx, /* as a LUT is used, q must never be negative; * should not happen, though */ - const GLint qClamped = q >= 0.0F ? q : 0; + const GLint qClamped = q >= 0.0F ? (GLint) q : 0; GLfloat weight = weightLut[qClamped]; newCoord[0] = u / ((GLfloat) img->Width2); @@ -1795,19 +1795,19 @@ sample_2d_footprint(struct gl_context *ctx, /* Calculate the per anisotropic sample offsets in s,t space. */ if (Px2 > Py2) { - numSamples = ceil(sqrtf(Px2)); + numSamples = (GLint) ceilf(sqrtf(Px2)); ds = ux / ((GLfloat) img->Width2); dt = vx / ((GLfloat) img->Height2); } else { - numSamples = ceil(sqrtf(Py2)); + numSamples = (GLint) ceilf(sqrtf(Py2)); ds = uy / ((GLfloat) img->Width2); dt = vy / ((GLfloat) img->Height2); } for (s = 0; s