Bug 1659274 - silence build warnings in SWGL linear_composite. r=jimb
authorLee Salzman <lsalzman@mozilla.com>
Sat, 15 Aug 2020 21:31:10 +0000
changeset 544892 01c8bc283e34f95f3550eb0641a3c82fdef7c443
parent 544891 962c787f963b38e0a5672dffbea1f4e811ba2830
child 544893 b7ad02f8114dce150fbf4887612ceb6fc91a75bb
push id124264
push userlsalzman@mozilla.com
push dateSat, 15 Aug 2020 21:35:50 +0000
treeherderautoland@01c8bc283e34 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimb
bugs1659274
milestone81.0a1
first release with
nightly linux32
01c8bc283e34 / 81.0a1 / 20200816094524 / files
nightly linux64
01c8bc283e34 / 81.0a1 / 20200816094524 / files
nightly mac
01c8bc283e34 / 81.0a1 / 20200816094524 / files
nightly win32
01c8bc283e34 / 81.0a1 / 20200816094524 / files
nightly win64
01c8bc283e34 / 81.0a1 / 20200816094524 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1659274 - silence build warnings in SWGL linear_composite. r=jimb Differential Revision: https://phabricator.services.mozilla.com/D87181
gfx/wr/swgl/src/gl.cc
--- a/gfx/wr/swgl/src/gl.cc
+++ b/gfx/wr/swgl/src/gl.cc
@@ -4006,18 +4006,18 @@ static void linear_row_composite(uint32_
     auto mask = span_mask_RGBA8(span);
     unaligned_store(dest, (mask & dstpx) | (~mask & r));
   }
 }
 
 static void linear_composite(Texture& srctex, const IntRect& srcReq, int srcZ,
                              Texture& dsttex, const IntRect& dstReq, int dstZ,
                              bool invertY) {
-  assert(srctex.internal_format == GL_RGBA8 ||
-         srctex.internal_format == GL_R8 || srctex.internal_format == GL_RG8);
+  assert(srctex.bpp() == 4);
+  assert(dsttex.bpp() == 4);
   // Compute valid dest bounds
   IntRect dstBounds = dsttex.sample_bounds(dstReq, invertY);
   // Check if sampling bounds are empty
   if (dstBounds.is_empty()) {
     return;
   }
   // Initialize sampler for source texture
   sampler2DArray_impl sampler;
@@ -4030,18 +4030,16 @@ static void linear_composite(Texture& sr
   vec2_scalar srcDUV(float(srcReq.width()) / dstReq.width(),
                      float(srcReq.height()) / dstReq.height());
   // Skip to clamped source start
   srcUV += srcDUV * vec2_scalar(dstBounds.x0, dstBounds.y0);
   // Offset source UVs to texel centers and scale by lerp precision
   srcUV = linearQuantize(srcUV + 0.5f, 128);
   srcDUV *= 128.0f;
   // Calculate dest pointer from clamped offsets
-  int bpp = dsttex.bpp();
-  assert(bpp == 4);
   int destStride = dsttex.stride();
   char* dest = dsttex.sample_ptr(dstReq, dstBounds, dstZ, invertY);
   // Inverted Y must step downward along dest rows
   if (invertY) {
     destStride = -destStride;
   }
   int span = dstBounds.width();
   for (int rows = dstBounds.height(); rows > 0; rows--) {
@@ -4192,16 +4190,17 @@ void Composite(LockedTexture* lockedDst,
                GLint dstY, GLsizei dstWidth, GLsizei dstHeight,
                GLboolean opaque, GLboolean flip, GLenum filter) {
   if (!lockedDst || !lockedSrc) {
     return;
   }
   Texture& srctex = *lockedSrc;
   Texture& dsttex = *lockedDst;
   assert(srctex.bpp() == 4);
+  assert(dsttex.bpp() == 4);
   const int bpp = 4;
   size_t src_stride = srctex.stride();
   size_t dest_stride = dsttex.stride();
   if (srcY < 0) {
     dstY -= srcY;
     srcHeight += srcY;
     srcY = 0;
   }