Vulkan: Add memory allocation log support in debug

* Added a memory tracker to the renderer object to keep track of the
memory allocations and deallocations in more detail.

  * This feature is used for debugging only.

  * To enable it, set angle_enable_memory_alloc_logging=true in GN args
    (added in renderer/vulkan/BUILD).

    * It is related to ANGLE_ENABLE_MEMORY_ALLOC_LOGGING in the code.

  * The tracker are updated in the memory allocation tracking functions
    if the feature is enabled. (The counter is always updated, even if
    the feature is disabled.)

  * At the end of a RendererVk object, it checks for and logs any
    remaining allocated memory from MemoryAllocationType members.

  * The data is stored in the map object "mMemoryAllocationTracker".
  The key used for it is currently of type angle::BacktraceInfo.

    * If angle_enable_unwind_backtrace_support is disabled, or not on
      Android, the key is an empty object.

  * MemoryAllocInfoMapKey is used as a key to access the allocation
    information.

Bug: b/242641395
Change-Id: If701a4bdea2f8738a830ee47e0c7c5cdacf95b87
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4050103
Reviewed-by: Charlie Lao <cclao@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
This commit is contained in:
Amirali Abdolrashidi
2022-11-22 16:08:07 -08:00
committed by Angle LUCI CQ
parent 66a7117a07
commit 58d7ace238
9 changed files with 249 additions and 20 deletions

View File

@@ -237,6 +237,10 @@ declare_args() {
# on Android for debugging purposes. Disabled by default.
angle_enable_unwind_backtrace_support = false
# Memory allocation logging support. This feature is for debugging only.
# Disabled by default.
angle_enable_memory_alloc_logging = false
# Disable the layers in ubsan builds because of really slow builds.
# Vulkan Validation Layers require Android NDK API level 26, i.e. Oreo, due to
# Vulkan Validation Layers compatibility issues, see http://crrev/c/1405714.