AvaloniaUI/Avalonia · error · ArgumentException
Device with the corresponding LUID not found
Error message
Device with the corresponding LUID not found
What it means
Thrown by D3DMemoryHelper.GetAdapterByLuid (ArgumentException) when no DXGI adapter enumerated via IDXGIFactory1.EnumAdapters has an AdapterLuid matching the supplied Vulkan device LUID. The Vulkan/D3D11 interop requires both APIs to reference the same physical GPU, identified by LUID.
Source
Thrown at samples/GpuInterop/VulkanDemo/D3DMemoryHelper.cs:68
return device;
}
private static unsafe ComPtr<IDXGIAdapter> GetAdapterByLuid(ComPtr<IDXGIFactory1> factory, Luid luid)
{
var index = 0u;
ComPtr<IDXGIAdapter> adapter = default;
while (factory.EnumAdapters(index, adapter.GetAddressOf()) != DxgiErrorNotFound)
{
AdapterDesc adapterDesc;
if (adapter.GetDesc(&adapterDesc) == 0 & AreLuidsEqual(adapterDesc.AdapterLuid, luid))
return adapter;
adapter.Dispose();
++index;
}
throw new ArgumentException("Device with the corresponding LUID not found");
}
public static unsafe ComPtr<ID3D11Texture2D> CreateMemoryHandle(ComPtr<ID3D11Device> device, PixelSize size, VulkanFormat format)
{
if (format != VulkanFormat.R8G8B8A8Unorm)
throw new ArgumentException("Not supported format");
ComPtr<ID3D11Texture2D> texture = default;
var textureDesc = new Texture2DDesc
{
Format = Format.FormatR8G8B8A8Unorm,
Width = (uint)size.Width,
Height = (uint)size.Height,
ArraySize = 1,
MipLevels = 1,
SampleDesc = new SampleDesc(1, 0),
Usage = Usage.Default,
BindFlags = (uint)(BindFlag.RenderTarget | BindFlag.ShaderResource),View on GitHub (pinned to 11c5427268)
Solutions
- Force Vulkan and D3D11 onto the same physical GPU (e.g. select the Vulkan device whose LUID matches a known D3D adapter).
- Use VkPhysicalDeviceIDProperties (deviceLUID) to obtain the exact LUID to compare against DXGI AdapterDesc.AdapterLuid.
- On multi-GPU systems, prefer the discrete adapter in both APIs or disable one GPU for testing.
- Update GPU drivers so LUIDs are reported consistently across APIs.
Example fix
// before var adapter = GetAdapterByLuid(factory, vulkanLuid); // no match -> throws // after // pick the Vulkan physical device whose deviceLUID matches a DXGI adapter first var dxgiLuid = PickMatchingDxgiLuid(factory, vkDeviceLuid); var adapter = GetAdapterByLuid(factory, dxgiLuid);
Defensive patterns
Strategy: validation
Validate before calling
Luid? findMatchingLuid(ComPtr<IDXGIFactory1> factory, Luid vkLuid) {
uint i = 0; ComPtr<IDXGIAdapter> a = default;
while (factory.EnumAdapters(i, a.GetAddressOf()) != DxgiErrorNotFound) {
AdapterDesc d; if (a.GetDesc(&d) == 0 && AreLuidsEqual(d.AdapterLuid, vkLuid)) return d.AdapterLuid;
a.Dispose(); ++i;
}
return null;
}
if (findMatchingLuid(factory, vkLuid) is null) { /* select a different Vulkan device */ } Type guard
static bool LuidMatchesAnyAdapter(ComPtr<IDXGIFactory1> factory, Luid luid) {
uint i = 0; ComPtr<IDXGIAdapter> a = default;
while (factory.EnumAdapters(i, a.GetAddressOf()) != DxgiErrorNotFound) {
AdapterDesc d; if (a.GetDesc(&d) == 0 && AreLuidsEqual(d.AdapterLuid, luid)) return true;
a.Dispose(); ++i;
}
return false;
} Try / catch
try { return GetAdapterByLuid(factory, luid); }
catch (ArgumentException ex) when (ex.Message.Contains("LUID")) { /* pick the Vulkan device whose LUID matches a DXGI adapter, then retry */ throw; } Prevention
- Use VkPhysicalDeviceIDProperties.deviceLUID to match the Vulkan device to a DXGI adapter.
- On multi-GPU systems, force both APIs to the same physical GPU.
- Keep GPU drivers current so LUIDs agree across APIs.
When it happens
Trigger: Enumerating DXGI adapters after acquiring a VkPhysicalDevice, where the Vulkan device's LUID does not match any D3D11 adapter. Common on multi-GPU systems where Vulkan picked one GPU (e.g. discrete) but DXGI enumeration/selection finds only another, or the LUID comparison is mismatched.
Common situations: Multi-GPU laptops (integrated + discrete) where Vulkan and D3D land on different GPUs; driver LUID reporting discrepancies; Vulkan device with no valid deviceLUID extension; the wrong factory/adapter enumeration path.
Related errors
- Not supported format
- Transition elements have different parents.
- Controls for PageSlide must have same parent.
- Vulkan D3DDevice wasn't created
- Value must be less than 10.
AI-assisted analysis of AvaloniaUI/Avalonia@11c5427268 (2026-08-13).
Data as JSON: /api/errors/8533098f8a98baf1.
Report an issue: GitHub.