MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / NormalBlock

Class NormalBlock

modules/engine/graphics/src/d3d12/D3D12MemAlloc.cpp:5847–10247  ·  view source on GitHub ↗

Represents a single block of device memory (heap) with all the data about its regions (aka suballocations, Allocation), assigned and free. Thread-safety: This class must be externally synchronized. */

Source from the content-addressed store, hash-verified

5845Thread-safety: This class must be externally synchronized.
5846*/
5847class NormalBlock : public MemoryBlock
5848{
5849public:
5850 BlockMetadata* m_pMetadata;
5851
5852 NormalBlock(
5853 AllocatorPimpl* allocator,
5854 BlockVector* blockVector,
5855 const D3D12_HEAP_PROPERTIES& heapProps,
5856 D3D12_HEAP_FLAGS heapFlags,
5857 UINT64 size,
5858 UINT id);
5859 virtual ~NormalBlock();
5860
5861 BlockVector* GetBlockVector() const { return m_BlockVector; }
5862
5863 // 'algorithm' should be one of the *_ALGORITHM_* flags in enums POOL_FLAGS or VIRTUAL_BLOCK_FLAGS
5864 HRESULT Init(UINT32 algorithm, ID3D12ProtectedResourceSession* pProtectedSession, bool denyMsaaTextures);
5865
5866 // Validates all data structures inside this object. If not valid, returns false.
5867 bool Validate() const;
5868
5869private:
5870 BlockVector* m_BlockVector;
5871
5872 D3D12MA_CLASS_NO_COPY(NormalBlock)
5873};
5874#endif // _D3D12MA_NORMAL_BLOCK
5875
5876#ifndef _D3D12MA_COMMITTED_ALLOCATION_LIST_ITEM_TRAITS
5877struct CommittedAllocationListItemTraits
5878{
5879 using ItemType = Allocation;
5880
5881 static ItemType* GetPrev(const ItemType* item)
5882 {
5883 D3D12MA_ASSERT(item->m_PackedData.GetType() == Allocation::TYPE_COMMITTED || item->m_PackedData.GetType() == Allocation::TYPE_HEAP);
5884 return item->m_Committed.prev;
5885 }
5886 static ItemType* GetNext(const ItemType* item)
5887 {
5888 D3D12MA_ASSERT(item->m_PackedData.GetType() == Allocation::TYPE_COMMITTED || item->m_PackedData.GetType() == Allocation::TYPE_HEAP);
5889 return item->m_Committed.next;
5890 }
5891 static ItemType*& AccessPrev(ItemType* item)
5892 {
5893 D3D12MA_ASSERT(item->m_PackedData.GetType() == Allocation::TYPE_COMMITTED || item->m_PackedData.GetType() == Allocation::TYPE_HEAP);
5894 return item->m_Committed.prev;
5895 }
5896 static ItemType*& AccessNext(ItemType* item)
5897 {
5898 D3D12MA_ASSERT(item->m_PackedData.GetType() == Allocation::TYPE_COMMITTED || item->m_PackedData.GetType() == Allocation::TYPE_HEAP);
5899 return item->m_Committed.next;
5900 }
5901};
5902#endif // _D3D12MA_COMMITTED_ALLOCATION_LIST_ITEM_TRAITS
5903
5904#ifndef _D3D12MA_COMMITTED_ALLOCATION_LIST

Callers

nothing calls this directly

Calls 15

IsHeapTypeStandardFunction · 0.85
ClearDetailedStatisticsFunction · 0.85
AddDetailedStatisticsFunction · 0.85
IndexToHeapTypeFunction · 0.85
memcpyFunction · 0.85
FreeFunction · 0.85
HeapFlagsToAlignmentFunction · 0.85
HeapTypeToIndexFunction · 0.85
GetHeapFunction · 0.85
AddStatisticsFunction · 0.85
D3D12MA_DELETEFunction · 0.85

Tested by

no test coverage detected