diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 726809f3a88..9b8d39d00bb 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -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 diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c index fc885c4d3a8..47e3a035f95 100644 --- a/src/compiler/nir/nir_gather_info.c +++ b/src/compiler/nir/nir_gather_info.c @@ -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; diff --git a/src/compiler/nir/nir_intrinsics_indices_h.py b/src/compiler/nir/nir_intrinsics_indices_h.py index 71bf5526ebd..9d5dbb30025 100644 --- a/src/compiler/nir/nir_intrinsics_indices_h.py +++ b/src/compiler/nir/nir_intrinsics_indices_h.py @@ -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: diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index d0e238b67b6..bb6ff15bd80 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -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.