From 5b37c322741f019118a618bc6220f37adba4fbcd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 5 Nov 1999 06:43:10 +0000 Subject: [PATCH] clean-up to reduce MSVC warnings --- src/mesa/main/stencil.c | 98 ++++++++++++++++++++-------------------- src/mesa/main/teximage.c | 22 ++++----- src/mesa/main/texobj.c | 6 +-- src/mesa/main/texstate.c | 78 +++++++++++++++++++++----------- src/mesa/main/varray.c | 6 +-- 5 files changed, 117 insertions(+), 93 deletions(-) diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index e3529996be7..1a05ab2ccab 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -1,4 +1,4 @@ -/* $Id: stencil.c,v 1.6 1999/10/13 18:42:50 brianp Exp $ */ +/* $Id: stencil.c,v 1.7 1999/11/05 06:43:10 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -99,8 +99,8 @@ void gl_StencilFunc( GLcontext *ctx, GLenum func, GLint ref, GLuint mask ) } maxref = (1 << STENCIL_BITS) - 1; - ctx->Stencil.Ref = CLAMP( ref, 0, maxref ); - ctx->Stencil.ValueMask = mask; + ctx->Stencil.Ref = (GLstencil) CLAMP( ref, 0, maxref ); + ctx->Stencil.ValueMask = (GLstencil) mask; if (ctx->Driver.StencilFunc) { (*ctx->Driver.StencilFunc)( ctx, func, ctx->Stencil.Ref, mask ); @@ -214,7 +214,7 @@ static void apply_stencil_op_to_span( GLcontext *ctx, { const GLstencil ref = ctx->Stencil.Ref; const GLstencil wrtmask = ctx->Stencil.WriteMask; - const GLstencil invmask = ~ctx->Stencil.WriteMask; + const GLstencil invmask = (GLstencil) (~ctx->Stencil.WriteMask); GLstencil *stencil = STENCIL_ADDRESS( x, y ); GLuint i; @@ -233,7 +233,7 @@ static void apply_stencil_op_to_span( GLcontext *ctx, else { for (i=0;i0) { - stencil[i] = s-1; + stencil[i] = (GLstencil) (s-1); } } } @@ -295,7 +295,7 @@ static void apply_stencil_op_to_span( GLcontext *ctx, /* VERIFY logic of subtracting 1 to a write-masked value */ GLstencil s = stencil[i]; if (s>0) { - stencil[i] = (invmask & s) | (wrtmask & (s-1)); + stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & (s-1))); } } } @@ -313,7 +313,7 @@ static void apply_stencil_op_to_span( GLcontext *ctx, for (i=0;iStencil.Ref & ctx->Stencil.ValueMask; + r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); for (i=0;iStencil.ValueMask; + s = (GLstencil) (stencil[i] & ctx->Stencil.ValueMask); if (r < s) { /* passed */ fail[i] = 0; @@ -424,10 +424,10 @@ GLint gl_stencil_span( GLcontext *ctx, } break; case GL_LEQUAL: - r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; + r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); for (i=0;iStencil.ValueMask; + s = (GLstencil) (stencil[i] & ctx->Stencil.ValueMask); if (r <= s) { /* pass */ fail[i] = 0; @@ -443,10 +443,10 @@ GLint gl_stencil_span( GLcontext *ctx, } break; case GL_GREATER: - r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; + r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); for (i=0;iStencil.ValueMask; + s = (GLstencil) (stencil[i] & ctx->Stencil.ValueMask); if (r > s) { /* passed */ fail[i] = 0; @@ -462,10 +462,10 @@ GLint gl_stencil_span( GLcontext *ctx, } break; case GL_GEQUAL: - r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; + r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); for (i=0;iStencil.ValueMask; + s = (GLstencil) (stencil[i] & ctx->Stencil.ValueMask); if (r >= s) { /* passed */ fail[i] = 0; @@ -481,10 +481,10 @@ GLint gl_stencil_span( GLcontext *ctx, } break; case GL_EQUAL: - r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; + r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); for (i=0;iStencil.ValueMask; + s = (GLstencil) (stencil[i] & ctx->Stencil.ValueMask); if (r == s) { /* passed */ fail[i] = 0; @@ -503,7 +503,7 @@ GLint gl_stencil_span( GLcontext *ctx, r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; for (i=0;iStencil.ValueMask; + s = (GLstencil) (stencil[i] & ctx->Stencil.ValueMask); if (r != s) { /* passed */ fail[i] = 0; @@ -611,7 +611,7 @@ static void apply_stencil_op_to_pixels( GLcontext *ctx, GLstencil wrtmask, invmask; wrtmask = ctx->Stencil.WriteMask; - invmask = ~ctx->Stencil.WriteMask; + invmask = (GLstencil) (~ctx->Stencil.WriteMask); ref = ctx->Stencil.Ref; @@ -632,7 +632,7 @@ static void apply_stencil_op_to_pixels( GLcontext *ctx, for (i=0;i0) { - *sptr = *sptr - 1; + *sptr = (GLstencil) (*sptr - 1); } } } @@ -693,7 +693,7 @@ static void apply_stencil_op_to_pixels( GLcontext *ctx, if (mask[i]) { GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); if (*sptr>0) { - *sptr = (invmask & *sptr) | (wrtmask & (*sptr-1)); + *sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & (*sptr-1))); } } } @@ -704,7 +704,7 @@ static void apply_stencil_op_to_pixels( GLcontext *ctx, for (i=0;iStencil.Ref & ctx->Stencil.ValueMask; + r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); for (i=0;iStencil.ValueMask; + s = (GLstencil) (*sptr & ctx->Stencil.ValueMask); if (r < s) { /* passed */ fail[i] = 0; @@ -823,11 +823,11 @@ GLint gl_stencil_pixels( GLcontext *ctx, } break; case GL_LEQUAL: - r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; + r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); for (i=0;iStencil.ValueMask; + s = (GLstencil) (*sptr & ctx->Stencil.ValueMask); if (r <= s) { /* pass */ fail[i] = 0; @@ -843,11 +843,11 @@ GLint gl_stencil_pixels( GLcontext *ctx, } break; case GL_GREATER: - r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; + r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); for (i=0;iStencil.ValueMask; + s = (GLstencil) (*sptr & ctx->Stencil.ValueMask); if (r > s) { /* passed */ fail[i] = 0; @@ -863,11 +863,11 @@ GLint gl_stencil_pixels( GLcontext *ctx, } break; case GL_GEQUAL: - r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; + r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); for (i=0;iStencil.ValueMask; + s = (GLstencil) (*sptr & ctx->Stencil.ValueMask); if (r >= s) { /* passed */ fail[i] = 0; @@ -883,11 +883,11 @@ GLint gl_stencil_pixels( GLcontext *ctx, } break; case GL_EQUAL: - r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; + r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); for (i=0;iStencil.ValueMask; + s = (GLstencil) (*sptr & ctx->Stencil.ValueMask); if (r == s) { /* passed */ fail[i] = 0; @@ -903,11 +903,11 @@ GLint gl_stencil_pixels( GLcontext *ctx, } break; case GL_NOTEQUAL: - r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; + r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); for (i=0;iStencil.ValueMask; + s = (GLstencil) (*sptr & ctx->Stencil.ValueMask); if (r != s) { /* passed */ fail[i] = 0; diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 2a732b178e9..599fbeede02 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1,4 +1,4 @@ -/* $Id: teximage.c,v 1.9 1999/11/03 17:27:05 brianp Exp $ */ +/* $Id: teximage.c,v 1.10 1999/11/05 06:43:11 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -619,9 +619,9 @@ make_null_texture( GLcontext *ctx, GLenum internalFormat, GLint srcRow = 7 - i % 8; for (j=0;jTexture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_image *teximage; @@ -1760,7 +1760,7 @@ void gl_CopyTexSubImage1D( GLcontext *ctx, GLenum target, GLint level, ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage1D"); if (!copytexsubimage_error_check(ctx, 1, target, level, - xoffset, 0, 0, x, y, width, 1)) { + xoffset, 0, 0, width, 1)) { struct gl_texture_unit *texUnit; struct gl_texture_image *teximage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; @@ -1787,7 +1787,7 @@ void gl_CopyTexSubImage2D( GLcontext *ctx, GLenum target, GLint level, ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage2D"); if (!copytexsubimage_error_check(ctx, 2, target, level, - xoffset, yoffset, 0, x, y, width, height)) { + xoffset, yoffset, 0, width, height)) { struct gl_texture_unit *texUnit; struct gl_texture_image *teximage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; @@ -1815,7 +1815,7 @@ void gl_CopyTexSubImage3D( GLcontext *ctx, GLenum target, GLint level, ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage3D"); if (!copytexsubimage_error_check(ctx, 3, target, level, - xoffset, yoffset, zoffset, x, y, width, height)) { + xoffset, yoffset, zoffset, width, height)) { struct gl_texture_unit *texUnit; struct gl_texture_image *teximage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 60a142ea5bc..2d7db2d5193 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1,4 +1,4 @@ -/* $Id: texobj.c,v 1.6 1999/10/13 18:42:50 brianp Exp $ */ +/* $Id: texobj.c,v 1.7 1999/11/05 06:43:11 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -415,7 +415,7 @@ void gl_BindTexture( GLcontext *ctx, GLenum target, GLuint texName ) struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; struct gl_texture_object *oldTexObj; struct gl_texture_object *newTexObj; - GLint dim; + GLuint dim; if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) fprintf(stderr, "glBindTexture %s %d\n", @@ -423,7 +423,7 @@ void gl_BindTexture( GLcontext *ctx, GLenum target, GLuint texName ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBindTexture"); - dim = target - GL_TEXTURE_1D; + dim = (GLuint) (target - GL_TEXTURE_1D); if (dim < 0 || dim > 2) { gl_error( ctx, GL_INVALID_ENUM, "glBindTexture" ); diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 0a828ce028a..5a3664e79aa 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -1,4 +1,4 @@ -/* $Id: texstate.c,v 1.3 1999/10/08 09:27:11 keithw Exp $ */ +/* $Id: texstate.c,v 1.4 1999/11/05 06:43:11 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -111,10 +111,10 @@ void gl_TexEnvfv( GLcontext *ctx, } } else if (pname==GL_TEXTURE_ENV_COLOR) { - texUnit->EnvColor[0] = CLAMP( param[0], 0.0, 1.0 ); - texUnit->EnvColor[1] = CLAMP( param[1], 0.0, 1.0 ); - texUnit->EnvColor[2] = CLAMP( param[2], 0.0, 1.0 ); - texUnit->EnvColor[3] = CLAMP( param[3], 0.0, 1.0 ); + texUnit->EnvColor[0] = CLAMP( param[0], 0.0F, 1.0F ); + texUnit->EnvColor[1] = CLAMP( param[1], 0.0F, 1.0F ); + texUnit->EnvColor[2] = CLAMP( param[2], 0.0F, 1.0F ); + texUnit->EnvColor[3] = CLAMP( param[3], 0.0F, 1.0F ); } else { gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" ); @@ -284,10 +284,10 @@ void gl_TexParameterfv( GLcontext *ctx, } break; case GL_TEXTURE_BORDER_COLOR: - texObj->BorderColor[0] = CLAMP((GLint)(params[0]*255.0), 0, 255); - texObj->BorderColor[1] = CLAMP((GLint)(params[1]*255.0), 0, 255); - texObj->BorderColor[2] = CLAMP((GLint)(params[2]*255.0), 0, 255); - texObj->BorderColor[3] = CLAMP((GLint)(params[3]*255.0), 0, 255); + texObj->BorderColor[0] = (GLubyte) CLAMP((GLint)(params[0]*255.0), 0, 255); + texObj->BorderColor[1] = (GLubyte) CLAMP((GLint)(params[1]*255.0), 0, 255); + texObj->BorderColor[2] = (GLubyte) CLAMP((GLint)(params[2]*255.0), 0, 255); + texObj->BorderColor[3] = (GLubyte) CLAMP((GLint)(params[3]*255.0), 0, 255); break; case GL_TEXTURE_MIN_LOD: texObj->MinLod = params[0]; @@ -315,7 +315,7 @@ void gl_TexParameterfv( GLcontext *ctx, break; case GL_TEXTURE_PRIORITY: /* (keithh@netcomuk.co.uk) */ - texObj->Priority = CLAMP( params[0], 0.0, 1.0 ); + texObj->Priority = CLAMP( params[0], 0.0F, 1.0F ); break; default: gl_error( ctx, GL_INVALID_ENUM, "glTexParameter(pname)" ); @@ -505,10 +505,10 @@ void gl_GetTexParameterfv( GLcontext *ctx, *params = obj->MaxLod; break; case GL_TEXTURE_BASE_LEVEL: - *params = obj->BaseLevel; + *params = (GLfloat) obj->BaseLevel; break; case GL_TEXTURE_MAX_LEVEL: - *params = obj->MaxLevel; + *params = (GLfloat) obj->MaxLevel; break; default: gl_error( ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname)" ); @@ -556,10 +556,10 @@ void gl_GetTexParameteriv( GLcontext *ctx, case GL_TEXTURE_BORDER_COLOR: { GLfloat color[4]; - color[0] = obj->BorderColor[0]/255.0; - color[1] = obj->BorderColor[1]/255.0; - color[2] = obj->BorderColor[2]/255.0; - color[3] = obj->BorderColor[3]/255.0; + color[0] = obj->BorderColor[0] / 255.0F; + color[1] = obj->BorderColor[1] / 255.0F; + color[2] = obj->BorderColor[2] / 255.0F; + color[3] = obj->BorderColor[3] / 255.0F; params[0] = FLOAT_TO_INT( color[0] ); params[1] = FLOAT_TO_INT( color[1] ); params[2] = FLOAT_TO_INT( color[2] ); @@ -965,10 +965,16 @@ void gl_GetTexGeniv( GLcontext *ctx, params[0] = texUnit->GenModeS; } else if (pname==GL_OBJECT_PLANE) { - COPY_4V( params, texUnit->ObjectPlaneS ); + params[0] = (GLint) texUnit->ObjectPlaneS[0]; + params[1] = (GLint) texUnit->ObjectPlaneS[1]; + params[2] = (GLint) texUnit->ObjectPlaneS[2]; + params[3] = (GLint) texUnit->ObjectPlaneS[3]; } else if (pname==GL_EYE_PLANE) { - COPY_4V( params, texUnit->EyePlaneS ); + params[0] = (GLint) texUnit->EyePlaneS[0]; + params[1] = (GLint) texUnit->EyePlaneS[1]; + params[2] = (GLint) texUnit->EyePlaneS[2]; + params[3] = (GLint) texUnit->EyePlaneS[3]; } else { gl_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); @@ -977,13 +983,19 @@ void gl_GetTexGeniv( GLcontext *ctx, break; case GL_T: if (pname==GL_TEXTURE_GEN_MODE) { - params[0] = texUnit->GenModeT; + params[0] = (GLint) texUnit->GenModeT; } else if (pname==GL_OBJECT_PLANE) { - COPY_4V( params, texUnit->ObjectPlaneT ); + params[0] = (GLint) texUnit->ObjectPlaneT[0]; + params[1] = (GLint) texUnit->ObjectPlaneT[1]; + params[2] = (GLint) texUnit->ObjectPlaneT[2]; + params[3] = (GLint) texUnit->ObjectPlaneT[3]; } else if (pname==GL_EYE_PLANE) { - COPY_4V( params, texUnit->EyePlaneT ); + params[0] = (GLint) texUnit->EyePlaneT[0]; + params[1] = (GLint) texUnit->EyePlaneT[1]; + params[2] = (GLint) texUnit->EyePlaneT[2]; + params[3] = (GLint) texUnit->EyePlaneT[3]; } else { gl_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); @@ -992,13 +1004,19 @@ void gl_GetTexGeniv( GLcontext *ctx, break; case GL_R: if (pname==GL_TEXTURE_GEN_MODE) { - params[0] = texUnit->GenModeR; + params[0] = (GLint) texUnit->GenModeR; } else if (pname==GL_OBJECT_PLANE) { - COPY_4V( params, texUnit->ObjectPlaneR ); + params[0] = (GLint) texUnit->ObjectPlaneR[0]; + params[1] = (GLint) texUnit->ObjectPlaneR[1]; + params[2] = (GLint) texUnit->ObjectPlaneR[2]; + params[3] = (GLint) texUnit->ObjectPlaneR[3]; } else if (pname==GL_EYE_PLANE) { - COPY_4V( params, texUnit->EyePlaneR ); + params[0] = (GLint) texUnit->EyePlaneR[0]; + params[1] = (GLint) texUnit->EyePlaneR[1]; + params[2] = (GLint) texUnit->EyePlaneR[2]; + params[3] = (GLint) texUnit->EyePlaneR[3]; } else { gl_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); @@ -1007,13 +1025,19 @@ void gl_GetTexGeniv( GLcontext *ctx, break; case GL_Q: if (pname==GL_TEXTURE_GEN_MODE) { - params[0] = texUnit->GenModeQ; + params[0] = (GLint) texUnit->GenModeQ; } else if (pname==GL_OBJECT_PLANE) { - COPY_4V( params, texUnit->ObjectPlaneQ ); + params[0] = (GLint) texUnit->ObjectPlaneQ[0]; + params[1] = (GLint) texUnit->ObjectPlaneQ[1]; + params[2] = (GLint) texUnit->ObjectPlaneQ[2]; + params[3] = (GLint) texUnit->ObjectPlaneQ[3]; } else if (pname==GL_EYE_PLANE) { - COPY_4V( params, texUnit->EyePlaneQ ); + params[0] = (GLint) texUnit->EyePlaneQ[0]; + params[1] = (GLint) texUnit->EyePlaneQ[1]; + params[2] = (GLint) texUnit->EyePlaneQ[2]; + params[3] = (GLint) texUnit->EyePlaneQ[3]; } else { gl_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 29eb392de8b..02aca61e4f1 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1,4 +1,4 @@ -/* $Id: varray.c,v 1.6 1999/11/04 19:42:28 keithw Exp $ */ +/* $Id: varray.c,v 1.7 1999/11/05 06:43:11 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -505,7 +505,7 @@ void gl_DrawArrays( GLcontext *ctx, GLenum mode, GLint start, GLsizei count ) struct immediate *IM = VB->IM; struct gl_client_array *client_data; struct gl_pipeline *elt = &ctx->CVA.elt; - GLuint relock; + GLboolean relock; GLuint fallback, required; if (ctx->NewState) @@ -1226,7 +1226,7 @@ void GLAPIENTRY glDrawRangeElements(CTX_ARG GLenum mode, GLuint start, return; } - if (!ctx->Array.LockCount && 2*count > 3*(end-start)) { + if (!ctx->Array.LockCount && 2*count > (GLint) 3*(end-start)) { glLockArraysEXT(CTX_PRM start, end ); glDrawElements(CTX_PRM mode, count, type, indices ); glUnlockArraysEXT(CTX_VPRM ); -- 2.30.2