mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
etnaviv: fix flatshading on halti5 GPUs
Halti5 has no interpolation setting which will take into account the rasterizer flatshade state. Force the interpolation qualifier to flatshade for the color varyings when API level flatshade is enabled. Only set the new bit in the shader key on halti5 GPUs to avoid generating unnecessary shader variants on GPUs where the rasterizer flatshade state is properly applied to the varyings. 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/32991>
This commit is contained in:
parent
41bd7aa9c8
commit
65076f3ab0
3 changed files with 10 additions and 0 deletions
|
|
@ -1222,6 +1222,11 @@ etna_compile_shader(struct etna_shader_variant *v)
|
|||
unsigned idx = var->data.driver_location;
|
||||
sf->reg[idx].reg = idx + 1;
|
||||
sf->reg[idx].slot = var->data.location;
|
||||
if (var->data.interpolation == INTERP_MODE_NONE && v->key.flatshade &&
|
||||
(var->data.location == VARYING_SLOT_COL0 ||
|
||||
var->data.location == VARYING_SLOT_COL1)) {
|
||||
var->data.interpolation = INTERP_MODE_FLAT;
|
||||
}
|
||||
sf->reg[idx].interpolation = var->data.interpolation;
|
||||
sf->reg[idx].num_components = glsl_get_components(var->type);
|
||||
sf->num_reg = MAX2(sf->num_reg, idx+1);
|
||||
|
|
|
|||
|
|
@ -302,6 +302,9 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
|
|||
.sprite_coord_yinvert = !!ctx->rasterizer->sprite_coord_mode,
|
||||
};
|
||||
|
||||
if (screen->info->halti >= 5)
|
||||
key.flatshade = ctx->rasterizer->flatshade;
|
||||
|
||||
for (i = 0; i < pfb->nr_cbufs; i++) {
|
||||
if (pfb->cbufs[i])
|
||||
key.frag_rb_swap |= !!translate_pe_format_rb_swap(pfb->cbufs[i]->format) << i;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ struct etna_shader_key
|
|||
unsigned sprite_coord_yinvert : 1;
|
||||
/* do we need to lower sample_tex_compare */
|
||||
unsigned has_sample_tex_compare : 1;
|
||||
/* color varyings should be flat shaded */
|
||||
unsigned flatshade : 1;
|
||||
};
|
||||
uint32_t global;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue