Add support for VK_IMAGE_LAYOUT_PRESENT_SRC_KHR in skia vulkan.
This change allows Skia to handle transfering from the present layout.
Skia currently never changes to the present layout, though we are looking
at adding support for this in a different CL.
With this change a client can wrap a an VkImage into an SkSurface still in
the queue present layout and Skia will handle the transation to color
attachment. If a client uses this functiality they most likely will want
to immediately call wait(GrBackendSemaphore) on the SkSurface so that Skia
waits on the VkSemaphore that came from a call to vulkan aquire image before
doing any work on the wrapped VkImage.
Bug: skia:
Change-Id: Ia9bd12ad4e6cd972daaa972cce8698d396c002fc
Reviewed-on: https://skia-review.googlesource.com/c/194424
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index e01a58f..bab24ca 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -558,7 +558,9 @@
// Although the clear will ignore the stencil buffer, following draw ops may not so we can't get
// rid of all the preceding ops. Beware! If we ever add any ops that have a side effect beyond
// modifying the stencil buffer we will need a more elaborate tracking system (skbug.com/7002).
- if (this->isEmpty() || !fTarget.get()->asRenderTargetProxy()->needsStencil()) {
+ // Additionally, if we previously recorded a wait op, we cannot delete the wait op. Until we
+ // track the wait ops separately from normal ops, we have to avoid clearing out any ops.
+ if (this->isEmpty() || (!fTarget.get()->asRenderTargetProxy()->needsStencil() && !fHasWaitOp)) {
this->deleteOps();
fDeferredProxies.reset();