diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index c2f09cb9f..c69424ca7 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -543,20 +543,23 @@ namespace bgfx { namespace d3d11 g_caps.gpu[ii].deviceId = (uint16_t)desc.DeviceId; ++g_caps.numGPUs; - if ( (BGFX_PCI_ID_NONE != g_caps.vendorId || 0 != g_caps.deviceId) - && (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId) - && ( 0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) ) + if (NULL == m_adapter) { - m_adapter = adapter; - m_adapter->AddRef(); - m_driverType = D3D_DRIVER_TYPE_UNKNOWN; - } + if ( (BGFX_PCI_ID_NONE != g_caps.vendorId || 0 != g_caps.deviceId) + && (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId) + && ( 0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) ) + { + m_adapter = adapter; + m_adapter->AddRef(); + m_driverType = D3D_DRIVER_TYPE_UNKNOWN; + } - if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) - && 0 != strstr(description, "PerfHUD") ) - { - m_adapter = adapter; - m_driverType = D3D_DRIVER_TYPE_REFERENCE; + if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) + && 0 != strstr(description, "PerfHUD") ) + { + m_adapter = adapter; + m_driverType = D3D_DRIVER_TYPE_REFERENCE; + } } } diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index a6370f08f..f40cebc78 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -380,20 +380,22 @@ namespace bgfx { namespace d3d9 g_caps.gpu[ii].vendorId = (uint16_t)desc.VendorId; g_caps.gpu[ii].deviceId = (uint16_t)desc.DeviceId; - if ( (BGFX_PCI_ID_NONE != g_caps.vendorId || 0 != g_caps.deviceId) - && (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId) - && ( 0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) ) + if (D3DADAPTER_DEFAULT == m_adapter) { - m_adapter = ii; - } + if ( (BGFX_PCI_ID_NONE != g_caps.vendorId || 0 != g_caps.deviceId) + && (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId) + && ( 0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) ) + { + m_adapter = ii; + } -#if BGFX_CONFIG_DEBUG_PERFHUD - if (0 != strstr(desc.Description, "PerfHUD") ) - { - m_adapter = ii; - m_deviceType = D3DDEVTYPE_REF; + if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) + && 0 != strstr(description, "PerfHUD")) + { + m_adapter = ii; + m_deviceType = D3DDEVTYPE_REF; + } } -#endif // BGFX_CONFIG_DEBUG_PERFHUD } }