Pass depth to computeBlockSize.

This was very wrong for 3D textures.

BUG=angleproject:1384

Change-Id: I7f042449e30e1e909778c0524d1ce99d20ddfd65
Reviewed-on: https://chromium-review.googlesource.com/348063
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/formatutils.cpp b/src/libANGLE/formatutils.cpp
index c9c701e..fc16f3a 100644
--- a/src/libANGLE/formatutils.cpp
+++ b/src/libANGLE/formatutils.cpp
@@ -696,7 +696,7 @@
     }
     else
     {
-        ANGLE_TRY_RESULT(computeBlockSize(formatType, width, 1), rowBytes);
+        ANGLE_TRY_RESULT(computeBlockSize(formatType, gl::Extents(width, 1, 1)), rowBytes);
     }
     auto checkedResult = rx::CheckedRoundUp(rowBytes, static_cast<GLuint>(alignment));
     ANGLE_TRY_CHECKED_MATH(checkedResult);
@@ -729,17 +729,17 @@
 }
 
 gl::ErrorOrResult<GLuint> InternalFormat::computeBlockSize(GLenum formatType,
-                                                           GLsizei width,
-                                                           GLsizei height) const
+                                                           const gl::Extents &size) const
 {
-    CheckedNumeric<GLuint> checkedWidth(width);
-    CheckedNumeric<GLuint> checkedHeight(height);
+    CheckedNumeric<GLuint> checkedWidth(size.width);
+    CheckedNumeric<GLuint> checkedHeight(size.height);
+    CheckedNumeric<GLuint> checkedDepth(size.depth);
 
     if (compressed)
     {
         auto numBlocksWide = (checkedWidth + compressedBlockWidth - 1u) / compressedBlockWidth;
         auto numBlocksHigh = (checkedHeight + compressedBlockHeight - 1u) / compressedBlockHeight;
-        auto bytes         = numBlocksWide * numBlocksHigh * pixelBytes;
+        auto bytes         = numBlocksWide * numBlocksHigh * pixelBytes * checkedDepth;
         ANGLE_TRY_CHECKED_MATH(bytes);
         return bytes.ValueOrDie();
     }
@@ -747,7 +747,7 @@
     const Type &typeInfo = GetTypeInfo(formatType);
     GLuint components    = typeInfo.specialInterpretation ? 1u : componentCount;
 
-    auto result = checkedWidth * checkedHeight * components * typeInfo.bytes;
+    auto result = checkedWidth * checkedHeight * checkedDepth * components * typeInfo.bytes;
     ANGLE_TRY_CHECKED_MATH(result);
     return result.ValueOrDie();
 }