Vulkan: Merge append/beginWriteResource.

The new API is named 'recordCommands'.

These two APIs were basically doing the same thing. We don't need to
have an understanding of creating a new graph node to know that we
want to record some Vulkan commands to a command buffer. The prior
design was actually masking a bug where we would allow appending
commands to a command graph node that had already started a render
pass. Fix this by adding a render pass check to recordCommands.

Also removes 'hasStartedWriteResource' since this method wasn't used
anywhere.

Also renames 'onResourceChanged' to 'finishCurrentCommands'.

Bug: angleproject:2828
Change-Id: I00bd5b893fcfc37172b6c1706cb2f5fc57e79f54
Reviewed-on: https://chromium-review.googlesource.com/1235654
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/CommandGraph.cpp b/src/libANGLE/renderer/vulkan/CommandGraph.cpp
index 9d91a80..3dd7467 100644
--- a/src/libANGLE/renderer/vulkan/CommandGraph.cpp
+++ b/src/libANGLE/renderer/vulkan/CommandGraph.cpp
@@ -81,28 +81,16 @@
     return mStoredQueueSerial;
 }
 
-bool CommandGraphResource::hasStartedWriteResource() const
-{
-    return hasChildlessWritingNode() &&
-           mCurrentWritingNode->getOutsideRenderPassCommands()->valid();
-}
-
-angle::Result CommandGraphResource::beginWriteResource(Context *context,
-                                                       CommandBuffer **commandBufferOut)
-{
-    onResourceChanged(context->getRenderer());
-    return mCurrentWritingNode->beginOutsideRenderPassRecording(
-        context, context->getRenderer()->getCommandPool(), commandBufferOut);
-}
-
-angle::Result CommandGraphResource::appendWriteResource(Context *context,
-                                                        CommandBuffer **commandBufferOut)
+angle::Result CommandGraphResource::recordCommands(Context *context,
+                                                   CommandBuffer **commandBufferOut)
 {
     updateQueueSerial(context->getRenderer()->getCurrentQueueSerial());
 
-    if (!hasChildlessWritingNode())
+    if (!hasChildlessWritingNode() || hasStartedRenderPass())
     {
-        return beginWriteResource(context, commandBufferOut);
+        finishCurrentCommands(context->getRenderer());
+        return mCurrentWritingNode->beginOutsideRenderPassRecording(
+            context, context->getRenderer()->getCommandPool(), commandBufferOut);
     }
 
     CommandBuffer *outsideRenderPassCommands = mCurrentWritingNode->getOutsideRenderPassCommands();
@@ -154,7 +142,7 @@
     return mCurrentWritingNode->beginInsideRenderPassRecording(context, commandBufferOut);
 }
 
-void CommandGraphResource::onResourceChanged(RendererVk *renderer)
+void CommandGraphResource::finishCurrentCommands(RendererVk *renderer)
 {
     CommandGraphNode *newCommands = renderer->getCommandGraph()->allocateNode();
     onWriteImpl(newCommands, renderer->getCurrentQueueSerial());