From 8f3708fe28fc682ff58b2ee46ff105cdd9c0b522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Tue, 31 Mar 2015 22:01:50 -0700 Subject: [PATCH] Cleanup. --- src/renderer_d3d11.cpp | 27 +++++++++++++++------------ src/renderer_d3d9.cpp | 24 +++++++++++++----------- 2 files changed, 28 insertions(+), 23 deletions(-) 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 } }