diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-12-06 06:31:26 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-12-06 06:31:26 +0000 |
| commit | c4a10aae14aafadc267bb32a2edb53185ced008f (patch) | |
| tree | faeb815b35550d65386bf06955686a82483a501c /Graphics | |
| parent | Added PlatformMisc and StringTools tests (diff) | |
| download | DiligentCore-c4a10aae14aafadc267bb32a2edb53185ced008f.tar.gz DiligentCore-c4a10aae14aafadc267bb32a2edb53185ced008f.zip | |
Added ADAPTER_TYPE enum and AdapterType member to AdapterAttribs struct (API version 240043)
Diffstat (limited to 'Graphics')
6 files changed, 40 insertions, 27 deletions
diff --git a/Graphics/GraphicsEngine/interface/APIInfo.h b/Graphics/GraphicsEngine/interface/APIInfo.h index 866a7693..1e8a74b4 100644 --- a/Graphics/GraphicsEngine/interface/APIInfo.h +++ b/Graphics/GraphicsEngine/interface/APIInfo.h @@ -26,7 +26,7 @@ /// \file /// Diligent API information -#define DILIGENT_API_VERSION 240042 +#define DILIGENT_API_VERSION 240043 #include "../../../Primitives/interface/BasicTypes.h" @@ -55,7 +55,7 @@ struct APIInfo size_t RectSize = 0; size_t CopyTextureAttribsSize = 0; size_t DeviceObjectAttribsSize = 0; - size_t HardwareAdapterAttribsSize = 0; + size_t AdapterAttribsSize = 0; size_t DisplayModeAttribsSize = 0; size_t SwapChainDescSize = 0; size_t FullScreenModeDescSize = 0; diff --git a/Graphics/GraphicsEngine/interface/GraphicsTypes.h b/Graphics/GraphicsEngine/interface/GraphicsTypes.h index da4152c4..859eaf2f 100644 --- a/Graphics/GraphicsEngine/interface/GraphicsTypes.h +++ b/Graphics/GraphicsEngine/interface/GraphicsTypes.h @@ -1084,10 +1084,26 @@ namespace Diligent Name{_Name} {} }; + + /// Hardware adapter type + enum ADAPTER_TYPE : Uint8 + { + /// Adapter type is unknown + ADAPTER_TYPE_UNKNOWN = 0, + + /// Software adapter + ADAPTER_TYPE_SOFTWARE, - /// Hardware adapter attributes - struct HardwareAdapterAttribs + /// Hardware adapter + ADAPTER_TYPE_HARDWARE + }; + + /// Adapter attributes + struct AdapterAttribs { + /// Adapter type. See Diligent::ADAPTER_TYPE. + ADAPTER_TYPE AdapterType = ADAPTER_TYPE_UNKNOWN; + /// A string that contains the adapter description char Description[128] = {}; diff --git a/Graphics/GraphicsEngine/src/APIInfo.cpp b/Graphics/GraphicsEngine/src/APIInfo.cpp index c50b1863..51c824ac 100644 --- a/Graphics/GraphicsEngine/src/APIInfo.cpp +++ b/Graphics/GraphicsEngine/src/APIInfo.cpp @@ -64,7 +64,7 @@ static APIInfo InitAPIInfo() INIT_STRUCTURE_SIZE(Rect); INIT_STRUCTURE_SIZE(CopyTextureAttribs); INIT_STRUCTURE_SIZE(DeviceObjectAttribs); - INIT_STRUCTURE_SIZE(HardwareAdapterAttribs); + INIT_STRUCTURE_SIZE(AdapterAttribs); INIT_STRUCTURE_SIZE(DisplayModeAttribs); INIT_STRUCTURE_SIZE(SwapChainDesc); INIT_STRUCTURE_SIZE(FullScreenModeDesc); diff --git a/Graphics/GraphicsEngineD3D11/interface/EngineFactoryD3D11.h b/Graphics/GraphicsEngineD3D11/interface/EngineFactoryD3D11.h index e357bc05..e164d048 100644 --- a/Graphics/GraphicsEngineD3D11/interface/EngineFactoryD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/EngineFactoryD3D11.h @@ -102,7 +102,7 @@ public: IDeviceContext** ppContexts) = 0; - /// Enumerates hardware adapters available on this machine. + /// Enumerates adapters available on this machine. /// \param [in] MinFeatureLevel - Minimum required feature level. /// \param [in,out] NumAdapters - Number of adapters. If Adapters is null, this value @@ -115,15 +115,15 @@ public: /// \param [out] Adapters - Pointer to the array conataining adapter information. If /// null is provided, the number of available adapters is /// written to NumAdapters. - virtual void EnumerateHardwareAdapters(DIRECT3D_FEATURE_LEVEL MinFeatureLevel, - Uint32& NumAdapters, - HardwareAdapterAttribs* Adapters) = 0; + virtual void EnumerateAdapters(DIRECT3D_FEATURE_LEVEL MinFeatureLevel, + Uint32& NumAdapters, + AdapterAttribs* Adapters) = 0; /// Enumerates available display modes for the specified output of the specified adapter. - /// \param [in] MinFeatureLevel - Minimum feature level of the adapter that was given to EnumerateHardwareAdapters(). - /// \param [in] AdapterId - Id of the adapter enumerated by EnumerateHardwareAdapters(). + /// \param [in] MinFeatureLevel - Minimum feature level of the adapter that was given to EnumerateAdapters(). + /// \param [in] AdapterId - Id of the adapter enumerated by EnumerateAdapters(). /// \param [in] OutputId - Adapter output id. /// \param [in] Format - Display mode format. /// \param [in, out] NumDisplayModes - Number of display modes. If DisplayModes is null, this diff --git a/Graphics/GraphicsEngineD3D12/interface/EngineFactoryD3D12.h b/Graphics/GraphicsEngineD3D12/interface/EngineFactoryD3D12.h index b02deaa0..75058c31 100644 --- a/Graphics/GraphicsEngineD3D12/interface/EngineFactoryD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/EngineFactoryD3D12.h @@ -117,15 +117,15 @@ public: /// \param [out] Adapters - Pointer to the array conataining adapter information. If /// null is provided, the number of available adapters is written to /// NumAdapters - virtual void EnumerateHardwareAdapters(DIRECT3D_FEATURE_LEVEL MinFeatureLevel, - Uint32& NumAdapters, - HardwareAdapterAttribs* Adapters) = 0; + virtual void EnumerateAdapters(DIRECT3D_FEATURE_LEVEL MinFeatureLevel, + Uint32& NumAdapters, + AdapterAttribs* Adapters) = 0; /// Enumerates available display modes for the specified output of the specified adapter. - /// \param [in] MinFeatureLevel - Minimum feature level of the adapter that was given to EnumerateHardwareAdapters(). - /// \param [in] AdapterId - Id of the adapter enumerated by EnumerateHardwareAdapters(). + /// \param [in] MinFeatureLevel - Minimum feature level of the adapter that was given to EnumerateAdapters(). + /// \param [in] AdapterId - Id of the adapter enumerated by EnumerateAdapters(). /// \param [in] OutputId - Adapter output id. /// \param [in] Format - Display mode format. /// \param [in, out] NumDisplayModes - Number of display modes. If DisplayModes is null, this diff --git a/Graphics/GraphicsEngineD3DBase/include/EngineFactoryD3DBase.h b/Graphics/GraphicsEngineD3DBase/include/EngineFactoryD3DBase.h index a13379a7..eda702b1 100644 --- a/Graphics/GraphicsEngineD3DBase/include/EngineFactoryD3DBase.h +++ b/Graphics/GraphicsEngineD3DBase/include/EngineFactoryD3DBase.h @@ -43,9 +43,9 @@ public: {} - virtual void EnumerateHardwareAdapters(DIRECT3D_FEATURE_LEVEL MinFeatureLevel, - Uint32& NumAdapters, - HardwareAdapterAttribs* Adapters) override final + virtual void EnumerateAdapters(DIRECT3D_FEATURE_LEVEL MinFeatureLevel, + Uint32& NumAdapters, + AdapterAttribs* Adapters) override final { auto DXGIAdapters = FindCompatibleAdapters(MinFeatureLevel); @@ -61,6 +61,8 @@ public: pDXIAdapter->GetDesc1(&AdapterDesc); auto& Attribs = Adapters[adapter]; + + Attribs.AdapterType = (AdapterDesc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) ? ADAPTER_TYPE_SOFTWARE : ADAPTER_TYPE_HARDWARE; WideCharToMultiByte(CP_ACP, 0, AdapterDesc.Description, -1, Attribs.Description, _countof(Attribs.Description), NULL, FALSE); Attribs.DedicatedVideoMemory = AdapterDesc.DedicatedVideoMemory; Attribs.DedicatedSystemMemory = AdapterDesc.DedicatedSystemMemory; @@ -148,19 +150,14 @@ public: return std::move(DXGIAdapters); } - auto d3dFeatureLevel = GetD3DFeatureLevel(MinFeatureLevel); CComPtr<IDXGIAdapter1> pDXIAdapter; - UINT adapter = 0; + + auto d3dFeatureLevel = GetD3DFeatureLevel(MinFeatureLevel); + UINT adapter = 0; for (; pFactory->EnumAdapters1(adapter, &pDXIAdapter) != DXGI_ERROR_NOT_FOUND; ++adapter, pDXIAdapter.Release()) { DXGI_ADAPTER_DESC1 AdapterDesc; pDXIAdapter->GetDesc1(&AdapterDesc); - if (AdapterDesc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) - { - // Skip software devices - continue; - } - bool IsCompatibleAdapter = CheckAdapterCompatibility<DevType>(pDXIAdapter, d3dFeatureLevel); if (IsCompatibleAdapter) { |
