Fix copying of multiple image layers
Only a single layer was being copied in the case of 2D array to 2D array
copies. In the case of 2D array to 3D image copies, or vice-versa, the
extent depth is the same as the layer count as per the Vulkan
requirements, but this relied on the layer pitch to be the same as the
slice pitch, which isn't true when layers contain multiple mipmap
levels.
Both issues have been addressed by adding a loop to iterate over the
layers, adjusting the pitch in case a layer is copied to/from a slice.
The inner loop for copying slices to slices is used for 3D image to
3D image copies, and for multisample 2D image to multisample 2D image
copies (which can also have multiple layers).
Also clarify the Image::getLastLayerIndex() and getLastMipLevel()
methods should not be used for VkImageSubresourceLayers structures used
by copy, blit, and resolve operations (they require explicit layer and
level counts). VkImageSubresourceRange is only for image view creation,
memory barriers, and clear operations, which accept the use of
VK_REMAINING_ARRAY_LAYERS and VK_REMAINING_MIP_LEVELS.
Bug: b/159666631
Bug: swiftshader:152
Change-Id: If998795e2b5e55950cc9fa23373a7300b6d2e0fc
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/46132
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Tested-by:
Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by:
Antonio Maiorano <amaiorano@google.com>
Showing
This diff is collapsed.
Click to expand it.
Please
register
or
sign in
to comment