Use RobustBufferAccess on NVIDIA gpus

Avoids the SMO waterfall triangle on older NVIDIA gpus.
This commit is contained in:
riperiperi 2022-06-11 18:33:03 +01:00
parent db5a1a6aa6
commit c98b61ade8
3 changed files with 21 additions and 9 deletions

View file

@ -8,4 +8,19 @@ namespace Ryujinx.Graphics.Vulkan
Qualcomm,
Unknown
}
static class VendorUtils
{
public static Vendor FromId(uint id)
{
return id switch
{
0x1002 => Vendor.Amd,
0x10DE => Vendor.Nvidia,
0x8086 => Vendor.Intel,
0x5143 => Vendor.Qualcomm,
_ => Vendor.Unknown
};
}
}
}

View file

@ -477,14 +477,7 @@ namespace Ryujinx.Graphics.Vulkan
_ => $"0x{properties.VendorID:X}"
};
Vendor = properties.VendorID switch
{
0x1002 => Vendor.Amd,
0x10DE => Vendor.Nvidia,
0x8086 => Vendor.Intel,
0x5143 => Vendor.Qualcomm,
_ => Vendor.Unknown
};
Vendor = VendorUtils.FromId(properties.VendorID);
IsAmdWindows = Vendor == Vendor.Amd && RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
IsIntelWindows = Vendor == Vendor.Intel && RuntimeInformation.IsOSPlatform(OSPlatform.Windows);

View file

@ -300,6 +300,9 @@ namespace Ryujinx.Graphics.Vulkan
PQueuePriorities = queuePriorities
};
api.GetPhysicalDeviceProperties(physicalDevice, out var properties);
bool useRobustBufferAccess = VendorUtils.FromId(properties.VendorID) == Vendor.Nvidia;
var supportedFeatures = api.GetPhysicalDeviceFeature(physicalDevice);
var features = new PhysicalDeviceFeatures()
@ -321,7 +324,8 @@ namespace Ryujinx.Graphics.Vulkan
// ShaderStorageImageReadWithoutFormat = true,
// ShaderStorageImageWriteWithoutFormat = true,
TessellationShader = true,
VertexPipelineStoresAndAtomics = true
VertexPipelineStoresAndAtomics = true,
RobustBufferAccess = useRobustBufferAccess
};
void* pExtendedFeatures = null;