diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index 2d7ea5f707c..50a057805ae 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -1277,6 +1277,23 @@ bi_word_node(bi_index idx) return (idx.value << 2) | idx.offset; } +/* + * Vertex ID and Instance ID are preloaded registers. Where they are preloaded + * changed from Bifrost to Valhall. Provide helpers that smooth over the + * architectural difference. + */ +static inline bi_index +bi_vertex_id(bi_builder *b) +{ + return bi_register((b->shader->arch >= 9) ? 60 : 61); +} + +static inline bi_index +bi_instance_id(bi_builder *b) +{ + return bi_register((b->shader->arch >= 9) ? 61 : 62); +} + /* NIR passes */ bool bi_lower_divergent_indirects(nir_shader *shader, unsigned lanes);