st/mesa: swap bytes in the fallback format translation path of GetTexImage
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 9 Nov 2016 14:49:22 +0000 (15:49 +0100)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 16 Nov 2016 09:31:36 +0000 (10:31 +0100)
Fixes parts of GL45-CTS.gtf32.GL3Tests.packed_pixels.packed_pixels_pixelstore.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
src/mesa/state_tracker/st_cb_texture.c

index e358c738c07832aff253455721063359c9c9a5be..7c493fc11433970607022ef26f89609dcde6ffb2 100644 (file)
@@ -2073,6 +2073,12 @@ st_GetTexSubImage(struct gl_context * ctx,
                               rgba, RGBA32_FLOAT, srcStride,
                               width, height, NULL);
 
+         /* Handle byte swapping if required */
+         if (ctx->Pack.SwapBytes) {
+            _mesa_swap_bytes_2d_image(format, type, &ctx->Pack,
+                                      width, height, dest, dest);
+         }
+
          map += tex_xfer->layer_stride;
       }