Renaming after merge - members of struct Budget are now called UsageBytes, BudgetBytes
JSON dump format also changed to reflect that.
diff --git a/src/D3D12MemAlloc.cpp b/src/D3D12MemAlloc.cpp
index ba3369c..aa4e974 100644
--- a/src/D3D12MemAlloc.cpp
+++ b/src/D3D12MemAlloc.cpp
@@ -3249,7 +3249,7 @@
{
Budget budget = {};
m_hAllocator->GetBudgetForHeapType(budget, m_HeapType);
- freeMemory = (budget.Usage < budget.MemoryBudget) ? (budget.MemoryBudget - budget.Usage) : 0;
+ freeMemory = (budget.UsageBytes < budget.BudgetBytes) ? (budget.BudgetBytes - budget.UsageBytes) : 0;
}
const bool canCreateNewBlock =
@@ -3368,7 +3368,7 @@
{
Budget budget = {};
m_hAllocator->GetBudgetForHeapType(budget, m_HeapType);
- budgetExceeded = budget.Usage >= budget.MemoryBudget;
+ budgetExceeded = budget.UsageBytes >= budget.BudgetBytes;
}
// Scope for lock.
@@ -3841,7 +3841,7 @@
{
Budget budget = {};
GetBudgetForHeapType(budget, pAllocDesc->HeapType);
- if(budget.Usage + resAllocInfo.SizeInBytes > budget.MemoryBudget)
+ if(budget.UsageBytes + resAllocInfo.SizeInBytes > budget.BudgetBytes)
{
return E_OUTOFMEMORY;
}
@@ -3896,7 +3896,7 @@
{
Budget budget = {};
GetBudgetForHeapType(budget, pAllocDesc->HeapType);
- if(budget.Usage + allocInfo.SizeInBytes > budget.MemoryBudget)
+ if(budget.UsageBytes + allocInfo.SizeInBytes > budget.BudgetBytes)
{
return E_OUTOFMEMORY;
}
@@ -4196,27 +4196,27 @@
if(m_Budget.m_D3D12UsageLocal + outGpuBudget->BlockBytes > m_Budget.m_BlockBytesAtBudgetFetch[0])
{
- outGpuBudget->Usage = m_Budget.m_D3D12UsageLocal +
+ outGpuBudget->UsageBytes = m_Budget.m_D3D12UsageLocal +
outGpuBudget->BlockBytes - m_Budget.m_BlockBytesAtBudgetFetch[0];
}
else
{
- outGpuBudget->Usage = 0;
+ outGpuBudget->UsageBytes = 0;
}
- outGpuBudget->MemoryBudget = m_Budget.m_D3D12BudgetLocal;
+ outGpuBudget->BudgetBytes = m_Budget.m_D3D12BudgetLocal;
}
if(outCpuBudget)
{
if(m_Budget.m_D3D12UsageNonLocal + outCpuBudget->BlockBytes > m_Budget.m_BlockBytesAtBudgetFetch[1] + m_Budget.m_BlockBytesAtBudgetFetch[2])
{
- outCpuBudget->Usage = m_Budget.m_D3D12UsageNonLocal +
+ outCpuBudget->UsageBytes = m_Budget.m_D3D12UsageNonLocal +
outCpuBudget->BlockBytes - (m_Budget.m_BlockBytesAtBudgetFetch[1] + m_Budget.m_BlockBytesAtBudgetFetch[2]);
}
else
{
- outCpuBudget->Usage = 0;
+ outCpuBudget->UsageBytes = 0;
}
- outCpuBudget->MemoryBudget = m_Budget.m_D3D12BudgetNonLocal;
+ outCpuBudget->BudgetBytes = m_Budget.m_D3D12BudgetNonLocal;
}
}
else
@@ -4231,14 +4231,14 @@
if(outGpuBudget)
{
const UINT64 gpuMemorySize = m_AdapterDesc.DedicatedVideoMemory + m_AdapterDesc.DedicatedSystemMemory; // TODO: Is this right?
- outGpuBudget->Usage = outGpuBudget->BlockBytes;
- outGpuBudget->MemoryBudget = gpuMemorySize * 8 / 10; // 80% heuristics.
+ outGpuBudget->UsageBytes = outGpuBudget->BlockBytes;
+ outGpuBudget->BudgetBytes = gpuMemorySize * 8 / 10; // 80% heuristics.
}
if(outCpuBudget)
{
const UINT64 cpuMemorySize = m_AdapterDesc.SharedSystemMemory; // TODO: Is this right?
- outCpuBudget->Usage = outCpuBudget->BlockBytes;
- outCpuBudget->MemoryBudget = cpuMemorySize * 8 / 10; // 80% heuristics.
+ outCpuBudget->UsageBytes = outCpuBudget->BlockBytes;
+ outCpuBudget->BudgetBytes = cpuMemorySize * 8 / 10; // 80% heuristics.
}
}
}
@@ -4503,10 +4503,10 @@
json.WriteNumber(budget.BlockBytes);
json.WriteString(L"AllocationBytes");
json.WriteNumber(budget.AllocationBytes);
- json.WriteString(L"Usage");
- json.WriteNumber(budget.Usage);
- json.WriteString(L"Budget");
- json.WriteNumber(budget.MemoryBudget);
+ json.WriteString(L"UsageBytes");
+ json.WriteNumber(budget.UsageBytes);
+ json.WriteString(L"BudgetBytes");
+ json.WriteNumber(budget.BudgetBytes);
}
json.EndObject();
}
diff --git a/src/D3D12MemAlloc.h b/src/D3D12MemAlloc.h
index 30dc20e..55932b2 100644
--- a/src/D3D12MemAlloc.h
+++ b/src/D3D12MemAlloc.h
@@ -703,7 +703,7 @@
also occupying the memory, like swapchain, pipeline state objects, descriptor heaps, command lists, or
memory blocks allocated outside of this library, if any.
*/
- UINT64 Usage;
+ UINT64 UsageBytes;
/** \brief Estimated amount of memory available to the program, in bytes.
@@ -711,10 +711,10 @@
It might be different (most probably smaller) than memory sizes reported in `DXGI_ADAPTER_DESC` due to factors
external to the program, like other programs also consuming system resources.
- Difference `Budget - Usage` is the amount of additional memory that can probably
+ Difference `BudgetBytes - UsageBytes` is the amount of additional memory that can probably
be allocated without problems. Exceeding the budget may result in various problems.
*/
- UINT64 MemoryBudget;
+ UINT64 BudgetBytes;
};
/**