diff options
| author | 2021-06-17 00:29:48 +0200 | |
|---|---|---|
| committer | 2021-06-17 00:29:48 +0200 | |
| commit | ca6f47c6862a24dfa78f3d25c8b7819636218cdd (patch) | |
| tree | d45fea664fa1e1d4de04b206289f638ffe1ceedc /src/video_core/vulkan_common | |
| parent | Reaper: Address Feedback. (diff) | |
| download | yuzu-ca6f47c6862a24dfa78f3d25c8b7819636218cdd.tar.gz yuzu-ca6f47c6862a24dfa78f3d25c8b7819636218cdd.tar.xz yuzu-ca6f47c6862a24dfa78f3d25c8b7819636218cdd.zip | |
Reaper: Change memory restrictions on TC depending on host memory on VK.
Diffstat (limited to 'src/video_core/vulkan_common')
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 14 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.h | 9 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 64206b3d2..724a0141c 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
| @@ -408,6 +408,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 408 | } | 408 | } |
| 409 | logical = vk::Device::Create(physical, queue_cis, extensions, first_next, dld); | 409 | logical = vk::Device::Create(physical, queue_cis, extensions, first_next, dld); |
| 410 | 410 | ||
| 411 | CollectPhysicalMemoryInfo(); | ||
| 411 | CollectTelemetryParameters(); | 412 | CollectTelemetryParameters(); |
| 412 | CollectToolingInfo(); | 413 | CollectToolingInfo(); |
| 413 | 414 | ||
| @@ -818,6 +819,19 @@ void Device::CollectTelemetryParameters() { | |||
| 818 | } | 819 | } |
| 819 | } | 820 | } |
| 820 | 821 | ||
| 822 | void Device::CollectPhysicalMemoryInfo() { | ||
| 823 | const auto mem_properties = physical.GetMemoryProperties(); | ||
| 824 | const std::size_t num_properties = mem_properties.memoryTypeCount; | ||
| 825 | device_access_memory = 0; | ||
| 826 | for (std::size_t element = 0; element < num_properties; element++) { | ||
| 827 | if ((mem_properties.memoryTypes[element].propertyFlags & | ||
| 828 | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) != 0) { | ||
| 829 | const std::size_t heap_index = mem_properties.memoryTypes[element].heapIndex; | ||
| 830 | device_access_memory += mem_properties.memoryHeaps[heap_index].size; | ||
| 831 | } | ||
| 832 | } | ||
| 833 | } | ||
| 834 | |||
| 821 | void Device::CollectToolingInfo() { | 835 | void Device::CollectToolingInfo() { |
| 822 | if (!ext_tooling_info) { | 836 | if (!ext_tooling_info) { |
| 823 | return; | 837 | return; |
diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index 67d70cd22..a1aba973b 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h | |||
| @@ -225,6 +225,10 @@ public: | |||
| 225 | return use_asynchronous_shaders; | 225 | return use_asynchronous_shaders; |
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | u64 GetDeviceLocalMemory() const { | ||
| 229 | return device_access_memory; | ||
| 230 | } | ||
| 231 | |||
| 228 | private: | 232 | private: |
| 229 | /// Checks if the physical device is suitable. | 233 | /// Checks if the physical device is suitable. |
| 230 | void CheckSuitability(bool requires_swapchain) const; | 234 | void CheckSuitability(bool requires_swapchain) const; |
| @@ -244,6 +248,9 @@ private: | |||
| 244 | /// Collects information about attached tools. | 248 | /// Collects information about attached tools. |
| 245 | void CollectToolingInfo(); | 249 | void CollectToolingInfo(); |
| 246 | 250 | ||
| 251 | /// Collects information about the device's local memory. | ||
| 252 | void CollectPhysicalMemoryInfo(); | ||
| 253 | |||
| 247 | /// Returns a list of queue initialization descriptors. | 254 | /// Returns a list of queue initialization descriptors. |
| 248 | std::vector<VkDeviceQueueCreateInfo> GetDeviceQueueCreateInfos() const; | 255 | std::vector<VkDeviceQueueCreateInfo> GetDeviceQueueCreateInfos() const; |
| 249 | 256 | ||
| @@ -302,6 +309,8 @@ private: | |||
| 302 | 309 | ||
| 303 | /// Nsight Aftermath GPU crash tracker | 310 | /// Nsight Aftermath GPU crash tracker |
| 304 | std::unique_ptr<NsightAftermathTracker> nsight_aftermath_tracker; | 311 | std::unique_ptr<NsightAftermathTracker> nsight_aftermath_tracker; |
| 312 | |||
| 313 | u64 device_access_memory; | ||
| 305 | }; | 314 | }; |
| 306 | 315 | ||
| 307 | } // namespace Vulkan | 316 | } // namespace Vulkan |