etnaviv: expose shader discard usage in etna_shader_variant

The information about a shader using discard/kill is interesting
to other parts of the driver, as depth states need to programmed
differently depending on this. As we don't want to deal with
NIR/TGSI differences in other parts of the driver, track this
usage in the common etna_shader_variant.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7396>
This commit is contained in:
Lucas Stach 2020-11-01 16:49:18 +01:00
parent bff60d665b
commit 3c7fc95f4f
3 changed files with 5 additions and 0 deletions

View file

@ -127,6 +127,9 @@ struct etna_shader_variant {
/* shader is larger than GPU instruction limit, thus needs icache */
bool needs_icache;
/* shader uses pixel kill/discard */
bool uses_discard;
};
struct etna_varying {

View file

@ -1058,6 +1058,7 @@ etna_compile_shader_nir(struct etna_shader_variant *v)
const struct etna_specs *specs = c->specs;
v->stage = s->info.stage;
v->uses_discard = s->info.fs.uses_discard;
v->num_loops = 0; /* TODO */
v->vs_id_in_reg = -1;
v->vs_pos_out_reg = -1;

View file

@ -2471,6 +2471,7 @@ etna_compile_shader(struct etna_shader_variant *v)
/* fill in output structure */
v->stage = c->info.processor == PIPE_SHADER_FRAGMENT ? MESA_SHADER_FRAGMENT : MESA_SHADER_VERTEX;
v->uses_discard = c->info.uses_kill;
v->code_size = c->inst_ptr * 4;
v->code = mem_dup(c->code, c->inst_ptr * 16);
v->num_loops = c->num_loops;