summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_program.c
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2017-10-30 09:56:43 -0400
committerRob Clark <[email protected]>2017-11-12 12:28:59 -0500
commitecbe1e976f279a3519aaf9ab365ebe28b60f1ace (patch)
treed777d9a745f64d1116f0f982d39c91abe7793c54 /src/mesa/state_tracker/st_program.c
parent5009dc55f206567df1f1527cac06bcbf7cb95814 (diff)
st/program: fix compute shader nir references
In case the IR is NIR, the driver takes reference to the nir_shader. Also, because there are no variants, we need to clone the shader, instead of sharing the reference with gl_program, which would result in a double free in _mesa_delete_program(). Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_program.c')
-rw-r--r--src/mesa/state_tracker/st_program.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index e3649a8b7cc..70b63a37471 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -360,8 +360,20 @@ st_release_cp_variants(struct st_context *st, struct st_compute_program *stcp)
*variants = NULL;
if (stcp->tgsi.prog) {
- ureg_free_tokens(stcp->tgsi.prog);
- stcp->tgsi.prog = NULL;
+ switch (stcp->tgsi.ir_type) {
+ case PIPE_SHADER_IR_TGSI:
+ ureg_free_tokens(stcp->tgsi.prog);
+ stcp->tgsi.prog = NULL;
+ break;
+ case PIPE_SHADER_IR_NIR:
+ /* pipe driver took ownership of prog */
+ break;
+ case PIPE_SHADER_IR_LLVM:
+ case PIPE_SHADER_IR_NATIVE:
+ /* ??? */
+ stcp->tgsi.prog = NULL;
+ break;
+ }
}
}