summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/shader/prog_instruction.c17
-rw-r--r--src/mesa/shader/prog_instruction.h3
2 files changed, 20 insertions, 0 deletions
diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/shader/prog_instruction.c
index 066129037a..bea5d0551e 100644
--- a/src/mesa/shader/prog_instruction.c
+++ b/src/mesa/shader/prog_instruction.c
@@ -119,6 +119,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
*/
struct instruction_info
diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h
index e8a2407ea8..711166f9dd 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);