aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2020-01-14 16:50:41 -0800
committerMarge Bot <[email protected]>2020-02-04 17:48:08 +0000
commitb064697af1dc8927756986f396c793e0e23c42e9 (patch)
tree9bcb34969578c44be893c9abe0e1bde7f11b6443
parentdd899fd43ebc56fee6ad41126db340a9c2f7bc72 (diff)
gallium/osmesa: Try to fix the test for big-endian.
Our packed expected values will be byte-swapped for the (mostly) array formats we're testing. Reviewed-by: Danylo Piliaiev <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3216> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3216>
-rw-r--r--src/gallium/targets/osmesa/test-render.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gallium/targets/osmesa/test-render.cpp b/src/gallium/targets/osmesa/test-render.cpp
index 55d449c2132..2e5ff962d8e 100644
--- a/src/gallium/targets/osmesa/test-render.cpp
+++ b/src/gallium/targets/osmesa/test-render.cpp
@@ -8,6 +8,8 @@
#include "GL/osmesa.h"
#include "util/macros.h"
+#include "util/u_endian.h"
+#include "util/u_math.h"
typedef struct {
unsigned format;
@@ -75,6 +77,25 @@ TEST_P(OSMesaRenderTestFixture, Render)
uint64_t expected = p.expected;
+ /* All the formats other than 565 and RGB/byte are array formats, but our
+ * expected values are packed, so byte swap appropriately.
+ */
+ if (UTIL_ARCH_BIG_ENDIAN) {
+ switch (p.bpp) {
+ case 8:
+ expected = util_bswap64(expected);
+ break;
+
+ case 4:
+ expected = util_bswap32(expected);
+ break;
+
+ case 3:
+ case 2:
+ break;
+ }
+ }
+
glClear(GL_COLOR_BUFFER_BIT);
glFinish();