mozilla-bmo849632.patch
changeset 1129 146af4f081b9
parent 1123 7fa561e5d7c7
child 1190 2a24a948b5cf
equal deleted inserted replaced
1116:52b1745787cf 1129:146af4f081b9
       
     1 # HG changeset patch
       
     2 # Parent  3de59fe1b8708c01e134ce698c4232b8a854f617
     1 Problem:  webGL sites are displayed in the wrong color (usually blue-ish)
     3 Problem:  webGL sites are displayed in the wrong color (usually blue-ish)
     2 Solution: Problem is with skia once again. Output of webgl seems endian-correct, but skia only
     4 Solution: Problem is with skia once again. Output of webgl seems endian-correct, but skia only
     3           knows how to deal with little endian.
     5           knows how to deal with little endian.
     4           So we swizzle the output of webgl after reading it from readpixels()
     6           So we swizzle the output of webgl after reading it from readpixels()
     5 Note:     This does not fix all webGL sites, but is a step in the right direction
     7 Note:     This does not fix all webGL sites, but is a step in the right direction
     6 diff -r 6b017d3e9733 gfx/gl/GLContext.h
     8 
     7 --- a/gfx/gl/GLContext.h    Mon Sep 09 10:04:05 2019 +0200
     9 diff --git a/gfx/gl/GLContext.h b/gfx/gl/GLContext.h
     8 +++ b/gfx/gl/GLContext.h    Wed Nov 13 17:13:04 2019 +0100
    10 --- a/gfx/gl/GLContext.h
     9 @@ -1551,6 +1551,13 @@
    11 +++ b/gfx/gl/GLContext.h
       
    12 @@ -1548,16 +1548,23 @@ class GLContext : public GenericAtomicRe
       
    13      AFTER_GL_CALL;
       
    14    }
       
    15  
       
    16    void raw_fReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
       
    17                         GLenum format, GLenum type, GLvoid* pixels) {
    10      BEFORE_GL_CALL;
    18      BEFORE_GL_CALL;
    11      mSymbols.fReadPixels(x, y, width, height, format, type, pixels);
    19      mSymbols.fReadPixels(x, y, width, height, format, type, pixels);
    12      OnSyncCall();
    20      OnSyncCall();
    13 +#if MOZ_BIG_ENDIAN
    21 +#if MOZ_BIG_ENDIAN()
    14 +    uint8_t* itr = (uint8_t*)pixels;
    22 +    uint8_t* itr = (uint8_t*)pixels;
    15 +    for (GLsizei i = 0; i < width * height; i++) {
    23 +    for (GLsizei i = 0; i < width * height; i++) {
    16 +      NativeEndian::swapToLittleEndianInPlace((uint32_t*)itr, 1);
    24 +      NativeEndian::swapToLittleEndianInPlace((uint32_t*)itr, 1);
    17 +      itr += 4;
    25 +      itr += 4;
    18 +    }
    26 +    }
    19 +#endif
    27 +#endif
    20      AFTER_GL_CALL;
    28      AFTER_GL_CALL;
    21      mHeavyGLCallsSinceLastFlush = true;
    29      mHeavyGLCallsSinceLastFlush = true;
    22    }
    30    }
    23 
    31  
       
    32    void fReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
       
    33                     GLenum format, GLenum type, GLvoid* pixels);
       
    34  
       
    35   public: