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 <robdclark@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user