vrend: Swap bytes when reading back on a big endian arch

Closes #153

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
macos/master
Gert Wollny 5 years ago committed by Gert Wollny
parent 5b3ad5c515
commit 8126424fc7
  1. 9
      src/vrend_renderer.c

@ -7378,6 +7378,10 @@ static int vrend_transfer_send_readpixels(struct vrend_resource *res,
if (actually_invert && !has_feature(feat_mesa_invert)) if (actually_invert && !has_feature(feat_mesa_invert))
separate_invert = true; separate_invert = true;
#ifdef PIPE_ARCH_BIG_ENDIAN
glPixelStorei(GL_PACK_SWAP_BYTES, 1);
#endif
if (num_iovs > 1 || separate_invert) if (num_iovs > 1 || separate_invert)
need_temp = 1; need_temp = 1;
@ -7492,6 +7496,11 @@ static int vrend_transfer_send_readpixels(struct vrend_resource *res,
if (!need_temp && row_stride) if (!need_temp && row_stride)
glPixelStorei(GL_PACK_ROW_LENGTH, 0); glPixelStorei(GL_PACK_ROW_LENGTH, 0);
glPixelStorei(GL_PACK_ALIGNMENT, 4); glPixelStorei(GL_PACK_ALIGNMENT, 4);
#ifdef PIPE_ARCH_BIG_ENDIAN
glPixelStorei(GL_PACK_SWAP_BYTES, 0);
#endif
if (need_temp) { if (need_temp) {
write_transfer_data(&res->base, iov, num_iovs, data, write_transfer_data(&res->base, iov, num_iovs, data,
info->stride, info->box, info->level, info->offset, info->stride, info->box, info->level, info->offset,

Loading…
Cancel
Save