Commit b01f2559 by Chris Forbes

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/+/30608Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 583f6425
...@@ -1500,7 +1500,7 @@ int Format::pitchB(int width, int border, bool target) const ...@@ -1500,7 +1500,7 @@ int Format::pitchB(int width, int border, bool target) const
} }
} }
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; height += 2 * border;
...@@ -1561,6 +1561,11 @@ int Format::sliceB(int width, int height, int border, bool target) const ...@@ -1561,6 +1561,11 @@ int Format::sliceB(int width, int height, int border, bool target) const
} }
} }
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 bool Format::getScale(sw::float4 &scale) const
{ {
switch(format) switch(format)
......
...@@ -71,6 +71,7 @@ public: ...@@ -71,6 +71,7 @@ public:
private: private:
VkFormat compatibleFormat() const; VkFormat compatibleFormat() const;
int sliceBUnpadded(int width, int height, int border, bool target) const;
VkFormat format = VK_FORMAT_UNDEFINED; VkFormat format = VK_FORMAT_UNDEFINED;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment