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: 482cc273af ("pan/bi: Implement load attribute with the builder")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21891>
This commit is contained in:
Alyssa Rosenzweig 2023-03-13 22:31:28 -04:00 committed by Marge Bot
parent 62497d4860
commit 90e78f6008
2 changed files with 10 additions and 2 deletions

View file

@ -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

View file

@ -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);