From: Brian Date: Mon, 7 Apr 2008 17:15:23 +0000 (-0600) Subject: mesa: added _mesa_free_instructions() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f3bd7bf5c913d2a58d424e995b4d441e402bd62b;p=mesa.git mesa: added _mesa_free_instructions() --- diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/shader/prog_instruction.c index 066129037a7..bea5d0551e4 100644 --- a/src/mesa/shader/prog_instruction.c +++ b/src/mesa/shader/prog_instruction.c @@ -118,6 +118,23 @@ _mesa_copy_instructions(struct prog_instruction *dest, } +/** + * Free an array of instructions + */ +void +_mesa_free_instructions(struct prog_instruction *inst, GLuint count) +{ + GLuint i; + for (i = 0; i < count; i++) { + if (inst[i].Data) + _mesa_free(inst[i].Data); + if (inst[i].Comment) + _mesa_free((char *) inst[i].Comment); + } + _mesa_free(inst); +} + + /** * Basic info about each instruction */ diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h index e8a2407ea85..711166f9ddb 100644 --- a/src/mesa/shader/prog_instruction.h +++ b/src/mesa/shader/prog_instruction.h @@ -439,6 +439,9 @@ extern struct prog_instruction * _mesa_copy_instructions(struct prog_instruction *dest, const struct prog_instruction *src, GLuint n); +extern void +_mesa_free_instructions(struct prog_instruction *inst, GLuint count); + extern GLuint _mesa_num_inst_src_regs(gl_inst_opcode opcode);