diff --git a/src/gallium/drivers/radeonsi/si_gfx_cs.c b/src/gallium/drivers/radeonsi/si_gfx_cs.c index 8ad95cba8af..fe175769f80 100644 --- a/src/gallium/drivers/radeonsi/si_gfx_cs.c +++ b/src/gallium/drivers/radeonsi/si_gfx_cs.c @@ -426,7 +426,8 @@ void si_begin_new_gfx_cs(struct si_context *ctx) si_pm4_reset_emitted(ctx); /* The CS initialization should be emitted before everything else. */ - si_pm4_emit(ctx, ctx->cs_preamble_state); + if (ctx->cs_preamble_state) + si_pm4_emit(ctx, ctx->cs_preamble_state); if (ctx->cs_preamble_gs_rings) si_pm4_emit(ctx, ctx->cs_preamble_gs_rings); diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 9501cb7c123..e366b6b5458 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -195,7 +195,8 @@ static void si_destroy_context(struct pipe_context *context) si_resource_reference(&sctx->wait_mem_scratch, NULL); si_resource_reference(&sctx->small_prim_cull_info_buf, NULL); - si_pm4_free_state(sctx, sctx->cs_preamble_state, ~0); + if (sctx->cs_preamble_state) + si_pm4_free_state(sctx, sctx->cs_preamble_state, ~0); if (sctx->cs_preamble_gs_rings) si_pm4_free_state(sctx, sctx->cs_preamble_gs_rings, ~0); for (i = 0; i < ARRAY_SIZE(sctx->vgt_shader_config); i++)