MVKCmdCopyImage: Only use the multi-layer copy method if available.

It is only available starting in Metal 3.0 (macOS 10.15, iOS/tvOS 13).
This commit is contained in:
Chip Davis 2020-10-01 14:50:46 -05:00
parent a31d87f0b4
commit d6294a17d6

View File

@ -161,7 +161,8 @@ void MVKCmdCopyImage<N>::encode(MVKCommandEncoder* cmdEncoder, MVKCommandUse com
VkExtent3D dstExtent = _dstImage->getExtent3D(dstPlaneIndex, dstLevel);
// If the extent completely covers both images, I can copy all layers at once.
// This will obviously not apply to copies between a 3D and 2D image.
if (mvkVkExtent3DsAreEqual(srcExtent, vkIC.extent) && mvkVkExtent3DsAreEqual(dstExtent, vkIC.extent)) {
if (mvkVkExtent3DsAreEqual(srcExtent, vkIC.extent) && mvkVkExtent3DsAreEqual(dstExtent, vkIC.extent) &&
[mtlBlitEnc respondsToSelector: @selector(copyFromTexture:sourceSlice:sourceLevel:toTexture:destinationSlice:destinationLevel:sliceCount:levelCount:)]) {
assert((_srcImage->getMTLTextureType() == MTLTextureType3D) == (_dstImage->getMTLTextureType() == MTLTextureType3D));
[mtlBlitEnc copyFromTexture: srcMTLTex
sourceSlice: srcBaseLayer