[Mesa-stable] [PATCH 1/4] radeonsi: fix primitive ID in fragment shader when using tessellation
Nicolai Hähnle
nhaehnle at gmail.com
Wed May 10 06:39:21 UTC 2017
Hi Andres,
I'm not sure whether the same bug is in 17.0, actually, but in any case
it's not high impact enough to try to backport patches 1&2 to 17.0.
Patch 3 is related but logically independent, so it can go to 17.0.
My apologies for the confusion!
Thanks,
Nicolai
On 10.05.2017 02:02, Andres Gomez wrote:
> Nicolai, patches 1, 2 and 3 are just tagged with:
>
> Cc: mesa-stable at lists.freedesktop.org
>
> However, patches 1 and 2 depend on 5f99c490089 and 9fd9a7d0ba3,
> respectively, that didn't make it for the 17.0 branch.
>
> Maybe you were just intending to nominate this series for the 17.1
> branch only?
>
> Notice that the patch 3 applies cleanly on top of 17.0 but I wonder
> whether it is OK to land it alone.
>
> Please, let me know what do you think.
>
>
> On Wed, 2017-05-03 at 15:58 +0200, Nicolai Hähnle wrote:
>> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>>
>> 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 at lists.freedesktop.org
>> ---
>> src/gallium/drivers/radeonsi/si_state_shaders.c | 27 ++++++++++++++++---------
>> 1 file 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 e479422..d756f30 100644
>> --- a/src/gallium/drivers/radeonsi/si_state_shaders.c
>> +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
>> @@ -2132,50 +2132,55 @@ 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)
>> +{
>> + 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;
>> struct si_shader_selector *sel = state;
>> bool enable_changed = !!sctx->gs_shader.cso != !!sel;
>>
>> if (sctx->gs_shader.cso == sel)
>> return;
>>
>> 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)
>> + 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;
>> 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;
>> @@ -2216,20 +2221,22 @@ static void si_bind_ps_shader(struct pipe_context *ctx, void *state)
>> struct si_context *sctx = (struct si_context *)ctx;
>> 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_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);
>> }
>>
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
More information about the mesa-stable
mailing list