From 015bde8d5a46f32979c00dbb1feb4b3d80729c44 Mon Sep 17 00:00:00 2001 From: skallweitNV <64953474+skallweitNV@users.noreply.github.com> Date: Fri, 4 Nov 2022 17:34:53 +0100 Subject: Add AdapterLUID to identify GPU adapters (#2492) * Add AdapterLUID to identify GPU adapters * Remove adapter option in render-test --- tools/gfx/d3d11/d3d11-device.cpp | 10 +++++----- tools/gfx/d3d11/d3d11-helper-functions.cpp | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'tools/gfx/d3d11') diff --git a/tools/gfx/d3d11/d3d11-device.cpp b/tools/gfx/d3d11/d3d11-device.cpp index fbc24c9ce..4872d2a54 100644 --- a/tools/gfx/d3d11/d3d11-device.cpp +++ b/tools/gfx/d3d11/d3d11-device.cpp @@ -112,12 +112,12 @@ SlangResult DeviceImpl::initialize(const Desc& desc) const auto deviceCheckFlags = combiner.getCombination(i); D3DUtil::createFactory(deviceCheckFlags, m_dxgiFactory); - // If we have an adapter set on the desc, look it up. We only need to do so for hardware + // If we have an adapter set on the desc, look it up. ComPtr adapter; - if (desc.adapter && (deviceCheckFlags & DeviceCheckFlag::UseHardwareDevice)) + if (desc.adapterLUID) { List> dxgiAdapters; - D3DUtil::findAdapters(deviceCheckFlags, Slang::UnownedStringSlice(desc.adapter), dxgiAdapters); + D3DUtil::findAdapters(deviceCheckFlags, desc.adapterLUID, m_dxgiFactory, dxgiAdapters); if (dxgiAdapters.getCount() == 0) { continue; @@ -147,7 +147,7 @@ SlangResult DeviceImpl::initialize(const Desc& desc) m_device.writeRef(), &featureLevel, m_immediateContext.writeRef()); - // Check if successfully constructed - if so we are done. + // Check if successfully constructed - if so we are done. if (SLANG_SUCCEEDED(res)) { break; @@ -882,7 +882,7 @@ Result DeviceImpl::createInputLayout(IInputLayout::Desc const& desc, IInputLayou default: return SLANG_FAIL; } - + hlslCursor += sprintf(hlslCursor, "%s a%d : %s%d", typeName, (int)ii, diff --git a/tools/gfx/d3d11/d3d11-helper-functions.cpp b/tools/gfx/d3d11/d3d11-helper-functions.cpp index 93065077a..4e1df9879 100644 --- a/tools/gfx/d3d11/d3d11-helper-functions.cpp +++ b/tools/gfx/d3d11/d3d11-helper-functions.cpp @@ -348,8 +348,7 @@ namespace d3d11 Result SLANG_MCALL getD3D11Adapters(List& outAdapters) { List> dxgiAdapters; - DeviceCheckFlags flags = DeviceCheckFlag::UseHardwareDevice; - SLANG_RETURN_ON_FAIL(D3DUtil::findAdapters(flags, UnownedStringSlice(), dxgiAdapters)); + SLANG_RETURN_ON_FAIL(D3DUtil::findAdapters(DeviceCheckFlag::UseHardwareDevice, nullptr, dxgiAdapters)); outAdapters.clear(); for (const auto& dxgiAdapter : dxgiAdapters) @@ -361,6 +360,7 @@ Result SLANG_MCALL getD3D11Adapters(List& outAdapters) memcpy(info.name, name.getBuffer(), Math::Min(name.getLength(), (Index)sizeof(AdapterInfo::name) - 1)); info.vendorID = desc.VendorId; info.deviceID = desc.DeviceId; + info.luid = D3DUtil::getAdapterLUID(dxgiAdapter); outAdapters.add(info); } return SLANG_OK; -- cgit v1.2.3