Diligent Engine  v.2.4.g
DescriptorHeap.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2019-2021 Diligent Graphics LLC
3  * Copyright 2015-2019 Egor Yusov
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * In no event and under no legal theory, whether in tort (including negligence),
18  * contract, or otherwise, unless required by applicable law (such as deliberate
19  * and grossly negligent acts) or agreed to in writing, shall any Contributor be
20  * liable for any damages, including any direct, indirect, special, incidental,
21  * or consequential damages of any character arising as a result of this License or
22  * out of the use or inability to use the software (including but not limited to damages
23  * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
24  * all other commercial damages or losses), even if such Contributor has been advised
25  * of the possibility of such damages.
26  */
27 
28 // Descriptor heap management utilities.
29 // See http://diligentgraphics.com/diligent-engine/architecture/d3d12/managing-descriptor-heaps/ for details
30 
31 #pragma once
32 
33 #include <mutex>
34 #include <vector>
35 #include <queue>
36 #include <string>
37 #include <unordered_set>
38 #include <atomic>
39 
41 
42 namespace Diligent
43 {
44 
45 class DescriptorHeapAllocation;
46 class DescriptorHeapAllocationManager;
47 class RenderDeviceD3D12Impl;
48 
50 {
51 public:
52  // Allocate Count descriptors
53  virtual DescriptorHeapAllocation Allocate(uint32_t Count) = 0;
54  virtual void Free(DescriptorHeapAllocation&& Allocation, Uint64 CmdQueueMask) = 0;
55  virtual Uint32 GetDescriptorSize() const = 0;
56 };
57 
58 
59 // The class represents descriptor heap allocation (continuous descriptor range in a descriptor heap)
60 //
61 // m_FirstCpuHandle
62 // |
63 // | ~ ~ ~ ~ ~ X X X X X X X ~ ~ ~ ~ ~ ~ | D3D12 Descriptor Heap
64 // |
65 // m_FirstGpuHandle
66 //
68 {
69 public:
70  // Creates null allocation
72  // clang-format off
73  m_NumHandles {1 }, // One null descriptor handle
74  m_pDescriptorHeap {nullptr},
75  m_DescriptorSize {0 }
76  // clang-format on
77  {
78  m_FirstCpuHandle.ptr = 0;
79  m_FirstGpuHandle.ptr = 0;
80  }
81 
82  // Initializes non-null allocation
84  ID3D12DescriptorHeap* pHeap,
85  D3D12_CPU_DESCRIPTOR_HANDLE CpuHandle,
86  D3D12_GPU_DESCRIPTOR_HANDLE GpuHandle,
87  Uint32 NHandles,
88  Uint16 AllocationManagerId) noexcept :
89  // clang-format off
90  m_FirstCpuHandle {CpuHandle },
91  m_FirstGpuHandle {GpuHandle },
92  m_pAllocator {&Allocator },
93  m_NumHandles {NHandles },
94  m_pDescriptorHeap {pHeap },
95  m_AllocationManagerId {AllocationManagerId}
96  // clang-format on
97  {
98  VERIFY_EXPR(m_pAllocator != nullptr && m_pDescriptorHeap != nullptr);
99  auto DescriptorSize = m_pAllocator->GetDescriptorSize();
100  VERIFY(DescriptorSize < std::numeric_limits<Uint16>::max(), "DescriptorSize exceeds allowed limit");
101  m_DescriptorSize = static_cast<Uint16>(DescriptorSize);
102  }
103 
104  // Move constructor (copy is not allowed)
106  // clang-format off
107  m_FirstCpuHandle {std::move(Allocation.m_FirstCpuHandle) },
108  m_FirstGpuHandle {std::move(Allocation.m_FirstGpuHandle) },
109  m_NumHandles {std::move(Allocation.m_NumHandles) },
110  m_pAllocator {std::move(Allocation.m_pAllocator) },
111  m_AllocationManagerId {std::move(Allocation.m_AllocationManagerId)},
112  m_pDescriptorHeap {std::move(Allocation.m_pDescriptorHeap) },
113  m_DescriptorSize {std::move(Allocation.m_DescriptorSize) }
114  // clang-format on
115  {
116  Allocation.Reset();
117  }
118 
119  // Move assignment (assignment is not allowed)
121  {
122  m_FirstCpuHandle = std::move(Allocation.m_FirstCpuHandle);
123  m_FirstGpuHandle = std::move(Allocation.m_FirstGpuHandle);
124  m_NumHandles = std::move(Allocation.m_NumHandles);
125  m_pAllocator = std::move(Allocation.m_pAllocator);
126  m_AllocationManagerId = std::move(Allocation.m_AllocationManagerId);
127  m_pDescriptorHeap = std::move(Allocation.m_pDescriptorHeap);
128  m_DescriptorSize = std::move(Allocation.m_DescriptorSize);
129 
130  Allocation.Reset();
131 
132  return *this;
133  }
134 
135  void Reset()
136  {
137  m_FirstCpuHandle.ptr = 0;
138  m_FirstGpuHandle.ptr = 0;
139  m_pAllocator = nullptr;
140  m_pDescriptorHeap = nullptr;
141  m_NumHandles = 0;
142  m_AllocationManagerId = static_cast<Uint16>(-1);
143  m_DescriptorSize = 0;
144  }
145 
146  // clang-format off
149  // clang-format on
150 
151 
152  // Destructor automatically releases this allocation through the allocator
154  {
155  if (!IsNull() && m_pAllocator)
156  m_pAllocator->Free(std::move(*this), ~Uint64{0});
157  // Allocation must have been disposed by the allocator
158  VERIFY(IsNull(), "Non-null descriptor is being destroyed");
159  }
160 
161  // Returns CPU descriptor handle at the specified offset
162  D3D12_CPU_DESCRIPTOR_HANDLE GetCpuHandle(Uint32 Offset = 0) const
163  {
164  VERIFY_EXPR(Offset >= 0 && Offset < m_NumHandles);
165 
166  D3D12_CPU_DESCRIPTOR_HANDLE CPUHandle = m_FirstCpuHandle;
167  CPUHandle.ptr += m_DescriptorSize * Offset;
168 
169  return CPUHandle;
170  }
171 
172  // Returns GPU descriptor handle at the specified offset
173  D3D12_GPU_DESCRIPTOR_HANDLE GetGpuHandle(Uint32 Offset = 0) const
174  {
175  VERIFY_EXPR(Offset >= 0 && Offset < m_NumHandles);
176  D3D12_GPU_DESCRIPTOR_HANDLE GPUHandle = m_FirstGpuHandle;
177  GPUHandle.ptr += m_DescriptorSize * Offset;
178 
179  return GPUHandle;
180  }
181 
182  template <typename HandleType>
183  HandleType GetHandle(Uint32 Offset = 0) const;
184 
185  template <>
186  D3D12_CPU_DESCRIPTOR_HANDLE GetHandle<D3D12_CPU_DESCRIPTOR_HANDLE>(Uint32 Offset) const
187  {
188  return GetCpuHandle(Offset);
189  }
190 
191  template <>
192  D3D12_GPU_DESCRIPTOR_HANDLE GetHandle<D3D12_GPU_DESCRIPTOR_HANDLE>(Uint32 Offset) const
193  {
194  return GetGpuHandle(Offset);
195  }
196 
197 
198  // Returns pointer to D3D12 descriptor heap that contains this allocation
199  ID3D12DescriptorHeap* GetDescriptorHeap() const { return m_pDescriptorHeap; }
200 
201 
202  // clang-format off
203  size_t GetNumHandles() const { return m_NumHandles; }
204  bool IsNull() const { return m_FirstCpuHandle.ptr == 0; }
205  bool IsShaderVisible() const { return m_FirstGpuHandle.ptr != 0; }
206  size_t GetAllocationManagerId() const { return m_AllocationManagerId; }
207  UINT GetDescriptorSize() const { return m_DescriptorSize; }
208  // clang-format on
209 
210 private:
211  // First CPU descriptor handle in this allocation
212  D3D12_CPU_DESCRIPTOR_HANDLE m_FirstCpuHandle = {0};
213 
214  // First GPU descriptor handle in this allocation
215  D3D12_GPU_DESCRIPTOR_HANDLE m_FirstGpuHandle = {0};
216 
217  // Keep strong reference to the parent heap to make sure it is alive while allocation is alive - TOO EXPENSIVE
218  //RefCntAutoPtr<IDescriptorAllocator> m_pAllocator;
219 
220  // Pointer to the descriptor heap allocator that created this allocation
221  IDescriptorAllocator* m_pAllocator = nullptr;
222 
223  // Pointer to the D3D12 descriptor heap that contains descriptors in this allocation
224  ID3D12DescriptorHeap* m_pDescriptorHeap = nullptr;
225 
226  // Number of descriptors in the allocation
227  Uint32 m_NumHandles = 0;
228 
229  // Allocation manager ID. One allocator may support several
230  // allocation managers. This field is required to identify
231  // the manager within the allocator that was used to create
232  // this allocation
233  Uint16 m_AllocationManagerId = static_cast<Uint16>(-1);
234 
235  // Descriptor size
236  Uint16 m_DescriptorSize = 0;
237 };
238 
239 
240 // The class performs suballocations within one D3D12 descriptor heap.
241 // It uses VariableSizeAllocationsManager to manage free space in the heap
242 //
243 // | X X X X O O O X X O O X O O O O | D3D12 descriptor heap
244 //
245 // X - used descriptor
246 // O - available descriptor
247 //
249 {
250 public:
251  // Creates a new D3D12 descriptor heap
253  RenderDeviceD3D12Impl& DeviceD3D12Impl,
254  IDescriptorAllocator& ParentAllocator,
255  size_t ThisManagerId,
256  const D3D12_DESCRIPTOR_HEAP_DESC& HeapDesc);
257 
258  // Uses subrange of descriptors in the existing D3D12 descriptor heap
259  // that starts at offset FirstDescriptor and uses NumDescriptors descriptors
261  RenderDeviceD3D12Impl& DeviceD3D12Impl,
262  IDescriptorAllocator& ParentAllocator,
263  size_t ThisManagerId,
264  ID3D12DescriptorHeap* pd3d12DescriptorHeap,
265  Uint32 FirstDescriptor,
266  Uint32 NumDescriptors);
267 
268 
269  // = default causes compiler error when instantiating std::vector::emplace_back() in Visual Studio 2015 (Version 14.0.23107.0 D14REL)
271  // clang-format off
272  m_ParentAllocator {rhs.m_ParentAllocator },
273  m_DeviceD3D12Impl {rhs.m_DeviceD3D12Impl },
274  m_ThisManagerId {rhs.m_ThisManagerId },
275  m_HeapDesc {rhs.m_HeapDesc },
276  m_DescriptorSize {rhs.m_DescriptorSize },
277  m_NumDescriptorsInAllocation{rhs.m_NumDescriptorsInAllocation},
278  m_FirstCPUHandle {rhs.m_FirstCPUHandle },
279  m_FirstGPUHandle {rhs.m_FirstGPUHandle },
280  m_MaxAllocatedSize {rhs.m_MaxAllocatedSize },
281  // Mutex is not movable
282  //m_FreeBlockManagerMutex (std::move(rhs.m_FreeBlockManagerMutex))
283  m_FreeBlockManager {std::move(rhs.m_FreeBlockManager) },
284  m_pd3d12DescriptorHeap {std::move(rhs.m_pd3d12DescriptorHeap)}
285  // clang-format on
286  {
287  rhs.m_NumDescriptorsInAllocation = 0; // Must be set to zero so that debug check in dtor passes
288  rhs.m_ThisManagerId = static_cast<size_t>(-1);
289  rhs.m_FirstCPUHandle.ptr = 0;
290  rhs.m_FirstGPUHandle.ptr = 0;
291  rhs.m_MaxAllocatedSize = 0;
292 #ifdef DILIGENT_DEVELOPMENT
293  m_AllocationsCounter.store(rhs.m_AllocationsCounter.load());
294  rhs.m_AllocationsCounter = 0;
295  m_pd3d12InvalidDescriptorHeap = std::move(rhs.m_pd3d12InvalidDescriptorHeap);
296 #endif
297  }
298 
299  // clang-format off
300  // No copies or move-assignments
304  // clang-format on
305 
307 
308  // Allocates Count descriptors
309  DescriptorHeapAllocation Allocate(uint32_t Count);
310  void FreeAllocation(DescriptorHeapAllocation&& Allocation);
311 
312  // clang-format off
313  size_t GetNumAvailableDescriptors()const { return m_FreeBlockManager.GetFreeSize(); }
314  Uint32 GetMaxDescriptors() const { return m_NumDescriptorsInAllocation; }
315  size_t GetMaxAllocatedSize() const { return m_MaxAllocatedSize; }
316  // clang-format on
317 
318 #ifdef DILIGENT_DEVELOPMENT
319  int32_t DvpGetAllocationsCounter() const
320  {
321  return m_AllocationsCounter;
322  }
323 #endif
324 
325 private:
326  IDescriptorAllocator& m_ParentAllocator;
327  RenderDeviceD3D12Impl& m_DeviceD3D12Impl;
328 
329  // External ID assigned to this descriptor allocations manager
330  size_t m_ThisManagerId = static_cast<size_t>(-1);
331 
332  // Heap description
333  const D3D12_DESCRIPTOR_HEAP_DESC m_HeapDesc;
334 
335  const UINT m_DescriptorSize = 0;
336 
337  // Number of descriptors in the allocation.
338  // If this manager was initialized as a subrange in the existing heap,
339  // this value may be different from m_HeapDesc.NumDescriptors
340  Uint32 m_NumDescriptorsInAllocation = 0;
341 
342  // Allocations manager used to handle descriptor allocations within the heap
343  std::mutex m_FreeBlockManagerMutex;
344  VariableSizeAllocationsManager m_FreeBlockManager;
345 
346  // Strong reference to D3D12 descriptor heap object
347  CComPtr<ID3D12DescriptorHeap> m_pd3d12DescriptorHeap;
348 
349  // First CPU descriptor handle in the available descriptor range
350  D3D12_CPU_DESCRIPTOR_HANDLE m_FirstCPUHandle = {0};
351 
352  // First GPU descriptor handle in the available descriptor range
353  D3D12_GPU_DESCRIPTOR_HANDLE m_FirstGPUHandle = {0};
354 
355  size_t m_MaxAllocatedSize = 0;
356 
357 #ifdef DILIGENT_DEVELOPMENT
358  std::atomic_int32_t m_AllocationsCounter = 0;
359  // This descriptor heap is only used to copy invalid descriptors to
360  // a new allocated region. Using these descriptors will result in device
361  // removal. Note that using null descriptors is perfectly valid in D3D12
362  // and does not produce any errors.
363  static constexpr Uint32 InvalidDescriptorsCount = 128;
364  CComPtr<ID3D12DescriptorHeap> m_pd3d12InvalidDescriptorHeap;
365 #endif
366 
367  // Note: when adding new members, do not forget to update move ctor
368 };
369 
370 // CPU descriptor heap is intended to provide storage for resource view descriptor handles.
371 // It contains a pool of DescriptorHeapAllocationManager object instances, where every instance manages
372 // its own CPU-only D3D12 descriptor heap:
373 //
374 // m_HeapPool[0] m_HeapPool[1] m_HeapPool[2]
375 // | X X X X X X X X |, | X X X O O X X O |, | X O O O O O O O |
376 //
377 // X - used descriptor m_AvailableHeaps = {1,2}
378 // O - available descriptor
379 //
380 // Allocation routine goes through the list of managers that have available descriptors and tries to process
381 // the request using every manager. If there are no available managers or no manager was able to handle the request,
382 // the function creates a new descriptor heap manager and lets it handle the request
383 //
384 // Render device contains four CPUDescriptorHeap object instances (one for each D3D12 heap type). The heaps are accessed
385 // when a texture or a buffer view is created.
386 //
388 {
389 public:
390  // Initializes the heap
392  RenderDeviceD3D12Impl& DeviceD3D12Impl,
393  Uint32 NumDescriptorsInHeap,
394  D3D12_DESCRIPTOR_HEAP_TYPE Type,
395  D3D12_DESCRIPTOR_HEAP_FLAGS Flags);
396 
397  // clang-format off
398  CPUDescriptorHeap (const CPUDescriptorHeap&) = delete;
402  // clang-format on
403 
405 
406  virtual DescriptorHeapAllocation Allocate(uint32_t Count) override final;
407  virtual void Free(DescriptorHeapAllocation&& Allocation, Uint64 CmdQueueMask) override final;
408  virtual Uint32 GetDescriptorSize() const override final { return m_DescriptorSize; }
409 
410 #ifdef DILIGENT_DEVELOPMENT
411  int32_t DvpGetTotalAllocationCount();
412 #endif
413 
414 private:
415  void FreeAllocation(DescriptorHeapAllocation&& Allocation);
416 
417  IMemoryAllocator& m_MemAllocator;
418  RenderDeviceD3D12Impl& m_DeviceD3D12Impl;
419 
420  // Pool of descriptor heap managers
421  std::mutex m_HeapPoolMutex;
422  std::vector<DescriptorHeapAllocationManager, STDAllocatorRawMem<DescriptorHeapAllocationManager>> m_HeapPool;
423  // Indices of available descriptor heap managers
424  std::unordered_set<size_t, std::hash<size_t>, std::equal_to<size_t>, STDAllocatorRawMem<size_t>> m_AvailableHeaps;
425 
426  D3D12_DESCRIPTOR_HEAP_DESC m_HeapDesc;
427  const UINT m_DescriptorSize = 0;
428 
429  // Maximum heap size during the application lifetime - for statistic purposes
430  Uint32 m_MaxSize = 0;
431  Uint32 m_CurrentSize = 0;
432 };
433 
434 // GPU descriptor heap provides storage for shader-visible descriptors
435 // The heap contains single D3D12 descriptor heap that is split into two parts.
436 // The first part stores static and mutable resource descriptor handles.
437 // The second part is intended to provide temporary storage for dynamic resources.
438 // Space for dynamic resources is allocated in chunks, and then descriptors are suballocated within every
439 // chunk. DynamicSuballocationsManager facilitates this process.
440 //
441 //
442 // static and mutable handles || dynamic space
443 // || chunk 0 chunk 1 chunk 2 unused
444 // | X O O X X O X O O O O X X X X O || | X X X O | | X X O O | | O O O O | O O O O ||
445 // | |
446 // suballocation suballocation
447 // within chunk 0 within chunk 1
448 //
449 // Render device contains two GPUDescriptorHeap instances (CBV_SRV_UAV and SAMPLER). The heaps
450 // are used to allocate GPU-visible descriptors for shader resource binding objects. The heaps
451 // are also used by the command contexts (through DynamicSuballocationsManager to allocated dynamic descriptors)
452 //
453 // _______________________________________________________________________________________________________________________________
454 // | Render Device |
455 // | |
456 // | m_CPUDescriptorHeaps[CBV_SRV_UAV] | X X X X X X X X |, | X X X X X X X X |, | X O O X O O O O | |
457 // | m_CPUDescriptorHeaps[SAMPLER] | X X X X O O O X |, | X O O X O O O O | |
458 // | m_CPUDescriptorHeaps[RTV] | X X X O O O O O |, | O O O O O O O O | |
459 // | m_CPUDescriptorHeaps[DSV] | X X X O X O X O | |
460 // | ctx1 ctx2 |
461 // | m_GPUDescriptorHeaps[CBV_SRV_UAV] | X O O X X O X O O O O X X X X O || | X X X O | | X X O O | | O O O O | O O O O || |
462 // | m_GPUDescriptorHeaps[SAMPLER] | X X O O X O X X X O O X O O O O || | X X O O | | X O O O | | O O O O | O O O O || |
463 // | |
464 // |_______________________________________________________________________________________________________________________________|
465 //
466 // ________________________________________________ ________________________________________________
467 // |Device Context 1 | |Device Context 2 |
468 // | | | |
469 // | m_DynamicGPUDescriptorAllocator[CBV_SRV_UAV] | | m_DynamicGPUDescriptorAllocator[CBV_SRV_UAV] |
470 // | m_DynamicGPUDescriptorAllocator[SAMPLER] | | m_DynamicGPUDescriptorAllocator[SAMPLER] |
471 // |________________________________________________| |________________________________________________|
472 //
474 {
475 public:
477  RenderDeviceD3D12Impl& Device,
478  Uint32 NumDescriptorsInHeap,
479  Uint32 NumDynamicDescriptors,
480  D3D12_DESCRIPTOR_HEAP_TYPE Type,
481  D3D12_DESCRIPTOR_HEAP_FLAGS Flags);
482 
483  // clang-format off
484  GPUDescriptorHeap (const GPUDescriptorHeap&) = delete;
488  // clang-format on
489 
491 
492  virtual DescriptorHeapAllocation Allocate(uint32_t Count) override final
493  {
495  }
496 
497  virtual void Free(DescriptorHeapAllocation&& Allocation, Uint64 CmdQueueMask) override final;
498  virtual Uint32 GetDescriptorSize() const override final { return m_DescriptorSize; }
499 
501  {
503  }
504 
505  const D3D12_DESCRIPTOR_HEAP_DESC& GetHeapDesc() const { return m_HeapDesc; }
508 
509 #ifdef DILIGENT_DEVELOPMENT
510  int32_t DvpGetTotalAllocationCount() const
511  {
512  return m_HeapAllocationManager.DvpGetAllocationsCounter() +
513  m_DynamicAllocationsManager.DvpGetAllocationsCounter();
514  }
515 #endif
516 
517 protected:
519 
520  const D3D12_DESCRIPTOR_HEAP_DESC m_HeapDesc;
521  CComPtr<ID3D12DescriptorHeap> m_pd3d12DescriptorHeap; // Must be defined after m_HeapDesc
522 
523  const UINT m_DescriptorSize;
524 
525  // Allocation manager for static/mutable part
527 
528  // Allocation manager for dynamic part
530 };
531 
532 
533 // The class facilitates allocation of dynamic descriptor handles. It requests a chunk of heap
534 // from the master GPU descriptor heap and then performs linear suballocation within the chunk
535 // At the end of the frame all allocations are disposed.
536 
537 // static and mutable handles || dynamic space
538 // || chunk 0 chunk 2
539 // | || | X X X O | | O O O O | || GPU Descriptor Heap
540 // | |
541 // m_Suballocations[0] m_Suballocations[1]
542 //
544 {
545 public:
547  GPUDescriptorHeap& ParentGPUHeap,
548  Uint32 DynamicChunkSize,
549  String ManagerName);
550 
551  // clang-format off
556  // clang-format on
557 
559 
560  void ReleaseAllocations(Uint64 CmdQueueMask);
561 
562  virtual DescriptorHeapAllocation Allocate(Uint32 Count) override final;
563  virtual void Free(DescriptorHeapAllocation&& Allocation, Uint64 CmdQueueMask) override final
564  {
565  // Do nothing. Dynamic allocations are not disposed individually, but as whole chunks
566  // at the end of the frame by ReleaseAllocations()
567  Allocation.Reset();
568  }
569 
570  virtual Uint32 GetDescriptorSize() const override final { return m_ParentGPUHeap.GetDescriptorSize(); }
571 
572  size_t GetSuballocationCount() const { return m_Suballocations.size(); }
573 
574 private:
575  // Parent GPU descriptor heap that is used to allocate chunks
576  GPUDescriptorHeap& m_ParentGPUHeap;
577  const String m_ManagerName;
578 
579  // List of chunks allocated from the master GPU descriptor heap. All chunks are disposed at the end
580  // of the frame
581  std::vector<DescriptorHeapAllocation, STDAllocatorRawMem<DescriptorHeapAllocation>> m_Suballocations;
582 
583  Uint32 m_CurrentSuballocationOffset = 0;
584  Uint32 m_DynamicChunkSize = 0;
585 
586  Uint32 m_CurrDescriptorCount = 0;
587  Uint32 m_PeakDescriptorCount = 0;
588  Uint32 m_CurrSuballocationsTotalSize = 0;
589  Uint32 m_PeakSuballocationsTotalSize = 0;
590 };
591 
592 } // namespace Diligent
VariableSizeAllocationsManager.hpp
Diligent::DescriptorHeapAllocationManager::FreeAllocation
void FreeAllocation(DescriptorHeapAllocation &&Allocation)
Diligent::GPUDescriptorHeap::m_pd3d12DescriptorHeap
CComPtr< ID3D12DescriptorHeap > m_pd3d12DescriptorHeap
Definition: DescriptorHeap.hpp:521
Diligent::DynamicSuballocationsManager::ReleaseAllocations
void ReleaseAllocations(Uint64 CmdQueueMask)
Diligent::DynamicSuballocationsManager::Allocate
virtual DescriptorHeapAllocation Allocate(Uint32 Count) override final
Diligent::DescriptorHeapAllocationManager::Allocate
DescriptorHeapAllocation Allocate(uint32_t Count)
Flags
Uint32 Flags
Definition: DXBCUtils.cpp:71
Diligent::DescriptorHeapAllocation::Reset
void Reset()
Definition: DescriptorHeap.hpp:135
Diligent::DescriptorHeapAllocation::IsNull
bool IsNull() const
Definition: DescriptorHeap.hpp:204
Diligent::Uint64
uint64_t Uint64
64-bit unsigned integer
Definition: BasicTypes.h:50
Diligent::DescriptorHeapAllocationManager::GetNumAvailableDescriptors
size_t GetNumAvailableDescriptors() const
Definition: DescriptorHeap.hpp:313
Diligent::GPUDescriptorHeap::GetHeapDesc
const D3D12_DESCRIPTOR_HEAP_DESC & GetHeapDesc() const
Definition: DescriptorHeap.hpp:505
Diligent::IDescriptorAllocator::Free
virtual void Free(DescriptorHeapAllocation &&Allocation, Uint64 CmdQueueMask)=0
Diligent::DescriptorHeapAllocation::DescriptorHeapAllocation
DescriptorHeapAllocation(IDescriptorAllocator &Allocator, ID3D12DescriptorHeap *pHeap, D3D12_CPU_DESCRIPTOR_HANDLE CpuHandle, D3D12_GPU_DESCRIPTOR_HANDLE GpuHandle, Uint32 NHandles, Uint16 AllocationManagerId) noexcept
Definition: DescriptorHeap.hpp:83
Diligent::DescriptorHeapAllocation::GetDescriptorSize
UINT GetDescriptorSize() const
Definition: DescriptorHeap.hpp:207
Diligent::DescriptorHeapAllocation::GetGpuHandle
D3D12_GPU_DESCRIPTOR_HANDLE GetGpuHandle(Uint32 Offset=0) const
Definition: DescriptorHeap.hpp:173
Diligent::GPUDescriptorHeap::GetMaxDynamicDescriptors
Uint32 GetMaxDynamicDescriptors() const
Definition: DescriptorHeap.hpp:507
Diligent::CPUDescriptorHeap::~CPUDescriptorHeap
~CPUDescriptorHeap()
Diligent::GPUDescriptorHeap::~GPUDescriptorHeap
~GPUDescriptorHeap()
Diligent::max
Vector3< T > max(const Vector3< T > &a, const Vector3< T > &b)
Definition: BasicMath.hpp:1660
Diligent::CPUDescriptorHeap::GetDescriptorSize
virtual Uint32 GetDescriptorSize() const override final
Definition: DescriptorHeap.hpp:408
Diligent::GPUDescriptorHeap::m_HeapAllocationManager
DescriptorHeapAllocationManager m_HeapAllocationManager
Definition: DescriptorHeap.hpp:526
Diligent::DescriptorHeapAllocation::operator=
DescriptorHeapAllocation & operator=(DescriptorHeapAllocation &&Allocation) noexcept
Definition: DescriptorHeap.hpp:120
Diligent::DescriptorHeapAllocation::GetNumHandles
size_t GetNumHandles() const
Definition: DescriptorHeap.hpp:203
Diligent::GPUDescriptorHeap::Free
virtual void Free(DescriptorHeapAllocation &&Allocation, Uint64 CmdQueueMask) override final
Diligent::DescriptorHeapAllocation::GetAllocationManagerId
size_t GetAllocationManagerId() const
Definition: DescriptorHeap.hpp:206
Diligent::GPUDescriptorHeap
Definition: DescriptorHeap.hpp:473
Diligent::GPUDescriptorHeap::m_HeapDesc
const D3D12_DESCRIPTOR_HEAP_DESC m_HeapDesc
Definition: DescriptorHeap.hpp:520
Diligent::STDAllocator
Definition: STDAllocator.hpp:53
Diligent::DescriptorHeapAllocationManager::operator=
DescriptorHeapAllocationManager & operator=(DescriptorHeapAllocationManager &&)=delete
Diligent::DescriptorHeapAllocation::IsShaderVisible
bool IsShaderVisible() const
Definition: DescriptorHeap.hpp:205
Diligent::IDescriptorAllocator::GetDescriptorSize
virtual Uint32 GetDescriptorSize() const =0
Diligent::RenderDeviceD3D12Impl
Render device implementation in Direct3D12 backend.
Definition: RenderDeviceD3D12Impl.hpp:70
Diligent::DescriptorType::Count
@ Count
Diligent::DescriptorHeapAllocationManager::GetMaxDescriptors
Uint32 GetMaxDescriptors() const
Definition: DescriptorHeap.hpp:314
Diligent::DescriptorHeapAllocationManager::DescriptorHeapAllocationManager
DescriptorHeapAllocationManager(DescriptorHeapAllocationManager &&rhs) noexcept
Definition: DescriptorHeap.hpp:270
Diligent::DescriptorHeapAllocationManager::GetMaxAllocatedSize
size_t GetMaxAllocatedSize() const
Definition: DescriptorHeap.hpp:315
Diligent::CPUDescriptorHeap::operator=
CPUDescriptorHeap & operator=(const CPUDescriptorHeap &)=delete
Diligent::GPUDescriptorHeap::GetDescriptorSize
virtual Uint32 GetDescriptorSize() const override final
Definition: DescriptorHeap.hpp:498
Diligent::DynamicSuballocationsManager
Definition: DescriptorHeap.hpp:543
Diligent::IDescriptorAllocator
Definition: DescriptorHeap.hpp:49
Diligent::DescriptorHeapAllocationManager::~DescriptorHeapAllocationManager
~DescriptorHeapAllocationManager()
Type
const D3D12_PIPELINE_STATE_SUBOBJECT_TYPE Type
Definition: PipelineStateD3D12Impl.cpp:69
Diligent::GPUDescriptorHeap::AllocateDynamic
DescriptorHeapAllocation AllocateDynamic(uint32_t Count)
Definition: DescriptorHeap.hpp:500
Diligent::Uint32
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
Diligent::DescriptorHeapAllocation::DescriptorHeapAllocation
DescriptorHeapAllocation() noexcept
Definition: DescriptorHeap.hpp:71
Diligent::CPUDescriptorHeap::CPUDescriptorHeap
CPUDescriptorHeap(IMemoryAllocator &Allocator, RenderDeviceD3D12Impl &DeviceD3D12Impl, Uint32 NumDescriptorsInHeap, D3D12_DESCRIPTOR_HEAP_TYPE Type, D3D12_DESCRIPTOR_HEAP_FLAGS Flags)
Diligent::DescriptorHeapAllocation::GetDescriptorHeap
ID3D12DescriptorHeap * GetDescriptorHeap() const
Definition: DescriptorHeap.hpp:199
Diligent::DynamicSuballocationsManager::GetDescriptorSize
virtual Uint32 GetDescriptorSize() const override final
Definition: DescriptorHeap.hpp:570
Diligent::DescriptorHeapAllocationManager
Definition: DescriptorHeap.hpp:248
Diligent::DynamicSuballocationsManager::GetSuballocationCount
size_t GetSuballocationCount() const
Definition: DescriptorHeap.hpp:572
Diligent::DescriptorHeapAllocation::GetCpuHandle
D3D12_CPU_DESCRIPTOR_HANDLE GetCpuHandle(Uint32 Offset=0) const
Definition: DescriptorHeap.hpp:162
Diligent::IDescriptorAllocator::Allocate
virtual DescriptorHeapAllocation Allocate(uint32_t Count)=0
Diligent::DescriptorHeapAllocation::DescriptorHeapAllocation
DescriptorHeapAllocation(DescriptorHeapAllocation &&Allocation) noexcept
Definition: DescriptorHeap.hpp:105
Diligent::CPUDescriptorHeap
Definition: DescriptorHeap.hpp:387
Diligent::IMemoryAllocator
Base interface for a raw memory allocator.
Definition: MemoryAllocator.h:41
Diligent::DynamicSuballocationsManager::DynamicSuballocationsManager
DynamicSuballocationsManager(IMemoryAllocator &Allocator, GPUDescriptorHeap &ParentGPUHeap, Uint32 DynamicChunkSize, String ManagerName)
Diligent::DescriptorHeapAllocation::~DescriptorHeapAllocation
~DescriptorHeapAllocation()
Definition: DescriptorHeap.hpp:153
Diligent::DescriptorHeapAllocationManager::DescriptorHeapAllocationManager
DescriptorHeapAllocationManager(IMemoryAllocator &Allocator, RenderDeviceD3D12Impl &DeviceD3D12Impl, IDescriptorAllocator &ParentAllocator, size_t ThisManagerId, const D3D12_DESCRIPTOR_HEAP_DESC &HeapDesc)
Definition: DescriptorHeap.cpp:37
Diligent::GPUDescriptorHeap::Allocate
virtual DescriptorHeapAllocation Allocate(uint32_t Count) override final
Definition: DescriptorHeap.hpp:492
Diligent::GPUDescriptorHeap::operator=
GPUDescriptorHeap & operator=(const GPUDescriptorHeap &)=delete
Diligent::Uint16
uint16_t Uint16
16-bit unsigned integer
Definition: BasicTypes.h:52
Diligent::String
std::basic_string< Char > String
String variable.
Definition: BasicTypes.h:66
Diligent::GPUDescriptorHeap::m_DynamicAllocationsManager
DescriptorHeapAllocationManager m_DynamicAllocationsManager
Definition: DescriptorHeap.hpp:529
Diligent::CPUDescriptorHeap::Free
virtual void Free(DescriptorHeapAllocation &&Allocation, Uint64 CmdQueueMask) override final
VERIFY_EXPR
#define VERIFY_EXPR(...)
Definition: DebugUtilities.hpp:79
VERIFY
#define VERIFY(...)
Definition: DebugUtilities.hpp:76
Diligent::GPUDescriptorHeap::m_DescriptorSize
const UINT m_DescriptorSize
Definition: DescriptorHeap.hpp:523
Diligent::DynamicSuballocationsManager::Free
virtual void Free(DescriptorHeapAllocation &&Allocation, Uint64 CmdQueueMask) override final
Definition: DescriptorHeap.hpp:563
Diligent::GPUDescriptorHeap::GPUDescriptorHeap
GPUDescriptorHeap(IMemoryAllocator &Allocator, RenderDeviceD3D12Impl &Device, Uint32 NumDescriptorsInHeap, Uint32 NumDynamicDescriptors, D3D12_DESCRIPTOR_HEAP_TYPE Type, D3D12_DESCRIPTOR_HEAP_FLAGS Flags)
Diligent::DynamicSuballocationsManager::operator=
DynamicSuballocationsManager & operator=(const DynamicSuballocationsManager &)=delete
Diligent::DynamicSuballocationsManager::~DynamicSuballocationsManager
~DynamicSuballocationsManager()
Diligent::GPUDescriptorHeap::m_DeviceD3D12Impl
RenderDeviceD3D12Impl & m_DeviceD3D12Impl
Definition: DescriptorHeap.hpp:518
Diligent::GPUDescriptorHeap::GetMaxStaticDescriptors
Uint32 GetMaxStaticDescriptors() const
Definition: DescriptorHeap.hpp:506
Diligent::DescriptorHeapAllocation
Definition: DescriptorHeap.hpp:67
Diligent::CPUDescriptorHeap::Allocate
virtual DescriptorHeapAllocation Allocate(uint32_t Count) override final
Diligent::DescriptorHeapAllocation::GetHandle
HandleType GetHandle(Uint32 Offset=0) const
Diligent
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37
Diligent::VariableSizeAllocationsManager::GetFreeSize
OffsetType GetFreeSize() const
Definition: VariableSizeAllocationsManager.hpp:358