Browse Source

Fix DeviceLuid byte ordering on MacOS GPU interop (#21293)

bytes.Reverse() was resolving to System.Linq.Enumberable.Reverse(). Forcing now to
MemoryExtensions.Reverse(Span) by calling AsSpan().
pull/21301/head
Diego Rivero 6 months ago
committed by GitHub
parent
commit
550b57db33
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      src/Avalonia.Native/AvaloniaNativeGlPlatformGraphics.cs
  2. 2
      src/Avalonia.Native/Metal.cs

2
src/Avalonia.Native/AvaloniaNativeGlPlatformGraphics.cs

@ -264,7 +264,7 @@ namespace Avalonia.Native
{
// We are reversing bytes to match MoltenVK (LUID is a Vulkan term after all)
var bytes = BitConverter.GetBytes(registryId);
bytes.Reverse();
bytes.AsSpan().Reverse();
DeviceLuid = bytes;
}
}

2
src/Avalonia.Native/Metal.cs

@ -102,7 +102,7 @@ internal class MetalExternalObjectsFeature : IMetalExternalObjectsFeature
if (_device.GetIOKitRegistryId(&registryId) != 0)
{
var bytes = BitConverter.GetBytes(registryId);
bytes.Reverse();
bytes.AsSpan().Reverse();
DeviceLuid = bytes;
}
}

Loading…
Cancel
Save