summaryrefslogtreecommitdiff
path: root/src/mesa/main/arbvertparse.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/arbvertparse.c')
-rw-r--r--src/mesa/main/arbvertparse.c44
1 files changed, 27 insertions, 17 deletions
diff --git a/src/mesa/main/arbvertparse.c b/src/mesa/main/arbvertparse.c
index 7a6fc6e7db..0bc2a2d04c 100644
--- a/src/mesa/main/arbvertparse.c
+++ b/src/mesa/main/arbvertparse.c
@@ -178,36 +178,46 @@ _mesa_parse_arb_vertex_program(GLcontext * ctx, GLenum target,
retval = _mesa_parse_arb_program(ctx, str, len, &ap);
- /* XXX: Parse error. Cleanup things and return */
+ /* copy the relvant contents of the arb_program struct into the
+ * fragment_program struct
+ */
+ program->Base.NumInstructions = ap.Base.NumInstructions;
+ program->Base.NumTemporaries = ap.Base.NumTemporaries;
+ program->Base.NumParameters = ap.Base.NumParameters;
+ program->Base.NumAttributes = ap.Base.NumAttributes;
+ program->Base.NumAddressRegs = ap.Base.NumAddressRegs;
+
+ program->IsPositionInvariant = ap.HintPositionInvariant;
+ program->InputsRead = ap.InputsRead;
+ 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;
}
- /* XXX: Eh.. we parsed something that wasn't a vertex program. doh! */
+ /* Eh.. we parsed something that wasn't a vertex program. doh! */
if (ap.type != GL_VERTEX_PROGRAM_ARB)
{
+ program->Instructions = (struct vp_instruction *) _mesa_malloc (
+ sizeof(struct vp_instruction) );
+ program->Instructions[0].Opcode = VP_OPCODE_END;
+
+ _mesa_error (ctx, GL_INVALID_OPERATION, "Parsed a non-vertex program as a vertex program");
return;
}
-
+
+ program->Instructions = ap.VPInstructions;
+
#if DEBUG_VP
debug_vp_inst(ap.Base.NumInstructions, ap.VPInstructions);
#else
(void) debug_vp_inst;
#endif
- /* copy the relvant contents of the arb_program struct into the
- * fragment_program struct
- */
- program->Base.NumInstructions = ap.Base.NumInstructions;
- program->Base.NumTemporaries = ap.Base.NumTemporaries;
- program->Base.NumParameters = ap.Base.NumParameters;
- program->Base.NumAttributes = ap.Base.NumAttributes;
- program->Base.NumAddressRegs = ap.Base.NumAddressRegs;
-
- program->Instructions = ap.VPInstructions;
- program->IsPositionInvariant = ap.HintPositionInvariant;
- program->InputsRead = ap.InputsRead;
- program->OutputsWritten = ap.OutputsWritten;
- program->Parameters = ap.Parameters;
}