From 1313de1ab167fe67d14fa2a848946f442491ca11 Mon Sep 17 00:00:00 2001 From: azhirnov Date: Tue, 25 Aug 2020 04:56:42 +0300 Subject: added HLSLTools, HLSL shader compiler refactoring added ShaderCompiler field to ShaderCreateInfo, fixed tests that doesn't compile on DXC, added dxc/WinAdapter.h to fix compilation on linux --- Graphics/GraphicsEngineD3D12/CMakeLists.txt | 1 + Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp | 2 +- Graphics/GraphicsEngineD3D12/src/ShaderResourcesD3D12.cpp | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) (limited to 'Graphics/GraphicsEngineD3D12') diff --git a/Graphics/GraphicsEngineD3D12/CMakeLists.txt b/Graphics/GraphicsEngineD3D12/CMakeLists.txt index 00ce6a91..b5e85ad4 100644 --- a/Graphics/GraphicsEngineD3D12/CMakeLists.txt +++ b/Graphics/GraphicsEngineD3D12/CMakeLists.txt @@ -157,6 +157,7 @@ PRIVATE Diligent-GraphicsEngineD3DBase Diligent-GraphicsEngineNextGenBase Diligent-TargetPlatform + Diligent-HLSLTools dxgi.lib d3dcompiler.lib PUBLIC diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp index 768983da..3c740b29 100644 --- a/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp @@ -59,7 +59,7 @@ ShaderD3D12Impl::ShaderD3D12Impl(IReferenceCounters* pRefCounters, pRenderDeviceD3D12, ShaderCI.Desc }, - ShaderD3DBase{ShaderCI, GetD3D12ShaderModel(pRenderDeviceD3D12, ShaderCI.HLSLVersion)} + ShaderD3DBase{ShaderCI, GetD3D12ShaderModel(pRenderDeviceD3D12, ShaderCI.HLSLVersion), true} // clang-format on { // Load shader resources diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourcesD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourcesD3D12.cpp index e2093eaa..f7488afe 100644 --- a/Graphics/GraphicsEngineD3D12/src/ShaderResourcesD3D12.cpp +++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourcesD3D12.cpp @@ -31,6 +31,8 @@ #include "ShaderResourcesD3D12.hpp" #include "ShaderD3DBase.hpp" #include "ShaderBase.hpp" +#include "DXILUtils.hpp" +#include "dxc/dxcapi.h" namespace Diligent { @@ -61,7 +63,7 @@ ShaderResourcesD3D12::ShaderResourcesD3D12(ID3DBlob* pShaderBytecode, bool isDXI const uint32_t DFCC_DXIL = uint32_t('D') | (uint32_t('X') << 8) | (uint32_t('I') << 16) | (uint32_t('L') << 24); CComPtr pReflection; UINT32 shaderIdx; - hr = DXILCreateInstance(CLSID_DxcContainerReflection, IID_PPV_ARGS(&pReflection)); + hr = D3D12DxcCreateInstance(CLSID_DxcContainerReflection, IID_PPV_ARGS(&pReflection)); CHECK_D3D_RESULT_THROW(hr, "Failed to create shader reflection instance"); hr = pReflection->Load(reinterpret_cast(pShaderBytecode)); CHECK_D3D_RESULT_THROW(hr, "Failed to load shader reflection from bytecode"); -- cgit v1.2.3