Our packed expected values will be byte-swapped for the (mostly) array
formats we're testing.
Reviewed-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3216>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3216>
#include "GL/osmesa.h"
#include "util/macros.h"
+#include "util/u_endian.h"
+#include "util/u_math.h"
typedef struct {
unsigned format;
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();