Fix DeviceLuid byte ordering on MacOS GPU interop by dirivero · Pull Request #21293 · AvaloniaUI/Avalonia (original) (raw)

Fixes #21291

What does the pull request do?

MetalExternalObjectsFeature.DeviceLuid is supposed to be byte-equal to VkPhysicalDeviceVulkan11Properties.deviceLUID returned by MoltenVK. In Avalonia 12 it ends up byte-reversed.

The problem was that bytes.Reverse() in MetalExternalObjectsFeature constructor was resolving to System.Linq.Enumerable.Reverse<T>(). This PRs calls AsSpan() to remove the ambiguity and resolve to MemoryExtensions.Reverse<T>(this Span<T>).

What is the current behavior?

Avalonia's DeviceLuid bytes are in reverse order when compared to what MoltenVK exposes.

What is the updated/expected behavior with this PR?

Avalonia's DeviceLuid bytes are in the same order of what MoltenVK exposes.

How was the solution implemented (if it's not obvious)?

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

Fixes #21291