Be sure to assign program.Base.String pointer.
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;
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 */
/*
#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");
grammar_destroy (arbprogram_syn_id);
/* Initialize the arb_program struct */
+ program->Base.String = strz;
program->Base.NumInstructions =
program->Base.NumTemporaries =
program->Base.NumParameters =
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;
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 */
/*