nir: Record per-primitive inputs without variables.

Previously, this information would have been lost when the
shader has no I/O variables.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28489>
This commit is contained in:
Timur Kristóf 2024-03-31 08:36:45 +02:00 committed by Marge Bot
parent b085248819
commit ecbf3464f6
4 changed files with 6 additions and 4 deletions

View file

@ -1952,7 +1952,9 @@ typedef struct nir_io_semantics {
unsigned no_sysval_output : 1; /* whether this system value output has no
effect due to current pipeline states */
unsigned interp_explicit_strict : 1; /* preserve original vertex order */
unsigned _pad : 1;
unsigned per_primitive : 1; /* Per-primitive FS input (when FS is used with a mesh shader).
Note that per-primitive MS outputs are implied by
using a dedicated intrinsic, store_per_primitive_output. */
} nir_io_semantics;
/* Transform feedback info for 2 outputs. nir_intrinsic_store_output contains

View file

@ -534,6 +534,8 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader,
shader->info.inputs_read |= slot_mask;
if (nir_intrinsic_io_semantics(instr).high_dvec2)
shader->info.dual_slot_inputs |= slot_mask;
if (nir_intrinsic_io_semantics(instr).per_primitive)
shader->info.per_primitive_inputs |= slot_mask;
shader->info.inputs_read_16bit |= slot_mask_16bit;
if (!nir_src_is_const(*nir_get_io_offset_src(instr))) {
shader->info.inputs_read_indirectly |= slot_mask;

View file

@ -54,9 +54,6 @@ nir_intrinsic_set_${name}(nir_intrinsic_instr *instr, ${data_type} val)
const nir_intrinsic_info *info = &nir_intrinsic_infos[instr->intrinsic];
assert(info->index_map[${enum}] > 0);
% if "struct" in data_type:
% if name == "io_semantics":
val._pad = 0; /* clear padding bits */
% endif
STATIC_ASSERT(sizeof(instr->const_index[0]) == sizeof(val));
memcpy(&instr->const_index[info->index_map[${enum}] - 1], &val, sizeof(val));
% else:

View file

@ -340,6 +340,7 @@ emit_load(struct lower_io_state *state,
var->data.precision == GLSL_PRECISION_MEDIUM ||
var->data.precision == GLSL_PRECISION_LOW;
semantics.high_dvec2 = high_dvec2;
semantics.per_primitive = var->data.per_primitive;
/* "per_vertex" is misnamed. It means "explicit interpolation with
* the original vertex order", which is a stricter version of
* INTERP_MODE_EXPLICIT.