diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_descriptor_pool.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.h | 5 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/video_core/renderer_vulkan/vk_descriptor_pool.cpp b/src/video_core/renderer_vulkan/vk_descriptor_pool.cpp index 8e77e4796..60e45f1b9 100644 --- a/src/video_core/renderer_vulkan/vk_descriptor_pool.cpp +++ b/src/video_core/renderer_vulkan/vk_descriptor_pool.cpp | |||
| @@ -18,7 +18,6 @@ namespace Vulkan { | |||
| 18 | // Prefer small grow rates to avoid saturating the descriptor pool with barely used pipelines | 18 | // Prefer small grow rates to avoid saturating the descriptor pool with barely used pipelines |
| 19 | constexpr size_t SETS_GROW_RATE = 16; | 19 | constexpr size_t SETS_GROW_RATE = 16; |
| 20 | constexpr s32 SCORE_THRESHOLD = 3; | 20 | constexpr s32 SCORE_THRESHOLD = 3; |
| 21 | constexpr u32 SETS_PER_POOL = 64; | ||
| 22 | 21 | ||
| 23 | struct DescriptorBank { | 22 | struct DescriptorBank { |
| 24 | DescriptorBankInfo info; | 23 | DescriptorBankInfo info; |
| @@ -58,11 +57,12 @@ static DescriptorBankInfo MakeBankInfo(std::span<const Shader::Info> infos) { | |||
| 58 | static void AllocatePool(const Device& device, DescriptorBank& bank) { | 57 | static void AllocatePool(const Device& device, DescriptorBank& bank) { |
| 59 | std::array<VkDescriptorPoolSize, 6> pool_sizes; | 58 | std::array<VkDescriptorPoolSize, 6> pool_sizes; |
| 60 | size_t pool_cursor{}; | 59 | size_t pool_cursor{}; |
| 60 | const u32 sets_per_pool = device.GetSetsPerPool(); | ||
| 61 | const auto add = [&](VkDescriptorType type, u32 count) { | 61 | const auto add = [&](VkDescriptorType type, u32 count) { |
| 62 | if (count > 0) { | 62 | if (count > 0) { |
| 63 | pool_sizes[pool_cursor++] = { | 63 | pool_sizes[pool_cursor++] = { |
| 64 | .type = type, | 64 | .type = type, |
| 65 | .descriptorCount = count * SETS_PER_POOL, | 65 | .descriptorCount = count * sets_per_pool, |
| 66 | }; | 66 | }; |
| 67 | } | 67 | } |
| 68 | }; | 68 | }; |
| @@ -77,7 +77,7 @@ static void AllocatePool(const Device& device, DescriptorBank& bank) { | |||
| 77 | .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, | 77 | .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, |
| 78 | .pNext = nullptr, | 78 | .pNext = nullptr, |
| 79 | .flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, | 79 | .flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, |
| 80 | .maxSets = SETS_PER_POOL, | 80 | .maxSets = sets_per_pool, |
| 81 | .poolSizeCount = static_cast<u32>(pool_cursor), | 81 | .poolSizeCount = static_cast<u32>(pool_cursor), |
| 82 | .pPoolSizes = std::data(pool_sizes), | 82 | .pPoolSizes = std::data(pool_sizes), |
| 83 | })); | 83 | })); |
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 86ca4be54..5662a7bdc 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
| @@ -599,6 +599,12 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 599 | 599 | ||
| 600 | graphics_queue = logical.GetQueue(graphics_family); | 600 | graphics_queue = logical.GetQueue(graphics_family); |
| 601 | present_queue = logical.GetQueue(present_family); | 601 | present_queue = logical.GetQueue(present_family); |
| 602 | |||
| 603 | sets_per_pool = 64; | ||
| 604 | if (driver_id == VK_DRIVER_ID_AMD_PROPRIETARY || driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE) { | ||
| 605 | // AMD drivers need a higher amount of Sets per Pool in certain circunstances like in XC2. | ||
| 606 | sets_per_pool = 96; | ||
| 607 | } | ||
| 602 | } | 608 | } |
| 603 | 609 | ||
| 604 | Device::~Device() = default; | 610 | Device::~Device() = default; |
diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index 234d74129..9d1cb9181 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h | |||
| @@ -318,6 +318,10 @@ public: | |||
| 318 | return device_access_memory; | 318 | return device_access_memory; |
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | u32 GetSetsPerPool() const { | ||
| 322 | return sets_per_pool; | ||
| 323 | } | ||
| 324 | |||
| 321 | private: | 325 | private: |
| 322 | /// Checks if the physical device is suitable. | 326 | /// Checks if the physical device is suitable. |
| 323 | void CheckSuitability(bool requires_swapchain) const; | 327 | void CheckSuitability(bool requires_swapchain) const; |
| @@ -371,6 +375,7 @@ private: | |||
| 371 | VkShaderStageFlags guest_warp_stages{}; ///< Stages where the guest warp size can be forced. | 375 | VkShaderStageFlags guest_warp_stages{}; ///< Stages where the guest warp size can be forced. |
| 372 | u64 device_access_memory{}; ///< Total size of device local memory in bytes. | 376 | u64 device_access_memory{}; ///< Total size of device local memory in bytes. |
| 373 | u32 max_push_descriptors{}; ///< Maximum number of push descriptors | 377 | u32 max_push_descriptors{}; ///< Maximum number of push descriptors |
| 378 | u32 sets_per_pool{}; ///< Sets per Description Pool | ||
| 374 | bool is_optimal_astc_supported{}; ///< Support for native ASTC. | 379 | bool is_optimal_astc_supported{}; ///< Support for native ASTC. |
| 375 | bool is_float16_supported{}; ///< Support for float16 arithmetic. | 380 | bool is_float16_supported{}; ///< Support for float16 arithmetic. |
| 376 | bool is_int8_supported{}; ///< Support for int8 arithmetic. | 381 | bool is_int8_supported{}; ///< Support for int8 arithmetic. |