diff options
| author | CamilleLaVey <camillelavey99@gmail.com> | 2026-01-11 05:31:23 +0100 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2026-01-11 05:31:23 +0100 |
| commit | a27d35362d288b9af6c76cadec664e9453a9d237 (patch) | |
| tree | 7f8ec123f9b0a04994fdc6e558c1a5a954f0adbe /src/video_core/vulkan_common | |
| parent | a2236c1a430b643ed981877a7af19a3360d017f1 (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')
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 19 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.h | 14 |
2 files changed, 33 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; diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index 726b17e47e..9b08dc2926 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h @@ -6,6 +6,7 @@ #pragma once +#include <optional> #include <set> #include <span> #include <string> @@ -326,6 +327,16 @@ public: return properties.properties.limits.maxComputeSharedMemorySize; } + /// Returns the maximum number of dynamic storage buffer descriptors per set. + u32 GetMaxDescriptorSetStorageBuffersDynamic() const { + return properties.properties.limits.maxDescriptorSetStorageBuffersDynamic; + } + + /// Returns the maximum number of dynamic uniform buffer descriptors per set. + u32 GetMaxDescriptorSetUniformBuffersDynamic() const { + return properties.properties.limits.maxDescriptorSetUniformBuffersDynamic; + } + /// Returns float control properties of the device. const VkPhysicalDeviceFloatControlsPropertiesKHR& FloatControlProperties() const { return properties.float_controls; @@ -744,6 +755,8 @@ public: return has_broken_parallel_compiling; } + std::optional<size_t> GetSamplerHeapBudget() const; + /// Returns the vendor name reported from Vulkan. std::string_view GetVendorName() const { return properties.driver.driverName; @@ -1040,6 +1053,7 @@ private: bool dynamic_state3_alpha_to_coverage{}; bool dynamic_state3_alpha_to_one{}; bool supports_conditional_barriers{}; ///< Allows barriers in conditional control flow. + size_t sampler_heap_budget{}; ///< Sampler budget for buggy drivers (0 = unlimited). u64 device_access_memory{}; ///< Total size of device local memory in bytes. u32 sets_per_pool{}; ///< Sets per Description Pool NvidiaArchitecture nvidia_arch{NvidiaArchitecture::Arch_AmpereOrNewer}; |
