Commit 86ce210a by Jamie Madill Committed by Commit Bot

Vulkan: Clean up onResourceChanged.

Merge this with the internal method to generate a new command graph node. Call onResourceChanged internally in beginWriteResource. Bug: angleproject:2539 Change-Id: Ie33f886c5df7e15ff0b5d690a63fa664b1e964d4 Reviewed-on: https://chromium-review.googlesource.com/1069292 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarLuc Ferron <lucferron@chromium.org> Reviewed-by: 's avatarFrank Henigman <fjhenigman@chromium.org>
parent c57ee259
...@@ -157,13 +157,6 @@ bool CommandGraphResource::hasChildlessWritingNode() const ...@@ -157,13 +157,6 @@ bool CommandGraphResource::hasChildlessWritingNode() const
return (mCurrentWritingNode != nullptr && !mCurrentWritingNode->hasChildren()); return (mCurrentWritingNode != nullptr && !mCurrentWritingNode->hasChildren());
} }
CommandGraphNode *CommandGraphResource::getNewWritingNode(RendererVk *renderer)
{
CommandGraphNode *newCommands = renderer->getCommandGraph()->allocateNode();
onWriteImpl(newCommands, renderer->getCurrentQueueSerial());
return newCommands;
}
bool CommandGraphResource::hasStartedWriteResource() const bool CommandGraphResource::hasStartedWriteResource() const
{ {
return hasChildlessWritingNode() && return hasChildlessWritingNode() &&
...@@ -173,12 +166,11 @@ bool CommandGraphResource::hasStartedWriteResource() const ...@@ -173,12 +166,11 @@ bool CommandGraphResource::hasStartedWriteResource() const
Error CommandGraphResource::beginWriteResource(RendererVk *renderer, Error CommandGraphResource::beginWriteResource(RendererVk *renderer,
CommandBuffer **commandBufferOut) CommandBuffer **commandBufferOut)
{ {
CommandGraphNode *commands = getNewWritingNode(renderer); onResourceChanged(renderer);
VkDevice device = renderer->getDevice(); VkDevice device = renderer->getDevice();
ANGLE_TRY(commands->beginOutsideRenderPassRecording(device, renderer->getCommandPool(), return mCurrentWritingNode->beginOutsideRenderPassRecording(device, renderer->getCommandPool(),
commandBufferOut)); commandBufferOut);
return NoError();
} }
Error CommandGraphResource::appendWriteResource(RendererVk *renderer, Error CommandGraphResource::appendWriteResource(RendererVk *renderer,
...@@ -247,7 +239,8 @@ Error CommandGraphResource::beginRenderPass(RendererVk *renderer, ...@@ -247,7 +239,8 @@ Error CommandGraphResource::beginRenderPass(RendererVk *renderer,
void CommandGraphResource::onResourceChanged(RendererVk *renderer) void CommandGraphResource::onResourceChanged(RendererVk *renderer)
{ {
getNewWritingNode(renderer); CommandGraphNode *newCommands = renderer->getCommandGraph()->allocateNode();
onWriteImpl(newCommands, renderer->getCurrentQueueSerial());
} }
void CommandGraphResource::addWriteDependency(CommandGraphResource *writingResource) void CommandGraphResource::addWriteDependency(CommandGraphResource *writingResource)
......
...@@ -81,9 +81,6 @@ class CommandGraphResource ...@@ -81,9 +81,6 @@ class CommandGraphResource
// Returns true if this node has a current writing node with no children. // Returns true if this node has a current writing node with no children.
bool hasChildlessWritingNode() const; bool hasChildlessWritingNode() const;
// Allocates a new write node and calls onWriteResource internally.
CommandGraphNode *getNewWritingNode(RendererVk *renderer);
// Checks if we're in a RenderPass without children. // Checks if we're in a RenderPass without children.
bool hasStartedRenderPass() const; bool hasStartedRenderPass() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment