etnaviv: nir: Make use of nir_lower_fragcolor

This is a prep step to be able to use nir_lower_blend(..) and
also simplifies the compiler a little bit.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26565>
This commit is contained in:
Christian Gmeiner 2023-09-12 17:17:16 +02:00 committed by Marge Bot
parent a83b816f03
commit 3e6f178734
2 changed files with 5 additions and 4 deletions

View file

@ -104,8 +104,7 @@ etna_emit_output(struct etna_compile *c, nir_variable *var, struct etna_inst_src
if (is_fs(c)) {
switch (var->data.location) {
case FRAG_RESULT_COLOR:
case FRAG_RESULT_DATA0: /* DATA0 is used by gallium shaders for color */
case FRAG_RESULT_DATA0:
c->variant->ps_color_out_reg = src.reg;
break;
case FRAG_RESULT_DEPTH:
@ -1145,6 +1144,9 @@ etna_compile_shader(struct etna_shader_variant *v)
v->ps_color_out_reg = 0; /* 0 for shader that doesn't write fragcolor.. */
v->ps_depth_out_reg = -1;
if (s->info.stage == MESA_SHADER_FRAGMENT)
NIR_PASS_V(s, nir_lower_fragcolor, 1);
/*
* Lower glTexCoord, fixes e.g. neverball point sprite (exit cylinder stars)
* and gl4es pointsprite.trace apitrace

View file

@ -64,8 +64,7 @@ etna_lower_io(nir_shader *shader, struct etna_shader_variant *v)
assert(deref->deref_type == nir_deref_type_var);
if (deref->var->data.location != FRAG_RESULT_COLOR &&
deref->var->data.location != FRAG_RESULT_DATA0)
if (deref->var->data.location != FRAG_RESULT_DATA0)
break;
b.cursor = nir_before_instr(instr);