diff options
Diffstat (limited to 'src/video_core/vulkan_common/vulkan_device.cpp')
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index d68cc4b9a4..2ae5052640 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp @@ -605,6 +605,18 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR if (version < VK_MAKE_API_VERSION(0, 255, 615, 512)) { has_broken_parallel_compiling = true; } + const size_t sampler_limit = properties.properties.limits.maxSamplerAllocationCount; + if (sampler_limit > 0) { + constexpr size_t MIN_SAMPLER_BUDGET = 1024U; + const size_t reserved = sampler_limit / 4U; + const size_t derived_budget = + (std::max)(MIN_SAMPLER_BUDGET, sampler_limit - reserved); + sampler_heap_budget = derived_budget; + LOG_WARNING(Render_Vulkan, + "Qualcomm driver reports max {} samplers; reserving {} (25%) and " + "allowing Eden to use {} (75%) to avoid heap exhaustion", + sampler_limit, reserved, sampler_heap_budget); + } } if (extensions.sampler_filter_minmax && is_amd) { @@ -1529,6 +1541,13 @@ void Device::SetupFamilies(VkSurfaceKHR surface) { } } +std::optional<size_t> Device::GetSamplerHeapBudget() const { + if (sampler_heap_budget == 0) { + return std::nullopt; + } + return sampler_heap_budget; +} + u64 Device::GetDeviceMemoryUsage() const { VkPhysicalDeviceMemoryBudgetPropertiesEXT budget; budget.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT; |
