mozilla-bmo849632.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Fri, 19 Jun 2020 10:01:49 +0200
changeset 1136 d068eb84b4d3
parent 1123 7fa561e5d7c7
permissions -rw-r--r--
sync SLE specifics
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1123
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
     1
# HG changeset patch
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
     2
# Parent  3de59fe1b8708c01e134ce698c4232b8a854f617
1114
572ec48f3fe8 Firefox 71.0b11
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     3
Problem:  webGL sites are displayed in the wrong color (usually blue-ish)
572ec48f3fe8 Firefox 71.0b11
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     4
Solution: Problem is with skia once again. Output of webgl seems endian-correct, but skia only
572ec48f3fe8 Firefox 71.0b11
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     5
          knows how to deal with little endian.
572ec48f3fe8 Firefox 71.0b11
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     6
          So we swizzle the output of webgl after reading it from readpixels()
572ec48f3fe8 Firefox 71.0b11
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     7
Note:     This does not fix all webGL sites, but is a step in the right direction
1123
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
     8
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
     9
diff --git a/gfx/gl/GLContext.h b/gfx/gl/GLContext.h
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    10
--- a/gfx/gl/GLContext.h
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    11
+++ b/gfx/gl/GLContext.h
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    12
@@ -1548,16 +1548,23 @@ class GLContext : public GenericAtomicRe
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    13
     AFTER_GL_CALL;
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    14
   }
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    15
 
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    16
   void raw_fReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    17
                        GLenum format, GLenum type, GLvoid* pixels) {
1114
572ec48f3fe8 Firefox 71.0b11
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    18
     BEFORE_GL_CALL;
572ec48f3fe8 Firefox 71.0b11
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    19
     mSymbols.fReadPixels(x, y, width, height, format, type, pixels);
572ec48f3fe8 Firefox 71.0b11
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    20
     OnSyncCall();
1122
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1114
diff changeset
    21
+#if MOZ_BIG_ENDIAN()
1114
572ec48f3fe8 Firefox 71.0b11
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    22
+    uint8_t* itr = (uint8_t*)pixels;
572ec48f3fe8 Firefox 71.0b11
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    23
+    for (GLsizei i = 0; i < width * height; i++) {
572ec48f3fe8 Firefox 71.0b11
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    24
+      NativeEndian::swapToLittleEndianInPlace((uint32_t*)itr, 1);
572ec48f3fe8 Firefox 71.0b11
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    25
+      itr += 4;
572ec48f3fe8 Firefox 71.0b11
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    26
+    }
572ec48f3fe8 Firefox 71.0b11
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    27
+#endif
572ec48f3fe8 Firefox 71.0b11
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    28
     AFTER_GL_CALL;
572ec48f3fe8 Firefox 71.0b11
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    29
     mHeavyGLCallsSinceLastFlush = true;
572ec48f3fe8 Firefox 71.0b11
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    30
   }
1123
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    31
 
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    32
   void fReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    33
                    GLenum format, GLenum type, GLvoid* pixels);
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    34
 
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    35
  public: