diff --git a/src/gallium/frontends/lavapipe/lvp_pipeline.c b/src/gallium/frontends/lavapipe/lvp_pipeline.c index e20688ec64c..0d8a55bf5be 100644 --- a/src/gallium/frontends/lavapipe/lvp_pipeline.c +++ b/src/gallium/frontends/lavapipe/lvp_pipeline.c @@ -58,6 +58,10 @@ shader_destroy(struct lvp_device *device, struct lvp_shader *shader, bool locked device->queue.ctx->delete_ts_state, device->queue.ctx->delete_ms_state, }; + + if (!locked) + simple_mtx_lock(&device->queue.lock); + set_foreach(&shader->inlines.variants, entry) { struct lvp_inline_variant *variant = (void*)entry->key; destroy[stage](device->queue.ctx, variant->cso); @@ -65,9 +69,6 @@ shader_destroy(struct lvp_device *device, struct lvp_shader *shader, bool locked } ralloc_free(shader->inlines.variants.table); - if (!locked) - simple_mtx_lock(&device->queue.lock); - if (shader->shader_cso) destroy[stage](device->queue.ctx, shader->shader_cso); if (shader->tess_ccw_cso)