mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-05 12:20:07 +00:00
Bumped recording file format version to 1.5.
(Partial cherry pick from branch sparse_binding_example.)
This commit is contained in:
parent
0d601d8789
commit
920bfbe6f3
@ -23,7 +23,7 @@ Formats with only minor version incremented are backward compatible.
|
|||||||
VmaReplay application supports all older versions.
|
VmaReplay application supports all older versions.
|
||||||
Current version is:
|
Current version is:
|
||||||
|
|
||||||
1,4
|
1,5
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
|
|
||||||
@ -230,10 +230,14 @@ If `VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT` was used with the allocatio
|
|||||||
It may contain additional commas.
|
It may contain additional commas.
|
||||||
It should not contain end-of-line characters - results are then undefined.
|
It should not contain end-of-line characters - results are then undefined.
|
||||||
|
|
||||||
|
**list of (...)** (min format version: 1.5)
|
||||||
|
|
||||||
|
An ordered sequence of values of some type, separated by single space.
|
||||||
|
|
||||||
# Example file
|
# Example file
|
||||||
|
|
||||||
Vulkan Memory Allocator,Calls recording
|
Vulkan Memory Allocator,Calls recording
|
||||||
1,4
|
1,5
|
||||||
Config,Begin
|
Config,Begin
|
||||||
PhysicalDevice,apiVersion,4198477
|
PhysicalDevice,apiVersion,4198477
|
||||||
PhysicalDevice,driverVersion,8388653
|
PhysicalDevice,driverVersion,8388653
|
||||||
|
@ -1,5 +1,29 @@
|
|||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
|
bool StrRangeToPtrList(const StrRange& s, std::vector<uint64_t>& out)
|
||||||
|
{
|
||||||
|
out.clear();
|
||||||
|
StrRange currRange = { s.beg, nullptr };
|
||||||
|
while(currRange.beg < s.end)
|
||||||
|
{
|
||||||
|
currRange.end = currRange.beg;
|
||||||
|
while(currRange.end < s.end && *currRange.end != ' ')
|
||||||
|
{
|
||||||
|
++currRange.end;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t ptr = 0;
|
||||||
|
if(!StrRangeToPtr(currRange, ptr))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
out.push_back(ptr);
|
||||||
|
|
||||||
|
currRange.beg = currRange.end + 1;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// LineSplit class
|
// LineSplit class
|
||||||
|
|
||||||
|
@ -111,6 +111,7 @@ inline bool StrRangeToBool(const StrRange& s, bool& out)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
bool StrRangeToPtrList(const StrRange& s, std::vector<uint64_t>& out);
|
||||||
|
|
||||||
class LineSplit
|
class LineSplit
|
||||||
{
|
{
|
||||||
|
@ -150,7 +150,7 @@ static size_t g_DefragmentAfterLineNextIndex = 0;
|
|||||||
static bool ValidateFileVersion()
|
static bool ValidateFileVersion()
|
||||||
{
|
{
|
||||||
if(GetVersionMajor(g_FileVersion) == 1 &&
|
if(GetVersionMajor(g_FileVersion) == 1 &&
|
||||||
GetVersionMinor(g_FileVersion) <= 4)
|
GetVersionMinor(g_FileVersion) <= 5)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -200,7 +200,7 @@ public:
|
|||||||
void RegisterCreateImage(uint32_t usage, uint32_t tiling);
|
void RegisterCreateImage(uint32_t usage, uint32_t tiling);
|
||||||
void RegisterCreateBuffer(uint32_t usage);
|
void RegisterCreateBuffer(uint32_t usage);
|
||||||
void RegisterCreatePool();
|
void RegisterCreatePool();
|
||||||
void RegisterCreateAllocation();
|
void RegisterCreateAllocation(size_t allocCount = 1);
|
||||||
|
|
||||||
void UpdateMemStats(const VmaStats& currStats);
|
void UpdateMemStats(const VmaStats& currStats);
|
||||||
|
|
||||||
@ -369,9 +369,9 @@ void Statistics::RegisterCreatePool()
|
|||||||
++m_PoolCreationCount;
|
++m_PoolCreationCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Statistics::RegisterCreateAllocation()
|
void Statistics::RegisterCreateAllocation(size_t allocCount)
|
||||||
{
|
{
|
||||||
++m_AllocationCreationCount;
|
m_AllocationCreationCount += allocCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Statistics::UpdateMemStats(const VmaStats& currStats)
|
void Statistics::UpdateMemStats(const VmaStats& currStats)
|
||||||
@ -966,10 +966,10 @@ private:
|
|||||||
};
|
};
|
||||||
struct Allocation
|
struct Allocation
|
||||||
{
|
{
|
||||||
uint32_t allocationFlags;
|
uint32_t allocationFlags = 0;
|
||||||
VmaAllocation allocation;
|
VmaAllocation allocation = VK_NULL_HANDLE;
|
||||||
VkBuffer buffer;
|
VkBuffer buffer = VK_NULL_HANDLE;
|
||||||
VkImage image;
|
VkImage image = VK_NULL_HANDLE;
|
||||||
};
|
};
|
||||||
std::unordered_map<uint64_t, Pool> m_Pools;
|
std::unordered_map<uint64_t, Pool> m_Pools;
|
||||||
std::unordered_map<uint64_t, Allocation> m_Allocations;
|
std::unordered_map<uint64_t, Allocation> m_Allocations;
|
||||||
@ -1014,10 +1014,10 @@ private:
|
|||||||
void ExecuteDestroyPool(size_t lineNumber, const CsvSplit& csvSplit);
|
void ExecuteDestroyPool(size_t lineNumber, const CsvSplit& csvSplit);
|
||||||
void ExecuteSetAllocationUserData(size_t lineNumber, const CsvSplit& csvSplit);
|
void ExecuteSetAllocationUserData(size_t lineNumber, const CsvSplit& csvSplit);
|
||||||
void ExecuteCreateBuffer(size_t lineNumber, const CsvSplit& csvSplit);
|
void ExecuteCreateBuffer(size_t lineNumber, const CsvSplit& csvSplit);
|
||||||
void ExecuteDestroyBuffer(size_t lineNumber, const CsvSplit& csvSplit) { m_Stats.RegisterFunctionCall(VMA_FUNCTION::DestroyBuffer); DestroyAllocation(lineNumber, csvSplit); }
|
void ExecuteDestroyBuffer(size_t lineNumber, const CsvSplit& csvSplit) { m_Stats.RegisterFunctionCall(VMA_FUNCTION::DestroyBuffer); DestroyAllocation(lineNumber, csvSplit, "vmaDestroyBuffer"); }
|
||||||
void ExecuteCreateImage(size_t lineNumber, const CsvSplit& csvSplit);
|
void ExecuteCreateImage(size_t lineNumber, const CsvSplit& csvSplit);
|
||||||
void ExecuteDestroyImage(size_t lineNumber, const CsvSplit& csvSplit) { m_Stats.RegisterFunctionCall(VMA_FUNCTION::DestroyImage); DestroyAllocation(lineNumber, csvSplit); }
|
void ExecuteDestroyImage(size_t lineNumber, const CsvSplit& csvSplit) { m_Stats.RegisterFunctionCall(VMA_FUNCTION::DestroyImage); DestroyAllocation(lineNumber, csvSplit, "vmaDestroyImage"); }
|
||||||
void ExecuteFreeMemory(size_t lineNumber, const CsvSplit& csvSplit) { m_Stats.RegisterFunctionCall(VMA_FUNCTION::FreeMemory); DestroyAllocation(lineNumber, csvSplit); }
|
void ExecuteFreeMemory(size_t lineNumber, const CsvSplit& csvSplit) { m_Stats.RegisterFunctionCall(VMA_FUNCTION::FreeMemory); DestroyAllocation(lineNumber, csvSplit, "vmaFreeMemory"); }
|
||||||
void ExecuteCreateLostAllocation(size_t lineNumber, const CsvSplit& csvSplit);
|
void ExecuteCreateLostAllocation(size_t lineNumber, const CsvSplit& csvSplit);
|
||||||
void ExecuteAllocateMemory(size_t lineNumber, const CsvSplit& csvSplit);
|
void ExecuteAllocateMemory(size_t lineNumber, const CsvSplit& csvSplit);
|
||||||
void ExecuteAllocateMemoryForBufferOrImage(size_t lineNumber, const CsvSplit& csvSplit, OBJECT_TYPE objType);
|
void ExecuteAllocateMemoryForBufferOrImage(size_t lineNumber, const CsvSplit& csvSplit, OBJECT_TYPE objType);
|
||||||
@ -1030,7 +1030,7 @@ private:
|
|||||||
void ExecuteMakePoolAllocationsLost(size_t lineNumber, const CsvSplit& csvSplit);
|
void ExecuteMakePoolAllocationsLost(size_t lineNumber, const CsvSplit& csvSplit);
|
||||||
void ExecuteResizeAllocation(size_t lineNumber, const CsvSplit& csvSplit);
|
void ExecuteResizeAllocation(size_t lineNumber, const CsvSplit& csvSplit);
|
||||||
|
|
||||||
void DestroyAllocation(size_t lineNumber, const CsvSplit& csvSplit);
|
void DestroyAllocation(size_t lineNumber, const CsvSplit& csvSplit, const char* functionName);
|
||||||
|
|
||||||
void PrintStats(const VmaStats& stats, const char* suffix);
|
void PrintStats(const VmaStats& stats, const char* suffix);
|
||||||
void PrintStatInfo(const VmaStatInfo& info);
|
void PrintStatInfo(const VmaStatInfo& info);
|
||||||
@ -1135,45 +1135,45 @@ void Player::ExecuteLine(size_t lineNumber, const StrRange& line)
|
|||||||
// Nothing.
|
// Nothing.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(StrRangeEq(functionName, "vmaCreatePool"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::CreatePool]))
|
||||||
ExecuteCreatePool(lineNumber, csvSplit);
|
ExecuteCreatePool(lineNumber, csvSplit);
|
||||||
else if(StrRangeEq(functionName, "vmaDestroyPool"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::DestroyPool]))
|
||||||
ExecuteDestroyPool(lineNumber, csvSplit);
|
ExecuteDestroyPool(lineNumber, csvSplit);
|
||||||
else if(StrRangeEq(functionName, "vmaSetAllocationUserData"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::SetAllocationUserData]))
|
||||||
ExecuteSetAllocationUserData(lineNumber, csvSplit);
|
ExecuteSetAllocationUserData(lineNumber, csvSplit);
|
||||||
else if(StrRangeEq(functionName, "vmaCreateBuffer"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::CreateBuffer]))
|
||||||
ExecuteCreateBuffer(lineNumber, csvSplit);
|
ExecuteCreateBuffer(lineNumber, csvSplit);
|
||||||
else if(StrRangeEq(functionName, "vmaDestroyBuffer"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::DestroyBuffer]))
|
||||||
ExecuteDestroyBuffer(lineNumber, csvSplit);
|
ExecuteDestroyBuffer(lineNumber, csvSplit);
|
||||||
else if(StrRangeEq(functionName, "vmaCreateImage"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::CreateImage]))
|
||||||
ExecuteCreateImage(lineNumber, csvSplit);
|
ExecuteCreateImage(lineNumber, csvSplit);
|
||||||
else if(StrRangeEq(functionName, "vmaDestroyImage"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::DestroyImage]))
|
||||||
ExecuteDestroyImage(lineNumber, csvSplit);
|
ExecuteDestroyImage(lineNumber, csvSplit);
|
||||||
else if(StrRangeEq(functionName, "vmaFreeMemory"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::FreeMemory]))
|
||||||
ExecuteFreeMemory(lineNumber, csvSplit);
|
ExecuteFreeMemory(lineNumber, csvSplit);
|
||||||
else if(StrRangeEq(functionName, "vmaCreateLostAllocation"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::CreateLostAllocation]))
|
||||||
ExecuteCreateLostAllocation(lineNumber, csvSplit);
|
ExecuteCreateLostAllocation(lineNumber, csvSplit);
|
||||||
else if(StrRangeEq(functionName, "vmaAllocateMemory"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::AllocateMemory]))
|
||||||
ExecuteAllocateMemory(lineNumber, csvSplit);
|
ExecuteAllocateMemory(lineNumber, csvSplit);
|
||||||
else if(StrRangeEq(functionName, "vmaAllocateMemoryForBuffer"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::AllocateMemoryForBuffer]))
|
||||||
ExecuteAllocateMemoryForBufferOrImage(lineNumber, csvSplit, OBJECT_TYPE::BUFFER);
|
ExecuteAllocateMemoryForBufferOrImage(lineNumber, csvSplit, OBJECT_TYPE::BUFFER);
|
||||||
else if(StrRangeEq(functionName, "vmaAllocateMemoryForImage"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::AllocateMemoryForImage]))
|
||||||
ExecuteAllocateMemoryForBufferOrImage(lineNumber, csvSplit, OBJECT_TYPE::IMAGE);
|
ExecuteAllocateMemoryForBufferOrImage(lineNumber, csvSplit, OBJECT_TYPE::IMAGE);
|
||||||
else if(StrRangeEq(functionName, "vmaMapMemory"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::MapMemory]))
|
||||||
ExecuteMapMemory(lineNumber, csvSplit);
|
ExecuteMapMemory(lineNumber, csvSplit);
|
||||||
else if(StrRangeEq(functionName, "vmaUnmapMemory"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::UnmapMemory]))
|
||||||
ExecuteUnmapMemory(lineNumber, csvSplit);
|
ExecuteUnmapMemory(lineNumber, csvSplit);
|
||||||
else if(StrRangeEq(functionName, "vmaFlushAllocation"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::FlushAllocation]))
|
||||||
ExecuteFlushAllocation(lineNumber, csvSplit);
|
ExecuteFlushAllocation(lineNumber, csvSplit);
|
||||||
else if(StrRangeEq(functionName, "vmaInvalidateAllocation"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::InvalidateAllocation]))
|
||||||
ExecuteInvalidateAllocation(lineNumber, csvSplit);
|
ExecuteInvalidateAllocation(lineNumber, csvSplit);
|
||||||
else if(StrRangeEq(functionName, "vmaTouchAllocation"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::TouchAllocation]))
|
||||||
ExecuteTouchAllocation(lineNumber, csvSplit);
|
ExecuteTouchAllocation(lineNumber, csvSplit);
|
||||||
else if(StrRangeEq(functionName, "vmaGetAllocationInfo"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::GetAllocationInfo]))
|
||||||
ExecuteGetAllocationInfo(lineNumber, csvSplit);
|
ExecuteGetAllocationInfo(lineNumber, csvSplit);
|
||||||
else if(StrRangeEq(functionName, "vmaMakePoolAllocationsLost"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::MakePoolAllocationsLost]))
|
||||||
ExecuteMakePoolAllocationsLost(lineNumber, csvSplit);
|
ExecuteMakePoolAllocationsLost(lineNumber, csvSplit);
|
||||||
else if(StrRangeEq(functionName, "vmaResizeAllocation"))
|
else if(StrRangeEq(functionName, VMA_FUNCTION_NAMES[(uint32_t)VMA_FUNCTION::ResizeAllocation]))
|
||||||
ExecuteResizeAllocation(lineNumber, csvSplit);
|
ExecuteResizeAllocation(lineNumber, csvSplit);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2241,7 +2241,7 @@ void Player::ExecuteCreateBuffer(size_t lineNumber, const CsvSplit& csvSplit)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::DestroyAllocation(size_t lineNumber, const CsvSplit& csvSplit)
|
void Player::DestroyAllocation(size_t lineNumber, const CsvSplit& csvSplit, const char* functionName)
|
||||||
{
|
{
|
||||||
if(ValidateFunctionParameterCount(lineNumber, csvSplit, 1, false))
|
if(ValidateFunctionParameterCount(lineNumber, csvSplit, 1, false))
|
||||||
{
|
{
|
||||||
@ -2271,7 +2271,7 @@ void Player::DestroyAllocation(size_t lineNumber, const CsvSplit& csvSplit)
|
|||||||
{
|
{
|
||||||
if(IssueWarning())
|
if(IssueWarning())
|
||||||
{
|
{
|
||||||
printf("Line %zu: Invalid parameters for vmaDestroyBuffer.\n", lineNumber);
|
printf("Line %zu: Invalid parameters for %s.\n", lineNumber, functionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6397,6 +6397,7 @@ private:
|
|||||||
int64_t m_StartCounter;
|
int64_t m_StartCounter;
|
||||||
|
|
||||||
void GetBasicParams(CallParams& outParams);
|
void GetBasicParams(CallParams& outParams);
|
||||||
|
void PrintPointerList(uint64_t count, const VmaAllocation* pItems);
|
||||||
void Flush();
|
void Flush();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -13235,7 +13236,7 @@ VkResult VmaRecorder::Init(const VmaRecordSettings& settings, bool useMutex)
|
|||||||
|
|
||||||
// Write header.
|
// Write header.
|
||||||
fprintf(m_File, "%s\n", "Vulkan Memory Allocator,Calls recording");
|
fprintf(m_File, "%s\n", "Vulkan Memory Allocator,Calls recording");
|
||||||
fprintf(m_File, "%s\n", "1,4");
|
fprintf(m_File, "%s\n", "1,5");
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -13682,6 +13683,18 @@ void VmaRecorder::GetBasicParams(CallParams& outParams)
|
|||||||
outParams.time = (double)(counter.QuadPart - m_StartCounter) / (double)m_Freq;
|
outParams.time = (double)(counter.QuadPart - m_StartCounter) / (double)m_Freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VmaRecorder::PrintPointerList(uint64_t count, const VmaAllocation* pItems)
|
||||||
|
{
|
||||||
|
if(count)
|
||||||
|
{
|
||||||
|
fprintf(m_File, "%p", pItems[0]);
|
||||||
|
for(uint64_t i = 1; i < count; ++i)
|
||||||
|
{
|
||||||
|
fprintf(m_File, " %p", pItems[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void VmaRecorder::Flush()
|
void VmaRecorder::Flush()
|
||||||
{
|
{
|
||||||
if((m_Flags & VMA_RECORD_FLUSH_AFTER_CALL_BIT) != 0)
|
if((m_Flags & VMA_RECORD_FLUSH_AFTER_CALL_BIT) != 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user