diff options
author | Lucas Stach <[email protected]> | 2017-06-08 17:01:40 +0200 |
---|---|---|
committer | Lucas Stach <[email protected]> | 2017-10-10 12:29:35 +0200 |
commit | cedab87e762aa38997a07bc8a2eb624aed584afd (patch) | |
tree | 5e3b42e3a100d027acdf5f689d0d331acfe7e27b | |
parent | 03b1f8ba205d3eff59784faf805272a4d7aa4b18 (diff) |
etnaviv: fix varying interpolation
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 <[email protected]>
Reviewed-by: Wladimir J. van der Laan <[email protected]>
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_compiler.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c b/src/gallium/drivers/etnaviv/etnaviv_compiler.c index 2bca2dda70c..e2b906c2f6a 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c @@ -2557,6 +2557,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_always = fsio->semantic.Name != TGSI_SEMANTIC_COLOR; assert(fsio->reg > 0 && fsio->reg <= ARRAY_SIZE(info->varyings)); @@ -2566,27 +2567,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_always) /* colors affected by flat shading */ 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_always ? VARYING_COMPONENT_USE_POINTCOORD_X : VARYING_COMPONENT_USE_USED; + varying->use[1] = interpolate_always ? VARYING_COMPONENT_USE_POINTCOORD_Y : VARYING_COMPONENT_USE_USED; + varying->use[2] = VARYING_COMPONENT_USE_USED; + varying->use[3] = VARYING_COMPONENT_USE_USED; + + + /* point coord is position output from VS, so has no dedicated reg */ + if (fsio->semantic.Name == TGSI_SEMANTIC_PCOORD) continue; - } 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; } |