mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-11-27 12:14:10 +08:00
mesa/st: fix reference to nir->info after nir_to_tgsi
The nir shader memory is freed in nir_to_tgsi(), but the already
freed shader info is referenced later when create compute state.
To avoid referencing the freed memory, copy the shader info first before
calling nir_to_tgsi.
Fixes vmx crash running aztec on SVGA driver.
Fixes: 580f1ac473
("nir: Extract shader_info->cs.shared_size out of union")
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17999>
This commit is contained in:
parent
7426675363
commit
4393be8291
@ -502,6 +502,7 @@ st_create_nir_shader(struct st_context *st, struct pipe_shader_state *state)
|
||||
|
||||
assert(state->type == PIPE_SHADER_IR_NIR);
|
||||
nir_shader *nir = state->ir.nir;
|
||||
struct shader_info info = nir->info;
|
||||
gl_shader_stage stage = nir->info.stage;
|
||||
enum pipe_shader_type sh = pipe_shader_type_from_mesa(stage);
|
||||
|
||||
@ -548,7 +549,7 @@ st_create_nir_shader(struct st_context *st, struct pipe_shader_state *state)
|
||||
case MESA_SHADER_COMPUTE: {
|
||||
struct pipe_compute_state cs = {0};
|
||||
cs.ir_type = state->type;
|
||||
cs.req_local_mem = nir->info.shared_size;
|
||||
cs.req_local_mem = info.shared_size;
|
||||
|
||||
if (state->type == PIPE_SHADER_IR_NIR)
|
||||
cs.prog = state->ir.nir;
|
||||
|
Loading…
Reference in New Issue
Block a user