summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/arbfragparse.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2004-03-30 15:55:10 +0000
committerBrian Paul <[email protected]>2004-03-30 15:55:10 +0000
commita7f52a9ba1175174efb98a145248da331c9d4c54 (patch)
tree641c5555d51e466320b7ec5adf5e519c986bab20 /src/mesa/shader/arbfragparse.c
parent41d389909bc87d21cf7ef8639bead1b4494e3b0e (diff)
Reorder some code so we don't upset program state when there's a parsing error.
Be sure to assign program.Base.String pointer.
Diffstat (limited to 'src/mesa/shader/arbfragparse.c')
-rw-r--r--src/mesa/shader/arbfragparse.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/mesa/shader/arbfragparse.c b/src/mesa/shader/arbfragparse.c
index d876946a251..7192156463e 100644
--- a/src/mesa/shader/arbfragparse.c
+++ b/src/mesa/shader/arbfragparse.c
@@ -192,9 +192,19 @@ _mesa_parse_arb_fragment_program(GLcontext * ctx, GLenum target,
retval = _mesa_parse_arb_program(ctx, str, len, &ap);
+ /* XXX: Parse error. Cleanup things and return */
+ if (retval)
+ {
+ program->Instructions = (struct fp_instruction *) _mesa_malloc (
+ sizeof(struct fp_instruction) );
+ program->Instructions[0].Opcode = FP_OPCODE_END;
+ return;
+ }
+
/* copy the relvant contents of the arb_program struct into the
* fragment_program struct
*/
+ program->Base.String = ap.Base.String;
program->Base.NumInstructions = ap.Base.NumInstructions;
program->Base.NumTemporaries = ap.Base.NumTemporaries;
program->Base.NumParameters = ap.Base.NumParameters;
@@ -211,15 +221,6 @@ _mesa_parse_arb_fragment_program(GLcontext * ctx, GLenum target,
program->Parameters = ap.Parameters;
program->FogOption = ap.FogOption;
- /* XXX: Parse error. Cleanup things and return */
- if (retval)
- {
- program->Instructions = (struct fp_instruction *) _mesa_malloc (
- sizeof(struct fp_instruction) );
- program->Instructions[0].Opcode = FP_OPCODE_END;
- return;
- }
-
/* XXX: Eh.. we parsed something that wasn't a fragment program. doh! */
/* this wont happen any more */
/*