summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3DBase
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-03-30 03:05:30 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-03-30 03:05:30 +0000
commitb0b568e32e854a720e97e1085151f54c7e62f047 (patch)
tree8d3d99becd2b835ed247e4c90f38c6409287aab3 /Graphics/GraphicsEngineD3DBase
parentImplemented hardware adapter and display mode enumeration (diff)
downloadDiligentCore-b0b568e32e854a720e97e1085151f54c7e62f047.tar.gz
DiligentCore-b0b568e32e854a720e97e1085151f54c7e62f047.zip
Implemented option to specify hardware adapter when initializing the engine in d3d mode
Diffstat (limited to 'Graphics/GraphicsEngineD3DBase')
-rw-r--r--Graphics/GraphicsEngineD3DBase/include/EngineFactoryD3DBase.h37
1 files changed, 19 insertions, 18 deletions
diff --git a/Graphics/GraphicsEngineD3DBase/include/EngineFactoryD3DBase.h b/Graphics/GraphicsEngineD3DBase/include/EngineFactoryD3DBase.h
index 3e91851a..86142c8c 100644
--- a/Graphics/GraphicsEngineD3DBase/include/EngineFactoryD3DBase.h
+++ b/Graphics/GraphicsEngineD3DBase/include/EngineFactoryD3DBase.h
@@ -147,30 +147,13 @@ public:
}
}
-private:
-
- template<DeviceType DevType>
- bool CheckAdapterCompatibility(IDXGIAdapter1 *pDXGIAdapter);
-
- template<>
- bool CheckAdapterCompatibility<DeviceType::D3D11>(IDXGIAdapter1 *pDXGIAdapter)
- {
- return true;
- }
-
- template<>
- bool CheckAdapterCompatibility<DeviceType::D3D12>(IDXGIAdapter1 *pDXGIAdapter)
- {
- auto hr = D3D12CreateDevice(pDXGIAdapter, D3D_FEATURE_LEVEL_11_0, _uuidof(ID3D12Device), nullptr);
- return SUCCEEDED(hr);
- }
std::vector<CComPtr<IDXGIAdapter1>> FindCompatibleAdapters()
{
std::vector<CComPtr<IDXGIAdapter1>> DXGIAdapters;
CComPtr<IDXGIFactory2> pFactory;
- if (FAILED(CreateDXGIFactory(__uuidof(IDXGIFactory2), (void**)&pFactory)))
+ if (FAILED(CreateDXGIFactory1(__uuidof(IDXGIFactory2), (void**)&pFactory)))
{
LOG_ERROR_MESSAGE("Failed to create DXGI Factory");
return std::move(DXGIAdapters);
@@ -198,6 +181,24 @@ private:
return std::move(DXGIAdapters);
}
+
+private:
+
+ template<DeviceType DevType>
+ bool CheckAdapterCompatibility(IDXGIAdapter1 *pDXGIAdapter);
+
+ template<>
+ bool CheckAdapterCompatibility<DeviceType::D3D11>(IDXGIAdapter1 *pDXGIAdapter)
+ {
+ return true;
+ }
+
+ template<>
+ bool CheckAdapterCompatibility<DeviceType::D3D12>(IDXGIAdapter1 *pDXGIAdapter)
+ {
+ auto hr = D3D12CreateDevice(pDXGIAdapter, D3D_FEATURE_LEVEL_11_0, _uuidof(ID3D12Device), nullptr);
+ return SUCCEEDED(hr);
+ }
};
}