layers: Also allow fences to be submitted via acquire next image.
diff --git a/layers/mem_tracker.cpp b/layers/mem_tracker.cpp
index e883c7a..9a26a7e 100644
--- a/layers/mem_tracker.cpp
+++ b/layers/mem_tracker.cpp
@@ -1995,9 +1995,18 @@
                 skipCall |= log_msg(my_data->report_data, VK_DEBUG_REPORT_INFO_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT, (uint64_t) fence, __LINE__, MEMTRACK_INVALID_FENCE_STATE, "MEM",
                     "%s specified fence %#" PRIxLEAST64 " already in SIGNALED state.", apiCall, (uint64_t) fence);
             }
-            if (!pFenceInfo->second.queue) { // Checking status of unsubmitted fence
-                skipCall |= log_msg(my_data->report_data, VK_DEBUG_REPORT_WARN_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT, (uint64_t) fence, __LINE__, MEMTRACK_INVALID_FENCE_STATE, "MEM",
-                    "%s called for fence %#" PRIxLEAST64 " which has not been submitted on a Queue.", apiCall, (uint64_t) fence);
+            if (!pFenceInfo->second.queue &&
+                !pFenceInfo->second
+                     .swapchain) { // Checking status of unsubmitted fence
+                skipCall |= log_msg(
+                    my_data->report_data, VK_DEBUG_REPORT_WARN_BIT_EXT,
+                    VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT,
+                    reinterpret_cast<uint64_t &>(fence),
+                    __LINE__, MEMTRACK_INVALID_FENCE_STATE, "MEM",
+                    "%s called for fence %#" PRIxLEAST64
+                    " which has not been submitted on a Queue or during "
+                    "acquire next image.",
+                    apiCall, reinterpret_cast<uint64_t &>(fence));
             }
         } else {
             pFenceInfo->second.firstTimeFlag = VK_FALSE;
@@ -3118,6 +3127,10 @@
         }
         my_data->semaphoreMap[semaphore] = MEMTRACK_SEMAPHORE_STATE_SIGNALLED;
     }
+    auto fence_data = my_data->fenceMap.find(fence);
+    if (fence_data != my_data->fenceMap.end()) {
+        fence_data->second.swapchain = swapchain;
+    }
     loader_platform_thread_unlock_mutex(&globalLock);
     if (VK_FALSE == skipCall) {
         result = my_data->device_dispatch_table->AcquireNextImageKHR(device,