summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/shader/arbfragparse.c19
-rw-r--r--src/mesa/shader/arbprogparse.c5
-rw-r--r--src/mesa/shader/arbvertparse.c19
3 files changed, 22 insertions, 21 deletions
diff --git a/src/mesa/shader/arbfragparse.c b/src/mesa/shader/arbfragparse.c
index d876946a25..7192156463 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 */
/*
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index c2365a281c..9099fd8f42 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -3872,11 +3872,9 @@ _mesa_parse_arb_program (GLcontext * ctx, const GLubyte * str, GLsizei len,
#endif
err = grammar_check (arbprogram_syn_id, strz, &parsed, &parsed_len);
- _mesa_free (strz);
- strz = NULL;
-
/* Syntax parse error */
if (err == 0) {
+ _mesa_free (strz);
grammar_get_last_error ((GLubyte *) error_msg, 300, &error_pos);
_mesa_set_program_error (ctx, error_pos, error_msg);
_mesa_error (ctx, GL_INVALID_OPERATION, "Parse Error");
@@ -3891,6 +3889,7 @@ _mesa_parse_arb_program (GLcontext * ctx, const GLubyte * str, GLsizei len,
grammar_destroy (arbprogram_syn_id);
/* Initialize the arb_program struct */
+ program->Base.String = strz;
program->Base.NumInstructions =
program->Base.NumTemporaries =
program->Base.NumParameters =
diff --git a/src/mesa/shader/arbvertparse.c b/src/mesa/shader/arbvertparse.c
index 5f011106ef..cfad87b5b1 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 */
/*