[dxvk] Remove optional memory property flags one by one

We don't always want to remove HOST_CACHED if no DEVICE_LOCAL
type exists, so iterate over the bits one by one.
This commit is contained in:
Philip Rebohle 2020-08-13 18:47:52 +02:00
parent 346197c8c1
commit 48777c8fcf
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
1 changed files with 7 additions and 2 deletions

View File

@ -200,9 +200,14 @@ namespace dxvk {
// If that still didn't work, probe slower memory types as well
VkMemoryPropertyFlags optFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
| VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
VkMemoryPropertyFlags remFlags = 0;
if (!result && (flags & optFlags))
result = this->tryAlloc(req, dedAllocPtr, flags & ~optFlags, priority);
while (!result && (flags & optFlags)) {
remFlags |= optFlags & -optFlags;
optFlags &= ~remFlags;
result = this->tryAlloc(req, dedAllocPtr, flags & ~remFlags, priority);
}
if (!result) {
DxvkAdapterMemoryInfo memHeapInfo = m_device->adapter()->getMemoryHeapInfo();