mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-09-20 17:51:13 +02:00
Vulkan: Enable VK_EXT_memory_priority for Pageable Memory to work properly
This commit is contained in:
@@ -108,12 +108,19 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
PHostPointer = (void*)pageAlignedPointer,
|
||||
};
|
||||
|
||||
MemoryPriorityAllocateInfoEXT priorityInfo = new()
|
||||
{
|
||||
SType = StructureType.MemoryPriorityAllocateInfoExt,
|
||||
Priority = 0.0f,
|
||||
PNext = &importInfo,
|
||||
};
|
||||
|
||||
var memoryAllocateInfo = new MemoryAllocateInfo
|
||||
{
|
||||
SType = StructureType.MemoryAllocateInfo,
|
||||
AllocationSize = pageAlignedSize,
|
||||
MemoryTypeIndex = (uint)memoryTypeIndex,
|
||||
PNext = &importInfo,
|
||||
PNext = &priorityInfo,
|
||||
};
|
||||
|
||||
Result result = _api.AllocateMemory(_device, in memoryAllocateInfo, null, out var deviceMemory);
|
||||
|
||||
@@ -46,7 +46,8 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
"VK_KHR_8bit_storage",
|
||||
"VK_KHR_maintenance2",
|
||||
"VK_EXT_attachment_feedback_loop_layout",
|
||||
"VK_EXT_attachment_feedback_loop_dynamic_state"
|
||||
"VK_EXT_attachment_feedback_loop_dynamic_state",
|
||||
"VK_EXT_memory_priority"
|
||||
];
|
||||
|
||||
private static readonly string[] _requiredExtensions =
|
||||
@@ -466,7 +467,21 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
PNext = features2.PNext,
|
||||
};
|
||||
|
||||
if (physicalDevice.IsDeviceExtensionPresent(ExtPageableDeviceLocalMemory.ExtensionName))
|
||||
{
|
||||
features2.PNext = &supportedPageableDeviceLocalMemoryFeatures;
|
||||
}
|
||||
|
||||
PhysicalDeviceMemoryPriorityFeaturesEXT supportedDeviceMemoryPriorityFeatures = new()
|
||||
{
|
||||
SType = StructureType.PhysicalDeviceMemoryPriorityFeaturesExt,
|
||||
PNext = features2.PNext,
|
||||
};
|
||||
|
||||
if (physicalDevice.IsDeviceExtensionPresent("VK_EXT_memory_priority"))
|
||||
{
|
||||
features2.PNext = &supportedDeviceMemoryPriorityFeatures;
|
||||
}
|
||||
|
||||
PhysicalDeviceVulkan12Features supportedPhysicalDeviceVulkan12Features = new()
|
||||
{
|
||||
@@ -640,14 +655,31 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
pExtendedFeatures = &featuresDynamicAttachmentFeedbackLoop;
|
||||
}
|
||||
|
||||
if (physicalDevice.IsDeviceExtensionPresent(ExtPageableDeviceLocalMemory.ExtensionName) &&
|
||||
supportedPageableDeviceLocalMemoryFeatures.PageableDeviceLocalMemory)
|
||||
{
|
||||
PhysicalDevicePageableDeviceLocalMemoryFeaturesEXT featuresPageableDeviceLocalMemory = new()
|
||||
{
|
||||
SType = StructureType.PhysicalDevicePageableDeviceLocalMemoryFeaturesExt,
|
||||
PNext = pExtendedFeatures,
|
||||
PageableDeviceLocalMemory = supportedPageableDeviceLocalMemoryFeatures.PageableDeviceLocalMemory,
|
||||
PageableDeviceLocalMemory = true,
|
||||
};
|
||||
|
||||
pExtendedFeatures = &featuresPageableDeviceLocalMemory;
|
||||
}
|
||||
|
||||
if (physicalDevice.IsDeviceExtensionPresent("VK_EXT_memory_priority") &&
|
||||
supportedDeviceMemoryPriorityFeatures.MemoryPriority)
|
||||
{
|
||||
PhysicalDeviceMemoryPriorityFeaturesEXT featuresDeviceMemoryPriority = new()
|
||||
{
|
||||
SType = StructureType.PhysicalDeviceMemoryPriorityFeaturesExt,
|
||||
PNext = pExtendedFeatures,
|
||||
MemoryPriority = true,
|
||||
};
|
||||
|
||||
pExtendedFeatures = &featuresDeviceMemoryPriority;
|
||||
}
|
||||
|
||||
var enabledExtensions = _requiredExtensions.Union(_desirableExtensions.Intersect(physicalDevice.DeviceExtensions)).ToArray();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user