Module: Mesa
Branch: master
Commit: 140b3c50195fa69ff52a923c24c7d34d08e56088
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=140b3c50195fa69ff52a923c24c7d34d08e56088

Author: Marek Olšák <[email protected]>
Date:   Sat May 27 19:17:27 2017 +0200

radeonsi: add a new helper si_get_vs

Reviewed-by: Nicolai Hähnle <[email protected]>

---

 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 9eb0297459..791145e9c5 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 7ed6722c26..078b5e6250 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;
 

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to