mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-01 12:08:12 +00:00
vk: Implement max VRAM override in config
This commit is contained in:
parent
29d87a3743
commit
4e6231a321
@ -686,13 +686,9 @@ namespace vk
|
||||
m_allocator = std::make_unique<vk::mem_allocator_vma>(dev, pdev);
|
||||
}
|
||||
|
||||
if (pgpu->props.deviceID == 0x13c2)
|
||||
{
|
||||
// GTX970 workaround/hack
|
||||
// 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;
|
||||
}
|
||||
// Useful for debugging different VRAM configurations
|
||||
const u64 vram_allocation_limit = g_cfg.video.vk.vram_allocation_limit * 0x100000ull;
|
||||
memory_map.device_local_total_bytes = std::min(memory_map.device_local_total_bytes, vram_allocation_limit);
|
||||
}
|
||||
|
||||
void render_device::destroy()
|
||||
|
@ -162,6 +162,23 @@ namespace vk
|
||||
allocatorInfo.physicalDevice = pdev;
|
||||
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));
|
||||
|
||||
// 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::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::uint<256, 65536> vram_allocation_limit{ this, "VRAM allocation limit (MB)", 65536, false };
|
||||
|
||||
} vk{ this };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user