mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-03 22:24:13 +01:00
[dxvk] Add flag to ensure stable image GPU addresses
This commit is contained in:
parent
438a08f87c
commit
c59d6bd12c
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
@ -151,7 +151,7 @@ namespace dxvk {
|
||||
void* sharedMemoryInfo = nullptr;
|
||||
|
||||
VkExportMemoryAllocateInfo sharedExport = { VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO };
|
||||
VkImportMemoryWin32HandleInfoKHR sharedImportWin32= { VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR };
|
||||
VkImportMemoryWin32HandleInfoKHR sharedImportWin32 = { VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR };
|
||||
|
||||
if (m_shared && m_info.sharing.mode == DxvkSharedHandleMode::Export) {
|
||||
sharedExport.pNext = std::exchange(sharedMemoryInfo, &sharedExport);
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 = { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user