summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D11
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2019-12-28 05:13:26 +0000
committerassiduous <assiduous@diligentgraphics.com>2019-12-28 05:13:26 +0000
commit9ead3562fb06c14098b7885cc7c736ea4bbc292c (patch)
treef1518a3383204ea2d72f6cb3e372dacdbff553a2 /Graphics/GraphicsEngineD3D11
parentFixed minor issue with draw command test (diff)
downloadDiligentCore-9ead3562fb06c14098b7885cc7c736ea4bbc292c.tar.gz
DiligentCore-9ead3562fb06c14098b7885cc7c736ea4bbc292c.zip
Added AdapterType member to DeviceCaps struct (API Version 240048)
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
-rw-r--r--Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp
index d54b82e7..7b95aef3 100644
--- a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp
@@ -40,6 +40,34 @@
namespace Diligent
{
+static CComPtr<IDXGIAdapter1> DXGIAdapterFromD3D11Device(ID3D11Device* pd3d11Device)
+{
+ CComPtr<IDXGIDevice> pDXGIDevice;
+
+ auto hr = pd3d11Device->QueryInterface(__uuidof(pDXGIDevice), reinterpret_cast<void**>(static_cast<IDXGIDevice**>(&pDXGIDevice)));
+ if (SUCCEEDED(hr))
+ {
+ CComPtr<IDXGIAdapter> pDXGIAdapter;
+ hr = pDXGIDevice->GetAdapter(&pDXGIAdapter);
+ if (SUCCEEDED(hr))
+ {
+ CComPtr<IDXGIAdapter1> pDXGIAdapter1;
+ pDXGIAdapter->QueryInterface(__uuidof(pDXGIAdapter1), reinterpret_cast<void**>(static_cast<IDXGIAdapter1**>(&pDXGIAdapter1)));
+ return pDXGIAdapter1;
+ }
+ else
+ {
+ LOG_ERROR("Failed to get DXGI Adapter from DXGI Device.");
+ }
+ }
+ else
+ {
+ LOG_ERROR("Failed to query IDXGIDevice from D3D device.");
+ }
+
+ return nullptr;
+}
+
RenderDeviceD3D11Impl::RenderDeviceD3D11Impl(IReferenceCounters* pRefCounters,
IMemoryAllocator& RawMemAllocator,
IEngineFactory* pEngineFactory,
@@ -96,6 +124,21 @@ RenderDeviceD3D11Impl::RenderDeviceD3D11Impl(IReferenceCounters* pRefCo
// above 11.0 (for example, 11.1 or 12.0), so bindless resources are never available.
// https://docs.microsoft.com/en-us/windows/win32/direct3d11/overviews-direct3d-11-devices-downlevel-intro#overview-for-each-feature-level
m_DeviceCaps.bBindlessSupported = False;
+
+ if (auto pDXGIAdapter1 = DXGIAdapterFromD3D11Device(pd3d11Device))
+ {
+ DXGI_ADAPTER_DESC1 AdapterDesc = {};
+
+ auto hr = pDXGIAdapter1->GetDesc1(&AdapterDesc);
+ if (SUCCEEDED(hr))
+ {
+ m_DeviceCaps.AdaterType = (AdapterDesc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) ? ADAPTER_TYPE_SOFTWARE : ADAPTER_TYPE_HARDWARE;
+ }
+ else
+ {
+ LOG_ERROR_MESSAGE("Failed to get DXGIDevice adapter desc. Adapter type will be unknown.");
+ }
+ }
}
void RenderDeviceD3D11Impl::TestTextureFormat(TEXTURE_FORMAT TexFormat)