mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 23:41:26 +12:00
vk: Implement max VRAM override in config
This commit is contained in:
parent
29d87a3743
commit
4e6231a321
3 changed files with 21 additions and 7 deletions
|
@ -686,13 +686,9 @@ namespace vk
|
||||||
m_allocator = std::make_unique<vk::mem_allocator_vma>(dev, pdev);
|
m_allocator = std::make_unique<vk::mem_allocator_vma>(dev, pdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pgpu->props.deviceID == 0x13c2)
|
// Useful for debugging different VRAM configurations
|
||||||
{
|
const u64 vram_allocation_limit = g_cfg.video.vk.vram_allocation_limit * 0x100000ull;
|
||||||
// GTX970 workaround/hack
|
memory_map.device_local_total_bytes = std::min(memory_map.device_local_total_bytes, vram_allocation_limit);
|
||||||
// The driver reports a full working 4GB of memory which is incorrect.
|
|
||||||
// Limit to ~2.5GB to allow vma to avoid running over the headroom of 0.5G.
|
|
||||||
memory_map.device_local_total_bytes = 2560ULL * 0x100000ULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void render_device::destroy()
|
void render_device::destroy()
|
||||||
|
|
|
@ -162,6 +162,23 @@ namespace vk
|
||||||
allocatorInfo.physicalDevice = pdev;
|
allocatorInfo.physicalDevice = pdev;
|
||||||
allocatorInfo.device = dev;
|
allocatorInfo.device = dev;
|
||||||
|
|
||||||
|
std::vector<VkDeviceSize> heap_limits;
|
||||||
|
const auto vram_allocation_limit = g_cfg.video.vk.vram_allocation_limit * 0x100000ull;
|
||||||
|
if (vram_allocation_limit < g_render_device->get_memory_mapping().device_local_total_bytes)
|
||||||
|
{
|
||||||
|
VkPhysicalDeviceMemoryProperties memory_properties;
|
||||||
|
vkGetPhysicalDeviceMemoryProperties(pdev, &memory_properties);
|
||||||
|
for (int i = 0; i < memory_properties.memoryHeapCount; ++i)
|
||||||
|
{
|
||||||
|
const u64 max_sz = (memory_properties.memoryHeaps[i].flags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
|
||||||
|
? vram_allocation_limit
|
||||||
|
: VK_WHOLE_SIZE;
|
||||||
|
|
||||||
|
heap_limits.push_back(max_sz);
|
||||||
|
}
|
||||||
|
allocatorInfo.pHeapSizeLimit = heap_limits.data();
|
||||||
|
}
|
||||||
|
|
||||||
CHECK_RESULT(vmaCreateAllocator(&allocatorInfo, &m_allocator));
|
CHECK_RESULT(vmaCreateAllocator(&allocatorInfo, &m_allocator));
|
||||||
|
|
||||||
// Allow fastest possible allocation on start
|
// Allow fastest possible allocation on start
|
||||||
|
|
|
@ -191,6 +191,7 @@ struct cfg_root : cfg::node
|
||||||
cfg::_bool asynchronous_texture_streaming{ this, "Asynchronous Texture Streaming 2", false };
|
cfg::_bool asynchronous_texture_streaming{ this, "Asynchronous Texture Streaming 2", false };
|
||||||
cfg::uint<0, 100> rcas_sharpening_intensity{ this, "FidelityFX CAS Sharpening Intensity", 50, true };
|
cfg::uint<0, 100> rcas_sharpening_intensity{ this, "FidelityFX CAS Sharpening Intensity", 50, true };
|
||||||
cfg::_enum<vk_gpu_scheduler_mode> asynchronous_scheduler{ this, "Asynchronous Queue Scheduler", vk_gpu_scheduler_mode::safe };
|
cfg::_enum<vk_gpu_scheduler_mode> asynchronous_scheduler{ this, "Asynchronous Queue Scheduler", vk_gpu_scheduler_mode::safe };
|
||||||
|
cfg::uint<256, 65536> vram_allocation_limit{ this, "VRAM allocation limit (MB)", 65536, false };
|
||||||
|
|
||||||
} vk{ this };
|
} vk{ this };
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue