diff --git a/src/panfrost/compiler/bifrost_compile.c b/src/panfrost/compiler/bifrost_compile.c index bd5f77c3e19..4065a2933ba 100644 --- a/src/panfrost/compiler/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost_compile.c @@ -1205,6 +1205,7 @@ va_shader_output_from_semantics(const nir_io_semantics *sem) return VA_SHADER_OUTPUT_POSITION; case VARYING_SLOT_PSIZ: case VARYING_SLOT_LAYER: + case VARYING_SLOT_PRIMITIVE_ID: return VA_SHADER_OUTPUT_ATTRIB; default: return VA_SHADER_OUTPUT_VARY; @@ -1399,6 +1400,11 @@ bi_emit_store_vary(bi_builder *b, nir_intrinsic_instr *instr) if (sem.location == VARYING_SLOT_PSIZ) assert(T_size == 16 && "should've been lowered"); + if (sem.location == VARYING_SLOT_PRIMITIVE_ID) { + assert(nr == 1 && src_bit_sz == 32); + pos_attr_offset = 12; + } + bool varying = (output_type == VA_SHADER_OUTPUT_VARY); if (instr->intrinsic == nir_intrinsic_store_per_view_output) { diff --git a/src/panfrost/compiler/bifrost_compile.h b/src/panfrost/compiler/bifrost_compile.h index 2ce589b0568..9998063e2bc 100644 --- a/src/panfrost/compiler/bifrost_compile.h +++ b/src/panfrost/compiler/bifrost_compile.h @@ -93,7 +93,7 @@ void bifrost_compile_shader_nir(nir_shader *nir, struct pan_shader_info *info); #define VALHAL_EX_FIFO_VARYING_BITS \ - (VARYING_BIT_PSIZ | VARYING_BIT_LAYER) + (VARYING_BIT_PSIZ | VARYING_BIT_LAYER | VARYING_BIT_PRIMITIVE_ID) static inline bool valhal_writes_extended_fifo(uint64_t outputs_written,