use _mesa_alloc_instructions()
This commit is contained in:
@@ -4000,8 +4000,7 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target,
|
|||||||
|
|
||||||
/* Initialize the arb_program struct */
|
/* Initialize the arb_program struct */
|
||||||
program->Base.String = strz;
|
program->Base.String = strz;
|
||||||
program->Base.Instructions = (struct prog_instruction *)
|
program->Base.Instructions = _mesa_alloc_instructions(MAX_INSTRUCTIONS);
|
||||||
_mesa_malloc(MAX_INSTRUCTIONS * sizeof(struct prog_instruction));
|
|
||||||
program->Base.NumInstructions =
|
program->Base.NumInstructions =
|
||||||
program->Base.NumTemporaries =
|
program->Base.NumTemporaries =
|
||||||
program->Base.NumParameters =
|
program->Base.NumParameters =
|
||||||
|
@@ -1534,13 +1534,12 @@ _mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum dstTarget,
|
|||||||
|
|
||||||
/* copy the compiled instructions */
|
/* copy the compiled instructions */
|
||||||
assert(parseState.numInst <= MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS);
|
assert(parseState.numInst <= MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS);
|
||||||
newInst = (struct prog_instruction *)
|
newInst = _mesa_alloc_instructions(parseState.numInst);
|
||||||
MALLOC(parseState.numInst * sizeof(struct prog_instruction));
|
|
||||||
if (!newInst) {
|
if (!newInst) {
|
||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
|
||||||
return; /* out of memory */
|
return; /* out of memory */
|
||||||
}
|
}
|
||||||
MEMCPY(newInst, instBuffer,
|
_mesa_memcpy(newInst, instBuffer,
|
||||||
parseState.numInst * sizeof(struct prog_instruction));
|
parseState.numInst * sizeof(struct prog_instruction));
|
||||||
|
|
||||||
/* install the program */
|
/* install the program */
|
||||||
|
@@ -1374,8 +1374,7 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget,
|
|||||||
|
|
||||||
/* copy the compiled instructions */
|
/* copy the compiled instructions */
|
||||||
assert(parseState.numInst <= MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS);
|
assert(parseState.numInst <= MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS);
|
||||||
newInst = (struct prog_instruction *)
|
newInst = _mesa_alloc_instructions(parseState.numInst);
|
||||||
_mesa_malloc(parseState.numInst * sizeof(struct prog_instruction));
|
|
||||||
if (!newInst) {
|
if (!newInst) {
|
||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
|
||||||
_mesa_free(programString);
|
_mesa_free(programString);
|
||||||
|
Reference in New Issue
Block a user