[PATCH v2 1/2] etnaviv: fix varying interpolation
Lucas Stach
l.stach at pengutronix.de
Tue Sep 19 09:51:15 UTC 2017
Am Dienstag, den 19.09.2017, 10:30 +0200 schrieb Philipp Zabel:
> On Fri, 2017-09-15 at 18:04 +0200, Lucas Stach wrote:
> > It seems that newer cores don't use the PA_ATTRIBUTES to decide if the
> > varying should bypass the flat shading, but derive this from the
> > component
> > use. This fixes flat shading on GC880+.
> >
> > VARYING_COMPONENT_USE_POINTCOORD is a bit of a misnomer now, as it
> > isn't
> > only used for pointcoords, but missing a better name I left it as-is.
> >
> > Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
> > ---
> > v2: fix invalid vreg assignment
> ---
> > src/gallium/drivers/etnaviv/etnaviv_compiler.c | 23 ++++++++++-------------
> > 1 file changed, 10 insertions(+), 13 deletions(-)
> >
> > diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
> > index 165ab74298a4..d86d0561503a 100644
> > --- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c
> > +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
> > @@ -2607,6 +2607,7 @@ etna_link_shader(struct etna_shader_link_info *info,
> > const struct etna_shader_inout *fsio = &fs->infile.reg[idx];
> > const struct etna_shader_inout *vsio = etna_shader_vs_lookup(vs, fsio);
> > struct etna_varying *varying;
> > + bool interpolate = fsio->semantic.Name != TGSI_SEMANTIC_COLOR;
> >
> > assert(fsio->reg > 0 && fsio->reg <= ARRAY_SIZE(info->varyings));
> >
> > @@ -2616,28 +2617,24 @@ etna_link_shader(struct etna_shader_link_info *info,
> > varying = &info->varyings[fsio->reg - 1];
> > varying->num_components = fsio->num_components;
> >
> > - if (fsio->semantic.Name == TGSI_SEMANTIC_COLOR) /* colors affected by flat shading */
> > + if (interpolate) /* colors affected by flat shading */
>
> This was (!interpolate) before, and looks like it should still be?
> With that addressed,
Uh, I'm sure I already fixed this at some point. Thanks for the catch!
> Reviewed-by: Philipp Zabel <p.zabel at pengutronix.de>
>
> > varying->pa_attributes = 0x200;
> > else /* texture coord or other bypasses flat shading */
> > varying->pa_attributes = 0x2f1;
> >
> > - if (fsio->semantic.Name == TGSI_SEMANTIC_PCOORD) {
> > - varying->use[0] = VARYING_COMPONENT_USE_POINTCOORD_X;
> > - varying->use[1] = VARYING_COMPONENT_USE_POINTCOORD_Y;
> > - varying->use[2] = VARYING_COMPONENT_USE_USED;
> > - varying->use[3] = VARYING_COMPONENT_USE_USED;
> > - varying->reg = 0; /* replaced by point coord -- doesn't matter */
> > + varying->use[0] = interpolate ? VARYING_COMPONENT_USE_POINTCOORD_X : VARYING_COMPONENT_USE_USED;
> > + varying->use[1] = interpolate ? VARYING_COMPONENT_USE_POINTCOORD_Y : VARYING_COMPONENT_USE_USED;
> > + varying->use[2] = VARYING_COMPONENT_USE_USED;
> > + varying->use[3] = VARYING_COMPONENT_USE_USED;
> > +
> > +
> > + if (fsio->semantic.Name == TGSI_SEMANTIC_PCOORD)
> > continue;
>
> Since for point coord we just continue here without setting varying->reg
> at all ...
>
> > - }
> >
> > if (vsio == NULL)
> > return true; /* not found -- link error */
> >
> > - varying->use[0] = VARYING_COMPONENT_USE_USED;
> > - varying->use[1] = VARYING_COMPONENT_USE_USED;
> > - varying->use[2] = VARYING_COMPONENT_USE_USED;
> > - varying->use[3] = VARYING_COMPONENT_USE_USED;
> > - varying->reg = vsio->reg;
> > + varying->reg = vsio->reg; /* replaced by point coord -- doesn't matter */
>
> ... is the comment still relevant here? Maybe this should be moved up
> there.
>
> > }
> >
> > assert(info->num_varyings == fs->infile.num_reg);
>
> regards
> Philipp
More information about the etnaviv
mailing list