Simplify InternalFormat::getCompressedImageMinBlocks

Changed the function to return a scalar
instead of a pair with equal values.

Bug: angleproject:42263253
Change-Id: Ic68d9cd33f9fdce49202ea2bfcf90ad12b02bebb
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/7964942
Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
diff --git a/src/libANGLE/formatutils.cpp b/src/libANGLE/formatutils.cpp
index af70359..e2f30b9 100644
--- a/src/libANGLE/formatutils.cpp
+++ b/src/libANGLE/formatutils.cpp
@@ -1951,12 +1951,12 @@
 
     CheckedNumeric<GLuint> checkedWidth(width);
     CheckedNumeric<GLuint> checkedBlockWidth(compressedBlockWidth);
-    const GLuint minBlockWidth = getCompressedImageMinBlocks().first;
+    const GLuint minBlocks = getCompressedImageMinBlocks();
 
     auto numBlocksWide = (checkedWidth + checkedBlockWidth - 1u) / checkedBlockWidth;
-    if (numBlocksWide.IsValid() && numBlocksWide.ValueOrDie() < minBlockWidth)
+    if (numBlocksWide.IsValid() && numBlocksWide.ValueOrDie() < minBlocks)
     {
-        numBlocksWide = minBlockWidth;
+        numBlocksWide = minBlocks;
     }
     return CheckedMathResult(numBlocksWide * pixelBytes, resultOut);
 }
@@ -1971,12 +1971,12 @@
     CheckedNumeric<GLuint> checkedHeight(height);
     CheckedNumeric<GLuint> checkedRowPitch(rowPitch);
     CheckedNumeric<GLuint> checkedBlockHeight(compressedBlockHeight);
-    const GLuint minBlockHeight = getCompressedImageMinBlocks().second;
+    const GLuint minBlocks = getCompressedImageMinBlocks();
 
     auto numBlocksHigh = (checkedHeight + checkedBlockHeight - 1u) / checkedBlockHeight;
-    if (numBlocksHigh.IsValid() && numBlocksHigh.ValueOrDie() < minBlockHeight)
+    if (numBlocksHigh.IsValid() && numBlocksHigh.ValueOrDie() < minBlocks)
     {
-        numBlocksHigh = minBlockHeight;
+        numBlocksHigh = minBlocks;
     }
     return CheckedMathResult(numBlocksHigh * checkedRowPitch, resultOut);
 }
@@ -2014,20 +2014,19 @@
     CheckedNumeric<GLuint> checkedBlockWidth(compressedBlockWidth);
     CheckedNumeric<GLuint> checkedBlockHeight(compressedBlockHeight);
     CheckedNumeric<GLuint> checkedBlockDepth(compressedBlockDepth);
-    GLuint minBlockWidth, minBlockHeight;
-    std::tie(minBlockWidth, minBlockHeight) = getCompressedImageMinBlocks();
+    const GLuint minBlocks = getCompressedImageMinBlocks();
 
     ASSERT(compressed);
     auto numBlocksWide = (checkedWidth + checkedBlockWidth - 1u) / checkedBlockWidth;
     auto numBlocksHigh = (checkedHeight + checkedBlockHeight - 1u) / checkedBlockHeight;
     auto numBlocksDeep = (checkedDepth + checkedBlockDepth - 1u) / checkedBlockDepth;
-    if (numBlocksWide.IsValid() && numBlocksWide.ValueOrDie() < minBlockWidth)
+    if (numBlocksWide.IsValid() && numBlocksWide.ValueOrDie() < minBlocks)
     {
-        numBlocksWide = minBlockWidth;
+        numBlocksWide = minBlocks;
     }
-    if (numBlocksHigh.IsValid() && numBlocksHigh.ValueOrDie() < minBlockHeight)
+    if (numBlocksHigh.IsValid() && numBlocksHigh.ValueOrDie() < minBlocks)
     {
-        numBlocksHigh = minBlockHeight;
+        numBlocksHigh = minBlocks;
     }
     auto bytes = numBlocksWide * numBlocksHigh * numBlocksDeep * pixelBytes;
     return CheckedMathResult(bytes, resultOut);
@@ -2052,23 +2051,15 @@
     }
 }
 
-std::pair<GLuint, GLuint> InternalFormat::getCompressedImageMinBlocks() const
+GLuint InternalFormat::getCompressedImageMinBlocks() const
 {
-    GLuint minBlockWidth  = 0;
-    GLuint minBlockHeight = 0;
-
     // Per the specification, a PVRTC block needs information from the 3 nearest blocks.
     // GL_IMG_texture_compression_pvrtc specifies the minimum size requirement in pixels, but
     // ANGLE's texture tables are written in terms of blocks. The 4BPP formats use 4x4 blocks, and
     // the 2BPP formats, 8x4 blocks. Therefore, both kinds of formats require a minimum of 2x2
     // blocks.
-    if (IsPVRTC1Format(internalFormat))
-    {
-        minBlockWidth  = 2;
-        minBlockHeight = 2;
-    }
 
-    return std::make_pair(minBlockWidth, minBlockHeight);
+    return IsPVRTC1Format(internalFormat) ? 2 : 0;
 }
 
 bool InternalFormat::computeSkipBytes(GLenum formatType,
diff --git a/src/libANGLE/formatutils.h b/src/libANGLE/formatutils.h
index b21465b..1814136 100644
--- a/src/libANGLE/formatutils.h
+++ b/src/libANGLE/formatutils.h
@@ -212,7 +212,7 @@
                                         GLsizei samples,
                                         GLuint *resultOut) const;
 
-    [[nodiscard]] std::pair<GLuint, GLuint> getCompressedImageMinBlocks() const;
+    [[nodiscard]] GLuint getCompressedImageMinBlocks() const;
 
     [[nodiscard]] bool computeRowDepthSkipBytes(GLenum formatType,
                                                 GLsizei width,