summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/radeonsi
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2017-05-03 11:40:07 +0200
committerEmil Velikov <emil.l.velikov@gmail.com>2017-05-18 17:41:09 +0100
commit35ec26bb00536639b9571f31d8e3f2bcbcfc32fb (patch)
tree6933f611d735b1471b827446931ce32ca61e4119 /src/gallium/drivers/radeonsi
parent424bf46f27d791b2d159a3c7ff862e504d8d689c (diff)
radeonsi: fix primitive ID in fragment shader when using tessellation
In a VS->TCS->TES->PS pipeline, the primitive ID is read from TES exports, so it is as if TES were using the primitive ID. Specifically, this fixes a bug where the primitive ID is not reset at the start of a new instance. Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Marek Olšák <marek.olsak@amd.com> (cherry picked from commit 0549ea15ec380f3ca6df76ce53ff4c30bfc21dbf)
Diffstat (limited to 'src/gallium/drivers/radeonsi')
-rw-r--r--src/gallium/drivers/radeonsi/si_state_shaders.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 1f0080ffb8b..0c82deebfc9 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -1813,6 +1813,17 @@ static void si_bind_vs_shader(struct pipe_context *ctx, void *state)
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)
+{
+ sctx->ia_multi_vgt_param_key.u.tcs_tes_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->ps_shader.cso && !sctx->gs_shader.cso &&
+ sctx->ps_shader.cso->info.uses_primid);
+}
+
static void si_bind_gs_shader(struct pipe_context *ctx, void *state)
{
struct si_context *sctx = (struct si_context *)ctx;
@@ -1829,20 +1840,14 @@ static void si_bind_gs_shader(struct pipe_context *ctx, void *state)
si_mark_atom_dirty(sctx, &sctx->clip_regs);
sctx->last_rast_prim = -1; /* reset this so that it gets updated */
- if (enable_changed)
+ 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);
+ }
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)
-{
- sctx->ia_multi_vgt_param_key.u.tcs_tes_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);
-}
-
static void si_bind_tcs_shader(struct pipe_context *ctx, void *state)
{
struct si_context *sctx = (struct si_context *)ctx;
@@ -1897,6 +1902,8 @@ static void si_bind_ps_shader(struct pipe_context *ctx, void *state)
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_mark_atom_dirty(sctx, &sctx->cb_render_state);
}