summaryrefslogtreecommitdiffstats
path: root/src/mesa/program/arbprogparse.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/arbprogparse.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/arbprogparse.c')
-rw-r--r--src/mesa/program/arbprogparse.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mesa/program/arbprogparse.c b/src/mesa/program/arbprogparse.c
index e545d710e52..a7e21d91672 100644
--- a/src/mesa/program/arbprogparse.c
+++ b/src/mesa/program/arbprogparse.c
@@ -170,17 +170,20 @@ _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
memset(&prog, 0, sizeof(prog));
memset(&state, 0, sizeof(state));
state.prog = &prog;
+ state.mem_ctx = program;
if (!_mesa_parse_arb_program(ctx, target, (const GLubyte*) str, len,
&state)) {
+ ralloc_free(prog.Instructions);
+ ralloc_free(prog.String);
_mesa_error(ctx, GL_INVALID_OPERATION, "glProgramString(bad program)");
return;
}
if ((ctx->_Shader->Flags & GLSL_NO_OPT) == 0)
- _mesa_optimize_program(ctx, &prog);
+ _mesa_optimize_program(ctx, &prog, program);
- free(program->String);
+ ralloc_free(program->String);
/* Copy the relevant contents of the arb_program struct into the
* vertex_program struct.
@@ -202,7 +205,7 @@ _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
program->IsPositionInvariant = (state.option.PositionInvariant)
? GL_TRUE : GL_FALSE;
- free(program->Instructions);
+ ralloc_free(program->Instructions);
program->Instructions = prog.Instructions;
if (program->Parameters)