[Mesa-dev] [PATCH 08/70] mesa: make use of ralloc when creating ARB program instructions
Emil Velikov
emil.l.velikov at gmail.com
Wed Nov 16 20:19:12 UTC 2016
On 11 November 2016 at 00:45, Timothy Arceri
<timothy.arceri at collabora.com> wrote:
> 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.
> ---
> src/mesa/main/ffvertex_prog.c | 7 +++----
> src/mesa/program/arbprogparse.c | 9 ++++++---
> src/mesa/program/ir_to_mesa.cpp | 2 +-
> src/mesa/program/prog_instruction.c | 15 ++-------------
> src/mesa/program/prog_instruction.h | 7 +++----
> src/mesa/program/prog_optimize.c | 28 +++++++++++++++-------------
> src/mesa/program/prog_optimize.h | 3 ++-
> src/mesa/program/program.c | 17 ++++++-----------
> src/mesa/program/program.h | 3 ++-
> src/mesa/program/program_parse.y | 5 +++--
> src/mesa/program/program_parser.h | 3 +++
> src/mesa/program/programopt.c | 12 ++++++------
> 12 files changed, 52 insertions(+), 59 deletions(-)
>
> diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
> index 8cec1cb..d4a22c1 100644
> --- a/src/mesa/main/ffvertex_prog.c
> +++ b/src/mesa/main/ffvertex_prog.c
> @@ -586,7 +586,7 @@ static void emit_op3fn(struct tnl_program *p,
> /* double the size */
> p->max_inst *= 2;
>
> - newInst = _mesa_alloc_instructions(p->max_inst);
> + newInst = _mesa_alloc_instructions(p->program, p->max_inst);
> if (!newInst) {
> _mesa_error(NULL, GL_OUT_OF_MEMORY, "vertex program build");
> return;
> @@ -595,8 +595,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);
>
Having a mismatched ralloc_free for _mesa_alloc_instructions is very
confusing/misleading.
Please opt for one or the other - direct ralloc usage or _mesa* wrappers.
Fwiw I'm leaning for the former.
>
> - free(prog->String);
> - free(prog->LocalParams);
> -
These two are not mentioned in the commit. Afaict the patch has all
the required String changes so feel free to leave it as-is but please
mention in the summary.
LocalParams on the other hand looks should be in the next patch ?
That's a lot of plumbing that this series touches. I hope you've
double-checked for explosions via the CI.
Emil
More information about the mesa-dev
mailing list