diff options
author | Timothy Arceri <[email protected]> | 2016-11-05 22:35:41 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2016-11-17 12:52:24 +1100 |
commit | 0ad69e6b51b06c483db37c3b7eeb1da1a95d0629 (patch) | |
tree | f45eba45b62e2f5b933349463b368c040fec88a6 /src/mesa/main/ffvertex_prog.c | |
parent | 9c9589f1e22568a16194e04bb5be6333ac202393 (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/main/ffvertex_prog.c')
-rw-r--r-- | src/mesa/main/ffvertex_prog.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 8cec1cbaa60..5bc64f18c74 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -586,7 +586,8 @@ static void emit_op3fn(struct tnl_program *p, /* double the size */ p->max_inst *= 2; - newInst = _mesa_alloc_instructions(p->max_inst); + newInst = + rzalloc_array(p->program, struct prog_instruction, p->max_inst); if (!newInst) { _mesa_error(NULL, GL_OUT_OF_MEMORY, "vertex program build"); return; @@ -595,8 +596,7 @@ static void emit_op3fn(struct tnl_program *p, _mesa_copy_instructions(newInst, p->program->Instructions, p->program->NumInstructions); - _mesa_free_instructions(p->program->Instructions, - p->program->NumInstructions); + ralloc_free(p->program->Instructions); p->program->Instructions = newInst; } @@ -1632,7 +1632,8 @@ create_new_program( const struct state_key *key, * If we need more, we'll grow the instruction array as needed. */ p.max_inst = 32; - p.program->Instructions = _mesa_alloc_instructions(p.max_inst); + p.program->Instructions = rzalloc_array(program, struct prog_instruction, + p.max_inst); p.program->String = NULL; p.program->NumInstructions = p.program->NumTemporaries = |