Go to the documentation of this file.
116 class CommandContext;
117 class RenderDeviceD3D12Impl;
123 m_ContentType{ContentType}
125 for (
auto& HeapIndex : m_AllocationIndex)
151 const Uint32 TableSizes[]);
175 #ifdef DILIGENT_DEVELOPMENT
177 void DvpVerifyResourceState();
189 m_NumResources {_NumResources },
190 m_IsRootView {_IsRootView ? 1u : 0u},
191 m_pResources {_pResources },
192 m_TableStartOffset{_TableStartOffset }
202 VERIFY(OffsetFromTableStart < m_NumResources,
"Root table is not large enough to store descriptor at offset ", OffsetFromTableStart);
203 return m_pResources[OffsetFromTableStart];
214 VERIFY(OffsetFromTableStart < m_NumResources,
"Root table is not large enough to store descriptor at offset ", OffsetFromTableStart);
215 return m_pResources[OffsetFromTableStart];
220 const Uint32 m_TableStartOffset;
223 const Uint32 m_NumResources : 31;
226 const Uint32 m_IsRootView : 1;
233 Uint32 OffsetFromTableStart,
235 D3D12_CPU_DESCRIPTOR_HANDLE CPUDescriptorHandle,
240 Uint32 OffsetFromTableStart,
248 Uint32 OffsetFromTableStart)
256 return reinterpret_cast<const RootTable*
>(m_pMemory.get())[RootIndex];
263 auto AllocationIdx = m_AllocationIndex[HeapType][Group];
264 return AllocationIdx >= 0 ? m_DescriptorAllocations[AllocationIdx].
GetDescriptorHeap() :
nullptr;
268 template <
typename HandleType>
270 D3D12_DESCRIPTOR_HEAP_TYPE HeapType,
273 Uint32 OffsetFromTableStart = 0)
const
277 VERIFY(OffsetFromTableStart < RootParam.GetSize(),
"Offset is out of range");
279 const auto AllocationIdx = m_AllocationIndex[HeapType][Group];
280 VERIFY(AllocationIdx >= 0,
"Descriptor space is not assigned to this table");
281 VERIFY_EXPR(AllocationIdx < m_NumDescriptorAllocations);
283 return m_DescriptorAllocations[AllocationIdx].
GetHandle<HandleType>(RootParam.GetStartOffset() + OffsetFromTableStart);
289 const auto AllocationIdx = m_AllocationIndex[HeapType][Group];
290 VERIFY(AllocationIdx >= 0,
"Descriptor space is not assigned to this combination of heap type and parameter group");
291 VERIFY_EXPR(AllocationIdx < m_NumDescriptorAllocations);
292 return m_DescriptorAllocations[AllocationIdx];
311 #ifdef DILIGENT_DEBUG
312 void DbgValidateDynamicBuffersMask()
const;
319 return reinterpret_cast<RootTable*
>(m_pMemory.get())[RootIndex];
322 Resource& GetResource(
Uint32 Idx)
325 return reinterpret_cast<Resource*
>(
reinterpret_cast<RootTable*
>(m_pMemory.get()) + m_NumTables)[Idx];
328 size_t AllocateMemory(IMemoryAllocator& MemAllocator);
331 static constexpr
Uint32 MaxRootTables = 64;
333 std::unique_ptr<void, STDDeleter<void, IMemoryAllocator>> m_pMemory;
336 DescriptorHeapAllocation* m_DescriptorAllocations =
nullptr;
339 Uint32 m_TotalResourceCount = 0;
345 Uint8 m_NumDescriptorAllocations = 0;
353 std::array<std::array<Int8, ROOT_PARAMETER_GROUP_COUNT>, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER + 1> m_AllocationIndex{};
ResourceCacheContentType
The type of the content that is stored in the shader resource cache.
Definition: ShaderResourceCacheCommon.hpp:39
bool IsNull() const
Definition: ShaderResourceCacheD3D12.hpp:170
ResourceCacheContentType GetContentType() const
Definition: ShaderResourceCacheD3D12.hpp:303
Resource() noexcept
Definition: ShaderResourceCacheD3D12.hpp:163
SHADER_RESOURCE_TYPE
Describes shader resource type.
Definition: Shader.h:356
ROOT_PARAMETER_GROUP
Definition: RootParamsManager.hpp:43
SHADER_RESOURCE_TYPE Type
Definition: ShaderResourceCacheD3D12.hpp:165
uint64_t Uint64
64-bit unsigned integer
Definition: BasicTypes.h:50
HandleType GetDescriptorTableHandle(D3D12_DESCRIPTOR_HEAP_TYPE HeapType, ROOT_PARAMETER_GROUP Group, Uint32 RootParamInd, Uint32 OffsetFromTableStart=0) const
Definition: ShaderResourceCacheD3D12.hpp:269
const Resource & GetResource(Uint32 OffsetFromTableStart) const
Definition: ShaderResourceCacheD3D12.hpp:200
const DescriptorHeapAllocation & GetDescriptorAllocation(D3D12_DESCRIPTOR_HEAP_TYPE HeapType, ROOT_PARAMETER_GROUP Group) const
Definition: ShaderResourceCacheD3D12.hpp:286
RootTable(Uint32 _NumResources, Resource *_pResources, bool _IsRootView, Uint32 _TableStartOffset=InvalidDescriptorOffset) noexcept
Definition: ShaderResourceCacheD3D12.hpp:184
void Initialize(IMemoryAllocator &MemAllocator, Uint32 NumTables, const Uint32 TableSizes[])
Definition: ShaderResourceCacheD3D12.cpp:122
Definition: CommandContext.hpp:66
static constexpr Uint32 InvalidDescriptorOffset
Definition: ShaderResourceCacheD3D12.hpp:159
static MemoryRequirements GetMemoryRequirements(const RootParamsManager &RootParams)
Definition: ShaderResourceCacheD3D12.cpp:44
Uint32 GetSize() const
Definition: ShaderResourceCacheD3D12.hpp:206
Uint32 NumDescriptorAllocations
Definition: ShaderResourceCacheD3D12.hpp:142
Render device implementation in Direct3D12 backend.
Definition: RenderDeviceD3D12Impl.hpp:70
Definition: ShaderResourceCacheD3D12.hpp:119
Uint32 NumTables
Definition: ShaderResourceCacheD3D12.hpp:140
Uint32 GetNumRootTables() const
Definition: ShaderResourceCacheD3D12.hpp:259
const Resource & ResetResource(Uint32 RootIndex, Uint32 OffsetFromTableStart)
Definition: ShaderResourceCacheD3D12.hpp:247
Definition: ShaderResourceCacheD3D12.hpp:161
ShaderResourceCacheD3D12 & operator=(const ShaderResourceCacheD3D12 &)=delete
const Resource & CopyResource(Uint32 RootIndex, Uint32 OffsetFromTableStart, const Resource &SrcRes)
Definition: ShaderResourceCacheD3D12.hpp:239
Definition: ShaderResourceCacheD3D12.hpp:181
Template class that implements reference counting.
Definition: RefCntAutoPtr.hpp:73
const D3D12_PIPELINE_STATE_SUBOBJECT_TYPE Type
Definition: PipelineStateD3D12Impl.cpp:69
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
const Resource & SetResource(Uint32 RootIndex, Uint32 OffsetFromTableStart, SHADER_RESOURCE_TYPE Type, D3D12_CPU_DESCRIPTOR_HANDLE CPUDescriptorHandle, RefCntAutoPtr< IDeviceObject > &&pObject)
Definition: ShaderResourceCacheD3D12.cpp:296
ID3D12DescriptorHeap * GetDescriptorHeap() const
Definition: DescriptorHeap.hpp:199
void TransitionResourceStates(CommandContext &Ctx, StateTransitionMode Mode)
Definition: ShaderResourceCacheD3D12.cpp:620
Uint64 GetDynamicRootBuffersMask() const
Definition: ShaderResourceCacheD3D12.hpp:306
StateTransitionMode
Definition: ShaderResourceCacheD3D12.hpp:295
D3D12_CPU_DESCRIPTOR_HANDLE CPUDescriptorHandle
Definition: ShaderResourceCacheD3D12.hpp:167
Uint64 GetNonDynamicRootBuffersMask() const
Definition: ShaderResourceCacheD3D12.hpp:309
Definition: ShaderResourceCacheD3D12.hpp:138
bool IsRootView() const
Definition: ShaderResourceCacheD3D12.hpp:208
ShaderResourceCacheD3D12(ResourceCacheContentType ContentType) noexcept
Definition: ShaderResourceCacheD3D12.hpp:122
Base interface for a raw memory allocator.
Definition: MemoryAllocator.h:41
Uint32 TotalResources
Definition: ShaderResourceCacheD3D12.hpp:141
~ShaderResourceCacheD3D12()
Definition: ShaderResourceCacheD3D12.cpp:281
uint16_t Uint16
16-bit unsigned integer
Definition: BasicTypes.h:52
RefCntAutoPtr< IDeviceObject > pObject
Definition: ShaderResourceCacheD3D12.hpp:168
uint8_t Uint8
8-bit unsigned integer
Definition: BasicTypes.h:53
#define VERIFY_EXPR(...)
Definition: DebugUtilities.hpp:79
#define VERIFY(...)
Definition: DebugUtilities.hpp:76
const RootTable & GetRootTable(Uint32 RootIndex) const
Definition: ShaderResourceCacheD3D12.hpp:253
ID3D12DescriptorHeap * GetDescriptorHeap(D3D12_DESCRIPTOR_HEAP_TYPE HeapType, ROOT_PARAMETER_GROUP Group) const
Definition: ShaderResourceCacheD3D12.hpp:261
Definition: DescriptorHeap.hpp:67
Uint32 GetStartOffset() const
Definition: ShaderResourceCacheD3D12.hpp:207
@ SHADER_RESOURCE_TYPE_UNKNOWN
Shader resource type is unknown.
Definition: Shader.h:359
__forceinline void TransitionResource(CommandContext &Ctx)
Definition: ShaderResourceCacheD3D12.cpp:429
Container for root parameters.
Definition: RootParamsManager.hpp:127
HandleType GetHandle(Uint32 Offset=0) const
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37
size_t TotalSize
Definition: ShaderResourceCacheD3D12.hpp:143