summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorazhirnov <zh1dron@gmail.com>2020-08-19 15:50:31 +0000
committerazhirnov <zh1dron@gmail.com>2020-08-19 15:50:31 +0000
commit801c65731c10ae61a0fb9252ab8add6bb65ba4d0 (patch)
tree2feb970e34be88030d0387f304ceffa1d6d8462f /Graphics/GraphicsEngineD3D12
parentRename ***_PIPELINE to PIPELINE_TYPE_*** (diff)
downloadDiligentCore-801c65731c10ae61a0fb9252ab8add6bb65ba4d0.tar.gz
DiligentCore-801c65731c10ae61a0fb9252ab8add6bb65ba4d0.zip
Use ShaderVersion instead of Uint8
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp20
-rw-r--r--Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp11
2 files changed, 17 insertions, 14 deletions
diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp
index c9e0ee88..8b0b05eb 100644
--- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp
@@ -67,25 +67,23 @@ static CComPtr<IDXGIAdapter1> DXGIAdapterFromD3D12Device(ID3D12Device* pd3d12Dev
D3D_SHADER_MODEL RenderDeviceD3D12Impl::GetShaderModel() const
{
-#ifdef HAS_DXIL_COMPILER
// Header may not have constants for D3D_SHADER_MODEL_6_5 and above.
const D3D_SHADER_MODEL Models[] = {
D3D_SHADER_MODEL(0x65), // for mesh shader
D3D_SHADER_MODEL(0x64),
- D3D_SHADER_MODEL(0x60)};
+ D3D_SHADER_MODEL(0x63),
+ D3D_SHADER_MODEL(0x62),
+ D3D_SHADER_MODEL(0x61),
+ D3D_SHADER_MODEL_6_0};
- // Get maximum supported shader model
+ // Get maximum supported shader model.
D3D12_FEATURE_DATA_SHADER_MODEL ShaderModel = {};
- if (m_pd3d12Device)
+ for (auto Model : Models)
{
- for (auto Model : Models)
- {
- ShaderModel.HighestShaderModel = Model;
- if (SUCCEEDED(m_pd3d12Device->CheckFeatureSupport(D3D12_FEATURE_SHADER_MODEL, &ShaderModel, sizeof(ShaderModel))))
- return ShaderModel.HighestShaderModel;
- }
+ ShaderModel.HighestShaderModel = Model;
+ if (SUCCEEDED(m_pd3d12Device->CheckFeatureSupport(D3D12_FEATURE_SHADER_MODEL, &ShaderModel, sizeof(ShaderModel))))
+ return ShaderModel.HighestShaderModel;
}
-#endif
// Direct3D12 supports shader model 5.1 on all feature levels.
// https://docs.microsoft.com/en-us/windows/win32/direct3d12/hardware-feature-levels#feature-level-support
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp
index dc723614..86ccaa02 100644
--- a/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp
@@ -36,16 +36,21 @@
namespace Diligent
{
-static const Uint8 GetD3D12ShaderModel(RenderDeviceD3D12Impl* pDevice, const ShaderVersion& HLSLVersion)
+static ShaderVersion GetD3D12ShaderModel(RenderDeviceD3D12Impl* pDevice, const ShaderVersion& HLSLVersion)
{
if (HLSLVersion.Major == 0 && HLSLVersion.Minor == 0)
{
+#ifdef HAS_D12_DXIL_COMPILER
D3D_SHADER_MODEL ver = pDevice->GetShaderModel();
- return Uint8((ver & 0xF0) | (ver & 0x0F));
+ return ShaderVersion{Uint8((ver >> 4) & 0xF), Uint8(ver & 0xF)};
+#else
+ // without DXIL compiler you can use only SM 5.1
+ return ShaderVersion{5, 1};
+#endif
}
else
{
- return Uint8(((HLSLVersion.Major & 0xF) << 4) | (HLSLVersion.Minor & 0xF));
+ return HLSLVersion;
}
}