summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorazhirnov <zh1dron@gmail.com>2021-02-11 20:43:57 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-03-19 00:31:36 +0000
commit3a37b56ef7344b05ccb144c5302ce8addd782aa7 (patch)
tree4a7ed173272a96d4d84edb2183fe3aadcd6cef06 /Graphics/GraphicsEngineD3D12
parentfixed mem leak in root signature cache in dx12 (diff)
downloadDiligentCore-3a37b56ef7344b05ccb144c5302ce8addd782aa7.tar.gz
DiligentCore-3a37b56ef7344b05ccb144c5302ce8addd782aa7.zip
fixed descriptor heap type
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp
index 7d465018..b66a0ca1 100644
--- a/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp
@@ -1103,6 +1103,11 @@ void PipelineResourceSignatureD3D12Impl::InitializeStaticSRBResources(ShaderReso
const auto& Attr = GetResourceAttribs(r);
VERIFY_EXPR(ResDesc.VarType == SHADER_RESOURCE_VARIABLE_TYPE_STATIC);
+ if (Attr.IsImmutableSamplerAssigned())
+ continue;
+
+ const bool IsSampler = (ResDesc.ResourceType == SHADER_RESOURCE_TYPE_SAMPLER);
+ const auto HeapType = IsSampler ? D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER : D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
const auto DstRootIndex = Attr.RootIndex(DstCacheType);
const auto& SrcRootTable = SrcResourceCache.GetRootTable(Attr.RootIndex(SrcCacheType));
auto& DstRootTable = DstResourceCache.GetRootTable(DstRootIndex);
@@ -1111,13 +1116,12 @@ void PipelineResourceSignatureD3D12Impl::InitializeStaticSRBResources(ShaderReso
{
const auto SrcCacheOffset = Attr.OffsetFromTableStart(SrcCacheType) + ArrInd;
const auto DstCacheOffset = Attr.OffsetFromTableStart(DstCacheType) + ArrInd;
- const bool IsSampler = (ResDesc.ResourceType == SHADER_RESOURCE_TYPE_SAMPLER);
- const auto& SrcRes = SrcRootTable.GetResource(SrcCacheOffset, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
+ const auto& SrcRes = SrcRootTable.GetResource(SrcCacheOffset, HeapType);
if (!SrcRes.pObject)
LOG_ERROR_MESSAGE("No resource is assigned to static shader variable '", GetShaderResourcePrintName(ResDesc, ArrInd), "' in pipeline resource signature '", m_Desc.Name, "'.");
- auto& DstRes = DstRootTable.GetResource(DstCacheOffset, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
+ auto& DstRes = DstRootTable.GetResource(DstCacheOffset, HeapType);
if (DstRes.pObject != SrcRes.pObject)
{
DEV_CHECK_ERR(DstRes.pObject == nullptr, "Static resource has already been initialized, and the resource to be assigned from the shader does not match previously assigned resource");