Reaper: Change memory restrictions on TC depending on host memory on VK.
This commit is contained in:
parent
0dd98842bf
commit
ca6f47c686
10 changed files with 90 additions and 41 deletions
|
@ -408,6 +408,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
|||
}
|
||||
logical = vk::Device::Create(physical, queue_cis, extensions, first_next, dld);
|
||||
|
||||
CollectPhysicalMemoryInfo();
|
||||
CollectTelemetryParameters();
|
||||
CollectToolingInfo();
|
||||
|
||||
|
@ -818,6 +819,19 @@ void Device::CollectTelemetryParameters() {
|
|||
}
|
||||
}
|
||||
|
||||
void Device::CollectPhysicalMemoryInfo() {
|
||||
const auto mem_properties = physical.GetMemoryProperties();
|
||||
const std::size_t num_properties = mem_properties.memoryTypeCount;
|
||||
device_access_memory = 0;
|
||||
for (std::size_t element = 0; element < num_properties; element++) {
|
||||
if ((mem_properties.memoryTypes[element].propertyFlags &
|
||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) != 0) {
|
||||
const std::size_t heap_index = mem_properties.memoryTypes[element].heapIndex;
|
||||
device_access_memory += mem_properties.memoryHeaps[heap_index].size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Device::CollectToolingInfo() {
|
||||
if (!ext_tooling_info) {
|
||||
return;
|
||||
|
|
|
@ -225,6 +225,10 @@ public:
|
|||
return use_asynchronous_shaders;
|
||||
}
|
||||
|
||||
u64 GetDeviceLocalMemory() const {
|
||||
return device_access_memory;
|
||||
}
|
||||
|
||||
private:
|
||||
/// Checks if the physical device is suitable.
|
||||
void CheckSuitability(bool requires_swapchain) const;
|
||||
|
@ -244,6 +248,9 @@ private:
|
|||
/// Collects information about attached tools.
|
||||
void CollectToolingInfo();
|
||||
|
||||
/// Collects information about the device's local memory.
|
||||
void CollectPhysicalMemoryInfo();
|
||||
|
||||
/// Returns a list of queue initialization descriptors.
|
||||
std::vector<VkDeviceQueueCreateInfo> GetDeviceQueueCreateInfos() const;
|
||||
|
||||
|
@ -302,6 +309,8 @@ private:
|
|||
|
||||
/// Nsight Aftermath GPU crash tracker
|
||||
std::unique_ptr<NsightAftermathTracker> nsight_aftermath_tracker;
|
||||
|
||||
u64 device_access_memory;
|
||||
};
|
||||
|
||||
} // namespace Vulkan
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue