diff --git a/src/panfrost/compiler/bifrost_compile.c b/src/panfrost/compiler/bifrost_compile.c index 61026c2fd3c..8a4b0eb872b 100644 --- a/src/panfrost/compiler/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost_compile.c @@ -1837,26 +1837,14 @@ bi_emit_intrinsic(bi_builder *b, nir_intrinsic_instr *instr) break; /* It appears vertex_id is zero-based with Bifrost geometry flows, but - * not with Valhall's memory-allocation IDVS geometry flow. Ostensibly - * we support the legacy geometry flow even on Valhall, so - * vertex_id_zero_based isn't a machine property for us. Don't set it, - * and lower here if needed. + * not with Valhall's memory-allocation IDVS geometry flow. We only support + * the new flow on Valhall so this is lowered in NIR. */ case nir_intrinsic_load_vertex_id: - if (b->shader->malloc_idvs) { - bi_mov_i32_to(b, dst, bi_vertex_id(b)); - } else { - bi_index first = - bi_load_sysval(b, PAN_SYSVAL_VERTEX_INSTANCE_OFFSETS, 1, 0); - - bi_iadd_u32_to(b, dst, bi_vertex_id(b), first, false); - } - - break; - - /* We only use in our transform feedback lowering */ case nir_intrinsic_load_vertex_id_zero_base: - assert(b->shader->nir->info.has_transform_feedback_varyings); + assert(b->shader->malloc_idvs == + (instr->intrinsic == nir_intrinsic_load_vertex_id)); + bi_mov_i32_to(b, dst, bi_vertex_id(b)); break; diff --git a/src/panfrost/compiler/bifrost_compile.h b/src/panfrost/compiler/bifrost_compile.h index 86f966fb540..bcb1c83ea4a 100644 --- a/src/panfrost/compiler/bifrost_compile.h +++ b/src/panfrost/compiler/bifrost_compile.h @@ -55,6 +55,12 @@ void bifrost_compile_shader_nir(nir_shader *nir, .lower_insert_byte = true, \ .lower_rotate = true, \ \ + /* Vertex ID is zero based in the traditional geometry flows, but not in \ + * the memory-allocated IDVS flow introduced and used exclusively in \ + * Valhall. So this is a machine property for us. \ + */ \ + .vertex_id_zero_based = (arch <= 7), \ + \ .lower_pack_half_2x16 = true, \ .lower_pack_unorm_2x16 = true, \ .lower_pack_snorm_2x16 = true, \ @@ -97,5 +103,6 @@ void bifrost_compile_shader_nir(nir_shader *nir, }; DEFINE_OPTIONS(6); +DEFINE_OPTIONS(9); #endif diff --git a/src/panfrost/lib/pan_shader.c b/src/panfrost/lib/pan_shader.c index 1fe84913be7..eb683de1f3e 100644 --- a/src/panfrost/lib/pan_shader.c +++ b/src/panfrost/lib/pan_shader.c @@ -35,7 +35,9 @@ const nir_shader_compiler_options * GENX(pan_shader_get_compiler_options)(void) { -#if PAN_ARCH >= 6 +#if PAN_ARCH >= 9 + return &bifrost_nir_options_v9; +#elif PAN_ARCH >= 6 return &bifrost_nir_options_v6; #else return &midgard_nir_options;