From 9983a27cbe4f123f4e7fcce59c0d8b61b0f73924 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 25 Aug 2006 15:13:25 +0000 Subject: [PATCH] added _mesa_alloc_instructions() utility function --- src/mesa/shader/program.c | 13 +++++++++++++ src/mesa/shader/program.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index f6877bd1426..b1d06bbb278 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -1312,6 +1312,19 @@ _mesa_init_instruction(struct prog_instruction *inst) } +/** + * Allocate an array of program instructions. + * \param numInst number of instructions + * \return pointer to instruction memory + */ +struct prog_instruction * +_mesa_alloc_instructions(GLuint numInst) +{ + return (struct prog_instruction *) + _mesa_calloc(numInst * sizeof(struct prog_instruction)); +} + + /** * Reallocate memory storing an array of program instructions. * This is used when we need to append additional instructions onto an diff --git a/src/mesa/shader/program.h b/src/mesa/shader/program.h index a8535cc2cf1..6a345339aff 100644 --- a/src/mesa/shader/program.h +++ b/src/mesa/shader/program.h @@ -114,6 +114,9 @@ _mesa_delete_program(GLcontext *ctx, struct gl_program *prog); extern struct gl_program * _mesa_lookup_program(GLcontext *ctx, GLuint id); +extern struct prog_instruction * +_mesa_alloc_instructions(GLuint numInst); + extern struct prog_instruction * _mesa_realloc_instructions(struct prog_instruction *oldInst, GLuint numOldInst, GLuint numNewInst); -- 2.30.2