summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian <brian@nostromo.localnet.net>2007-01-23 16:37:51 -0700
committerBrian <brian@nostromo.localnet.net>2007-01-23 16:37:51 -0700
commit223d7cb3c785ad58c869a3ee0fbf2f1d42c3310d (patch)
tree85ae41eea6ed9b915e14603fc19ce2ef53765bb8 /src
parentbc5d480e2ca83855a343f1ad979e05f0ee59d2fb (diff)
fix g++ warnings/errors
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/texenvprogram.c5
-rw-r--r--src/mesa/shader/arbprogram.c4
-rw-r--r--src/mesa/shader/prog_parameter.c8
-rw-r--r--src/mesa/shader/prog_parameter.h4
-rw-r--r--src/mesa/shader/prog_statevars.c2
-rw-r--r--src/mesa/shader/shader_api.c6
-rw-r--r--src/mesa/shader/slang/slang_codegen.c17
-rw-r--r--src/mesa/shader/slang/slang_emit.c46
-rw-r--r--src/mesa/shader/slang/slang_link2.c2
-rw-r--r--src/mesa/sources1
-rw-r--r--src/mesa/swrast/s_fragprog.c7
11 files changed, 54 insertions, 48 deletions
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index 3cb2adbde2..b69e650159 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -1187,13 +1187,14 @@ static void cache_item( struct texenvprog_cache *cache,
const struct state_key *key,
void *data )
{
- struct texenvprog_cache_item *c = MALLOC(sizeof(*c));
+ struct texenvprog_cache_item *c
+ = (struct texenvprog_cache_item *) MALLOC(sizeof(*c));
c->hash = hash;
c->key = _mesa_malloc(sizeof(*key));
memcpy(c->key, key, sizeof(*key));
- c->data = data;
+ c->data = (struct gl_fragment_program *) data;
if (cache->n_items > cache->size * 1.5) {
if (cache->size < 1000)
diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c
index f3b25da394..5583f16ce8 100644
--- a/src/mesa/shader/arbprogram.c
+++ b/src/mesa/shader/arbprogram.c
@@ -312,7 +312,7 @@ _mesa_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
const GLfloat *params)
{
GET_CURRENT_CONTEXT(ctx);
- unsigned i;
+ GLint i;
GLfloat * dest;
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -464,7 +464,7 @@ _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
{
GET_CURRENT_CONTEXT(ctx);
struct gl_program *prog;
- unsigned i;
+ GLint i;
ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c
index 90118b6294..a87dafc598 100644
--- a/src/mesa/shader/prog_parameter.c
+++ b/src/mesa/shader/prog_parameter.c
@@ -217,7 +217,7 @@ _mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList,
* constants because we rely on smearing (i.e. .yyyy or .zzzz).
*/
if (size == 1) {
- for (pos = 0; pos < paramList->NumParameters; pos++) {
+ for (pos = 0; pos < (GLint) paramList->NumParameters; pos++) {
struct gl_program_parameter *p = paramList->Parameters + pos;
if (p->Type == PROGRAM_CONSTANT && p->Size + size <= 4) {
/* ok, found room */
@@ -321,7 +321,7 @@ _mesa_add_attribute(struct gl_program_parameter_list *paramList,
else {
/* add */
gl_state_index state[STATE_LENGTH];
- state[0] = attrib;
+ state[0] = (gl_state_index) attrib;
if (size < 0)
size = 4;
i = _mesa_add_parameter(paramList, PROGRAM_INPUT, name,
@@ -373,7 +373,7 @@ _mesa_add_state_reference(struct gl_program_parameter_list *paramList,
GLint index;
/* Check if the state reference is already in the list */
- for (index = 0; index < paramList->NumParameters; index++) {
+ for (index = 0; index < (GLint) paramList->NumParameters; index++) {
GLuint i, match = 0;
for (i = 0; i < 6; i++) {
if (paramList->Parameters[index].StateIndexes[i] == stateTokens[i]) {
@@ -468,7 +468,7 @@ _mesa_lookup_parameter_index(const struct gl_program_parameter_list *paramList,
*/
GLboolean
_mesa_lookup_parameter_constant(const struct gl_program_parameter_list *list,
- const GLfloat v[], GLsizei vSize,
+ const GLfloat v[], GLuint vSize,
GLint *posOut, GLuint *swizzleOut)
{
GLuint i;
diff --git a/src/mesa/shader/prog_parameter.h b/src/mesa/shader/prog_parameter.h
index bfae071be0..459643f425 100644
--- a/src/mesa/shader/prog_parameter.h
+++ b/src/mesa/shader/prog_parameter.h
@@ -50,7 +50,7 @@ struct gl_program_parameter
/**
* A sequence of STATE_* tokens and integers to identify GL state.
*/
- GLuint StateIndexes[STATE_LENGTH];
+ GLint StateIndexes[STATE_LENGTH];
};
@@ -127,7 +127,7 @@ _mesa_lookup_parameter_index(const struct gl_program_parameter_list *paramList,
extern GLboolean
_mesa_lookup_parameter_constant(const struct gl_program_parameter_list *list,
- const GLfloat v[], GLsizei vSize,
+ const GLfloat v[], GLuint vSize,
GLint *posOut, GLuint *swizzleOut);
extern GLuint
diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c
index a0a00cfb95..3a54ab8c58 100644
--- a/src/mesa/shader/prog_statevars.c
+++ b/src/mesa/shader/prog_statevars.c
@@ -775,7 +775,7 @@ _mesa_load_state_parameters(GLcontext *ctx,
for (i = 0; i < paramList->NumParameters; i++) {
if (paramList->Parameters[i].Type == PROGRAM_STATE_VAR) {
_mesa_fetch_state(ctx,
- paramList->Parameters[i].StateIndexes,
+ (gl_state_index *) paramList->Parameters[i].StateIndexes,
paramList->ParameterValues[i]);
}
}
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index c18bbcec4b..6bae17a905 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -518,7 +518,7 @@ _mesa_get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount,
struct gl_shader_program *shProg
= _mesa_lookup_shader_program(ctx, program);
if (shProg) {
- GLuint i;
+ GLint i;
for (i = 0; i < maxCount && i < shProg->NumShaders; i++) {
obj[i] = shProg->Shaders[i]->Name;
}
@@ -719,7 +719,7 @@ _mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location,
struct gl_shader_program *shProg
= _mesa_lookup_shader_program(ctx, program);
if (shProg) {
- GLuint i;
+ GLint i;
if (location >= 0 && location < shProg->Uniforms->NumParameters) {
for (i = 0; i < shProg->Uniforms->Parameters[location].Size; i++) {
params[i] = shProg->Uniforms->ParameterValues[location][i];
@@ -883,7 +883,7 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
return;
}
- if (location < 0 || location >= shProg->Uniforms->NumParameters) {
+ if (location < 0 || location >= (GLint) shProg->Uniforms->NumParameters) {
_mesa_error(ctx, GL_INVALID_VALUE, "glUniform(location)");
return;
}
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index aba6813a8b..ff42db9def 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -661,7 +661,7 @@ static slang_operation *
slang_inline_asm_function(slang_assemble_ctx *A,
slang_function *fun, slang_operation *oper)
{
- const int numArgs = oper->num_children;
+ const GLuint numArgs = oper->num_children;
const slang_operation *args = oper->children;
GLuint i;
slang_operation *inlined = slang_operation_new(1);
@@ -1052,7 +1052,8 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun,
&inlined->children,
inlined->num_children);
lab->type = slang_oper_label;
- lab->a_id = slang_atom_pool_atom(A->atoms, A->CurFunction->end_label);
+ lab->a_id = slang_atom_pool_atom(A->atoms,
+ (char *) A->CurFunction->end_label);
}
for (i = 0; i < totalArgs; i++) {
@@ -1281,7 +1282,7 @@ _slang_gen_cond(slang_ir_node *n)
static void
print_funcs(struct slang_function_scope_ *scope, const char *name)
{
- int i;
+ GLuint i;
for (i = 0; i < scope->num_functions; i++) {
slang_function *f = &scope->functions[i];
if (!name || strcmp(name, (char*) f->header.a_name) == 0)
@@ -1301,7 +1302,7 @@ print_funcs(struct slang_function_scope_ *scope, const char *name)
static slang_function *
_slang_first_function(struct slang_function_scope_ *scope, const char *name)
{
- int i;
+ GLuint i;
for (i = 0; i < scope->num_functions; i++) {
slang_function *f = &scope->functions[i];
if (strcmp(name, (char*) f->header.a_name) == 0)
@@ -1800,7 +1801,9 @@ _slang_gen_return(slang_assemble_ctx * A, slang_operation *oper)
slang_operation gotoOp;
slang_operation_construct(&gotoOp);
gotoOp.type = slang_oper_goto;
- gotoOp.a_id = slang_atom_pool_atom(A->atoms, A->CurFunction->end_label);
+ /* XXX don't call function? */
+ gotoOp.a_id = slang_atom_pool_atom(A->atoms,
+ (char *) A->CurFunction->end_label);
/* assemble the new code */
n = _slang_gen_operation(A, &gotoOp);
/* destroy temp code */
@@ -1855,7 +1858,9 @@ _slang_gen_return(slang_assemble_ctx * A, slang_operation *oper)
jump = &block->children[1];
jump->type = slang_oper_goto;
assert(A->CurFunction->end_label);
- jump->a_id = slang_atom_pool_atom(A->atoms, A->CurFunction->end_label);
+ /* XXX don't call function? */
+ jump->a_id = slang_atom_pool_atom(A->atoms,
+ (char *) A->CurFunction->end_label);
#if 0 /* debug */
printf("NEW RETURN:\n");
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index 036509c51c..82e8c0b158 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -83,35 +83,35 @@ static slang_ir_info IrInfo[] = {
{ IR_FLOOR, "IR_FLOOR", OPCODE_FLR, 4, 1 },
{ IR_FRAC, "IR_FRAC", OPCODE_FRC, 4, 1 },
{ IR_ABS, "IR_ABS", OPCODE_ABS, 4, 1 },
- { IR_NEG, "IR_NEG", 0/*spec case*/, 4, 1 },
+ { IR_NEG, "IR_NEG", OPCODE_NOP/*spec case*/, 4, 1 },
{ IR_DDX, "IR_DDX", OPCODE_DDX, 4, 1 },
{ IR_DDX, "IR_DDY", OPCODE_DDX, 4, 1 },
{ IR_SIN, "IR_SIN", OPCODE_SIN, 1, 1 },
{ IR_COS, "IR_COS", OPCODE_COS, 1, 1 },
/* other */
- { IR_SEQ, "IR_SEQ", 0, 0, 0 },
- { IR_SCOPE, "IR_SCOPE", 0, 0, 0 },
- { IR_LABEL, "IR_LABEL", 0, 0, 0 },
- { IR_JUMP, "IR_JUMP", 0, 0, 0 },
- { IR_CJUMP0, "IR_CJUMP0", 0, 0, 0 },
- { IR_CJUMP1, "IR_CJUMP1", 0, 0, 0 },
- { IR_IF, "IR_IF", 0, 0, 0 },
- { IR_ELSE, "IR_ELSE", 0, 0, 0 },
- { IR_ENDIF, "IR_ENDIF", 0, 0, 0 },
- { IR_KILL, "IR_KILL", 0, 0, 0 },
- { IR_COND, "IR_COND", 0, 0, 0 },
- { IR_CALL, "IR_CALL", 0, 0, 0 },
- { IR_MOVE, "IR_MOVE", 0, 0, 1 },
- { IR_NOT, "IR_NOT", 0, 1, 1 },
- { IR_VAR, "IR_VAR", 0, 0, 0 },
- { IR_VAR_DECL, "IR_VAR_DECL", 0, 0, 0 },
+ { IR_SEQ, "IR_SEQ", OPCODE_NOP, 0, 0 },
+ { IR_SCOPE, "IR_SCOPE", OPCODE_NOP, 0, 0 },
+ { IR_LABEL, "IR_LABEL", OPCODE_NOP, 0, 0 },
+ { IR_JUMP, "IR_JUMP", OPCODE_NOP, 0, 0 },
+ { IR_CJUMP0, "IR_CJUMP0", OPCODE_NOP, 0, 0 },
+ { IR_CJUMP1, "IR_CJUMP1", OPCODE_NOP, 0, 0 },
+ { IR_IF, "IR_IF", OPCODE_NOP, 0, 0 },
+ { IR_ELSE, "IR_ELSE", OPCODE_NOP, 0, 0 },
+ { IR_ENDIF, "IR_ENDIF", OPCODE_NOP, 0, 0 },
+ { IR_KILL, "IR_KILL", OPCODE_NOP, 0, 0 },
+ { IR_COND, "IR_COND", OPCODE_NOP, 0, 0 },
+ { IR_CALL, "IR_CALL", OPCODE_NOP, 0, 0 },
+ { IR_MOVE, "IR_MOVE", OPCODE_NOP, 0, 1 },
+ { IR_NOT, "IR_NOT", OPCODE_NOP, 1, 1 },
+ { IR_VAR, "IR_VAR", OPCODE_NOP, 0, 0 },
+ { IR_VAR_DECL, "IR_VAR_DECL", OPCODE_NOP, 0, 0 },
{ IR_TEX, "IR_TEX", OPCODE_TEX, 4, 1 },
{ IR_TEXB, "IR_TEXB", OPCODE_TXB, 4, 1 },
{ IR_TEXP, "IR_TEXP", OPCODE_TXP, 4, 1 },
- { IR_FLOAT, "IR_FLOAT", 0, 0, 0 },
- { IR_FIELD, "IR_FIELD", 0, 0, 0 },
- { IR_ELEMENT, "IR_ELEMENT", 0, 0, 0 },
- { IR_SWIZZLE, "IR_SWIZZLE", 0, 0, 0 },
+ { IR_FLOAT, "IR_FLOAT", OPCODE_NOP, 0, 0 },
+ { IR_FIELD, "IR_FIELD", OPCODE_NOP, 0, 0 },
+ { IR_ELEMENT, "IR_ELEMENT", OPCODE_NOP, 0, 0 },
+ { IR_SWIZZLE, "IR_SWIZZLE", OPCODE_NOP, 0, 0 },
{ IR_NOP, NULL, OPCODE_NOP, 0, 0 }
};
@@ -219,7 +219,7 @@ storage_string(const slang_ir_storage *st)
sprintf(s, "%s[%d..%d]", files[st->File], st->Index,
st->Index + st->Size - 1);
#endif
- assert(st->File < sizeof(files) / sizeof(files[0]));
+ assert(st->File < (GLint) (sizeof(files) / sizeof(files[0])));
sprintf(s, "%s[%d]", files[st->File], st->Index);
return s;
}
@@ -966,7 +966,7 @@ emit(slang_var_table *vt, slang_ir_node *n, struct gl_program *prog)
if (n->Children[1]->Opcode == IR_FLOAT) {
/* OK, constant index */
const GLint arrayAddr = n->Children[0]->Store->Index;
- const GLint index = n->Children[1]->Value[0];
+ const GLint index = (GLint) n->Children[1]->Value[0];
n->Store->Index = arrayAddr + index;
}
else {
diff --git a/src/mesa/shader/slang/slang_link2.c b/src/mesa/shader/slang/slang_link2.c
index 0a517aecc5..9676aa5fa1 100644
--- a/src/mesa/shader/slang/slang_link2.c
+++ b/src/mesa/shader/slang/slang_link2.c
@@ -133,7 +133,7 @@ link_varying_vars(struct gl_shader_program *shProg, struct gl_program *prog)
static GLboolean
-is_uniform(enum register_file file)
+is_uniform(GLuint file)
{
return (file == PROGRAM_ENV_PARAM ||
file == PROGRAM_STATE_VAR ||
diff --git a/src/mesa/sources b/src/mesa/sources
index 1b0474c14b..d0b7246ed6 100644
--- a/src/mesa/sources
+++ b/src/mesa/sources
@@ -182,6 +182,7 @@ SLANG_SOURCES = \
shader/slang/slang_error.c \
shader/slang/slang_execute.c \
shader/slang/slang_export.c \
+ shader/slang/slang_label.c \
shader/slang/slang_library_noise.c \
shader/slang/slang_library_texsample.c \
shader/slang/slang_link.c \
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index 813345f4cd..ed82460669 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -200,8 +200,7 @@ fetch_vector4( GLcontext *ctx,
const GLfloat *src = get_register_pointer(ctx, source, machine, program);
ASSERT(src);
- if (source->Swizzle == MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y,
- SWIZZLE_Z, SWIZZLE_W)) {
+ if (source->Swizzle == SWIZZLE_NOOP) {
/* no swizzling */
COPY_4V(result, src);
}
@@ -1263,8 +1262,8 @@ execute_program( GLcontext *ctx,
{
GLfloat a[4], result[4];
fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a );
- result[0] = (GLfloat)_mesa_cos(a[0]);
- result[1] = (GLfloat)_mesa_sin(a[0]);
+ result[0] = (GLfloat) _mesa_cos(a[0]);
+ result[1] = (GLfloat) _mesa_sin(a[0]);
result[2] = 0.0; /* undefined! */
result[3] = 0.0; /* undefined! */
store_vector4( inst, machine, result );