mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 15:20:10 +01:00
etnaviv: fix flatshading
color varyings must be properly annoted, so they don't get interpolated when the rasterizer is configured for flatshading. For whatever reason the etnaviv NIR compiler failed to do so from its inception. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32922>
This commit is contained in:
parent
2483d28d0b
commit
ca5a9a3861
1 changed files with 9 additions and 4 deletions
|
|
@ -1382,7 +1382,8 @@ 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 = true;
|
||||
bool varying_is_color = fsio->slot == VARYING_SLOT_COL0 ||
|
||||
fsio->slot == VARYING_SLOT_COL1;
|
||||
|
||||
assert(fsio->reg > 0 && fsio->reg <= ARRAY_SIZE(info->varyings));
|
||||
|
||||
|
|
@ -1392,13 +1393,17 @@ etna_link_shader(struct etna_shader_link_info *info,
|
|||
varying = &info->varyings[fsio->reg - 1];
|
||||
varying->num_components = fsio->num_components;
|
||||
|
||||
if (!interpolate_always) /* colors affected by flat shading */
|
||||
if (varying_is_color) /* colors affected by flat shading */
|
||||
varying->pa_attributes = 0x200;
|
||||
else /* texture coord or other bypasses flat shading */
|
||||
varying->pa_attributes = 0x2f1;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
varying->use[i] = VARYING_COMPONENT_USE_GENERIC;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (varying_is_color)
|
||||
varying->use[i] = VARYING_COMPONENT_USE_COLOR;
|
||||
else
|
||||
varying->use[i] = VARYING_COMPONENT_USE_GENERIC;
|
||||
}
|
||||
|
||||
/* point/tex coord is an input to the PS without matching VS output,
|
||||
* so it gets a varying slot without being assigned a VS register.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue