summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-11-17 12:26:08 +1100
committerTimothy Arceri <[email protected]>2016-11-19 07:42:33 +1100
commit2b8f97d0ff0836b1d1c8753a81a8810df385b21d (patch)
tree1b26f511a4477c78ee2fab6a57116f7dc24af60a /src/mesa/drivers/dri/i965
parent9db5cc829f6bd7ba09f3bf0bf057b7162d05d037 (diff)
st/mesa/i965: simplify gl_program references and stop leaking
In i965 we were calling _mesa_reference_program() after creating gl_program and then later calling it again with NULL as a param to get the refcount back down to 1. This changes things to not use _mesa_reference_program() at all and just have gl_linked_shader take ownership of gl_program since refcount starts at 1. The st and ir_to_mesa linkers were worse as they were both getting in a state were the refcount would never get to 0 and we would leak the program. Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r--src/mesa/drivers/dri/i965/brw_link.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index fbb834be1a0..a0c9e20807c 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -227,7 +227,8 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
if (!prog)
return false;
- _mesa_reference_program(ctx, &shader->Program, prog);
+ /* Don't use _mesa_reference_program() just take ownership */
+ shader->Program = prog;
prog->Parameters = _mesa_new_parameter_list();
@@ -276,8 +277,6 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
prog->nir = brw_create_nir(brw, shProg, prog, (gl_shader_stage) stage,
compiler->scalar_stage[stage]);
-
- _mesa_reference_program(ctx, &prog, NULL);
}
if ((ctx->_Shader->Flags & GLSL_DUMP) && shProg->Name != 0) {