From 140b3c50195fa69ff52a923c24c7d34d08e56088 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 27 May 2017 19:17:27 +0200 Subject: [PATCH] radeonsi: add a new helper si_get_vs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_pipe.h | 30 ++++++++++++++----------- src/gallium/drivers/radeonsi/si_state_shaders.c | 6 ++--- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 9eb0297..791145e 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 7ed6722..078b5e6 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; -- 2.7.4