OSDN Git Service

added _mesa_alloc_instructions() utility function
authorBrian Paul <brian.paul@tungstengraphics.com>
Fri, 25 Aug 2006 15:13:25 +0000 (15:13 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Fri, 25 Aug 2006 15:13:25 +0000 (15:13 +0000)
src/mesa/shader/program.c
src/mesa/shader/program.h

index f6877bd..b1d06bb 100644 (file)
@@ -1313,6 +1313,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
  * program.
index a8535cc..6a34533 100644 (file)
@@ -115,6 +115,9 @@ 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);