1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-12 04:08:52 +01:00

[dxvk] Add flag to ensure stable image GPU addresses

This commit is contained in:
Philip Rebohle 2024-09-29 15:09:19 +02:00 committed by Philip Rebohle
parent 438a08f87c
commit c59d6bd12c
3 changed files with 15 additions and 5 deletions

View File

@ -1943,9 +1943,14 @@ namespace dxvk {
&& (image->info().access & usageInfo.access) == usageInfo.access
&& (usageInfo.layout && image->info().layout == usageInfo.layout);
// If everything matches already, no need to do anything.
if (isUsageAndFormatCompatible && isAccessAndLayoutCompatible)
// If everything matches already, no need to do anything. Only ensure
// that the stable adress bit is respected if set for the first time.
if (isUsageAndFormatCompatible && isAccessAndLayoutCompatible) {
if (usageInfo.stableGpuAddress && image->canRelocate())
image->assignResourceWithUsage(image->getAllocation(), usageInfo);
return true;
}
// Ensure the image is accessible and in its default layout
this->spillRenderPass(true);

View File

@ -49,7 +49,7 @@ namespace dxvk {
bool DxvkImage::canRelocate() const {
return !m_imageInfo.mapPtr && !m_shared
return !m_imageInfo.mapPtr && !m_shared && !m_stableAddress
&& !m_storage->flags().test(DxvkAllocationFlag::Imported)
&& !(m_info.flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT);
}
@ -164,7 +164,8 @@ namespace dxvk {
sharedImportWin32.handle = m_info.sharing.handle;
}
return m_allocator->createImageResource(imageInfo, m_properties, sharedMemoryInfo);
return m_allocator->createImageResource(imageInfo,
m_properties, sharedMemoryInfo);
}
@ -206,6 +207,7 @@ namespace dxvk {
m_info.viewFormats = m_viewFormats.data();
}
m_stableAddress |= usageInfo.stableGpuAddress;
return old;
}

View File

@ -91,6 +91,8 @@ namespace dxvk {
uint32_t viewFormatCount = 0u;
// View formats to add to the compatibility list
const VkFormat* viewFormats = nullptr;
// Requtes the image to not be relocated in the future
VkBool32 stableGpuAddress = VK_FALSE;
};
@ -583,6 +585,7 @@ namespace dxvk {
uint32_t m_version = 0u;
VkBool32 m_shared = VK_FALSE;
VkBool32 m_stableAddress = VK_FALSE;
DxvkResourceImageInfo m_imageInfo = { };