aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/vulkan_common/vulkan_device.cpp
diff options
context:
space:
mode:
authorCamilleLaVey <camillelavey99@gmail.com>2026-01-11 05:31:23 +0100
committercrueter <crueter@eden-emu.dev>2026-01-11 05:31:23 +0100
commita27d35362d288b9af6c76cadec664e9453a9d237 (patch)
tree7f8ec123f9b0a04994fdc6e558c1a5a954f0adbe /src/video_core/vulkan_common/vulkan_device.cpp
parenta2236c1a430b643ed981877a7af19a3360d017f1 (diff)
[vk, qcom] Memory, Samplers, BindingBuffers and UniformBufferAlignment set by hardware capabilities for QCOM. (#3280)
This PR adjust resources usage of Eden based on driver specification, improving stability and smarter resources usage, extends the amount of TotalPipelineWorkers on Android. Co-authored-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3280 Reviewed-by: Lizzie <lizzie@eden-emu.dev> Reviewed-by: DraVee <dravee@eden-emu.dev> Co-authored-by: CamilleLaVey <camillelavey99@gmail.com> Co-committed-by: CamilleLaVey <camillelavey99@gmail.com>
Diffstat (limited to 'src/video_core/vulkan_common/vulkan_device.cpp')
-rw-r--r--src/video_core/vulkan_common/vulkan_device.cpp19
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;