[Mesa-dev] [PATCH 3/4] radeonsi: rename tcs_tes_uses_prim_id for clarity

Nicolai Hähnle nhaehnle at gmail.com
Mon May 15 09:18:37 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

What we care about is whether PrimID is used while tessellation is
enabled; whether it's used in TCS/TES or further down the pipeline is
irrelevant.
---
 src/gallium/drivers/radeonsi/si_pipe.h          |  2 +-
 src/gallium/drivers/radeonsi/si_state_draw.c    |  4 ++--
 src/gallium/drivers/radeonsi/si_state_shaders.c | 12 ++++++------
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 71a3e98..431d8a3 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -210,21 +210,21 @@ struct si_shader_ctx_state {
  */
 union si_vgt_param_key {
 	struct {
 		unsigned prim:4;
 		unsigned uses_instancing:1;
 		unsigned multi_instances_smaller_than_primgroup:1;
 		unsigned primitive_restart:1;
 		unsigned count_from_stream_output:1;
 		unsigned line_stipple_enabled:1;
 		unsigned uses_tess:1;
-		unsigned tcs_tes_uses_prim_id:1;
+		unsigned tess_uses_prim_id:1;
 		unsigned uses_gs:1;
 		unsigned _pad:32 - SI_NUM_VGT_PARAM_KEY_BITS;
 	} u;
 	uint32_t index;
 };
 
 struct si_context {
 	struct r600_common_context	b;
 	struct blitter_context		*blitter;
 	void				*custom_dsa_flush;
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index 1de523c..8651592 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -321,21 +321,21 @@ si_get_init_multi_vgt_param(struct si_screen *sscreen,
 
 	/* SWITCH_ON_EOP(0) is always preferable. */
 	bool wd_switch_on_eop = false;
 	bool ia_switch_on_eop = false;
 	bool ia_switch_on_eoi = false;
 	bool partial_vs_wave = false;
 	bool partial_es_wave = false;
 
 	if (key->u.uses_tess) {
 		/* SWITCH_ON_EOI must be set if PrimID is used. */
-		if (key->u.tcs_tes_uses_prim_id)
+		if (key->u.tess_uses_prim_id)
 			ia_switch_on_eoi = true;
 
 		/* Bug with tessellation and GS on Bonaire and older 2 SE chips. */
 		if ((sscreen->b.family == CHIP_TAHITI ||
 		     sscreen->b.family == CHIP_PITCAIRN ||
 		     sscreen->b.family == CHIP_BONAIRE) &&
 		    key->u.uses_gs)
 			partial_vs_wave = true;
 
 		/* Needed for 028B6C_DISTRIBUTION_MODE != 0 */
@@ -452,21 +452,21 @@ void si_init_ia_multi_vgt_param_table(struct si_context *sctx)
 		union si_vgt_param_key key;
 
 		key.index = 0;
 		key.u.prim = prim;
 		key.u.uses_instancing = uses_instancing;
 		key.u.multi_instances_smaller_than_primgroup = multi_instances;
 		key.u.primitive_restart = primitive_restart;
 		key.u.count_from_stream_output = count_from_so;
 		key.u.line_stipple_enabled = line_stipple;
 		key.u.uses_tess = uses_tess;
-		key.u.tcs_tes_uses_prim_id = tess_uses_primid;
+		key.u.tess_uses_prim_id = tess_uses_primid;
 		key.u.uses_gs = uses_gs;
 
 		sctx->ia_multi_vgt_param[key.index] =
 			si_get_init_multi_vgt_param(sctx->screen, &key);
 	}
 }
 
 static unsigned si_get_ia_multi_vgt_param(struct si_context *sctx,
 					  const struct pipe_draw_info *info,
 					  unsigned num_patches)
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index f761073..313af85 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -2119,23 +2119,23 @@ static void si_bind_vs_shader(struct pipe_context *ctx, void *state)
 	if (sctx->vs_shader.cso == sel)
 		return;
 
 	sctx->vs_shader.cso = sel;
 	sctx->vs_shader.current = sel ? sel->first_variant : NULL;
 	sctx->do_update_shaders = true;
 	si_mark_atom_dirty(sctx, &sctx->clip_regs);
 	r600_update_vs_writes_viewport_index(&sctx->b, si_get_vs_info(sctx));
 }
 
-static void si_update_tcs_tes_uses_prim_id(struct si_context *sctx)
+static void si_update_tess_uses_prim_id(struct si_context *sctx)
 {
-	sctx->ia_multi_vgt_param_key.u.tcs_tes_uses_prim_id =
+	sctx->ia_multi_vgt_param_key.u.tess_uses_prim_id =
 		(sctx->tes_shader.cso &&
 		 sctx->tes_shader.cso->info.uses_primid) ||
 		(sctx->tcs_shader.cso &&
 		 sctx->tcs_shader.cso->info.uses_primid) ||
 		(sctx->gs_shader.cso &&
 		 sctx->gs_shader.cso->info.uses_primid) ||
 		(sctx->ps_shader.cso && !sctx->gs_shader.cso &&
 		 sctx->ps_shader.cso->info.uses_primid);
 }
 
@@ -2151,56 +2151,56 @@ static void si_bind_gs_shader(struct pipe_context *ctx, void *state)
 	sctx->gs_shader.cso = sel;
 	sctx->gs_shader.current = sel ? sel->first_variant : NULL;
 	sctx->ia_multi_vgt_param_key.u.uses_gs = sel != NULL;
 	sctx->do_update_shaders = true;
 	si_mark_atom_dirty(sctx, &sctx->clip_regs);
 	sctx->last_rast_prim = -1; /* reset this so that it gets updated */
 
 	if (enable_changed) {
 		si_shader_change_notify(sctx);
 		if (sctx->ia_multi_vgt_param_key.u.uses_tess)
-			si_update_tcs_tes_uses_prim_id(sctx);
+			si_update_tess_uses_prim_id(sctx);
 	}
 	r600_update_vs_writes_viewport_index(&sctx->b, si_get_vs_info(sctx));
 }
 
 static void si_bind_tcs_shader(struct pipe_context *ctx, void *state)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
 	struct si_shader_selector *sel = state;
 	bool enable_changed = !!sctx->tcs_shader.cso != !!sel;
 
 	if (sctx->tcs_shader.cso == sel)
 		return;
 
 	sctx->tcs_shader.cso = sel;
 	sctx->tcs_shader.current = sel ? sel->first_variant : NULL;
-	si_update_tcs_tes_uses_prim_id(sctx);
+	si_update_tess_uses_prim_id(sctx);
 	sctx->do_update_shaders = true;
 
 	if (enable_changed)
 		sctx->last_tcs = NULL; /* invalidate derived tess state */
 }
 
 static void si_bind_tes_shader(struct pipe_context *ctx, void *state)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
 	struct si_shader_selector *sel = state;
 	bool enable_changed = !!sctx->tes_shader.cso != !!sel;
 
 	if (sctx->tes_shader.cso == sel)
 		return;
 
 	sctx->tes_shader.cso = sel;
 	sctx->tes_shader.current = sel ? sel->first_variant : NULL;
 	sctx->ia_multi_vgt_param_key.u.uses_tess = sel != NULL;
-	si_update_tcs_tes_uses_prim_id(sctx);
+	si_update_tess_uses_prim_id(sctx);
 	sctx->do_update_shaders = true;
 	si_mark_atom_dirty(sctx, &sctx->clip_regs);
 	sctx->last_rast_prim = -1; /* reset this so that it gets updated */
 
 	if (enable_changed) {
 		si_shader_change_notify(sctx);
 		sctx->last_tes_sh_base = -1; /* invalidate derived tess state */
 	}
 	r600_update_vs_writes_viewport_index(&sctx->b, si_get_vs_info(sctx));
 }
@@ -2211,21 +2211,21 @@ static void si_bind_ps_shader(struct pipe_context *ctx, void *state)
 	struct si_shader_selector *sel = state;
 
 	/* skip if supplied shader is one already in use */
 	if (sctx->ps_shader.cso == sel)
 		return;
 
 	sctx->ps_shader.cso = sel;
 	sctx->ps_shader.current = sel ? sel->first_variant : NULL;
 	sctx->do_update_shaders = true;
 	if (sel && sctx->ia_multi_vgt_param_key.u.uses_tess)
-		si_update_tcs_tes_uses_prim_id(sctx);
+		si_update_tess_uses_prim_id(sctx);
 	si_mark_atom_dirty(sctx, &sctx->cb_render_state);
 }
 
 static void si_delete_shader(struct si_context *sctx, struct si_shader *shader)
 {
 	if (shader->is_optimized) {
 		util_queue_fence_wait(&shader->optimized_ready);
 		util_queue_fence_destroy(&shader->optimized_ready);
 	}
 
-- 
2.9.3



More information about the mesa-dev mailing list