Skip to content

Commit 1f8aa44

Browse files
Improved documentation of Allocation::SetResource - added a warning
1 parent 62b73ef commit 1f8aa44

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

include/D3D12MemAlloc.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,13 @@ class D3D12MA_API Allocation : public IUnknownImpl
549549
*/
550550
ID3D12Resource* GetResource() const { return m_Resource; }
551551

552-
/// Releases the resource currently pointed by the allocation (if any), sets it to new one, incrementing its reference counter (if not null).
552+
/** \brief Releases the resource currently pointed by the allocation (if not null), sets it to new one, incrementing its reference counter (if not null).
553+
554+
\warning
555+
This is an advanced feature that should be used only in special cases, e.g. during \subpage defragmentation.
556+
Typically, an allocation object should reference the resource that was created together with it.
557+
If you swap it to another resource of different size, \subpage statistics and budgets can be calculated incorrectly.
558+
*/
553559
void SetResource(ID3D12Resource* pResource);
554560

555561
/** \brief Returns memory heap that the resource is created in.

0 commit comments

Comments
 (0)