#include "libANGLE/renderer/vulkan/MemoryTracking.h"
#include "common/debug.h"
#include "libANGLE/renderer/vulkan/vk_renderer.h"
namespace
{
constexpr bool kTrackMemoryAllocationSizes = …;
#if defined(ANGLE_ENABLE_MEMORY_ALLOC_LOGGING)
constexpr bool kTrackMemoryAllocationDebug = true;
static_assert(kTrackMemoryAllocationSizes,
"kTrackMemoryAllocationSizes must be enabled to use kTrackMemoryAllocationDebug.");
#else
constexpr bool kTrackMemoryAllocationDebug = …;
#endif
}
namespace rx
{
namespace
{
void OutputMemoryLogStream(std::stringstream &outStream, vk::MemoryLogSeverity severity)
{ … }
void CheckForCurrentMemoryAllocations(vk::Renderer *renderer, vk::MemoryLogSeverity severity)
{ … }
void LogPendingMemoryAllocation(vk::Renderer *renderer, vk::MemoryLogSeverity severity)
{ … }
void LogMemoryHeapStats(vk::Renderer *renderer, vk::MemoryLogSeverity severity)
{ … }
}
MemoryAllocationTracker::MemoryAllocationTracker(vk::Renderer *renderer)
: … { … }
void MemoryAllocationTracker::initMemoryTrackers()
{ … }
void MemoryAllocationTracker::onDestroy()
{ … }
void MemoryAllocationTracker::onDeviceInit()
{ … }
void MemoryAllocationTracker::logMemoryStatsOnError()
{ … }
void MemoryAllocationTracker::onMemoryAllocImpl(vk::MemoryAllocationType allocType,
VkDeviceSize size,
uint32_t memoryTypeIndex,
void *handle)
{ … }
void MemoryAllocationTracker::onMemoryDeallocImpl(vk::MemoryAllocationType allocType,
VkDeviceSize size,
uint32_t memoryTypeIndex,
void *handle)
{ … }
VkDeviceSize MemoryAllocationTracker::getActiveMemoryAllocationsSize(uint32_t allocTypeIndex) const
{ … }
VkDeviceSize MemoryAllocationTracker::getActiveHeapMemoryAllocationsSize(uint32_t allocTypeIndex,
uint32_t heapIndex) const
{ … }
uint64_t MemoryAllocationTracker::getActiveMemoryAllocationsCount(uint32_t allocTypeIndex) const
{ … }
uint64_t MemoryAllocationTracker::getActiveHeapMemoryAllocationsCount(uint32_t allocTypeIndex,
uint32_t heapIndex) const
{ … }
void MemoryAllocationTracker::compareExpectedFlagsWithAllocatedFlags(
VkMemoryPropertyFlags requiredFlags,
VkMemoryPropertyFlags preferredFlags,
VkMemoryPropertyFlags allocatedFlags,
void *handle)
{ … }
VkDeviceSize MemoryAllocationTracker::getPendingMemoryAllocationSize() const
{ … }
vk::MemoryAllocationType MemoryAllocationTracker::getPendingMemoryAllocationType() const
{ … }
uint32_t MemoryAllocationTracker::getPendingMemoryTypeIndex() const
{ … }
void MemoryAllocationTracker::setPendingMemoryAlloc(vk::MemoryAllocationType allocType,
VkDeviceSize size,
uint32_t memoryTypeIndex)
{ … }
void MemoryAllocationTracker::resetPendingMemoryAlloc()
{ … }
namespace vk
{
MemoryReport::MemoryReport()
: … { … }
void MemoryReport::processCallback(const VkDeviceMemoryReportCallbackDataEXT &callbackData,
bool logCallback)
{ … }
void MemoryReport::logMemoryReportStats() const
{ … }
}
}