Go to the documentation of this file.
84 VERIFY_EXPR((IsActive && Bindings[ShaderInd] != InvalidBindPoint ||
85 !IsActive && Bindings[ShaderInd] == InvalidBindPoint));
92 return Bindings[ShaderInd];
98 for (
auto Binding : Bindings)
105 return Bindings == rhs.Bindings;
115 NewBindPoints.Bindings[ShaderInd] = Bindings[ShaderInd] +
static_cast<Uint8>(value);
117 return NewBindPoints;
124 const Uint32 _ShaderInd) :
125 BindPoints{_BindPoints},
126 ShaderInd{_ShaderInd}
130 StageAccessor (
const StageAccessor&) =
delete;
131 StageAccessor ( StageAccessor&&) =
delete;
132 StageAccessor& operator=(
const StageAccessor&) =
delete;
133 StageAccessor& operator=( StageAccessor&&) =
delete;
138 return BindPoints.Set(ShaderInd,
BindPoint);
141 operator Uint8()
const
154 return {*
this, ShaderInd};
164 ActiveStages |=
Uint32{1} << ShaderInd;
168 static constexpr
Uint8 InvalidBindPoint = 0xFF;
172 std::array<Uint8, NumShaderTypes> Bindings{InvalidBindPoint, InvalidBindPoint, InvalidBindPoint, InvalidBindPoint, InvalidBindPoint, InvalidBindPoint};
174 Uint8 ActiveStages = 0;
186 return (PackedCounters >> (NumBitsPerStage * Stage)) & StageMask;
191 #ifdef DILIGENT_DEBUG
195 const Uint32 val1 = rhs[s];
196 VERIFY(val0 + val1 <= MaxCounter,
"The resulting value (", val0 + val1,
") is out of range.");
199 PackedCounters += rhs.PackedCounters;
205 return PackedCounters == rhs.PackedCounters;
212 const Uint32 _ShaderInd) :
214 ShaderInd{_ShaderInd}
218 StageAccessor (
const StageAccessor&) =
delete;
219 StageAccessor ( StageAccessor&&) =
delete;
220 StageAccessor& operator=(
const StageAccessor&) =
delete;
221 StageAccessor& operator=( StageAccessor&&) =
delete;
226 return Counters.Set(ShaderInd, Counter);
231 Uint32 CurrValue =
static_cast<const D3D11ResourceRangeCounters&
>(Counters)[ShaderInd];
232 return Counters.Set(ShaderInd, CurrValue + Val);
235 operator Uint8()
const
237 return static_cast<const D3D11ResourceRangeCounters&
>(Counters)[ShaderInd];
241 D3D11ResourceRangeCounters& Counters;
248 return {*
this, ShaderInd};
255 const Uint64 BitOffset = NumBitsPerStage * ShaderInd;
256 PackedCounters &= ~(StageMask << BitOffset);
257 PackedCounters |=
Uint64{Counter} << BitOffset;
258 return static_cast<Uint8>(Counter);
261 static constexpr
Uint64 NumBitsPerStage = 8;
262 static constexpr
Uint64 StageMask = (
Uint64{1} << NumBitsPerStage) - 1;
263 static constexpr
Uint32 MaxCounter = (
Uint32{1} << NumBitsPerStage) - 1;
267 Uint64 PackedCounters = 0;
278 static constexpr
Uint32 _SamplerIndBits = 31;
279 static constexpr
Uint32 _SamplerAssignedBits = 1;
291 bool _ImtblSamplerAssigned) noexcept :
297 VERIFY(
SamplerInd == _SamplerInd,
"Sampler index (", _SamplerInd,
") exceeds maximum representable value.");
const Uint32 SamplerInd
Definition: PipelineResourceAttribsD3D11.hpp:285
Shader resource counters for one specific resource range.
Definition: PipelineResourceAttribsD3D11.hpp:179
bool IsEmpty() const
Definition: PipelineResourceAttribsD3D11.hpp:76
Int32 ExtractFirstShaderStageIndex(SHADER_TYPE &Stages)
Definition: GraphicsAccessories.hpp:450
Definition: PipelineResourceAttribsD3D11.hpp:275
SHADER_TYPE GetShaderTypeFromIndex(Int32 Index)
Definition: GraphicsAccessories.hpp:501
SHADER_TYPE
Describes the shader type.
Definition: GraphicsTypes.h:65
@ D3D11_RESOURCE_RANGE_COUNT
Definition: PipelineResourceAttribsD3D11.hpp:49
uint64_t Uint64
64-bit unsigned integer
Definition: BasicTypes.h:50
bool operator==(const D3D11ResourceRangeCounters &rhs) const
Definition: PipelineResourceAttribsD3D11.hpp:203
@ D3D11_RESOURCE_RANGE_SAMPLER
Definition: PipelineResourceAttribsD3D11.hpp:47
@ D3D11_RESOURCE_RANGE_SRV
Definition: PipelineResourceAttribsD3D11.hpp:46
D3D11ResourceRangeCounters & operator+=(const D3D11ResourceRangeCounters &rhs)
Definition: PipelineResourceAttribsD3D11.hpp:189
bool IsStageActive(Uint32 ShaderInd) const
Definition: PipelineResourceAttribsD3D11.hpp:81
@ D3D11_RESOURCE_RANGE_CBV
Definition: PipelineResourceAttribsD3D11.hpp:45
Uint8 operator[](Uint32 Stage) const
Definition: PipelineResourceAttribsD3D11.hpp:183
const Uint32 ImtblSamplerAssigned
Definition: PipelineResourceAttribsD3D11.hpp:286
D3D11ResourceBindPoints operator+(Uint32 value) const
Definition: PipelineResourceAttribsD3D11.hpp:108
D3D11ResourceBindPoints BindPoints
Definition: PipelineResourceAttribsD3D11.hpp:288
std::array< D3D11ResourceRangeCounters, D3D11_RESOURCE_RANGE_COUNT > D3D11ShaderResourceCounters
Resource counters for all shader stages and all resource types.
Definition: PipelineResourceAttribsD3D11.hpp:271
StageAccessor operator[](Uint32 ShaderInd)
Definition: PipelineResourceAttribsD3D11.hpp:246
bool IsCompatibleWith(const PipelineResourceAttribsD3D11 &rhs) const
Definition: PipelineResourceAttribsD3D11.hpp:303
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
std::size_t ComputeHash(const ArgsType &... Args)
Definition: HashUtils.hpp:57
@ SHADER_TYPE_UNKNOWN
Unknown shader type.
Definition: GraphicsTypes.h:67
size_t GetHash() const
Definition: PipelineResourceAttribsD3D11.hpp:95
bool IsImmutableSamplerAssigned() const
Definition: PipelineResourceAttribsD3D11.hpp:301
Resource binding points in all shader stages.
Definition: PipelineResourceAttribsD3D11.hpp:56
SHADER_TYPE GetActiveStages() const
Definition: PipelineResourceAttribsD3D11.hpp:71
static constexpr Uint32 NumShaderTypes
Definition: PipelineResourceAttribsD3D11.hpp:181
Uint8 operator[](Uint32 ShaderInd) const
Definition: PipelineResourceAttribsD3D11.hpp:89
size_t GetHash() const
Definition: PipelineResourceAttribsD3D11.hpp:312
@ D3D11_RESOURCE_RANGE_UAV
Definition: PipelineResourceAttribsD3D11.hpp:48
uint8_t Uint8
8-bit unsigned integer
Definition: BasicTypes.h:53
StageAccessor operator[](Uint32 ShaderInd)
Definition: PipelineResourceAttribsD3D11.hpp:152
#define VERIFY_EXPR(...)
Definition: DebugUtilities.hpp:79
#define VERIFY(...)
Definition: DebugUtilities.hpp:76
static constexpr Uint32 NumShaderTypes
The number of different shader types (Vertex, Pixel, Geometry, Hull, Domain, Compute)
Definition: PipelineResourceAttribsD3D11.hpp:59
@ D3D11_RESOURCE_RANGE_UNKNOWN
Definition: PipelineResourceAttribsD3D11.hpp:50
bool IsSamplerAssigned() const
Definition: PipelineResourceAttribsD3D11.hpp:300
PipelineResourceAttribsD3D11(Uint32 _SamplerInd, bool _ImtblSamplerAssigned) noexcept
Definition: PipelineResourceAttribsD3D11.hpp:290
bool operator==(const D3D11ResourceBindPoints &rhs) const
Definition: PipelineResourceAttribsD3D11.hpp:103
D3D11ResourceBindPoints() noexcept
Definition: PipelineResourceAttribsD3D11.hpp:61
static constexpr Uint32 InvalidSamplerInd
Definition: PipelineResourceAttribsD3D11.hpp:282
void HashCombine(std::size_t &Seed, const T &Val)
Definition: HashUtils.hpp:44
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37
D3D11_RESOURCE_RANGE
Definition: PipelineResourceAttribsD3D11.hpp:43
Uint32 BindPoint
Definition: DXBCUtils.cpp:83