From 86649a49abccfc98a40a574ebed294026fa12078 Mon Sep 17 00:00:00 2001 From: Rui Shi Date: Thu, 11 Jun 2026 15:34:44 -0700 Subject: [PATCH] D3D9On12: fix clang errors in 9on12Adapter.cpp Fixes three clang-cl errors surfaced when building under USE_CLANG=1, all in Adapter::Adapter: * CComQIPtr p = pAdapterIUnknown -> pAdapterIUnknown.p (lines 234, 245) Clang refuses two chained user-defined conversions; using .p makes the IUnknown* conversion explicit. * &m_pD3D12Device->GetAdapterLuid() -> stash LUID in a local first (line 261) Clang -Waddress-of-temporary; GetAdapterLuid() returns by value. Byte-identical behavior on MSVC; validated against an OS enlistment by building onecoreuap\windows\DirectX\dxg\inactive\d3d9\d3d9on12 under both USE_CLANG=1 and MSVC. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/9on12Adapter.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/9on12Adapter.cpp b/src/9on12Adapter.cpp index 6bac6c2..a120707 100644 --- a/src/9on12Adapter.cpp +++ b/src/9on12Adapter.cpp @@ -231,7 +231,7 @@ namespace D3D9on12 if (pAdapter) { - CComQIPtr pDXCoreAdapter = pAdapter; + CComQIPtr pDXCoreAdapter = pAdapter.p; ThrowFailure(pDXCoreAdapter->GetProperty(DXCoreAdapterProperty::HardwareID, &m_HWIDs)); ThrowFailure(pDXCoreAdapter->GetProperty(DXCoreAdapterProperty::DriverVersion, &m_DriverVersion)); } @@ -242,7 +242,7 @@ namespace D3D9on12 ThrowFailure(CreateDXGIFactory2(0, IID_PPV_ARGS(&pFactory))); ThrowFailure(pFactory->EnumAdapterByLuid(*pAdapterLUID, IID_PPV_ARGS(&pAdapter))); - CComQIPtr pDXGIAdapter = pAdapter; + CComQIPtr pDXGIAdapter = pAdapter.p; DXGI_ADAPTER_DESC AdapterDesc; ThrowFailure(pDXGIAdapter->GetDesc(&AdapterDesc)); m_HWIDs = { AdapterDesc.VendorId, AdapterDesc.DeviceId, AdapterDesc.SubSysId, AdapterDesc.Revision }; @@ -258,7 +258,8 @@ namespace D3D9on12 ThrowFailure(pArgs->pD3D12Device->QueryInterface(&m_pD3D12Device)); // Ensure the app provided D3D12 runtime matches up with the adapter the 9on12 device is being created ondapterLuid)); - ThrowFailure((memcmp(&m_pD3D12Device->GetAdapterLuid(), pAdapterLUID, sizeof(*pAdapterLUID)) == 0) ? + LUID deviceAdapterLuid = m_pD3D12Device->GetAdapterLuid(); + ThrowFailure((memcmp(&deviceAdapterLuid, pAdapterLUID, sizeof(*pAdapterLUID)) == 0) ? S_OK : E_FAIL); } else