Create Contains impl for arrays, fix device id blacklist detection

This commit is contained in:
CasualPokePlayer 2024-08-30 16:10:54 -07:00
parent c54102b3a6
commit d70daae5d6
2 changed files with 10 additions and 2 deletions

View File

@ -6,6 +6,7 @@ using Vortice.Direct3D;
using Vortice.Direct3D11;
using Vortice.DXGI;
using BizHawk.Common.CollectionExtensions;
using BizHawk.Common.StringExtensions;
using static SDL2.SDL;
@ -42,7 +43,7 @@ namespace BizHawk.Bizware.Graphics
Unknown
}
private static readonly ushort[] _blacklistedIntelDeviceIds =
private static readonly int[] _blacklistedIntelDeviceIds =
[
0x1602, 0x1606, 0x160A, 0x160B,
0x160D, 0x160E, 0x1612, 0x1616,
@ -151,7 +152,7 @@ namespace BizHawk.Bizware.Graphics
{
// avoid Broadwell gpus, these have been reported crashing with gl interop
// (specifically, Intel HD Graphics 5500, presumingly all Broadwell are affected, better safe than sorry)
if (Array.IndexOf(_blacklistedIntelDeviceIds, adapter.Description.DeviceId) != -1)
if (_blacklistedIntelDeviceIds.Contains(adapter.Description.DeviceId))
{
return;
}

View File

@ -110,6 +110,13 @@ namespace BizHawk.Common.CollectionExtensions
foreach (var item in collection) list.Add(item);
}
/// <remarks>
/// Contains method for arrays which does not need Linq, but rather uses Array.IndexOf
/// similar to <see cref="ICollection{T}.Contains">ICollection's Contains</see>
/// </remarks>
public static bool Contains<T>(this T[] array, T value)
=> Array.IndexOf(array, value) >= 0;
/// <returns>
/// portion of <paramref name="dest"/> that was written to,
/// unless either span is empty, in which case the other reference is returned<br/>