summaryrefslogtreecommitdiff
path: root/src/mesa/main/arbfragparse.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/arbfragparse.c')
-rw-r--r--src/mesa/main/arbfragparse.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/src/mesa/main/arbfragparse.c b/src/mesa/main/arbfragparse.c
index ca4b68d8e2..a12fd93cf3 100644
--- a/src/mesa/main/arbfragparse.c
+++ b/src/mesa/main/arbfragparse.c
@@ -189,15 +189,41 @@ _mesa_parse_arb_fragment_program(GLcontext * ctx, GLenum target,
retval = _mesa_parse_arb_program(ctx, str, len, &ap);
+ /* 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->InputsRead = ap.InputsRead;
+ program->OutputsWritten = ap.OutputsWritten;
+ for (retval=0; retval<MAX_TEXTURE_IMAGE_UNITS; retval++)
+ program->TexturesUsed[retval] = ap.TexturesUsed[retval];
+ program->NumAluInstructions = ap.NumAluInstructions;
+ program->NumTexInstructions = ap.NumTexInstructions;
+ program->NumTexIndirections = ap.NumTexIndirections;
+ program->Parameters = ap.Parameters;
+
/* 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! */
if (ap.type != GL_FRAGMENT_PROGRAM_ARB)
{
+ program->Instructions = (struct fp_instruction *) _mesa_malloc (
+ sizeof(struct fp_instruction) );
+ program->Instructions[0].Opcode = FP_OPCODE_END;
+
+ _mesa_error (ctx, GL_INVALID_OPERATION, "Parsed a non-fragment program as a fragment program");
return;
}
@@ -207,22 +233,5 @@ _mesa_parse_arb_fragment_program(GLcontext * ctx, GLenum target,
(void) debug_fp_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.FPInstructions;
- program->InputsRead = ap.InputsRead;
- program->OutputsWritten = ap.OutputsWritten;
- for (retval=0; retval<MAX_TEXTURE_IMAGE_UNITS; retval++)
- program->TexturesUsed[retval] = ap.TexturesUsed[retval];
- program->NumAluInstructions = ap.NumAluInstructions;
- program->NumTexInstructions = ap.NumTexInstructions;
- program->NumTexIndirections = ap.NumTexIndirections;
- program->Parameters = ap.Parameters;
}