diff options
author | Brian Paul <[email protected]> | 2004-03-30 15:55:10 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2004-03-30 15:55:10 +0000 |
commit | a7f52a9ba1175174efb98a145248da331c9d4c54 (patch) | |
tree | 641c5555d51e466320b7ec5adf5e519c986bab20 /src/mesa/shader/arbvertparse.c | |
parent | 41d389909bc87d21cf7ef8639bead1b4494e3b0e (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/arbvertparse.c')
-rw-r--r-- | src/mesa/shader/arbvertparse.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/mesa/shader/arbvertparse.c b/src/mesa/shader/arbvertparse.c index 5f011106ef5..cfad87b5b1b 100644 --- a/src/mesa/shader/arbvertparse.c +++ b/src/mesa/shader/arbvertparse.c @@ -181,9 +181,19 @@ _mesa_parse_arb_vertex_program(GLcontext * ctx, GLenum target, retval = _mesa_parse_arb_program(ctx, str, len, &ap); + /* Parse error. Allocate a dummy program and return */ + if (retval) + { + program->Instructions = (struct vp_instruction *) _mesa_malloc ( + sizeof(struct vp_instruction) ); + program->Instructions[0].Opcode = VP_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; @@ -195,15 +205,6 @@ _mesa_parse_arb_vertex_program(GLcontext * ctx, GLenum target, program->OutputsWritten = ap.OutputsWritten; program->Parameters = ap.Parameters; - /* Parse error. Allocate a dummy program and return */ - if (retval) - { - program->Instructions = (struct vp_instruction *) _mesa_malloc ( - sizeof(struct vp_instruction) ); - program->Instructions[0].Opcode = VP_OPCODE_END; - return; - } - /* Eh.. we parsed something that wasn't a vertex program. doh! */ /* this wont happen any more */ /* |