26f3ef
# HG changeset patch
26f3ef
# Parent  3de59fe1b8708c01e134ce698c4232b8a854f617
83ba88
Problem:  webGL sites are displayed in the wrong color (usually blue-ish)
83ba88
Solution: Problem is with skia once again. Output of webgl seems endian-correct, but skia only
83ba88
          knows how to deal with little endian.
83ba88
          So we swizzle the output of webgl after reading it from readpixels()
83ba88
Note:     This does not fix all webGL sites, but is a step in the right direction
26f3ef
763d03
Index: firefox-115.0/gfx/gl/GLContext.h
763d03
===================================================================
763d03
--- firefox-115.0.orig/gfx/gl/GLContext.h
763d03
+++ firefox-115.0/gfx/gl/GLContext.h
763d03
@@ -1560,6 +1560,13 @@ class GLContext : public GenericAtomicRe
83ba88
     BEFORE_GL_CALL;
83ba88
     mSymbols.fReadPixels(x, y, width, height, format, type, pixels);
83ba88
     OnSyncCall();
26f3ef
+#if MOZ_BIG_ENDIAN()
83ba88
+    uint8_t* itr = (uint8_t*)pixels;
83ba88
+    for (GLsizei i = 0; i < width * height; i++) {
83ba88
+      NativeEndian::swapToLittleEndianInPlace((uint32_t*)itr, 1);
83ba88
+      itr += 4;
83ba88
+    }
83ba88
+#endif
83ba88
     AFTER_GL_CALL;
83ba88
     mHeavyGLCallsSinceLastFlush = true;
83ba88
   }