From 1b359f3e59436319307ce9cbed79b998c29ce5a0 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Sat, 1 Feb 2025 01:40:35 -0800 Subject: [PATCH] panfrost: support 16-bit vertex attributes There is no auto32 equivalent for 16-bit types, we need to select specific register formats. Signed-off-by: Benjamin Lee Reviewed-by: Lars-Ivar Hesselberg Simonsen Part-of: --- src/panfrost/compiler/bifrost_compile.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/panfrost/compiler/bifrost_compile.c b/src/panfrost/compiler/bifrost_compile.c index 1cf3b2c35f8..3ce9ad645a5 100644 --- a/src/panfrost/compiler/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost_compile.c @@ -480,9 +480,27 @@ bi_emit_load_attr(bi_builder *b, nir_intrinsic_instr *instr) * s32) source, so use .auto32 to disregard. */ nir_alu_type T = nir_intrinsic_dest_type(instr); - assert(T == nir_type_uint32 || T == nir_type_int32 || T == nir_type_float32); - enum bi_register_format regfmt = - T == nir_type_float32 ? BI_REGISTER_FORMAT_F32 : BI_REGISTER_FORMAT_AUTO; + enum bi_register_format regfmt = BI_REGISTER_FORMAT_AUTO; + switch (T) { + case nir_type_uint32: + case nir_type_int32: + regfmt = BI_REGISTER_FORMAT_AUTO; + break; + case nir_type_float32: + regfmt = BI_REGISTER_FORMAT_F32; + break; + case nir_type_uint16: + regfmt = BI_REGISTER_FORMAT_U16; + break; + case nir_type_int16: + regfmt = BI_REGISTER_FORMAT_S16; + break; + case nir_type_float16: + regfmt = BI_REGISTER_FORMAT_F16; + break; + default: + assert("unsupported attribute type" && false); + } nir_src *offset = nir_get_io_offset_src(instr); unsigned component = nir_intrinsic_component(instr);