diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2017-06-14 12:45:06 +0200 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2017-07-13 13:27:37 +0200 |
commit | 85386907ce5155315b85a31f37ebef8a5de23553 (patch) | |
tree | 50d4b0ab787081186fa2c274551d3be8dc6c62db | |
parent | cb394a4991fbfefe52e46da3a370b004c86134c2 (diff) |
radeonsi: strengthen the conditions for the SI tessellation primid fallback
TODO wait for confirmation
TODO less stupid loop?
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101278
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_draw.c | 19 |
2 files changed, 15 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index bd724e80a0..e2713226f7 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -398,7 +398,7 @@ struct si_context { struct si_shader_selector *last_tcs; int last_num_tcs_input_cp; int last_tes_sh_base; - bool last_tess_uses_primid; + unsigned last_tess_primid_workaround_patches; unsigned last_num_patches; /* Debug state. */ diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c index 332e0c43de..507c2b9dae 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.c +++ b/src/gallium/drivers/radeonsi/si_state_draw.c @@ -105,6 +105,7 @@ static void si_emit_derived_tess_state(struct si_context *sctx, unsigned tess_uses_primid = sctx->ia_multi_vgt_param_key.u.tess_uses_prim_id; bool has_primid_instancing_bug = sctx->b.chip_class == SI && sctx->b.screen->info.max_se == 1; + unsigned tess_primid_workaround_patches = 0; unsigned tes_sh_base = sctx->shader_userdata.sh_base[PIPE_SHADER_TESS_EVAL]; unsigned num_tcs_input_cp = info->vertices_per_patch; unsigned num_tcs_output_cp, num_tcs_inputs, num_tcs_outputs; @@ -128,12 +129,18 @@ static void si_emit_derived_tess_state(struct si_context *sctx, ls = sctx->vs_shader.cso; } + if (has_primid_instancing_bug && tess_uses_primid) { + if (info->indirect) + tess_primid_workaround_patches = 1; + else if (info->instance_count > 1) + tess_primid_workaround_patches = info->count / num_tcs_input_cp; + } + if (sctx->last_ls == ls_current && sctx->last_tcs == tcs && sctx->last_tes_sh_base == tes_sh_base && sctx->last_num_tcs_input_cp == num_tcs_input_cp && - (!has_primid_instancing_bug || - (sctx->last_tess_uses_primid == tess_uses_primid))) { + sctx->last_tess_primid_workaround_patches == tess_primid_workaround_patches) { *num_patches = sctx->last_num_patches; return; } @@ -142,7 +149,7 @@ static void si_emit_derived_tess_state(struct si_context *sctx, sctx->last_tcs = tcs; sctx->last_tes_sh_base = tes_sh_base; sctx->last_num_tcs_input_cp = num_tcs_input_cp; - sctx->last_tess_uses_primid = tess_uses_primid; + sctx->last_tess_primid_workaround_patches = tess_uses_primid; /* This calculates how shader inputs and outputs among VS, TCS, and TES * are laid out in LDS. */ @@ -212,8 +219,10 @@ static void si_emit_derived_tess_state(struct si_context *sctx, * doesn't work correctly on SI when there is no other * SE to switch to. */ - if (has_primid_instancing_bug) - *num_patches = 1; + if (tess_primid_workaround_patches) { + while (tess_primid_workaround_patches % *num_patches != 0) + (*num_patches)--; + } sctx->last_num_patches = *num_patches; |