X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Ftexcompress_fxt1.c;h=c5646fbd7a35e26a21498ee4f58f9fe0724fc421;hb=1ebe4305fd0e4b4f023eb50ca0b8229bdd7c1a5e;hp=f06f048820d8c8bbeab7cf0619965eb77fc8a6a8;hpb=2768a0b1b42f3c1531ab9c3647a93f0504002280;p=mesa.git diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index f06f048820d..c5646fbd7a3 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -65,7 +65,7 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) if (srcFormat != GL_RGB || srcType != GL_UNSIGNED_BYTE || ctx->_ImageTransferState || - srcPacking->RowLength != srcWidth || + ALIGN(srcPacking->RowLength, srcPacking->Alignment) != srcWidth || srcPacking->SwapBytes) { /* convert image to RGB/GLubyte */ GLubyte *tempImageSlices[1]; @@ -130,7 +130,8 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) tempImageSlices[0] = (GLubyte *) tempImage; _mesa_texstore(ctx, dims, baseInternalFormat, - MESA_FORMAT_R8G8B8A8_UNORM, + _mesa_little_endian() ? MESA_FORMAT_R8G8B8A8_UNORM + : MESA_FORMAT_A8B8G8R8_UNORM, rgbaRowStride, tempImageSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, @@ -176,8 +177,8 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) #define LL_RMS_D 10 /* fault tolerance (maximum delta) */ #define LL_RMS_E 255 /* fault tolerance (maximum error) */ #define ALPHA_TS 2 /* alpha threshold: (255 - ALPHA_TS) deemed opaque */ -#define ISTBLACK(v) (*((GLuint *)(v)) == 0) - +static const GLuint zero = 0; +#define ISTBLACK(v) (memcmp(&(v), &zero, sizeof(zero)) == 0) /* * Define a 64-bit unsigned integer type and macros