mesa: Fix packing/unpacking of MESA_FORMAT_R5G6B5_UNORM
[mesa.git] / src / mesa / main / texstore.c
index f913e42d31564e4efdd789c98310dacf3b1bdf51..b9407d2f739d6574a7d426c356637b0ebc48ea93 100644 (file)
@@ -923,7 +923,7 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS)
          }
          else {
             for (col = 0; col < srcWidth; col++) {
-               dstUS[col] = PACK_COLOR_565_REV( srcUB[0], srcUB[1], srcUB[2] );
+               dstUS[col] = PACK_COLOR_565( srcUB[2], srcUB[1], srcUB[0] );
                srcUB += 3;
             }
          }
@@ -1667,8 +1667,10 @@ texstore_rgba_integer(TEXSTORE_PARAMS)
 
    assert(is_array && !normalized);
 
-   if (!is_array)
+   if (!is_array) {
+      free(tmp_row);
       return GL_FALSE;
+   }
 
    invert_swizzle(dst2rgba, rgba2dst);
    compute_component_mapping(GL_RGBA, baseInternalFormat, base2rgba);
@@ -2229,7 +2231,7 @@ _mesa_compute_compressed_pixelstore(GLuint dims, mesa_format texFormat,
 
       if (packing->RowLength) {
          store->TotalBytesPerRow = packing->CompressedBlockSize *
-            (packing->RowLength + bw - 1) / bw;
+            ((packing->RowLength + bw - 1) / bw);
       }
 
       store->SkipBytes += packing->SkipPixels * packing->CompressedBlockSize / bw;