mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 15:20:17 +01:00
pan/bi: Lower gl_VertexID in NIR
This gets rid of the hidden gl_BaseVertex system value which violates Ekstrand's rule. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20906>
This commit is contained in:
parent
540d556a8f
commit
91ffd10351
3 changed files with 15 additions and 18 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue