From 83acbd6c353255f478164018a357637fb2f11cb5 Mon Sep 17 00:00:00 2001 From: assiduous Date: Sat, 12 Sep 2020 20:17:35 -0700 Subject: Added option to enable/disable device features during initialization (API 240069) --- .../include/RenderDeviceD3D11Impl.hpp | 2 +- .../GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'Graphics/GraphicsEngineD3D11') diff --git a/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp b/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp index f041806c..8003615e 100644 --- a/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp +++ b/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp @@ -48,7 +48,7 @@ public: IEngineFactory* pEngineFactory, const EngineD3D11CreateInfo& EngineAttribs, ID3D11Device* pd3d11Device, - Uint32 NumDeferredContexts); + Uint32 NumDeferredContexts) noexcept(false); virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final; /// Implementation of IRenderDevice::CreateBuffer() in Direct3D11 backend. diff --git a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp index c8c26d80..d5671816 100644 --- a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp @@ -143,12 +143,25 @@ RenderDeviceD3D11Impl::RenderDeviceD3D11Impl(IReferenceCounters* pRefCo } } +#define UNSUPPORTED_FEATURE(Feature, Name) \ + do \ + { \ + if (EngineAttribs.Features.Feature == DEVICE_FEATURE_STATE_ENABLED) \ + LOG_ERROR_AND_THROW(Name " not supported by Direct3D11 device"); \ + m_DeviceCaps.Features.Feature = DEVICE_FEATURE_STATE_DISABLED; \ + } while (false) + // Direct3D11 only supports shader model 5.0 even if the device feature level is // 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.Features.BindlessResources = False; - - m_DeviceCaps.Features.VertexPipelineUAVWritesAndAtomics = False; + UNSUPPORTED_FEATURE(BindlessResources, "Bindless resources are"); + UNSUPPORTED_FEATURE(VertexPipelineUAVWritesAndAtomics, "Vertex pipeline UAV writes and atomics are"); + UNSUPPORTED_FEATURE(MeshShaders, "Mesh shaders are"); +#undef UNSUPPORTED_FEATURE + +#if defined(_MSC_VER) && defined(_WIN64) + static_assert(sizeof(DeviceFeatures) == 23, "Did you add a new feature to DeviceFeatures? Please handle its satus here."); +#endif auto& TexCaps = m_DeviceCaps.TexCaps; -- cgit v1.2.3