Go to the documentation of this file.
58 static constexpr
Uint32 ParameterGroupBits = 1;
59 static constexpr
Uint32 RootIndexBits = 32 - ParameterGroupBits;
79 const D3D12_ROOT_PARAMETER& _d3d12RootParam,
92 "Incorrect parameter type: descriptor table is expected");
97 VERIFY(d3d12Tbl.NumDescriptorRanges > 0,
"Descriptor table must contain at least one range");
98 const auto& d3d12LastRange = d3d12Tbl.pDescriptorRanges[d3d12Tbl.NumDescriptorRanges - 1];
99 VERIFY(d3d12LastRange.NumDescriptors > 0,
"The range must not be empty");
100 return d3d12LastRange.OffsetInDescriptorsFromTableStart + d3d12LastRange.NumDescriptors;
108 static_assert(
sizeof(RootParameter) ==
sizeof(D3D12_ROOT_PARAMETER) +
sizeof(
Uint32) * 2,
"Unexpected sizeof(RootParameter) - did you pack the members properly?");
146 return m_pRootTables[TableInd];
152 return m_pRootViews[ViewInd];
158 return m_ParameterGroupSizes[d3d12HeapType][Group];
163 #ifdef DILIGENT_DEBUG
164 void Validate()
const;
170 std::unique_ptr<void, STDDeleter<void, IMemoryAllocator>> m_pMemory;
172 Uint32 m_NumRootTables = 0;
173 Uint32 m_NumRootViews = 0;
179 std::array<std::array<Uint32, ROOT_PARAMETER_GROUP_COUNT>, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER + 1> m_ParameterGroupSizes{};
190 D3D12_ROOT_PARAMETER_TYPE RootParameterType,
191 D3D12_DESCRIPTOR_RANGE_TYPE RangeType,
196 Uint32& OffsetFromTableStart);
202 RootParameter& AddRootView(D3D12_ROOT_PARAMETER_TYPE ParameterType,
206 D3D12_SHADER_VISIBILITY Visibility,
209 struct RootTableData;
211 RootTableData& AddRootTable(
Uint32 RootIndex,
212 D3D12_SHADER_VISIBILITY Visibility,
214 Uint32 NumRangesInNewTable = 1);
220 RootTableData(
Uint32 _RootIndex,
221 D3D12_SHADER_VISIBILITY _Visibility,
224 void Extend(
Uint32 NumExtraRanges);
228 D3D12_ROOT_PARAMETER d3d12RootParam{};
230 std::vector<D3D12_DESCRIPTOR_RANGE> Ranges;
232 std::vector<RootTableData> m_RootTables;
233 std::vector<RootParameter> m_RootViews;
235 static constexpr
int InvalidRootTableIndex = -1;
@ ROOT_PARAMETER_GROUP_STATIC_MUTABLE
Definition: RootParamsManager.hpp:45
RootParameter & operator=(const RootParameter &)=delete
RootParamsManager() noexcept
Definition: RootParamsManager.hpp:130
SHADER_TYPE
Describes the shader type.
Definition: GraphicsTypes.h:65
bool operator==(const RootParameter &rhs) const
Definition: RootParamsManager.cpp:94
Uint32 GetDescriptorTableSize() const
Definition: RootParamsManager.hpp:89
ROOT_PARAMETER_GROUP
Definition: RootParamsManager.hpp:43
@ SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC
Shader variable binding is dynamic. It can be set multiple times for every instance of shader resourc...
Definition: ShaderResourceVariable.h:62
const Uint32 RootIndex
Definition: RootParamsManager.hpp:60
Definition: RootParamsManager.hpp:55
void InitializeMgr(IMemoryAllocator &MemAllocator, RootParamsManager &ParamsMgr)
Definition: RootParamsManager.cpp:405
Uint32 Space
Definition: DXBCUtils.cpp:99
void AllocateResourceSlot(SHADER_TYPE ShaderStages, SHADER_RESOURCE_VARIABLE_TYPE VariableType, D3D12_ROOT_PARAMETER_TYPE RootParameterType, D3D12_DESCRIPTOR_RANGE_TYPE RangeType, Uint32 ArraySize, Uint32 Register, Uint32 Space, Uint32 &RootIndex, Uint32 &OffsetFromTableStart)
Definition: RootParamsManager.cpp:319
Uint32 GetParameterGroupSize(D3D12_DESCRIPTOR_HEAP_TYPE d3d12HeapType, ROOT_PARAMETER_GROUP Group) const
Definition: RootParamsManager.hpp:156
RootParamsBuilder()
Definition: RootParamsManager.cpp:238
const Uint32 TableOffsetInGroupAllocation
Definition: RootParamsManager.hpp:71
@ ROOT_PARAMETER_GROUP_DYNAMIC
Definition: RootParamsManager.hpp:46
const RootParameter & GetRootView(Uint32 ViewInd) const
Definition: RootParamsManager.hpp:149
RootParameter(Uint32 _RootIndex, ROOT_PARAMETER_GROUP _Group, const D3D12_ROOT_PARAMETER &_d3d12RootParam, Uint32 _TableOffsetInGroupAllocation=InvalidTableOffsetInGroupAllocation) noexcept
Definition: RootParamsManager.cpp:74
size_t GetHash() const
Definition: RootParamsManager.cpp:104
const RootParameter & GetRootTable(Uint32 TableInd) const
Definition: RootParamsManager.hpp:143
RootParamsManager & operator=(const RootParamsManager &)=delete
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
const D3D12_ROOT_PARAMETER d3d12RootParam
Definition: RootParamsManager.hpp:75
static constexpr Uint32 InvalidTableOffsetInGroupAllocation
Definition: RootParamsManager.hpp:73
Base interface for a raw memory allocator.
Definition: MemoryAllocator.h:41
~RootParamsManager()
Definition: RootParamsManager.cpp:145
bool operator==(const RootParamsManager &RootParams) const
Definition: RootParamsManager.cpp:150
@ ROOT_PARAMETER_GROUP_COUNT
Definition: RootParamsManager.hpp:47
#define VERIFY_EXPR(...)
Definition: DebugUtilities.hpp:79
#define VERIFY(...)
Definition: DebugUtilities.hpp:76
const ROOT_PARAMETER_GROUP Group
Definition: RootParamsManager.hpp:65
Uint32 GetNumRootViews() const
Definition: RootParamsManager.hpp:141
ROOT_PARAMETER_GROUP VariableTypeToRootParameterGroup(SHADER_RESOURCE_VARIABLE_TYPE VarType)
Definition: RootParamsManager.hpp:50
bool operator!=(const RootParameter &rhs) const
Definition: RootParamsManager.hpp:104
Uint32 GetNumRootTables() const
Definition: RootParamsManager.hpp:140
Container for root parameters.
Definition: RootParamsManager.hpp:127
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37
SHADER_RESOURCE_VARIABLE_TYPE
Describes the type of the shader resource variable.
Definition: ShaderResourceVariable.h:48
Definition: RootParamsManager.hpp:182