From: Alyssa Rosenzweig Date: Tue, 14 Mar 2023 02:31:28 +0000 (-0400) Subject: pan/bi: Ignore signedness in vertex fetch X-Git-Tag: upstream/23.3.3~11659 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=90e78f6008cf5b2cd8a9f11b9a496a80aeee4196;p=platform%2Fupstream%2Fmesa.git pan/bi: Ignore signedness in vertex fetch We just want a bit-exact transfer for integers. Using .auto32 accomplishes this without any clamping shenanigans. Fixes gl-3.0-vertexattribipointer. Note we can't use .auto32 unconditionally, since reading a uint vertex as float is supposed to convert (or something like that, gl-2.0-vertexattribpointer tests the bad case at any rate). Fixes: 482cc273af5 ("pan/bi: Implement load attribute with the builder") Signed-off-by: Alyssa Rosenzweig Reviewed-by: Emma Anholt Reviewed-by: Boris Brezillon Part-of: --- diff --git a/src/panfrost/ci/panfrost-g52-fails.txt b/src/panfrost/ci/panfrost-g52-fails.txt index c4144a2..b94da48 100644 --- a/src/panfrost/ci/panfrost-g52-fails.txt +++ b/src/panfrost/ci/panfrost-g52-fails.txt @@ -546,7 +546,6 @@ spec@!opengl 2.0@gl-2.0-edgeflag-immediate,Fail spec@!opengl 2.1@pbo,Fail spec@!opengl 2.1@pbo@test_polygon_stip,Fail spec@!opengl 2.1@polygon-stipple-fs,Fail -spec@!opengl 3.0@gl-3.0-vertexattribipointer,Fail spec@!opengl 3.0@gl_vertexid used with glmultidrawarrays,Fail spec@!opengl 3.1@primitive-restart-xfb flush,Fail spec@!opengl 3.1@primitive-restart-xfb generated,Fail diff --git a/src/panfrost/compiler/bifrost_compile.c b/src/panfrost/compiler/bifrost_compile.c index 6055322..ea78c1c 100644 --- a/src/panfrost/compiler/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost_compile.c @@ -412,8 +412,17 @@ bi_copy_component(bi_builder *b, nir_intrinsic_instr *instr, bi_index tmp) static void bi_emit_load_attr(bi_builder *b, nir_intrinsic_instr *instr) { + /* Disregard the signedness of an integer, since loading 32-bits into a + * 32-bit register should be bit exact so should not incur any clamping. + * + * If we are reading as a u32, then it must be paired with an integer (u32 or + * s32) source, so use .auto32 to disregard. + */ nir_alu_type T = nir_intrinsic_dest_type(instr); - enum bi_register_format regfmt = bi_reg_fmt_for_nir(T); + 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; + nir_src *offset = nir_get_io_offset_src(instr); unsigned component = nir_intrinsic_component(instr); enum bi_vecsize vecsize = (instr->num_components + component - 1);