From: Marek Olšák Date: Sat, 27 May 2017 17:17:27 +0000 (+0200) Subject: radeonsi: add a new helper si_get_vs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=140b3c50195fa69ff52a923c24c7d34d08e56088;p=mesa.git radeonsi: add a new helper si_get_vs Reviewed-by: Nicolai Hähnle --- diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 9eb0297459f..791145e9c50 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -491,26 +491,30 @@ si_mark_atom_dirty(struct si_context *sctx, si_set_atom_dirty(sctx, atom, true); } -static inline struct tgsi_shader_info *si_get_vs_info(struct si_context *sctx) +static inline struct si_shader_ctx_state *si_get_vs(struct si_context *sctx) { if (sctx->gs_shader.cso) - return &sctx->gs_shader.cso->info; - else if (sctx->tes_shader.cso) - return &sctx->tes_shader.cso->info; - else if (sctx->vs_shader.cso) - return &sctx->vs_shader.cso->info; - else - return NULL; + return &sctx->gs_shader; + if (sctx->tes_shader.cso) + return &sctx->tes_shader; + + return &sctx->vs_shader; +} + +static inline struct tgsi_shader_info *si_get_vs_info(struct si_context *sctx) +{ + struct si_shader_ctx_state *vs = si_get_vs(sctx); + + return vs->cso ? &vs->cso->info : NULL; } static inline struct si_shader* si_get_vs_state(struct si_context *sctx) { - if (sctx->gs_shader.current) + if (sctx->gs_shader.cso) return sctx->gs_shader.cso->gs_copy_shader; - else if (sctx->tes_shader.current) - return sctx->tes_shader.current; - else - return sctx->vs_shader.current; + + struct si_shader_ctx_state *vs = si_get_vs(sctx); + return vs->current ? vs->current : NULL; } static inline unsigned diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 7ed6722c26e..078b5e6250d 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -2154,10 +2154,8 @@ static void *si_create_shader_selector(struct pipe_context *ctx, static void si_update_streamout_state(struct si_context *sctx) { - struct si_shader_selector *shader_with_so = - sctx->gs_shader.cso ? sctx->gs_shader.cso : - sctx->tes_shader.cso ? sctx->tes_shader.cso : - sctx->vs_shader.cso; + struct si_shader_selector *shader_with_so = si_get_vs(sctx)->cso; + if (!shader_with_so) return;