mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-26 04:54:17 +01:00
Support Multi-Aspect Copy in Texture::CopyIntoStagingBuffer
Only copying a single aspect was supported by `CopyIntoStagingBuffer` earlier due to not supplying a `VkBufferImageCopy` for each aspect separately, this has now been done with Color/Depth/Stencil aspects having their own `VkBufferImageCopy` for the `VkCmdCopyImageToBuffer` command.
This commit is contained in:
parent
daff17c776
commit
bd6cd0056c
@ -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<const vk::BufferImageCopy, 3> 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<u32>(bufferImageCopies.size()), bufferImageCopies.data()));
|
||||
|
||||
commandBuffer.pipelineBarrier(vk::PipelineStageFlagBits::eTransfer, vk::PipelineStageFlagBits::eHost, {}, {}, vk::BufferMemoryBarrier{
|
||||
.srcAccessMask = vk::AccessFlagBits::eTransferWrite,
|
||||
|
Loading…
Reference in New Issue
Block a user