summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/api_loopback.c10
-rw-r--r--src/mesa/main/arbprogram.c28
-rw-r--r--src/mesa/main/arbvertparse.c8
-rw-r--r--src/mesa/main/depth.c4
-rw-r--r--src/mesa/main/dlist.c20
-rw-r--r--src/mesa/main/imports.c2
-rw-r--r--src/mesa/main/macros.h9
-rw-r--r--src/mesa/main/matrix.c2
-rw-r--r--src/mesa/main/nvfragparse.c2
-rw-r--r--src/mesa/main/nvprogram.c4
-rw-r--r--src/mesa/main/nvvertexec.c4
-rw-r--r--src/mesa/main/occlude.c2
-rw-r--r--src/mesa/main/rastpos.c2
13 files changed, 54 insertions, 43 deletions
diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c
index ecd701da3bf..010a49399ad 100644
--- a/src/mesa/main/api_loopback.c
+++ b/src/mesa/main/api_loopback.c
@@ -1642,31 +1642,31 @@ loopback_VertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v)
static void
loopback_VertexAttrib4bvARB(GLuint index, const GLbyte * v)
{
- ATTRIB(index, v[0], v[1], v[2], v[3]);
+ ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
}
static void
loopback_VertexAttrib4ivARB(GLuint index, const GLint * v)
{
- ATTRIB(index, v[0], v[1], v[2], v[3]);
+ ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
}
static void
loopback_VertexAttrib4ubvARB(GLuint index, const GLubyte * v)
{
- ATTRIB(index, v[0], v[1], v[2], v[3]);
+ ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
}
static void
loopback_VertexAttrib4usvARB(GLuint index, const GLushort * v)
{
- ATTRIB(index, v[0], v[1], v[2], v[3]);
+ ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
}
static void
loopback_VertexAttrib4uivARB(GLuint index, const GLuint * v)
{
- ATTRIB(index, v[0], v[1], v[2], v[3]);
+ ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
}
static void
diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c
index e5febdb9fa2..07ba4622197 100644
--- a/src/mesa/main/arbprogram.c
+++ b/src/mesa/main/arbprogram.c
@@ -146,16 +146,16 @@ _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params)
switch (pname) {
case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB:
- params[0] = ctx->Array.VertexAttrib[index].Enabled;
+ params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Enabled;
break;
case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB:
- params[0] = ctx->Array.VertexAttrib[index].Size;
+ params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Size;
break;
case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB:
- params[0] = ctx->Array.VertexAttrib[index].Stride;
+ params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Stride;
break;
case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB:
- params[0] = ctx->Array.VertexAttrib[index].Type;
+ params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Type;
break;
case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB:
params[0] = ctx->Array.VertexAttrib[index].Normalized;
@@ -181,10 +181,10 @@ _mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params)
_mesa_GetVertexAttribfvARB(index, pname, fparams);
if (ctx->ErrorValue == GL_NO_ERROR) {
if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {
- COPY_4V(params, fparams); /* float to int */
+ COPY_4V_CAST(params, fparams, GLint); /* float to int */
}
else {
- params[0] = fparams[0];
+ params[0] = (GLint) fparams[0];
}
}
}
@@ -245,7 +245,8 @@ void
_mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index,
GLdouble x, GLdouble y, GLdouble z, GLdouble w)
{
- _mesa_ProgramEnvParameter4fARB(target, index, x, y, z, w);
+ _mesa_ProgramEnvParameter4fARB(target, index, (GLfloat) x, (GLfloat) y,
+ (GLfloat) z, (GLfloat) w);
}
@@ -253,8 +254,9 @@ void
_mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
const GLdouble *params)
{
- _mesa_ProgramEnvParameter4fARB(target, index, params[0], params[1],
- params[2], params[3]);
+ _mesa_ProgramEnvParameter4fARB(target, index, (GLfloat) params[0],
+ (GLfloat) params[1], (GLfloat) params[2],
+ (GLfloat) params[3]);
}
@@ -821,7 +823,7 @@ _mesa_GetProgramRegisterfvMESA(GLenum target,
if (reg[0] == 'R') {
/* Temp register */
GLint i = _mesa_atoi(reg + 1);
- if (i >= ctx->Const.MaxVertexProgramTemps) {
+ if (i >= (GLint)ctx->Const.MaxVertexProgramTemps) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glGetProgramRegisterfvMESA(registerName)");
return;
@@ -830,7 +832,7 @@ _mesa_GetProgramRegisterfvMESA(GLenum target,
}
else if (reg[0] == 'v' && reg[1] == '[') {
/* Vertex Input attribute */
- GLint i;
+ GLuint i;
for (i = 0; i < ctx->Const.MaxVertexProgramAttribs; i++) {
const char *name = _mesa_nv_vertex_input_register_name(i);
char number[10];
@@ -885,7 +887,7 @@ _mesa_GetProgramRegisterfvMESA(GLenum target,
if (reg[0] == 'R') {
/* Temp register */
GLint i = _mesa_atoi(reg + 1);
- if (i >= ctx->Const.MaxFragmentProgramTemps) {
+ if (i >= (GLint)ctx->Const.MaxFragmentProgramTemps) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glGetProgramRegisterfvMESA(registerName)");
return;
@@ -894,7 +896,7 @@ _mesa_GetProgramRegisterfvMESA(GLenum target,
}
else if (reg[0] == 'f' && reg[1] == '[') {
/* Fragment input attribute */
- GLint i;
+ GLuint i;
for (i = 0; i < ctx->Const.MaxFragmentProgramAttribs; i++) {
const char *name = _mesa_nv_fragment_input_register_name(i);
if (_mesa_strncmp(reg + 2, name, 4) == 0) {
diff --git a/src/mesa/main/arbvertparse.c b/src/mesa/main/arbvertparse.c
index 6706f55b39a..74922692318 100644
--- a/src/mesa/main/arbvertparse.c
+++ b/src/mesa/main/arbvertparse.c
@@ -5528,7 +5528,7 @@ parse_tree_fold_bindings(parse_state * s, parse_tree_node * ptn)
eat_children = 0;
bind_row = 0;
bind_nrows = 1;
- bind_vals[0] = bind_vals[1] = bind_vals[2] = bind_vals[3];
+ bind_vals[0] = bind_vals[1] = bind_vals[2] = bind_vals[3] = 0.0f;
switch (ptn->prod_applied) {
/* vertex */
case 121:
@@ -6123,7 +6123,7 @@ parse_tree_fold_bindings(parse_state * s, parse_tree_node * ptn)
#define FOLD_FLOAT_CONSTANT(float_ptr, bind_vals_idx, sign) \
if (float_ptr->tok == 49) /* GLfloat */ {\
- bind_vals[bind_vals_idx] = sign * s->floats.data[float_ptr->tok_attr];\
+ bind_vals[bind_vals_idx] = sign * (GLfloat) s->floats.data[float_ptr->tok_attr];\
}\
else /* GLint */ {\
bind_vals[bind_vals_idx] = sign * s->ints.data[float_ptr->tok_attr];\
@@ -6131,9 +6131,9 @@ parse_tree_fold_bindings(parse_state * s, parse_tree_node * ptn)
#define FOLD_SIGNED_FLOAT_CONSTANT(sf_ptr, bind_vals_idx) \
{\
- GLfloat __mul = 1.;\
+ GLfloat __mul = 1.0F;\
if (sf_ptr->children[0]->prod_applied == 282) \
- __mul = -1.;\
+ __mul = -1.0F;\
FOLD_FLOAT_CONSTANT(sf_ptr->children[1], bind_vals_idx, __mul);\
}
diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c
index 32c61622f7a..1e07607c463 100644
--- a/src/mesa/main/depth.c
+++ b/src/mesa/main/depth.c
@@ -137,8 +137,8 @@ _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax )
return;
FLUSH_VERTICES(ctx, _NEW_DEPTH);
- ctx->Depth.BoundsMin = zmin;
- ctx->Depth.BoundsMax = zmax;
+ ctx->Depth.BoundsMin = (GLfloat) zmin;
+ ctx->Depth.BoundsMax = (GLfloat) zmax;
}
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 1ebc4a086eb..abfc2dfff88 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -4265,10 +4265,10 @@ save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
if (n) {
n[1].e = target;
n[2].ui = index;
- n[3].f = x;
- n[4].f = y;
- n[5].f = z;
- n[6].f = w;
+ n[3].f = (GLfloat) x;
+ n[4].f = (GLfloat) y;
+ n[5].f = (GLfloat) z;
+ n[6].f = (GLfloat) w;
}
if (ctx->ExecuteFlag) {
(*ctx->Exec->ProgramLocalParameter4dARB)(target, index, x, y, z, w);
@@ -4287,10 +4287,10 @@ save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
if (n) {
n[1].e = target;
n[2].ui = index;
- n[3].f = params[0];
- n[4].f = params[1];
- n[5].f = params[2];
- n[6].f = params[3];
+ n[3].f = (GLfloat) params[0];
+ n[4].f = (GLfloat) params[1];
+ n[5].f = (GLfloat) params[2];
+ n[6].f = (GLfloat) params[3];
}
if (ctx->ExecuteFlag) {
(*ctx->Exec->ProgramLocalParameter4dvARB)(target, index, params);
@@ -4383,8 +4383,8 @@ static void save_DepthBoundsEXT( GLclampd zmin, GLclampd zmax )
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 2 );
if (n) {
- n[1].f = zmin;
- n[2].f = zmax;
+ n[1].f = (GLfloat) zmin;
+ n[2].f = (GLfloat) zmax;
}
if (ctx->ExecuteFlag) {
(*ctx->Exec->DepthBoundsEXT)( zmin, zmax );
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 7597979e4a7..5960a95b6e6 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -489,7 +489,7 @@ _mesa_inv_sqrtf(float n)
#elif defined(XFree86LOADER) && defined(IN_MODULE)
return 1.0F / xf86sqrt(n);
#else
- return 1.0F / sqrt(n);
+ return (float) (1.0 / sqrt(n));
#endif
}
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index f3c77ca5fca..fcb63f53f20 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -146,6 +146,15 @@ do { \
(DST)[3] = (SRC)[3]; \
} while (0)
+/** Copy a 4-element vector with cast */
+#define COPY_4V_CAST( DST, SRC, CAST ) \
+do { \
+ (DST)[0] = (CAST)(SRC)[0]; \
+ (DST)[1] = (CAST)(SRC)[1]; \
+ (DST)[2] = (CAST)(SRC)[2]; \
+ (DST)[3] = (CAST)(SRC)[3]; \
+} while (0)
+
/** Copy a 4-element unsigned byte vector */
#if defined(__i386__)
#define COPY_4UBV(DST, SRC) \
diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c
index 6a3485876d3..e74e1728e79 100644
--- a/src/mesa/main/matrix.c
+++ b/src/mesa/main/matrix.c
@@ -191,7 +191,7 @@ _mesa_MatrixMode( GLenum mode )
case GL_MATRIX7_ARB:
if (ctx->Extensions.ARB_vertex_program ||
ctx->Extensions.ARB_fragment_program) {
- const GLint m = mode - GL_MATRIX0_ARB;
+ const GLuint m = mode - GL_MATRIX0_ARB;
if (m > ctx->Const.MaxProgramMatrices) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glMatrixMode(GL_MATRIX%d_ARB)", m);
diff --git a/src/mesa/main/nvfragparse.c b/src/mesa/main/nvfragparse.c
index c2023785e5c..36840d0e753 100644
--- a/src/mesa/main/nvfragparse.c
+++ b/src/mesa/main/nvfragparse.c
@@ -204,7 +204,7 @@ lookup_parameter(struct parse_state *parseState, const char *name)
static const GLint
lookup_parameter_index(struct parse_state *parseState, const char *name)
{
- GLint i;
+ GLuint i;
for (i = 0; i < parseState->numParameters; i++) {
if (_mesa_strcmp(parseState->parameters[i].Name, name) == 0)
return i;
diff --git a/src/mesa/main/nvprogram.c b/src/mesa/main/nvprogram.c
index 2fb062ffb8a..61dca5001ac 100644
--- a/src/mesa/main/nvprogram.c
+++ b/src/mesa/main/nvprogram.c
@@ -1101,7 +1101,7 @@ _mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name,
{
struct program *prog;
struct fragment_program *fragProg;
- GLint i;
+ GLuint i;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -1167,7 +1167,7 @@ _mesa_GetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte *name,
{
struct program *prog;
struct fragment_program *fragProg;
- GLint i;
+ GLuint i;
GET_CURRENT_CONTEXT(ctx);
if (!ctx->_CurrentProgram)
diff --git a/src/mesa/main/nvvertexec.c b/src/mesa/main/nvvertexec.c
index 73d5440c79a..e41bdfb8503 100644
--- a/src/mesa/main/nvvertexec.c
+++ b/src/mesa/main/nvvertexec.c
@@ -689,7 +689,7 @@ _mesa_exec_vertex_program(GLcontext *ctx, const struct vertex_program *program)
{
GLfloat t[4];
fetch_vector1( &inst->SrcReg[0], state, t );
- t[0] = t[1] = t[2] = t[3] = _mesa_pow(2.0, t[0]);
+ t[0] = t[1] = t[2] = t[3] = (GLfloat)_mesa_pow(2.0, t[0]);
store_vector4( &inst->DstReg, state, t );
}
break;
@@ -706,7 +706,7 @@ _mesa_exec_vertex_program(GLcontext *ctx, const struct vertex_program *program)
GLfloat t[4], u[4];
fetch_vector1( &inst->SrcReg[0], state, t );
fetch_vector1( &inst->SrcReg[1], state, u );
- t[0] = t[1] = t[2] = t[3] = _mesa_pow(t[0], u[0]);
+ t[0] = t[1] = t[2] = t[3] = (GLfloat)_mesa_pow(t[0], u[0]);
store_vector4( &inst->DstReg, state, t );
}
break;
diff --git a/src/mesa/main/occlude.c b/src/mesa/main/occlude.c
index f6dc7056ba1..871beb9e541 100644
--- a/src/mesa/main/occlude.c
+++ b/src/mesa/main/occlude.c
@@ -116,7 +116,7 @@ _mesa_GenQueriesARB(GLsizei n, GLuint *ids)
first = _mesa_HashFindFreeKeyBlock(ctx->Occlusion.QueryObjects, n);
if (first) {
- GLuint i;
+ GLsizei i;
for (i = 0; i < n; i++) {
struct occlusion_query *q = new_query_object(GL_SAMPLES_PASSED_ARB,
first + i);
diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c
index 218e4f7ed2e..7e39ddc4164 100644
--- a/src/mesa/main/rastpos.c
+++ b/src/mesa/main/rastpos.c
@@ -380,7 +380,7 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
}
/* ndc = clip / W */
- d = (clip[3] == 0.0) ? 1.0 : 1.0F / clip[3];
+ d = (clip[3] == 0.0F) ? 1.0F : 1.0F / clip[3];
ndc[0] = clip[0] * d;
ndc[1] = clip[1] * d;
ndc[2] = clip[2] * d;