u_format: Use memcpy to avoid unaligned accesses
authorMatt Turner <mattst88@gmail.com>
Wed, 7 Jun 2023 00:53:41 +0000 (20:53 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 8 Jun 2023 03:42:39 +0000 (03:42 +0000)
commit19092576ce3678d090b4a62742b8fc0bc1293ab5
treebb42ec514cc0fbf74ac868dd082e39a3e0f49c90
parent96cf4531e11eac8175671be990a02c7b5d17fb60
u_format: Use memcpy to avoid unaligned accesses

These functions are used by gl[Get]TexImage, which imposes no
alignment restructions on the void *pixels parameter.

This fixes an unaligned access in GTK's "gtk:gdk / memorytexture" unit
test on SPARC, which causes the test to fail.

Fixes: 45ae4434b5b ("util: Use bitshift arithmetic to unpack pixels.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23482>
src/util/format/u_format_pack.py