From d45d3f0a815b75efefc6557e180e3c0382f3a818 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 17 May 2023 06:50:30 +1000 Subject: [PATCH] llvmpipe/cs: support passing a csctx instead of using implicit one This is just some refactoring to make adding mesh shaders easier Reviewed-by: Brian Paul Part-of: --- src/gallium/drivers/llvmpipe/lp_state_cs.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_state_cs.c b/src/gallium/drivers/llvmpipe/lp_state_cs.c index 4ab0bf09920..70452f69304 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_cs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_cs.c @@ -1319,10 +1319,9 @@ lp_csctx_set_cs_images(struct lp_cs_context *csctx, static void -update_csctx_consts(struct llvmpipe_context *llvmpipe) +update_csctx_consts(struct llvmpipe_context *llvmpipe, + struct lp_cs_context *csctx) { - struct lp_cs_context *csctx = llvmpipe->csctx; - for (int i = 0; i < ARRAY_SIZE(csctx->constants); ++i) { struct pipe_resource *buffer = csctx->constants[i].current.buffer; const ubyte *current_data = NULL; @@ -1351,10 +1350,9 @@ update_csctx_consts(struct llvmpipe_context *llvmpipe) static void -update_csctx_ssbo(struct llvmpipe_context *llvmpipe) +update_csctx_ssbo(struct llvmpipe_context *llvmpipe, + struct lp_cs_context *csctx) { - struct lp_cs_context *csctx = llvmpipe->csctx; - for (int i = 0; i < ARRAY_SIZE(csctx->ssbos); ++i) { struct pipe_resource *buffer = csctx->ssbos[i].current.buffer; const ubyte *current_data = NULL; @@ -1382,14 +1380,14 @@ llvmpipe_cs_update_derived(struct llvmpipe_context *llvmpipe, const void *input) lp_csctx_set_cs_constants(llvmpipe->csctx, ARRAY_SIZE(llvmpipe->constants[PIPE_SHADER_COMPUTE]), llvmpipe->constants[PIPE_SHADER_COMPUTE]); - update_csctx_consts(llvmpipe); + update_csctx_consts(llvmpipe, llvmpipe->csctx); } if (llvmpipe->cs_dirty & LP_CSNEW_SSBOS) { lp_csctx_set_cs_ssbos(llvmpipe->csctx, ARRAY_SIZE(llvmpipe->ssbos[PIPE_SHADER_COMPUTE]), llvmpipe->ssbos[PIPE_SHADER_COMPUTE]); - update_csctx_ssbo(llvmpipe); + update_csctx_ssbo(llvmpipe, llvmpipe->csctx); } if (llvmpipe->cs_dirty & LP_CSNEW_SAMPLER_VIEW)