Vulkan: Support Texture redefinition.
Because initializing the texture can queue a copy from a staging
vk::Image, we must ensure we're not in a render pass. To make this
easier we move the current render pass tracking into the RendererVk
from the FramebufferVk class. (Note: in the future we will have
deferred command submission and this will become unnecessary.)
BUG=angleproject:2200
Change-Id: Ide8d4d70b50efbd79bbfa7006ad75cbc57cdf4c7
Reviewed-on: https://chromium-review.googlesource.com/741549
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp
index f97e118..464daca 100644
--- a/src/libANGLE/renderer/vulkan/RendererVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp
@@ -96,7 +96,8 @@
mGlslangWrapper(nullptr),
mLastCompletedQueueSerial(mQueueSerialFactory.generate()),
mCurrentQueueSerial(mQueueSerialFactory.generate()),
- mInFlightCommands()
+ mInFlightCommands(),
+ mCurrentRenderPassFramebuffer(nullptr)
{
}
@@ -785,4 +786,31 @@
return mCurrentQueueSerial;
}
+gl::Error RendererVk::ensureInRenderPass(const gl::Context *context, FramebufferVk *framebufferVk)
+{
+ if (mCurrentRenderPassFramebuffer == framebufferVk)
+ {
+ return gl::NoError();
+ }
+
+ if (mCurrentRenderPassFramebuffer)
+ {
+ endRenderPass();
+ }
+ ANGLE_TRY(
+ framebufferVk->beginRenderPass(context, mDevice, &mCommandBuffer, mCurrentQueueSerial));
+ mCurrentRenderPassFramebuffer = framebufferVk;
+ return gl::NoError();
+}
+
+void RendererVk::endRenderPass()
+{
+ if (mCurrentRenderPassFramebuffer)
+ {
+ ASSERT(mCommandBuffer.started());
+ mCommandBuffer.endRenderPass();
+ mCurrentRenderPassFramebuffer = nullptr;
+ }
+}
+
} // namespace rx