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/program/program_parse.y | |
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/program/program_parse.y')
-rw-r--r-- | src/mesa/program/program_parse.y | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y index 41aeb241ffe..e861340a023 100644 --- a/src/mesa/program/program_parse.y +++ b/src/mesa/program/program_parse.y @@ -2511,7 +2511,7 @@ _mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *st /* Make a copy of the program string and force it to be NUL-terminated. */ - strz = (GLubyte *) malloc(len + 1); + strz = (GLubyte *) ralloc_size(state->mem_ctx, len + 1); if (strz == NULL) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB"); return GL_FALSE; @@ -2565,7 +2565,8 @@ _mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *st /* Add one instruction to store the "END" instruction. */ state->prog->Instructions = - _mesa_alloc_instructions(state->prog->NumInstructions + 1); + rzalloc_array(state->mem_ctx, struct prog_instruction, + state->prog->NumInstructions + 1); if (state->prog->Instructions == NULL) { goto error; |