summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-12-21 04:50:05 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-12-21 04:50:05 +0000
commitf0bc7dafea0b6c497a02b97cd0b513af9b7dbf4a (patch)
tree039081746169cbb8a03d4684ed786d0a507ef1eb /Graphics/GraphicsEngineD3D12
parentD3D12 backend: a bunch of cosmetic updates + made dynamic buffer allocation d... (diff)
downloadDiligentCore-f0bc7dafea0b6c497a02b97cd0b513af9b7dbf4a.tar.gz
DiligentCore-f0bc7dafea0b6c497a02b97cd0b513af9b7dbf4a.zip
ShaderResourceLayoutD3D12: more debug validation plus few more minor improvements
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/include/ShaderResourceCacheD3D12.hpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/include/ShaderResourceLayoutD3D12.hpp30
-rw-r--r--Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp36
-rw-r--r--Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp4
-rw-r--r--Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp79
5 files changed, 82 insertions, 69 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderResourceCacheD3D12.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderResourceCacheD3D12.hpp
index 73ebe3b8..56d4c4cc 100644
--- a/Graphics/GraphicsEngineD3D12/include/ShaderResourceCacheD3D12.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/ShaderResourceCacheD3D12.hpp
@@ -111,7 +111,7 @@ public:
SRBResources
};
- ShaderResourceCacheD3D12(DbgCacheContentType dbgContentType) noexcept
+ explicit ShaderResourceCacheD3D12(DbgCacheContentType dbgContentType) noexcept
// clang-format off
#ifdef DILIGENT_DEBUG
: m_DbgContentType
diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderResourceLayoutD3D12.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderResourceLayoutD3D12.hpp
index 741b49e6..7ca4a7a3 100644
--- a/Graphics/GraphicsEngineD3D12/include/ShaderResourceLayoutD3D12.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/ShaderResourceLayoutD3D12.hpp
@@ -119,7 +119,7 @@ namespace Diligent
class ShaderResourceLayoutD3D12 final
{
public:
- explicit ShaderResourceLayoutD3D12(IObject& Owner, ID3D12Device* pd3d12Device) noexcept :
+ ShaderResourceLayoutD3D12(IObject& Owner, ID3D12Device* pd3d12Device) noexcept :
m_Owner{Owner},
m_pd3d12Device{pd3d12Device}
{
@@ -129,7 +129,7 @@ public:
}
// Initializes reference layouts that address all types of resources (static, mutable, dynamic).
- // Root indices and descriptor table offsets are assigned during the initialization;
+ // Root indices and descriptor table offsets are assigned during the initialization.
void Initialize(PIPELINE_TYPE PipelineType,
const PipelineResourceLayoutDesc& ResourceLayout,
const std::vector<ShaderD3D12Impl*>& Shaders,
@@ -138,7 +138,8 @@ public:
class LocalRootSignature* pLocalRootSig);
// Copies the specified variable types from the source layout and initializes the
- // resource cache.
+ // resource cache. Uses bind points from the source layout.
+ // \note This method is used to initialize static resource cache.
void Initialize(const ShaderResourceLayoutD3D12& SrcLayout,
IMemoryAllocator& LayoutDataAllocator,
const SHADER_RESOURCE_VARIABLE_TYPE* const AllowedVarTypes,
@@ -177,7 +178,7 @@ public:
static_assert(static_cast<int>(CachedResourceType::NumTypes) < (1 << ResourceTypeBits), "Not enough bits to represent CachedResourceType");
/* 0 */ const ShaderResourceLayoutD3D12& ParentResLayout;
- /* 8 */ const D3DShaderResourceAttribs Attribs;
+ /* 8 */ const D3DShaderResourceAttribs Attribs; // Copy of the attributes, potentially with some changes to bindings
/*24 */ const Uint32 OffsetFromTableStart;
/*28.0*/ const Uint32 ResourceType : ResourceTypeBits; // | 0 1 2 |
/*28.3*/ const Uint32 VariableType : VariableTypeBits; // | 3 4 |
@@ -283,6 +284,10 @@ public:
{
return m_SamplersOffsets[VarType + 1] - m_SamplersOffsets[VarType];
}
+ Uint32 GetTotalResourceCount() const
+ {
+ return m_SamplersOffsets[SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES];
+ }
const D3D12Resource& GetSrvCbvUav(SHADER_RESOURCE_VARIABLE_TYPE VarType, Uint32 r) const
{
@@ -295,6 +300,13 @@ public:
return GetResource(GetSamplerOffset(VarType, s));
}
+ const D3D12Resource& GetResource(Uint32 r) const
+ {
+ VERIFY_EXPR(r < GetTotalResourceCount());
+ const auto* Resources = reinterpret_cast<const D3D12Resource*>(m_ResourceBuffer.get());
+ return Resources[r];
+ }
+
const bool IsUsingSeparateSamplers() const { return m_IsUsingSeparateSamplers; }
SHADER_TYPE GetShaderType() const { return m_ShaderType; }
@@ -322,10 +334,6 @@ private:
{
return m_SamplersOffsets[SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES] - m_SamplersOffsets[0];
}
- Uint32 GetTotalResourceCount() const
- {
- return m_SamplersOffsets[SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES];
- }
D3D12Resource& GetResource(Uint32 r)
{
@@ -333,12 +341,6 @@ private:
auto* Resources = reinterpret_cast<D3D12Resource*>(m_ResourceBuffer.get());
return Resources[r];
}
- const D3D12Resource& GetResource(Uint32 r) const
- {
- VERIFY_EXPR(r < GetTotalResourceCount());
- const auto* Resources = reinterpret_cast<const D3D12Resource*>(m_ResourceBuffer.get());
- return Resources[r];
- }
Uint32 GetSrvCbvUavOffset(SHADER_RESOURCE_VARIABLE_TYPE VarType, Uint32 r) const
{
diff --git a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp
index 10c45f1d..7c3f6489 100644
--- a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp
@@ -292,34 +292,24 @@ TBindingMapPerStage ExtractResourceBindingMap(const RootSignatureBuilder&
auto& BindingMap = BindingMapPerStage[ShaderIdx];
const auto& ResLayout = pLayouts[LayoutIdx];
- for (Uint32 v = 0; v < SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES; ++v)
- {
- auto VarType = static_cast<SHADER_RESOURCE_VARIABLE_TYPE>(v);
- Uint32 ResCount = ResLayout.GetCbvSrvUavCount(VarType);
- Uint32 SampCount = ResLayout.GetSamplerCount(VarType);
-
- for (Uint32 i = 0; i < ResCount; ++i)
- {
- const auto& Attribs = ResLayout.GetSrvCbvUav(VarType, i).Attribs;
- VERIFY_EXPR(Attribs.Name != nullptr && strlen(Attribs.Name) > 0);
- auto Iter = BindingMap.emplace(HashMapStringKey{Attribs.Name}, Attribs.BindPoint).first;
- VERIFY_EXPR(Iter->second == Attribs.BindPoint);
- }
- for (Uint32 i = 0; i < SampCount; ++i)
- {
- const auto& Attribs = ResLayout.GetSampler(VarType, i).Attribs;
- VERIFY_EXPR(Attribs.Name != nullptr && strlen(Attribs.Name) > 0);
+ const auto TotalResCount = ResLayout.GetTotalResourceCount();
+ for (Uint32 i = 0; i < TotalResCount; ++i)
+ {
+ const auto& Attribs = ResLayout.GetResource(i).Attribs;
+ VERIFY_EXPR(Attribs.Name != nullptr && strlen(Attribs.Name) > 0);
- auto Iter = BindingMap.emplace(HashMapStringKey{Attribs.Name}, Attribs.BindPoint).first;
- VERIFY_EXPR(Iter->second == Attribs.BindPoint);
- }
+ auto Iter = BindingMap.emplace(HashMapStringKey{Attribs.Name}, Attribs.BindPoint).first;
+ VERIFY(Iter->second == Attribs.BindPoint,
+ "Resource '", Attribs.Name, "' was assigned incosistent bind points in different resource layouts. This is a bug.");
}
}
};
+ // Gather resource bind points
ExtractResources(pResourceLayouts);
ExtractResources(pStaticLayouts);
+ // Gather static sampler bind points
for (size_t i = 0; i < RootSig.GetImmutableSamplerCount(); ++i)
{
const auto& ImtblSmplr = RootSig.GetImmutableSamplers()[i];
@@ -335,7 +325,9 @@ TBindingMapPerStage ExtractResourceBindingMap(const RootSignatureBuilder&
}
auto& BindingMap = BindingMapPerStage[ShaderIdx];
- BindingMap.emplace(HashMapStringKey{ImtblSmplr.Name.c_str()}, ImtblSmplr.ShaderRegister);
+ auto Iter = BindingMap.emplace(HashMapStringKey{ImtblSmplr.Name.c_str()}, ImtblSmplr.ShaderRegister).first;
+ VERIFY(Iter->second == ImtblSmplr.ShaderRegister,
+ "Static sampler '", ImtblSmplr.Name, "' was assigned incosistent bind points in different resource layouts. This is a bug.");
}
return BindingMapPerStage;
@@ -694,7 +686,7 @@ PipelineStateD3D12Impl::PipelineStateD3D12Impl(IReferenceCounters*
DynamicLinearAllocator TempPool{GetRawAllocator(), 4 << 10};
std::vector<D3D12_STATE_SUBOBJECT> Subobjects;
std::vector<CComPtr<IDxcBlob>> ShaderBlobs;
- // Create ray-tracing pipeline and remap shader registers using the bind points assigned during the
+ // Create ray-tracing pipeline and remap shader registers (including static samplers) using the bind points assigned during the
// resource layout initialization.
BuildRTPipelineDescription(CreateInfo, Subobjects, ShaderBlobs, TempPool, pDeviceD3D12->GetDxCompiler(), BindingMapPerStage);
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp
index a5224fb3..6fba86cb 100644
--- a/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp
@@ -71,11 +71,11 @@ void ShaderResourceCacheD3D12::Initialize(IMemoryAllocator& MemAllocator, Uint32
auto* pTables = reinterpret_cast<RootTable*>(m_pMemory);
auto* pCurrResPtr = reinterpret_cast<Resource*>(pTables + m_NumTables);
for (Uint32 res = 0; res < TotalResources; ++res)
- new (pCurrResPtr + res) Resource();
+ new (pCurrResPtr + res) Resource{};
for (Uint32 t = 0; t < NumTables; ++t)
{
- new (&GetRootTable(t)) RootTable(TableSizes[t], TableSizes[t] > 0 ? pCurrResPtr : nullptr);
+ new (&GetRootTable(t)) RootTable{TableSizes[t], TableSizes[t] > 0 ? pCurrResPtr : nullptr};
pCurrResPtr += TableSizes[t];
}
VERIFY_EXPR((char*)pCurrResPtr == (char*)m_pMemory + MemorySize);
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp
index 55a1cf9c..c731e505 100644
--- a/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp
@@ -205,7 +205,7 @@ void ShaderResourceLayoutD3D12::Initialize(PIPELINE_TYPE
if (TexSRV.IsCombinedWithSampler())
{
const auto& SamplerAttribs = ShaderRes.GetCombinedSampler(TexSRV);
- auto SamplerVarType = ShaderRes.FindVariableType(SamplerAttribs, ResourceLayout);
+ const auto SamplerVarType = ShaderRes.FindVariableType(SamplerAttribs, ResourceLayout);
const auto TexSrvVarType = ShaderRes.FindVariableType(TexSRV, ResourceLayout);
DEV_CHECK_ERR(SamplerVarType == TexSrvVarType,
"The type (", GetShaderVariableTypeLiteralName(TexSrvVarType), ") of texture SRV variable '", TexSRV.Name,
@@ -316,7 +316,7 @@ void ShaderResourceLayoutD3D12::Initialize(PIPELINE_TYPE
if (ImtblSamplerInd >= 0)
{
// Note that there may be multiple immutable samplers with the same name in different shaders that
- // are assigned to different registers. This not a problem, because InitImmutableSampler allocates new
+ // are assigned to different registers. This is not a problem, because InitImmutableSampler allocates new
// register only first time the sampler is encountered.
RootSgnBldr.InitImmutableSampler(ShaderRes.GetShaderType(), Sam.Name, ShaderRes.GetCombinedSamplerSuffix(), Sam);
}
@@ -488,7 +488,7 @@ void ShaderResourceLayoutD3D12::Initialize(const ShaderResourceLayoutD3D12&
Uint32 SamplerId = D3DShaderResourceAttribs::InvalidSamplerId;
if (SrcRes.Attribs.IsCombinedWithSampler())
{
- // If source resource is combined with the static sampler, there must also be
+ // If source resource is combined with the sampler, there must also be
// a corresponding sampler in this layout.
const auto& SrcAssignedSmplr = SrcLayout.GetAssignedSampler(SrcRes);
@@ -849,7 +849,7 @@ void ShaderResourceLayoutD3D12::D3D12Resource::BindResource(IDeviceObject*
}
}
#endif
- auto pSampler = pTexView->GetSampler();
+ auto* pSampler = pTexView->GetSampler();
if (pSampler)
{
Sam.CacheSampler(pSampler, DstSam, SamplerArrInd, ShdrVisibleSamplerHeapCPUDescriptorHandle);
@@ -956,10 +956,10 @@ void ShaderResourceLayoutD3D12::CopyStaticResourceDesriptorHandles(const ShaderR
const auto& src_res = GetSrvCbvUav(SHADER_RESOURCE_VARIABLE_TYPE_STATIC, i);
if (strcmp(src_res.Attribs.Name, res.Attribs.Name) == 0)
{
- SrcResourceFound = true;
VERIFY(src_res.Attribs.BindPoint == res.Attribs.BindPoint, "Src resource bind point does match the dst resource bind point");
- VERIFY(src_res.OffsetFromTableStart == src_res.Attribs.BindPoint, "Src resource bind point must match its offset in the descriptor table");
+ VERIFY(src_res.OffsetFromTableStart == res.Attribs.BindPoint, "Src resource bind point must match its offset in the descriptor table");
VERIFY(src_res.Attribs.BindCount == res.Attribs.BindCount, "Inconsistent array size");
+ SrcResourceFound = true;
break;
}
}
@@ -967,18 +967,20 @@ void ShaderResourceLayoutD3D12::CopyStaticResourceDesriptorHandles(const ShaderR
}
#endif
auto RangeType = GetDescriptorRangeType(res.GetResType());
+ // Source resource in the static resource cache is in the root table at index RangeType, at offset BindPoint
+ // D3D12_DESCRIPTOR_RANGE_TYPE_SRV = 0,
+ // D3D12_DESCRIPTOR_RANGE_TYPE_UAV = 1
+ // D3D12_DESCRIPTOR_RANGE_TYPE_CBV = 2
+ const auto& SrcRootTable = SrcCache.GetRootTable(RangeType);
+ auto& DstRootTable = DstCache.GetRootTable(res.RootIndex);
for (Uint32 ArrInd = 0; ArrInd < res.Attribs.BindCount; ++ArrInd)
{
- auto BindPoint = res.Attribs.BindPoint + ArrInd;
- // Source resource in the static resource cache is in the root table at index RangeType, at offset BindPoint
- // D3D12_DESCRIPTOR_RANGE_TYPE_SRV = 0,
- // D3D12_DESCRIPTOR_RANGE_TYPE_UAV = 1
- // D3D12_DESCRIPTOR_RANGE_TYPE_CBV = 2
- const auto& SrcRes = SrcCache.GetRootTable(RangeType).GetResource(BindPoint, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, GetShaderType());
+ // Offset in the source table equals the bind point
+ const auto& SrcRes = SrcRootTable.GetResource(res.Attribs.BindPoint + ArrInd, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, GetShaderType());
if (!SrcRes.pObject)
LOG_ERROR_MESSAGE("No resource is assigned to static shader variable '", res.Attribs.GetPrintName(ArrInd), "' in shader '", GetShaderName(), "'.");
// Destination resource is at the root index and offset defined by the resource layout
- auto& DstRes = DstCache.GetRootTable(res.RootIndex).GetResource(res.OffsetFromTableStart + ArrInd, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, GetShaderType());
+ auto& DstRes = DstRootTable.GetResource(res.OffsetFromTableStart + ArrInd, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, GetShaderType());
if (DstRes.pObject != SrcRes.pObject)
{
@@ -1019,12 +1021,27 @@ void ShaderResourceLayoutD3D12::CopyStaticResourceDesriptorHandles(const ShaderR
if (res.Attribs.IsCombinedWithSampler())
{
- const auto& SamInfo = DstLayout.GetAssignedSampler(res);
+#ifdef DILIGENT_DEBUG
+ const auto& DstSamInfo = DstLayout.GetAssignedSampler(res);
//VERIFY(!SamInfo.IsImmutableSampler(), "Immutable samplers should never be assigned space in the cache");
- VERIFY(SamInfo.Attribs.IsValidBindPoint(), "Sampler bind point must be valid");
- VERIFY_EXPR(SamInfo.Attribs.BindCount == res.Attribs.BindCount || SamInfo.Attribs.BindCount == 1);
+ VERIFY(DstSamInfo.Attribs.IsValidBindPoint(), "Sampler bind point must be valid");
+ VERIFY_EXPR(DstSamInfo.Attribs.BindCount == res.Attribs.BindCount || DstSamInfo.Attribs.BindCount == 1);
+ bool SrcSamplerFound = false;
+ for (Uint32 i = 0; i < GetSamplerCount(SHADER_RESOURCE_VARIABLE_TYPE_STATIC); ++i)
+ {
+ const auto& SrcSamInfo = GetSampler(SHADER_RESOURCE_VARIABLE_TYPE_STATIC, i);
+ if (strcmp(SrcSamInfo.Attribs.Name, DstSamInfo.Attribs.Name) == 0)
+ {
+ VERIFY_EXPR(SrcSamInfo.Attribs.BindCount == DstSamInfo.Attribs.BindCount);
+ SrcSamplerFound = true;
+ break;
+ }
+ }
+ VERIFY(SrcSamplerFound, "Sampler '", DstSamInfo.Attribs.Name, "' assigned to static texture SRV '", res.Attribs.Name,
+ "' is not found in the static resource cache. This is a bug.");
+#endif
}
}
}
@@ -1036,34 +1053,36 @@ void ShaderResourceLayoutD3D12::CopyStaticResourceDesriptorHandles(const ShaderR
") is not consistent with the number of static-type samplers in destination cache (", SamplerCount, ")");
for (Uint32 s = 0; s < SamplerCount; ++s)
{
- const auto& SamInfo = DstLayout.GetSampler(SHADER_RESOURCE_VARIABLE_TYPE_STATIC, s);
+ const auto& DstSamInfo = DstLayout.GetSampler(SHADER_RESOURCE_VARIABLE_TYPE_STATIC, s);
#ifdef DILIGENT_DEBUG
{
bool SrcSamplerFound = false;
for (Uint32 i = 0; i < SamplerCount; ++i)
{
const auto& SrcSamInfo = GetSampler(SHADER_RESOURCE_VARIABLE_TYPE_STATIC, i);
- if (strcmp(SrcSamInfo.Attribs.Name, SamInfo.Attribs.Name) == 0)
+ if (strcmp(SrcSamInfo.Attribs.Name, DstSamInfo.Attribs.Name) == 0)
{
- VERIFY(SrcSamInfo.Attribs.BindPoint == SamInfo.Attribs.BindPoint, "Src sampler bind point does match the dst sampler bind point");
- VERIFY(SrcSamInfo.OffsetFromTableStart == SrcSamInfo.Attribs.BindPoint, "Src sampler bind point must match its offset in the descriptor table");
- VERIFY(SrcSamInfo.Attribs.BindCount == SamInfo.Attribs.BindCount, "Inconsistent array size");
+ VERIFY(SrcSamInfo.Attribs.BindPoint == DstSamInfo.Attribs.BindPoint, "Src sampler bind point does match the dst sampler bind point");
+ VERIFY(SrcSamInfo.OffsetFromTableStart == DstSamInfo.Attribs.BindPoint, "Src sampler bind point must match its offset in the descriptor table");
+ VERIFY(SrcSamInfo.Attribs.BindCount == DstSamInfo.Attribs.BindCount, "Inconsistent array size");
SrcSamplerFound = true;
break;
}
}
- VERIFY(SrcSamplerFound, "Unable to find sampler '", SamInfo.Attribs.Name, "' in the cache. This is a bug.");
+ VERIFY(SrcSamplerFound, "Unable to find sampler '", DstSamInfo.Attribs.Name, "' in the cache. This is a bug.");
}
#endif
- for (Uint32 ArrInd = 0; ArrInd < SamInfo.Attribs.BindCount; ++ArrInd)
+ // Source sampler in the static resource cache is in the root table at index 3
+ // (D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER = 3), at offset BindPoint
+ const auto& SrcRootTable = SrcCache.GetRootTable(D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER);
+ auto& DstRootTable = DstCache.GetRootTable(DstSamInfo.RootIndex);
+ for (Uint32 ArrInd = 0; ArrInd < DstSamInfo.Attribs.BindCount; ++ArrInd)
{
- auto BindPoint = SamInfo.Attribs.BindPoint + ArrInd;
- // Source sampler in the static resource cache is in the root table at index 3
- // (D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER = 3), at offset BindPoint
- const auto& SrcSampler = SrcCache.GetRootTable(D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER).GetResource(BindPoint, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, GetShaderType());
+ // Offset in the source table equals the bind point
+ const auto& SrcSampler = SrcRootTable.GetResource(DstSamInfo.Attribs.BindPoint + ArrInd, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, GetShaderType());
if (!SrcSampler.pObject)
- LOG_ERROR_MESSAGE("No sampler assigned to static shader variable '", SamInfo.Attribs.GetPrintName(ArrInd), "' in shader '", GetShaderName(), "'.");
- auto& DstSampler = DstCache.GetRootTable(SamInfo.RootIndex).GetResource(SamInfo.OffsetFromTableStart + ArrInd, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, GetShaderType());
+ LOG_ERROR_MESSAGE("No sampler assigned to static shader variable '", DstSamInfo.Attribs.GetPrintName(ArrInd), "' in shader '", GetShaderName(), "'.");
+ auto& DstSampler = DstRootTable.GetResource(DstSamInfo.OffsetFromTableStart + ArrInd, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, GetShaderType());
if (DstSampler.pObject != SrcSampler.pObject)
{
@@ -1073,7 +1092,7 @@ void ShaderResourceLayoutD3D12::CopyStaticResourceDesriptorHandles(const ShaderR
DstSampler.Type = SrcSampler.Type;
DstSampler.CPUDescriptorHandle = SrcSampler.CPUDescriptorHandle;
- auto ShdrVisibleSamplerHeapCPUDescriptorHandle = DstCache.GetShaderVisibleTableCPUDescriptorHandle<D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER>(SamInfo.RootIndex, SamInfo.OffsetFromTableStart + ArrInd);
+ auto ShdrVisibleSamplerHeapCPUDescriptorHandle = DstCache.GetShaderVisibleTableCPUDescriptorHandle<D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER>(DstSamInfo.RootIndex, DstSamInfo.OffsetFromTableStart + ArrInd);
VERIFY_EXPR(ShdrVisibleSamplerHeapCPUDescriptorHandle.ptr != 0);
if (ShdrVisibleSamplerHeapCPUDescriptorHandle.ptr != 0)
{