1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-20 19:54:19 +01:00

[dxvk] Ensure image is in correct layout for invalidation

Otherwise, layout tracking might track a dead image and get confused.
This commit is contained in:
Philip Rebohle 2024-10-02 14:45:54 +02:00 committed by Philip Rebohle
parent 2af3fde5f2
commit c9ec2eeab2

View File

@ -1901,6 +1901,9 @@ namespace dxvk {
void DxvkContext::invalidateImage(
const Rc<DxvkImage>& image,
Rc<DxvkResourceAllocation>&& slice) {
// Ensure image is in the correct layout and not currently tracked
prepareImage(image, image->getAvailableSubresources());
invalidateImageWithUsage(image, std::move(slice), DxvkImageUsageInfo());
}
@ -6546,6 +6549,13 @@ namespace dxvk {
if (!bufferCount && !imageCount)
return;
// Ensure images are in the expected layout and any sort of layout
// tracking does not happen after the backing storage is swapped.
for (size_t i = 0; i < imageCount; i++)
prepareImage(imageInfos[i].image, imageInfos[i].image->getAvailableSubresources());
m_execBarriers.recordCommands(m_cmd);
small_vector<VkImageMemoryBarrier2, 16> imageBarriers;
VkMemoryBarrier2 bufferBarrier = { VK_STRUCTURE_TYPE_MEMORY_BARRIER_2 };