mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-12 13:08:50 +01:00
[dxgi] Use heap size to determine reservable memory
Budgets can change dynamically, so this should be more robust.
This commit is contained in:
parent
d14dcf5d47
commit
6783123654
@ -352,23 +352,24 @@ namespace dxvk {
|
||||
if (MemorySegmentGroup == DXGI_MEMORY_SEGMENT_GROUP_LOCAL)
|
||||
heapFlags |= VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
|
||||
|
||||
pVideoMemoryInfo->Budget = 0;
|
||||
pVideoMemoryInfo->Budget = 0;
|
||||
pVideoMemoryInfo->CurrentUsage = 0;
|
||||
pVideoMemoryInfo->AvailableForReservation = 0;
|
||||
|
||||
for (uint32_t i = 0; i < memInfo.heapCount; i++) {
|
||||
if ((memInfo.heaps[i].heapFlags & heapFlagMask) != heapFlags)
|
||||
continue;
|
||||
|
||||
pVideoMemoryInfo->Budget += memInfo.heaps[i].memoryBudget;
|
||||
pVideoMemoryInfo->Budget += memInfo.heaps[i].memoryBudget;
|
||||
pVideoMemoryInfo->CurrentUsage += memInfo.heaps[i].memoryAllocated;
|
||||
pVideoMemoryInfo->AvailableForReservation += memInfo.heaps[i].heapSize / 2;
|
||||
}
|
||||
|
||||
// We don't implement reservation, but the observable
|
||||
// behaviour should match that of Windows drivers
|
||||
uint32_t segmentId = uint32_t(MemorySegmentGroup);
|
||||
|
||||
pVideoMemoryInfo->AvailableForReservation = pVideoMemoryInfo->Budget / 2;
|
||||
pVideoMemoryInfo->CurrentReservation = m_memReservation[segmentId];
|
||||
pVideoMemoryInfo->CurrentReservation = m_memReservation[segmentId];
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@ namespace dxvk {
|
||||
|
||||
for (uint32_t i = 0; i < info.heapCount; i++) {
|
||||
info.heaps[i].heapFlags = memProps.memoryProperties.memoryHeaps[i].flags;
|
||||
info.heaps[i].heapSize = memProps.memoryProperties.memoryHeaps[i].size;
|
||||
|
||||
if (m_hasMemoryBudget) {
|
||||
info.heaps[i].memoryBudget = memBudget.heapBudget[i];
|
||||
|
@ -30,6 +30,7 @@ namespace dxvk {
|
||||
*/
|
||||
struct DxvkAdapterMemoryHeapInfo {
|
||||
VkMemoryHeapFlags heapFlags;
|
||||
VkDeviceSize heapSize;
|
||||
VkDeviceSize memoryBudget;
|
||||
VkDeviceSize memoryAllocated;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user