mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
etnaviv: Improve flatshading
If the shader has flat varyings but API level flatshade is disabled, we need to switch to flat shading in PA.CONFIG to ensure proper interpolation. Passes dEQP-GLES3.functional.rasterization.flatshading.* on GC7000. Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com> Tested-by: Daniel Lang <dalang@gmx.at> Reviewed-by: Daniel Lang <dalang@gmx.at> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36404>
This commit is contained in:
parent
3e9cbea34e
commit
6ba0797a06
1 changed files with 9 additions and 0 deletions
|
|
@ -258,6 +258,15 @@ etna_link_shaders(struct etna_context *ctx, struct compiled_shader_state *cs,
|
|||
}
|
||||
}
|
||||
|
||||
/* if shader has flat varyings, switch to flat shading */
|
||||
for (int idx = 0; idx < link.num_varyings; ++idx) {
|
||||
if (link.varyings[idx].semantic == VARYING_INTERPOLATION_MODE_FLAT) {
|
||||
cs->PA_CONFIG &= ~VIVS_PA_CONFIG_SHADE_MODEL_SMOOTH;
|
||||
cs->PA_CONFIG |= VIVS_PA_CONFIG_SHADE_MODEL_FLAT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cs->GL_VARYING_TOTAL_COMPONENTS =
|
||||
VIVS_GL_VARYING_TOTAL_COMPONENTS_NUM(align(total_components, 2));
|
||||
memcpy(cs->GL_VARYING_NUM_COMPONENTS, num_components, sizeof(uint32_t) * 2);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue