OSDN Git Service

mesa: Fix texture compression on big-endian systems
authorUlrich Weigand <uweigand@de.ibm.com>
Tue, 15 Sep 2015 13:23:26 +0000 (15:23 +0200)
committerEmil Velikov <emil.l.velikov@gmail.com>
Wed, 23 Sep 2015 20:04:15 +0000 (21:04 +0100)
commit5fe09ffe6a5ae4fc0629e44b21ae144e347bcf04
treee7f0a3d3ad6262acf975e7951826ea64185bd8ad
parent395cd23690345ce4a5c4b97ba6497009a984240e
mesa: Fix texture compression on big-endian systems

Various pieces of code to create compressed textures will first
generate an uncompressed RGBA texture into a temporary buffer,
and then read from that buffer while creating the final compressed
texture in the requested format.

The code reading from the temporary buffer assumes the buffer is
formatted as an array of bytes in RGBA order.  However, the buffer
is filled using a _mesa_texstore call with MESA_FORMAT_R8G8B8A8_UNORM
format -- this is defined as an array of *integers* holding the
RGBA values in packed format (least-significant to most-significant).
This means incorrect bytes are accessed on big-endian systems.

This patch fixes this by using the MESA_FORMAT_A8B8G8R8_UNORM format
instead on big-endian systems when filling the buffer.  This fixes
about 100 piglit test case failures on s390x for me.

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Tested-by: Oded Gabbay <oded.gabbay@gmail.com>
Cc: "10.6" "11.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@gmail.com>
(cherry picked from commit bd016a2601a741799bc76734deae0cb9ebcb2b8f)
src/mesa/main/texcompress_bptc.c
src/mesa/main/texcompress_fxt1.c
src/mesa/main/texcompress_rgtc.c
src/mesa/main/texcompress_s3tc.c