Compute the image size in 64-bit arithmetic

The size of a 2D 'slice' is returned in a 32-bit value, which is
sufficient for the maximum supported dimensions of 8192x8192, but for
3D images we need to multiply by the depth in 64-bit to avoid numerical
overflow.

Note that currently we only allow memory allocations up to 1 GiB, but
this change fixes correctly reporting how much memory would be required,
from a call to vkGetImageMemoryRequirements().

Bug: chromium:1248567
Change-Id: Ic055790b4ae53355a90a173b824e94e3c5933316
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/57268
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Vulkan/VkImage.cpp b/src/Vulkan/VkImage.cpp
index aaae8a8..c45e52e 100644
--- a/src/Vulkan/VkImage.cpp
+++ b/src/Vulkan/VkImage.cpp
@@ -908,7 +908,8 @@
 
 VkDeviceSize Image::getMipLevelSize(VkImageAspectFlagBits aspect, uint32_t mipLevel) const
 {
-	return getMipLevelExtent(aspect, mipLevel).depth * slicePitchBytes(aspect, mipLevel);
+	return static_cast<VkDeviceSize>(slicePitchBytes(aspect, mipLevel)) *
+	       getMipLevelExtent(aspect, mipLevel).depth;
 }
 
 VkDeviceSize Image::getMultiSampledLevelSize(VkImageAspectFlagBits aspect, uint32_t mipLevel) const