summaryrefslogtreecommitdiffstats
path: root/src/mesa/program/programopt.c
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-11-05 22:35:41 +1100
committerTimothy Arceri <[email protected]>2016-11-17 12:52:24 +1100
commit0ad69e6b51b06c483db37c3b7eeb1da1a95d0629 (patch)
treef45eba45b62e2f5b933349463b368c040fec88a6 /src/mesa/program/programopt.c
parent9c9589f1e22568a16194e04bb5be6333ac202393 (diff)
mesa: make use of ralloc when creating ARB asm gl_program fields
This will allow us to move the ARB asm fields in gl_program into a union as we will be able call ralloc_free() on the entire struct when destroying the context. In this change we switch over to using ralloc for the Instructions, String and LocalParams fields of gl_program. Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/mesa/program/programopt.c')
-rw-r--r--src/mesa/program/programopt.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mesa/program/programopt.c b/src/mesa/program/programopt.c
index 1b50b5b7a0e..e7cb8aab4d3 100644
--- a/src/mesa/program/programopt.c
+++ b/src/mesa/program/programopt.c
@@ -70,7 +70,7 @@ _mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_program *vprog)
}
/* Alloc storage for new instructions */
- newInst = _mesa_alloc_instructions(newLen);
+ newInst = rzalloc_array(vprog, struct prog_instruction, newLen);
if (!newInst) {
_mesa_error(ctx, GL_OUT_OF_MEMORY,
"glProgramString(inserting position_invariant code)");
@@ -102,7 +102,7 @@ _mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_program *vprog)
_mesa_copy_instructions (newInst + 4, vprog->Instructions, origLen);
/* free old instructions */
- _mesa_free_instructions(vprog->Instructions, origLen);
+ ralloc_free(vprog->Instructions);
/* install new instructions */
vprog->Instructions = newInst;
@@ -138,7 +138,7 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_program *vprog)
}
/* Alloc storage for new instructions */
- newInst = _mesa_alloc_instructions(newLen);
+ newInst = rzalloc_array(vprog, struct prog_instruction, newLen);
if (!newInst) {
_mesa_error(ctx, GL_OUT_OF_MEMORY,
"glProgramString(inserting position_invariant code)");
@@ -203,7 +203,7 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_program *vprog)
_mesa_copy_instructions (newInst + 4, vprog->Instructions, origLen);
/* free old instructions */
- _mesa_free_instructions(vprog->Instructions, origLen);
+ ralloc_free(vprog->Instructions);
/* install new instructions */
vprog->Instructions = newInst;
@@ -270,7 +270,7 @@ _mesa_append_fog_code(struct gl_context *ctx, struct gl_program *fprog,
}
/* Alloc storage for new instructions */
- newInst = _mesa_alloc_instructions(newLen);
+ newInst = rzalloc_array(fprog, struct prog_instruction, newLen);
if (!newInst) {
_mesa_error(ctx, GL_OUT_OF_MEMORY,
"glProgramString(inserting fog_option code)");
@@ -403,7 +403,7 @@ _mesa_append_fog_code(struct gl_context *ctx, struct gl_program *fprog,
inst++;
/* free old instructions */
- _mesa_free_instructions(fprog->Instructions, origLen);
+ ralloc_free(fprog->Instructions);
/* install new instructions */
fprog->Instructions = newInst;