From b98a150e4ca22bc648b2b220d942c1efa6b92d97 Mon Sep 17 00:00:00 2001 From: CamilleLaVey Date: Tue, 25 Nov 2025 19:55:55 -0400 Subject: [PATCH] [vk, qcom] Samplers Budget Management --- src/video_core/texture_cache/texture_cache.h | 1 + src/video_core/vulkan_common/vulkan_device.cpp | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index efae825885..23682371c5 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -2039,6 +2039,7 @@ SamplerId TextureCache

::FindSampler(const TSCEntry& config) { } const auto [pair, is_new] = channel_state->samplers.try_emplace(config); if (is_new) { + EnforceSamplerBudget(); pair->second = slot_samplers.insert(runtime, config); EnforceSamplerBudget(); } diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index b6ed8adaa4..a631b7fa94 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp @@ -595,14 +595,13 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR 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); + (std::max)(MIN_SAMPLER_BUDGET, sampler_limit / 4U); 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); + "Qualcomm driver reports max {} samplers; clamping cache to {} (25%) to " + "avoid heap exhaustion", + sampler_limit, sampler_heap_budget); } const u32 version = (properties.properties.driverVersion << 3) >> 3; if (version < VK_MAKE_API_VERSION(0, 255, 615, 512) ||