nir: Add a way to identify per-primitive variables

Per-primitive is similar to per-vertex attributes, but applies to all
fragments of the primitive without any interpolation involved.

Because they are regular input and outputs, keep track in shader_info
of which I/O is per-primitive so we can distinguish them after deref
lowering.  These fields can be used combined with the regular
`inputs_read`, `outputs_written` and `outputs_read`.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10600>
This commit is contained in:
Caio Marcelo de Oliveira Filho
2021-04-29 11:51:57 -07:00
committed by Marge Bot
parent 927584fa67
commit f95daad3a2
5 changed files with 40 additions and 3 deletions
+2 -1
View File
@@ -255,7 +255,8 @@ emit_load(struct lower_io_state *state,
case nir_var_shader_in:
if (nir->info.stage == MESA_SHADER_FRAGMENT &&
nir->options->use_interpolated_input_intrinsics &&
var->data.interpolation != INTERP_MODE_FLAT) {
var->data.interpolation != INTERP_MODE_FLAT &&
!var->data.per_primitive) {
if (var->data.interpolation == INTERP_MODE_EXPLICIT) {
assert(array_index != NULL);
op = nir_intrinsic_load_input_vertex;