diff --git a/app/src/main/cpp/skyline/gpu/texture/texture.cpp b/app/src/main/cpp/skyline/gpu/texture/texture.cpp index bbe4dc94..93648706 100644 --- a/app/src/main/cpp/skyline/gpu/texture/texture.cpp +++ b/app/src/main/cpp/skyline/gpu/texture/texture.cpp @@ -172,13 +172,26 @@ namespace skyline::gpu { }, }); - commandBuffer.copyImageToBuffer(image, layout, stagingBuffer->vkBuffer, vk::BufferImageCopy{ - .imageExtent = dimensions, - .imageSubresource = { - .aspectMask = format->vkAspect, - .layerCount = layerCount, - }, - }); + boost::container::static_vector bufferImageCopies; + auto pushBufferImageCopyWithAspect{[&](vk::ImageAspectFlagBits aspect) { + bufferImageCopies.emplace_back( + vk::BufferImageCopy{ + .imageExtent = dimensions, + .imageSubresource = { + .aspectMask = aspect, + .layerCount = layerCount, + }, + }); + }}; + + if (format->vkAspect & vk::ImageAspectFlagBits::eColor) + pushBufferImageCopyWithAspect(vk::ImageAspectFlagBits::eColor); + if (format->vkAspect & vk::ImageAspectFlagBits::eDepth) + pushBufferImageCopyWithAspect(vk::ImageAspectFlagBits::eDepth); + if (format->vkAspect & vk::ImageAspectFlagBits::eStencil) + pushBufferImageCopyWithAspect(vk::ImageAspectFlagBits::eStencil); + + commandBuffer.copyImageToBuffer(image, layout, stagingBuffer->vkBuffer, vk::ArrayProxy(static_cast(bufferImageCopies.size()), bufferImageCopies.data())); commandBuffer.pipelineBarrier(vk::PipelineStageFlagBits::eTransfer, vk::PipelineStageFlagBits::eHost, {}, {}, vk::BufferMemoryBarrier{ .srcAccessMask = vk::AccessFlagBits::eTransferWrite,