mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
lavapipe: always clone shader nir for shader states
these become owned and freed by llvmpipe, so ensure that freeing
them there won't cause crashes
cc: mesa-stable
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15281>
(cherry picked from commit 2f9976debc)
This commit is contained in:
parent
7c00af093b
commit
73ed1e1f23
2 changed files with 7 additions and 4 deletions
|
|
@ -1939,7 +1939,7 @@
|
|||
"description": "lavapipe: always clone shader nir for shader states",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null
|
||||
},
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ VKAPI_ATTR void VKAPI_CALL lvp_DestroyPipeline(
|
|||
if (pipeline->shader_cso[PIPE_SHADER_COMPUTE])
|
||||
device->queue.ctx->delete_compute_state(device->queue.ctx, pipeline->shader_cso[PIPE_SHADER_COMPUTE]);
|
||||
|
||||
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++)
|
||||
ralloc_free(pipeline->pipeline_nir[i]);
|
||||
|
||||
ralloc_free(pipeline->mem_ctx);
|
||||
vk_object_base_finish(&pipeline->base);
|
||||
vk_free2(&device->vk.alloc, pAllocator, pipeline);
|
||||
|
|
@ -658,7 +661,7 @@ lvp_shader_compile_to_ir(struct lvp_pipeline *pipeline,
|
|||
static void fill_shader_prog(struct pipe_shader_state *state, gl_shader_stage stage, struct lvp_pipeline *pipeline)
|
||||
{
|
||||
state->type = PIPE_SHADER_IR_NIR;
|
||||
state->ir.nir = pipeline->pipeline_nir[stage];
|
||||
state->ir.nir = nir_shader_clone(NULL, pipeline->pipeline_nir[stage]);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -730,7 +733,7 @@ lvp_pipeline_compile(struct lvp_pipeline *pipeline,
|
|||
device->physical_device->pscreen->finalize_nir(device->physical_device->pscreen, pipeline->pipeline_nir[stage]);
|
||||
if (stage == MESA_SHADER_COMPUTE) {
|
||||
struct pipe_compute_state shstate = {0};
|
||||
shstate.prog = (void *)pipeline->pipeline_nir[MESA_SHADER_COMPUTE];
|
||||
shstate.prog = (void *)nir_shader_clone(NULL, pipeline->pipeline_nir[MESA_SHADER_COMPUTE]);
|
||||
shstate.ir_type = PIPE_SHADER_IR_NIR;
|
||||
shstate.req_local_mem = pipeline->pipeline_nir[MESA_SHADER_COMPUTE]->info.shared_size;
|
||||
pipeline->shader_cso[PIPE_SHADER_COMPUTE] = device->queue.ctx->create_compute_state(device->queue.ctx, &shstate);
|
||||
|
|
@ -906,7 +909,7 @@ lvp_graphics_pipeline_init(struct lvp_pipeline *pipeline,
|
|||
pipeline->pipeline_nir[MESA_SHADER_FRAGMENT] = b.shader;
|
||||
struct pipe_shader_state shstate = {0};
|
||||
shstate.type = PIPE_SHADER_IR_NIR;
|
||||
shstate.ir.nir = pipeline->pipeline_nir[MESA_SHADER_FRAGMENT];
|
||||
shstate.ir.nir = nir_shader_clone(NULL, pipeline->pipeline_nir[MESA_SHADER_FRAGMENT]);
|
||||
pipeline->shader_cso[PIPE_SHADER_FRAGMENT] = device->queue.ctx->create_fs_state(device->queue.ctx, &shstate);
|
||||
}
|
||||
return VK_SUCCESS;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue