Vulkan: Swap to system memory for device local memory
This PR will swap device local memory to system ram. It relies on VK_EXT_external_memory and VK_EXT_pageable_device_local_memory extensions to be supported by the system. Most platforms support these extensions. Pull Request: https://projects.blender.org/blender/blender/pulls/144422
This commit is contained in:
@@ -393,6 +393,22 @@ class GHOST_DeviceVK {
|
||||
feature_struct_ptr.push_back(&fragment_shader_barycentric);
|
||||
}
|
||||
|
||||
/* VK_EXT_memory_priority */
|
||||
VkPhysicalDeviceMemoryPriorityFeaturesEXT memory_priority = {
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT, nullptr, VK_TRUE};
|
||||
if (extension_enabled(VK_EXT_MEMORY_PRIORITY_EXTENSION_NAME)) {
|
||||
feature_struct_ptr.push_back(&memory_priority);
|
||||
}
|
||||
|
||||
/* VK_EXT_pageable_device_local_memory */
|
||||
VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT pageable_device_local_memory = {
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT,
|
||||
nullptr,
|
||||
VK_TRUE};
|
||||
if (extension_enabled(VK_EXT_PAGEABLE_DEVICE_LOCAL_MEMORY_EXTENSION_NAME)) {
|
||||
feature_struct_ptr.push_back(&pageable_device_local_memory);
|
||||
}
|
||||
|
||||
/* Link all registered feature structs. */
|
||||
for (int i = 1; i < feature_struct_ptr.size(); i++) {
|
||||
((VkBaseInStructure *)(feature_struct_ptr[i - 1]))->pNext =
|
||||
@@ -1291,6 +1307,8 @@ GHOST_TSuccess GHOST_ContextVK::initializeDrawingContext()
|
||||
optional_device_extensions.push_back(VK_EXT_ROBUSTNESS_2_EXTENSION_NAME);
|
||||
optional_device_extensions.push_back(VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME);
|
||||
optional_device_extensions.push_back(VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME);
|
||||
optional_device_extensions.push_back(VK_EXT_MEMORY_PRIORITY_EXTENSION_NAME);
|
||||
optional_device_extensions.push_back(VK_EXT_PAGEABLE_DEVICE_LOCAL_MEMORY_EXTENSION_NAME);
|
||||
|
||||
VkInstance instance = VK_NULL_HANDLE;
|
||||
if (!vulkan_device.has_value()) {
|
||||
|
||||
Reference in New Issue
Block a user