mozilla-bmo849632.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Tue, 07 Jan 2020 09:47:03 +0100
branchfirefox71
changeset 1118 27c3f029180a
parent 1114 572ec48f3fe8
child 1122 a9cd24eaa361
permissions -rw-r--r--
latest 71.0 revision

Problem:  webGL sites are displayed in the wrong color (usually blue-ish)
Solution: Problem is with skia once again. Output of webgl seems endian-correct, but skia only
          knows how to deal with little endian.
          So we swizzle the output of webgl after reading it from readpixels()
Note:     This does not fix all webGL sites, but is a step in the right direction
diff -r 6b017d3e9733 gfx/gl/GLContext.h
--- a/gfx/gl/GLContext.h    Mon Sep 09 10:04:05 2019 +0200
+++ b/gfx/gl/GLContext.h    Wed Nov 13 17:13:04 2019 +0100
@@ -1551,6 +1551,13 @@
     BEFORE_GL_CALL;
     mSymbols.fReadPixels(x, y, width, height, format, type, pixels);
     OnSyncCall();
+#if MOZ_BIG_ENDIAN
+    uint8_t* itr = (uint8_t*)pixels;
+    for (GLsizei i = 0; i < width * height; i++) {
+      NativeEndian::swapToLittleEndianInPlace((uint32_t*)itr, 1);
+      itr += 4;
+    }
+#endif
     AFTER_GL_CALL;
     mHeavyGLCallsSinceLastFlush = true;
   }