summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorazhirnov <zh1dron@gmail.com>2020-09-08 19:24:03 +0000
committerazhirnov <zh1dron@gmail.com>2020-09-08 19:54:42 +0000
commitcb92debd446581a094941e923d3a973d5450018f (patch)
tree45e07a592e72d3525d31f2eb18a3d58cf77a1d03 /Graphics/GraphicsEngineD3D12
parentadded DXC license (diff)
downloadDiligentCore-cb92debd446581a094941e923d3a973d5450018f.tar.gz
DiligentCore-cb92debd446581a094941e923d3a973d5450018f.zip
removed m_isDXIL flag, detect DXIL by bytecode
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/include/ShaderResourcesD3D12.hpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/ShaderResourcesD3D12.cpp23
3 files changed, 5 insertions, 22 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderResourcesD3D12.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderResourcesD3D12.hpp
index 88c1cdc5..23f9882b 100644
--- a/Graphics/GraphicsEngineD3D12/include/ShaderResourcesD3D12.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/ShaderResourcesD3D12.hpp
@@ -92,7 +92,7 @@ class ShaderResourcesD3D12 final : public ShaderResources
{
public:
// Loads shader resources from the compiled shader bytecode
- ShaderResourcesD3D12(ID3DBlob* pShaderBytecode, bool isDXIL, const ShaderDesc& ShdrDesc, const char* CombinedSamplerSuffix);
+ ShaderResourcesD3D12(ID3DBlob* pShaderBytecode, const ShaderDesc& ShdrDesc, const char* CombinedSamplerSuffix);
// clang-format off
ShaderResourcesD3D12 (const ShaderResourcesD3D12&) = delete;
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp
index 3c740b29..d14eb122 100644
--- a/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp
@@ -65,7 +65,7 @@ ShaderD3D12Impl::ShaderD3D12Impl(IReferenceCounters* pRefCounters,
// Load shader resources
auto& Allocator = GetRawAllocator();
auto* pRawMem = ALLOCATE(Allocator, "Allocator for ShaderResources", ShaderResourcesD3D12, 1);
- auto* pResources = new (pRawMem) ShaderResourcesD3D12(m_pShaderByteCode, m_isDXIL, m_Desc, ShaderCI.UseCombinedTextureSamplers ? ShaderCI.CombinedSamplerSuffix : nullptr);
+ auto* pResources = new (pRawMem) ShaderResourcesD3D12(m_pShaderByteCode, m_Desc, ShaderCI.UseCombinedTextureSamplers ? ShaderCI.CombinedSamplerSuffix : nullptr);
m_pShaderResources.reset(pResources, STDDeleterRawMem<ShaderResourcesD3D12>(Allocator));
}
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourcesD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourcesD3D12.cpp
index f7488afe..bcb34226 100644
--- a/Graphics/GraphicsEngineD3D12/src/ShaderResourcesD3D12.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourcesD3D12.cpp
@@ -32,13 +32,12 @@
#include "ShaderD3DBase.hpp"
#include "ShaderBase.hpp"
#include "DXILUtils.hpp"
-#include "dxc/dxcapi.h"
namespace Diligent
{
-ShaderResourcesD3D12::ShaderResourcesD3D12(ID3DBlob* pShaderBytecode, bool isDXIL, const ShaderDesc& ShdrDesc, const char* CombinedSamplerSuffix) :
+ShaderResourcesD3D12::ShaderResourcesD3D12(ID3DBlob* pShaderBytecode, const ShaderDesc& ShdrDesc, const char* CombinedSamplerSuffix) :
ShaderResources{ShdrDesc.ShaderType}
{
class NewResourceHandler
@@ -56,25 +55,9 @@ ShaderResourcesD3D12::ShaderResourcesD3D12(ID3DBlob* pShaderBytecode, bool isDXI
CComPtr<ID3D12ShaderReflection> pShaderReflection;
- HRESULT hr;
-
- if (isDXIL)
- {
- const uint32_t DFCC_DXIL = uint32_t('D') | (uint32_t('X') << 8) | (uint32_t('I') << 16) | (uint32_t('L') << 24);
- CComPtr<IDxcContainerReflection> pReflection;
- UINT32 shaderIdx;
- hr = D3D12DxcCreateInstance(CLSID_DxcContainerReflection, IID_PPV_ARGS(&pReflection));
- CHECK_D3D_RESULT_THROW(hr, "Failed to create shader reflection instance");
- hr = pReflection->Load(reinterpret_cast<IDxcBlob*>(pShaderBytecode));
- CHECK_D3D_RESULT_THROW(hr, "Failed to load shader reflection from bytecode");
- hr = pReflection->FindFirstPartKind(DFCC_DXIL, &shaderIdx);
- CHECK_D3D_RESULT_THROW(hr, "Failed to find DXIL part");
- hr = pReflection->GetPartReflection(shaderIdx, __uuidof(pShaderReflection), reinterpret_cast<void**>(&pShaderReflection));
- CHECK_D3D_RESULT_THROW(hr, "Failed to get the shader reflection");
- }
- else
+ if (!DxcGetShaderReflection(reinterpret_cast<IDxcBlob*>(pShaderBytecode), &pShaderReflection))
{
- hr = D3DReflect(pShaderBytecode->GetBufferPointer(), pShaderBytecode->GetBufferSize(), __uuidof(pShaderReflection), reinterpret_cast<void**>(&pShaderReflection));
+ HRESULT hr = D3DReflect(pShaderBytecode->GetBufferPointer(), pShaderBytecode->GetBufferSize(), __uuidof(pShaderReflection), reinterpret_cast<void**>(&pShaderReflection));
CHECK_D3D_RESULT_THROW(hr, "Failed to get the shader reflection");
}