aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Vulkan/BufferManager.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2023-01-26 18:34:35 -0300
committerGitHub <noreply@github.com>2023-01-26 18:34:35 -0300
commit296c4a3d012b1203b1b7e58cdc34c334159e1599 (patch)
tree837659e6401356fac77a93681e3c678724074acf /Ryujinx.Graphics.Vulkan/BufferManager.cs
parente7cf4e6eaf528aa72e27f6ba86259c00813bc776 (diff)
Relax Vulkan requirements (#4282)1.1.596
* Relax Vulkan requirements * Fix MaxColorAttachmentIndex * Fix ColorBlendAttachmentStateCount value mismatch for background pipelines * Change query capability check to check for pipeline statistics query rather than geometry shader support
Diffstat (limited to 'Ryujinx.Graphics.Vulkan/BufferManager.cs')
-rw-r--r--Ryujinx.Graphics.Vulkan/BufferManager.cs22
1 files changed, 20 insertions, 2 deletions
diff --git a/Ryujinx.Graphics.Vulkan/BufferManager.cs b/Ryujinx.Graphics.Vulkan/BufferManager.cs
index f3240371..9c50e6ff 100644
--- a/Ryujinx.Graphics.Vulkan/BufferManager.cs
+++ b/Ryujinx.Graphics.Vulkan/BufferManager.cs
@@ -14,6 +14,12 @@ namespace Ryujinx.Graphics.Vulkan
MemoryPropertyFlags.HostCoherentBit |
MemoryPropertyFlags.HostCachedBit;
+ // Some drivers don't expose a "HostCached" memory type,
+ // so we need those alternative flags for the allocation to succeed there.
+ private const MemoryPropertyFlags DefaultBufferMemoryAltFlags =
+ MemoryPropertyFlags.HostVisibleBit |
+ MemoryPropertyFlags.HostCoherentBit;
+
private const MemoryPropertyFlags DeviceLocalBufferMemoryFlags =
MemoryPropertyFlags.DeviceLocalBit;
@@ -94,9 +100,21 @@ namespace Ryujinx.Graphics.Vulkan
gd.Api.CreateBuffer(_device, in bufferCreateInfo, null, out var buffer).ThrowOnError();
gd.Api.GetBufferMemoryRequirements(_device, buffer, out var requirements);
- var allocateFlags = deviceLocal ? DeviceLocalBufferMemoryFlags : DefaultBufferMemoryFlags;
+ MemoryPropertyFlags allocateFlags;
+ MemoryPropertyFlags allocateFlagsAlt;
+
+ if (deviceLocal)
+ {
+ allocateFlags = DeviceLocalBufferMemoryFlags;
+ allocateFlagsAlt = DeviceLocalBufferMemoryFlags;
+ }
+ else
+ {
+ allocateFlags = DefaultBufferMemoryFlags;
+ allocateFlagsAlt = DefaultBufferMemoryAltFlags;
+ }
- var allocation = gd.MemoryAllocator.AllocateDeviceMemory(_physicalDevice, requirements, allocateFlags);
+ var allocation = gd.MemoryAllocator.AllocateDeviceMemory(_physicalDevice, requirements, allocateFlags, allocateFlagsAlt);
if (allocation.Memory.Handle == 0UL)
{