Vulkan: Update resource dependency semantics.

This removes passing the Serial around to several methods, so that
dependency management is a bit more automatic.

This makes life a bit easier when dealing with state updates when
resources are in use by Vulkan.

The FramebuffeVk no longer stores an extra serial of the last draw,
instead it will trigger creation of a new writing node on a state
change update.

Bug: angleproject:2318
Change-Id: Ie58ec66e6e8644ba4d402c509255c3795d363dd3
Reviewed-on: https://chromium-review.googlesource.com/985201
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/CommandGraph.h b/src/libANGLE/renderer/vulkan/CommandGraph.h
index 5134ca2..b51f929 100644
--- a/src/libANGLE/renderer/vulkan/CommandGraph.h
+++ b/src/libANGLE/renderer/vulkan/CommandGraph.h
@@ -33,11 +33,11 @@
     void updateQueueSerial(Serial queueSerial);
     Serial getQueueSerial() const;
 
-    // Returns true if any tracked read or write nodes match 'currentSerial'.
-    bool hasCurrentWritingNode(Serial currentSerial) const;
+    // Returns true if this node has a current writing node with no children.
+    bool hasChildlessWritingNode() const;
 
-    // Returns the active write node, and asserts 'currentSerial' matches the stored serial.
-    CommandGraphNode *getCurrentWritingNode(Serial currentSerial);
+    // Returns the active write node.
+    CommandGraphNode *getCurrentWritingNode();
 
     // Allocates a new write node and calls onWriteResource internally.
     CommandGraphNode *getNewWritingNode(RendererVk *renderer);
@@ -52,6 +52,9 @@
     // Sets up dependency relations. 'readingNode' will read from 'this' ResourceVk.
     void onReadResource(CommandGraphNode *readingNode, Serial serial);
 
+    // Returns false if the resource is not in use, and clears any current read/write nodes.
+    bool checkResourceInUseAndRefreshDeps(RendererVk *renderer);
+
   private:
     Serial mStoredQueueSerial;
     std::vector<CommandGraphNode *> mCurrentReadingNodes;