[Mesa-dev] [PATCH 7/9] st/mesa: swap bytes in the fallback format translation path of GetTexImage

Nicolai Hähnle nhaehnle at gmail.com
Wed Nov 9 15:01:55 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

Fixes parts of GL45-CTS.gtf32.GL3Tests.packed_pixels.packed_pixels_pixelstore.
---
 src/mesa/state_tracker/st_cb_texture.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 078330f..b94a6ad 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -2066,20 +2066,26 @@ st_GetTexSubImage(struct gl_context * ctx,
                                           slice, 0, 0);
 
          /* get float[4] rgba row from surface */
          pipe_get_tile_rgba_format(tex_xfer, map, 0, 0, width, height,
                                    dst_format, rgba);
 
          _mesa_format_convert(dest, dstMesaFormat, dstStride,
                               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;
       }
 
       free(rgba);
    }
    done = TRUE;
 
 end:
    if (map)
       pipe_transfer_unmap(pipe, tex_xfer);
-- 
2.7.4



More information about the mesa-dev mailing list