mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-08-13 11:39:47 +00:00
vk: Expose memory heap sizes to the runtime.
- This will help to make decisions regarding VRAM utilization instead of relying on budget blindly
This commit is contained in:
parent
88abf3a6ba
commit
342b25d00e
2 changed files with 9 additions and 7 deletions
|
@ -647,10 +647,9 @@ namespace vk
|
||||||
memory_type_mapping result;
|
memory_type_mapping result;
|
||||||
result.device_local = VK_MAX_MEMORY_TYPES;
|
result.device_local = VK_MAX_MEMORY_TYPES;
|
||||||
result.host_visible_coherent = VK_MAX_MEMORY_TYPES;
|
result.host_visible_coherent = VK_MAX_MEMORY_TYPES;
|
||||||
|
result.device_local_total_bytes = 0;
|
||||||
|
result.host_visible_total_bytes = 0;
|
||||||
bool host_visible_cached = false;
|
bool host_visible_cached = false;
|
||||||
VkDeviceSize host_visible_vram_size = 0;
|
|
||||||
VkDeviceSize device_local_vram_size = 0;
|
|
||||||
|
|
||||||
for (u32 i = 0; i < memory_properties.memoryTypeCount; i++)
|
for (u32 i = 0; i < memory_properties.memoryTypeCount; i++)
|
||||||
{
|
{
|
||||||
|
@ -659,10 +658,10 @@ namespace vk
|
||||||
bool is_device_local = !!(memory_properties.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
|
bool is_device_local = !!(memory_properties.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
|
||||||
if (is_device_local)
|
if (is_device_local)
|
||||||
{
|
{
|
||||||
if (device_local_vram_size < heap.size)
|
if (result.device_local_total_bytes < heap.size)
|
||||||
{
|
{
|
||||||
result.device_local = i;
|
result.device_local = i;
|
||||||
device_local_vram_size = heap.size;
|
result.device_local_total_bytes = heap.size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,10 +671,10 @@ namespace vk
|
||||||
|
|
||||||
if (is_host_coherent && is_host_visible)
|
if (is_host_coherent && is_host_visible)
|
||||||
{
|
{
|
||||||
if ((is_cached && !host_visible_cached) || (host_visible_vram_size < heap.size))
|
if ((is_cached && !host_visible_cached) || (result.host_visible_total_bytes < heap.size))
|
||||||
{
|
{
|
||||||
result.host_visible_coherent = i;
|
result.host_visible_coherent = i;
|
||||||
host_visible_vram_size = heap.size;
|
result.host_visible_total_bytes = heap.size;
|
||||||
host_visible_cached = is_cached;
|
host_visible_cached = is_cached;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,9 @@ namespace vk
|
||||||
u32 host_visible_coherent;
|
u32 host_visible_coherent;
|
||||||
u32 device_local;
|
u32 device_local;
|
||||||
|
|
||||||
|
u64 device_local_total_bytes;
|
||||||
|
u64 host_visible_total_bytes;
|
||||||
|
|
||||||
PFN_vkGetMemoryHostPointerPropertiesEXT _vkGetMemoryHostPointerPropertiesEXT;
|
PFN_vkGetMemoryHostPointerPropertiesEXT _vkGetMemoryHostPointerPropertiesEXT;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue