From d6294a17d603b0e862825386a3a4c56196db627e Mon Sep 17 00:00:00 2001 From: Chip Davis Date: Thu, 1 Oct 2020 14:50:46 -0500 Subject: [PATCH] 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). --- MoltenVK/MoltenVK/Commands/MVKCmdTransfer.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdTransfer.mm b/MoltenVK/MoltenVK/Commands/MVKCmdTransfer.mm index 00e79dca..817ed193 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCmdTransfer.mm +++ b/MoltenVK/MoltenVK/Commands/MVKCmdTransfer.mm @@ -161,7 +161,8 @@ void MVKCmdCopyImage::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