summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-05-27 19:17:27 +0200
committerMarek Olšák <[email protected]>2017-06-07 20:17:16 +0200
commit140b3c50195fa69ff52a923c24c7d34d08e56088 (patch)
tree1ec6ddbb26f2db836d60f97792ae338f293fb4fc /src/gallium/drivers
parent878bd981bf7aac1466ba3278796f200fa329e2af (diff)
radeonsi: add a new helper si_get_vs
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.h30
-rw-r--r--src/gallium/drivers/radeonsi/si_state_shaders.c6
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 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;