From 4cc2674aee98a4c2972f4f097a89b7b4a30df4ab Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 20 Apr 2007 08:12:17 -0600 Subject: fix instruction comment code --- src/mesa/shader/prog_instruction.c | 8 +++++++- src/mesa/shader/program.c | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src/mesa/shader') diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/shader/prog_instruction.c index 1e8e0812262..d6b5652a276 100644 --- a/src/mesa/shader/prog_instruction.c +++ b/src/mesa/shader/prog_instruction.c @@ -108,7 +108,13 @@ struct prog_instruction * _mesa_copy_instructions(struct prog_instruction *dest, const struct prog_instruction *src, GLuint n) { - return _mesa_memcpy(dest, src, n * sizeof(struct prog_instruction)); + GLuint i; + _mesa_memcpy(dest, src, n * sizeof(struct prog_instruction)); + for (i = 0; i < n; i++) { + if (src[i].Comment) + dest[i].Comment = _mesa_strdup(src[i].Comment); + } + return dest; } diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index e872d78611f..42059198282 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -281,6 +281,8 @@ _mesa_delete_program(GLcontext *ctx, struct gl_program *prog) for (i = 0; i < prog->NumInstructions; i++) { if (prog->Instructions[i].Data) _mesa_free(prog->Instructions[i].Data); + if (prog->Instructions[i].Comment) + _mesa_free((char *) prog->Instructions[i].Comment); } _mesa_free(prog->Instructions); } -- cgit v1.2.3