Add padding between slices

When doing multisample rendering, we need to avoid conflicts between
render target writes to adjacent slices.

- Worst case is an unaligned 16-byte write hitting the last byte of the image, + 15 bytes beyond
- Ensure that slices are always 16-byte aligned

Test: dEQP-VK.renderpass.*
Bug: b/131719815
Change-Id: I5c3ee7c66f0f656fdc85d7388ca907e0173381e5
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/30608
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Vulkan/VkFormat.cpp b/src/Vulkan/VkFormat.cpp
index 0c41831..0f6558b 100644
--- a/src/Vulkan/VkFormat.cpp
+++ b/src/Vulkan/VkFormat.cpp
@@ -1500,7 +1500,7 @@
 	}
 }
 
-int Format::sliceB(int width, int height, int border, bool target) const
+int Format::sliceBUnpadded(int width, int height, int border, bool target) const
 {
 	height += 2 * border;
 
@@ -1561,6 +1561,11 @@
 	}
 }
 
+int Format::sliceB(int width, int height, int border, bool target) const
+{
+	return sw::align<16>(sliceBUnpadded(width, height, border, target) + 15);
+}
+
 bool Format::getScale(sw::float4 &scale) const
 {
 	switch(format)
diff --git a/src/Vulkan/VkFormat.h b/src/Vulkan/VkFormat.h
index 26b19e4..c45295d 100644
--- a/src/Vulkan/VkFormat.h
+++ b/src/Vulkan/VkFormat.h
@@ -71,6 +71,7 @@
 
 private:
 	VkFormat compatibleFormat() const;
+	int sliceBUnpadded(int width, int height, int border, bool target) const;
 
 	VkFormat format = VK_FORMAT_UNDEFINED;
 };