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/FramebufferVk.cpp b/src/libANGLE/renderer/vulkan/FramebufferVk.cpp
index dbd9405..c45a9e9 100644
--- a/src/libANGLE/renderer/vulkan/FramebufferVk.cpp
+++ b/src/libANGLE/renderer/vulkan/FramebufferVk.cpp
@@ -232,7 +232,7 @@
// Standard Depth/stencil clear without scissor.
if (clearDepth || clearStencil)
{
- ANGLE_TRY(beginWriteResource(contextVk, &commandBuffer));
+ ANGLE_TRY(recordCommands(contextVk, &commandBuffer));
const VkClearDepthStencilValue &clearDepthStencilValue =
contextVk->getClearDepthStencilValue().depthStencil;
@@ -255,7 +255,7 @@
if (!commandBuffer)
{
- ANGLE_TRY(beginWriteResource(contextVk, &commandBuffer));
+ ANGLE_TRY(recordCommands(contextVk, &commandBuffer));
}
// TODO(jmadill): Support gaps in RenderTargets. http://anglebug.com/2394
@@ -482,7 +482,7 @@
// Reinitialize the commandBuffer after a read pixels because it calls
// renderer->finish which makes command buffers obsolete.
- ANGLE_TRY(beginWriteResource(contextVk, &commandBuffer));
+ ANGLE_TRY(recordCommands(contextVk, &commandBuffer));
// We read the bytes of the image in a buffer, now we have to copy them into the
// destination target.
@@ -516,7 +516,7 @@
bool blitStencilBuffer = (mask & GL_STENCIL_BUFFER_BIT) != 0;
vk::CommandBuffer *commandBuffer = nullptr;
- ANGLE_TRY(beginWriteResource(contextVk, &commandBuffer));
+ ANGLE_TRY(recordCommands(contextVk, &commandBuffer));
FramebufferVk *sourceFramebufferVk = vk::GetImpl(sourceFramebuffer);
bool flipSource = contextVk->isViewportFlipEnabledForReadFBO();
bool flipDest = contextVk->isViewportFlipEnabledForDrawFBO();
@@ -772,7 +772,7 @@
// Will freeze the current set of dependencies on this FBO. The next time we render we will
// create a new entry in the command graph.
- onResourceChanged(renderer);
+ finishCurrentCommands(renderer);
contextVk->invalidateCurrentPipeline();
@@ -879,7 +879,7 @@
bool clearStencil)
{
// Trigger a new command node to ensure overlapping writes happen sequentially.
- onResourceChanged(contextVk->getRenderer());
+ finishCurrentCommands(contextVk->getRenderer());
// This command can only happen inside a render pass, so obtain one if its already happening
// or create a new one if not.
@@ -980,7 +980,7 @@
vk::ShaderLibrary *shaderLibrary = renderer->getShaderLibrary();
// Trigger a new command node to ensure overlapping writes happen sequentially.
- onResourceChanged(renderer);
+ finishCurrentCommands(renderer);
const vk::ShaderAndSerial *fullScreenQuad = nullptr;
ANGLE_TRY(shaderLibrary->getShader(contextVk, vk::InternalShaderID::FullScreenQuad_vert,
@@ -1040,7 +1040,7 @@
pipeline->updateSerial(renderer->getCurrentQueueSerial());
vk::CommandBuffer *writeCommands = nullptr;
- ANGLE_TRY(appendWriteResource(contextVk, &writeCommands));
+ ANGLE_TRY(recordCommands(contextVk, &writeCommands));
// If the format of the framebuffer does not have an alpha channel, we need to make sure we does
// not affect the alpha channel of the type we're using to emulate the format.
@@ -1099,7 +1099,7 @@
std::vector<VkClearValue> attachmentClearValues;
vk::CommandBuffer *writeCommands = nullptr;
- ANGLE_TRY(appendWriteResource(contextVk, &writeCommands));
+ ANGLE_TRY(recordCommands(contextVk, &writeCommands));
vk::RenderPassDesc renderPassDesc;
@@ -1152,7 +1152,7 @@
RendererVk *renderer = contextVk->getRenderer();
vk::CommandBuffer *commandBuffer = nullptr;
- ANGLE_TRY(beginWriteResource(contextVk, &commandBuffer));
+ ANGLE_TRY(recordCommands(contextVk, &commandBuffer));
// Note that although we're reading from the image, we need to update the layout below.