mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-09-28 00:27:58 +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,
|
PHostPointer = (void*)pageAlignedPointer,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MemoryPriorityAllocateInfoEXT priorityInfo = new()
|
||||||
|
{
|
||||||
|
SType = StructureType.MemoryPriorityAllocateInfoExt,
|
||||||
|
Priority = 0.0f,
|
||||||
|
PNext = &importInfo,
|
||||||
|
};
|
||||||
|
|
||||||
var memoryAllocateInfo = new MemoryAllocateInfo
|
var memoryAllocateInfo = new MemoryAllocateInfo
|
||||||
{
|
{
|
||||||
SType = StructureType.MemoryAllocateInfo,
|
SType = StructureType.MemoryAllocateInfo,
|
||||||
AllocationSize = pageAlignedSize,
|
AllocationSize = pageAlignedSize,
|
||||||
MemoryTypeIndex = (uint)memoryTypeIndex,
|
MemoryTypeIndex = (uint)memoryTypeIndex,
|
||||||
PNext = &importInfo,
|
PNext = &priorityInfo,
|
||||||
};
|
};
|
||||||
|
|
||||||
Result result = _api.AllocateMemory(_device, in memoryAllocateInfo, null, out var deviceMemory);
|
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_8bit_storage",
|
||||||
"VK_KHR_maintenance2",
|
"VK_KHR_maintenance2",
|
||||||
"VK_EXT_attachment_feedback_loop_layout",
|
"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 =
|
private static readonly string[] _requiredExtensions =
|
||||||
@@ -466,7 +467,21 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
PNext = features2.PNext,
|
PNext = features2.PNext,
|
||||||
};
|
};
|
||||||
|
|
||||||
features2.PNext = &supportedPageableDeviceLocalMemoryFeatures;
|
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()
|
PhysicalDeviceVulkan12Features supportedPhysicalDeviceVulkan12Features = new()
|
||||||
{
|
{
|
||||||
@@ -640,14 +655,31 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
pExtendedFeatures = &featuresDynamicAttachmentFeedbackLoop;
|
pExtendedFeatures = &featuresDynamicAttachmentFeedbackLoop;
|
||||||
}
|
}
|
||||||
|
|
||||||
PhysicalDevicePageableDeviceLocalMemoryFeaturesEXT featuresPageableDeviceLocalMemory = new()
|
if (physicalDevice.IsDeviceExtensionPresent(ExtPageableDeviceLocalMemory.ExtensionName) &&
|
||||||
|
supportedPageableDeviceLocalMemoryFeatures.PageableDeviceLocalMemory)
|
||||||
{
|
{
|
||||||
SType = StructureType.PhysicalDevicePageableDeviceLocalMemoryFeaturesExt,
|
PhysicalDevicePageableDeviceLocalMemoryFeaturesEXT featuresPageableDeviceLocalMemory = new()
|
||||||
PNext = pExtendedFeatures,
|
{
|
||||||
PageableDeviceLocalMemory = supportedPageableDeviceLocalMemoryFeatures.PageableDeviceLocalMemory,
|
SType = StructureType.PhysicalDevicePageableDeviceLocalMemoryFeaturesExt,
|
||||||
};
|
PNext = pExtendedFeatures,
|
||||||
|
PageableDeviceLocalMemory = true,
|
||||||
|
};
|
||||||
|
|
||||||
pExtendedFeatures = &featuresPageableDeviceLocalMemory;
|
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();
|
var enabledExtensions = _requiredExtensions.Union(_desirableExtensions.Intersect(physicalDevice.DeviceExtensions)).ToArray();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user