radv: make sure the heap budget is less than or equal to the heap size

Reported by Hans-Kristian.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28575>
(cherry picked from commit 14ba56718f)
This commit is contained in:
Samuel Pitoiset 2024-04-04 17:55:52 +02:00 committed by Eric Engestrom
parent 0deacc982b
commit a5d4638ed5
2 changed files with 6 additions and 1 deletions

View File

@ -1984,7 +1984,7 @@
"description": "radv: make sure the heap budget is less than or equal to the heap size",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View File

@ -2380,6 +2380,11 @@ radv_get_memory_budget_properties(VkPhysicalDevice physicalDevice,
assert(heap == memory_properties->memoryHeapCount);
}
/* The heapBudget value must be less than or equal to VkMemoryHeap::size for each heap. */
for (uint32_t i = 0; i < memory_properties->memoryHeapCount; i++) {
memoryBudget->heapBudget[i] = MIN2(memory_properties->memoryHeaps[i].size, memoryBudget->heapBudget[i]);
}
/* The heapBudget and heapUsage values must be zero for array elements
* greater than or equal to
* VkPhysicalDeviceMemoryProperties::memoryHeapCount.