[vulkan] Promote vkAllocate/FreeMemory to fully virtual entry points

bug: 111137294
bug: 121420031
Change-Id: Id85c246a3b853d035934cb1803be8fe825777a73
diff --git a/system/vulkan_enc/ResourceTracker.cpp b/system/vulkan_enc/ResourceTracker.cpp
index a3ff456..aac0fc6 100644
--- a/system/vulkan_enc/ResourceTracker.cpp
+++ b/system/vulkan_enc/ResourceTracker.cpp
@@ -425,11 +425,18 @@
         VkResult input_result,
         VkDevice device,
         const VkMemoryAllocateInfo* pAllocateInfo,
-        const VkAllocationCallbacks*,
+        const VkAllocationCallbacks* pAllocator,
         VkDeviceMemory* pMemory) {
 
         if (input_result != VK_SUCCESS) return input_result;
 
+        VkEncoder* enc = (VkEncoder*)context;
+
+        input_result =
+            enc->vkAllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
+        
+        if (input_result != VK_SUCCESS) return input_result;
+
         VkDeviceSize allocationSize = pAllocateInfo->allocationSize;
         VkDeviceSize mappedSize = getNonCoherentExtendedSize(device, allocationSize);
         uint8_t* mappedPtr = nullptr;
@@ -452,7 +459,6 @@
             hostVisible && directMappingSupported;
 
         if (doDirectMap) {
-            VkEncoder* enc = (VkEncoder*)context;
 
             uint64_t directMappedAddr = 0;
 
@@ -484,6 +490,16 @@
         return input_result;
     }
 
+    void on_vkFreeMemory(
+        void* context,
+        VkDevice device,
+        VkDeviceMemory memory,
+        const VkAllocationCallbacks* pAllocateInfo) {
+
+        VkEncoder* enc = (VkEncoder*)context;
+        enc->vkFreeMemory(device, memory, pAllocateInfo);
+    }
+
     VkResult on_vkMapMemory(
         void*,
         VkResult host_result,
@@ -791,6 +807,15 @@
         context, input_result, device, pAllocateInfo, pAllocator, pMemory);
 }
 
+void ResourceTracker::on_vkFreeMemory(
+    void* context,
+    VkDevice device,
+    VkDeviceMemory memory,
+    const VkAllocationCallbacks* pAllocator) {
+    return mImpl->on_vkFreeMemory(
+        context, device, memory, pAllocator);
+}
+
 VkResult ResourceTracker::on_vkMapMemory(
     void* context,
     VkResult input_result,