diff options
author | Karl Rasche <[email protected]> | 2003-11-23 19:29:18 +0000 |
---|---|---|
committer | Karl Rasche <[email protected]> | 2003-11-23 19:29:18 +0000 |
commit | 79e0dad79e24668fbb35aad970cb2b7b629a11fa (patch) | |
tree | 92cd4516111b057dad4d63c93beff67f55746cb1 /src/mesa/main | |
parent | 4eebfa14e72c7c1f2572dbbc3bc7e85cf71f5926 (diff) |
- parse_alias() Was totally borked
- forgot a ++ in texSrcBit switch
- copy/paste error in arbfragparse.c
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/arbfragparse.c | 6 | ||||
-rw-r--r-- | src/mesa/main/arbparse.c | 59 |
2 files changed, 31 insertions, 34 deletions
diff --git a/src/mesa/main/arbfragparse.c b/src/mesa/main/arbfragparse.c index a12fd93cf37..1723e6c5d9a 100644 --- a/src/mesa/main/arbfragparse.c +++ b/src/mesa/main/arbfragparse.c @@ -184,7 +184,7 @@ _mesa_parse_arb_fragment_program(GLcontext * ctx, GLenum target, const GLubyte * str, GLsizei len, struct fragment_program *program) { - GLuint retval; + GLuint a, retval; struct arb_program ap; retval = _mesa_parse_arb_program(ctx, str, len, &ap); @@ -200,8 +200,8 @@ _mesa_parse_arb_fragment_program(GLcontext * ctx, GLenum target, program->InputsRead = ap.InputsRead; program->OutputsWritten = ap.OutputsWritten; - for (retval=0; retval<MAX_TEXTURE_IMAGE_UNITS; retval++) - program->TexturesUsed[retval] = ap.TexturesUsed[retval]; + for (a=0; a<MAX_TEXTURE_IMAGE_UNITS; a++) + program->TexturesUsed[a] = ap.TexturesUsed[a]; program->NumAluInstructions = ap.NumAluInstructions; program->NumTexInstructions = ap.NumTexInstructions; program->NumTexIndirections = ap.NumTexIndirections; diff --git a/src/mesa/main/arbparse.c b/src/mesa/main/arbparse.c index a300c5d200a..e510f969760 100644 --- a/src/mesa/main/arbparse.c +++ b/src/mesa/main/arbparse.c @@ -42,7 +42,6 @@ #include "nvfragprog.h" #include "arbparse.h" - /* TODO: * Fragment Program Stuff: * ----------------------------------------------------- @@ -2726,7 +2725,7 @@ struct var_cache GLuint output_binding_idx; /* This is the index into the result register file * corresponding to the bound result state */ struct var_cache *alias_binding; /* For type vt_alias, points to the var_cache entry - * * that this is aliased to */ + * that this is aliased to */ GLuint param_binding_type; /* {PROGRAM_STATE_VAR, PROGRAM_LOCAL_PARAM, * PROGRAM_ENV_PARAM} */ GLuint param_binding_begin; /* This is the offset into the program_parameter_list where @@ -4116,41 +4115,40 @@ parse_alias (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct var_cache *temp_var; char *error_msg; - while (**inst != 0) { - temp_var = parse_string (inst, vc_head, Program, &found); - Program->Position = parse_position (inst); - if (found) { - error_msg = + + temp_var = parse_string (inst, vc_head, Program, &found); + Program->Position = parse_position (inst); + + if (found) { + error_msg = + _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40); + _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + temp_var->name); + + _mesa_set_program_error (ctx, Program->Position, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); + + _mesa_free (error_msg); + return 1; + } + + temp_var->type = vt_alias; + temp_var->alias_binding = parse_string (inst, vc_head, Program, &found); + Program->Position = parse_position (inst); + + if (!found) + { + error_msg = _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40); - _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", - temp_var->name); + _mesa_sprintf (error_msg, "Alias value %s is not defined", + temp_var->alias_binding->name); _mesa_set_program_error (ctx, Program->Position, error_msg); _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); _mesa_free (error_msg); return 1; - } - - temp_var->type = vt_temp; - - if (((Program->type == GL_FRAGMENT_PROGRAM_ARB) && - (Program->Base.NumTemporaries >= - ctx->Const.MaxFragmentProgramTemps)) - || ((Program->type == GL_VERTEX_PROGRAM_ARB) - && (Program->Base.NumTemporaries >= - ctx->Const.MaxVertexProgramTemps))) { - _mesa_set_program_error (ctx, Program->Position, - "Too many TEMP variables declared"); - _mesa_error (ctx, GL_INVALID_OPERATION, - "Too many TEMP variables declared"); - return 1; - } - - temp_var->temp_binding = Program->Base.NumTemporaries; - Program->Base.NumTemporaries++; } - (*inst)++; return 0; } @@ -4668,7 +4666,6 @@ parse_fp_instruction (GLcontext * ctx, GLubyte ** inst, /* The actual opcode name */ code = *(*inst)++; - /* Increment the correct count */ switch (class) { case F_ALU_INST: @@ -5015,7 +5012,7 @@ parse_fp_instruction (GLcontext * ctx, GLubyte ** inst, fp->TexSrcUnit = texcoord; /* texTarget */ - switch (*(*inst)) { + switch (*(*inst)++) { case TEXTARGET_1D: fp->TexSrcBit = TEXTURE_1D_BIT; break; |