Skip to content
  • Ulrich Weigand's avatar
    mesa: Fix texture compression on big-endian systems · bd016a26
    Ulrich Weigand authored and Dave Airlie's avatar Dave Airlie committed
    
    
    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: default avatarUlrich Weigand <ulrich.weigand@de.ibm.com>
    Tested-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
    Cc: "10.6" "11.0" <mesa-stable@lists.freedesktop.org>
    Signed-off-by: default avatarDave Airlie <airlied@gmail.com>
    bd016a26