diff options
| author | Ac_K <Acoustik666@gmail.com> | 2023-01-13 07:04:59 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-13 06:04:59 +0000 |
| commit | 85faa9d8fa1f8d5b1a80f3506717186f7a7e26c9 (patch) | |
| tree | c6a9bfe24c089f1c748dcc6ef34aa2e5262c5b8e /Ryujinx.Graphics.Vulkan/MemoryAllocator.cs | |
| parent | dca5b14493e730960ed5cd67906278ecea969b3a (diff) | |
Revert "Relax Vulkan requirements (#4228)" (#4279)
This reverts commit dca5b14493e730960ed5cd67906278ecea969b3a.
Diffstat (limited to 'Ryujinx.Graphics.Vulkan/MemoryAllocator.cs')
| -rw-r--r-- | Ryujinx.Graphics.Vulkan/MemoryAllocator.cs | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/Ryujinx.Graphics.Vulkan/MemoryAllocator.cs b/Ryujinx.Graphics.Vulkan/MemoryAllocator.cs index 83c0a324..eea4e60b 100644 --- a/Ryujinx.Graphics.Vulkan/MemoryAllocator.cs +++ b/Ryujinx.Graphics.Vulkan/MemoryAllocator.cs @@ -27,16 +27,7 @@ namespace Ryujinx.Graphics.Vulkan MemoryRequirements requirements, MemoryPropertyFlags flags = 0) { - return AllocateDeviceMemory(physicalDevice, requirements, flags, flags); - } - - public MemoryAllocation AllocateDeviceMemory( - PhysicalDevice physicalDevice, - MemoryRequirements requirements, - MemoryPropertyFlags flags, - MemoryPropertyFlags alternativeFlags) - { - int memoryTypeIndex = FindSuitableMemoryTypeIndex(_api, physicalDevice, requirements.MemoryTypeBits, flags, alternativeFlags); + int memoryTypeIndex = FindSuitableMemoryTypeIndex(_api, physicalDevice, requirements.MemoryTypeBits, flags); if (memoryTypeIndex < 0) { return default; @@ -65,35 +56,21 @@ namespace Ryujinx.Graphics.Vulkan return newBl.Allocate(size, alignment, map); } - private static int FindSuitableMemoryTypeIndex( - Vk api, - PhysicalDevice physicalDevice, - uint memoryTypeBits, - MemoryPropertyFlags flags, - MemoryPropertyFlags alternativeFlags) + private static int FindSuitableMemoryTypeIndex(Vk api, PhysicalDevice physicalDevice, uint memoryTypeBits, MemoryPropertyFlags flags) { - int bestCandidateIndex = -1; - api.GetPhysicalDeviceMemoryProperties(physicalDevice, out var properties); for (int i = 0; i < properties.MemoryTypeCount; i++) { var type = properties.MemoryTypes[i]; - if ((memoryTypeBits & (1 << i)) != 0) + if ((memoryTypeBits & (1 << i)) != 0 && type.PropertyFlags.HasFlag(flags)) { - if (type.PropertyFlags.HasFlag(flags)) - { - return i; - } - else if (type.PropertyFlags.HasFlag(alternativeFlags)) - { - bestCandidateIndex = i; - } + return i; } } - return bestCandidateIndex; + return -1; } public void Dispose() |
