Vulkan: Implement transfer path for texture copy
This is primarily in preparation for compressed texture copy, but has
the following side effect:
- When transfer is possible, it's faster than draw
- When texture format does not support draw (but transfer is possible),
it will avoid copying through CPU.
Bug: angleproject:2670
Change-Id: I49e1b51e6ccec875db3f971106687c7d48c4916f
Reviewed-on: https://chromium-review.googlesource.com/c/1470595
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp b/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp
index 1ac608a..8035c8e 100644
--- a/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp
@@ -140,6 +140,20 @@
ASSERT(mImage && mImage->valid());
// TODO(jmadill): Better simultaneous resource access. http://anglebug.com/2679
+ //
+ // A better alternative would be:
+ //
+ // if (mImage->isLayoutChangeNecessary(layout)
+ // {
+ // vk::CommandBuffer *srcLayoutChange;
+ // ANGLE_TRY(mImage->recordCommands(contextVk, &srcLayoutChange));
+ // mImage->changeLayout(mImage->getAspectFlags(), layout, srcLayoutChange);
+ // }
+ // mImage->addReadDependency(readingResource);
+ //
+ // I.e. the transition should happen on a node generated from mImage itself.
+ // However, this needs context to be available here, or all call sites changed
+ // to perform the layout transition and set the dependency.
mImage->addWriteDependency(readingResource);
mImage->changeLayout(mImage->getAspectFlags(), layout, commandBuffer);