Reland "Add flush() to SkImage."
This reverts commit 693bc2bae5cf41ec51408b8c252b2a61a980659e.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Revert "Add flush() to SkImage."
>
> This reverts commit d0503a72ac4293562a8e88be33633ec0cf55c3d4.
>
> Reason for revert: <INSERT REASONING HERE>
>
> Original change's description:
> > Add flush() to SkImage.
> >
> > This allows a client to ensure all uses of a texture-backed image have
> > been flushed.
> >
> > Does nothing if the image isn't texture-backed.
> >
> > The implementation adds support for triggering a flush if any of a set
> > of proxies are used rather than just a single proxy.
> >
> > Change-Id: I358882d9737e63c6e69b924c0767f49b8f8f36ec
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212405
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
>
> Change-Id: Ie376bf4225307f45b8fb3eb4a63bf84702365797
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212884
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
Change-Id: Idcba378ce2e3af0af9d0eef35737670055539ec5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212960
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index a90dce9..19d1f6e 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -264,7 +264,7 @@
return GrSemaphoresSubmitted::kNo;
}
- return this->drawingManager()->flush(nullptr, SkSurface::BackendSurfaceAccess::kNoAccess,
+ return this->drawingManager()->flush(nullptr, 0, SkSurface::BackendSurfaceAccess::kNoAccess,
info);
}
diff --git a/src/gpu/GrContextPriv.cpp b/src/gpu/GrContextPriv.cpp
index dfb2c0b..09b5327 100644
--- a/src/gpu/GrContextPriv.cpp
+++ b/src/gpu/GrContextPriv.cpp
@@ -24,12 +24,12 @@
#include "src/image/SkImage_Base.h"
#include "src/image/SkImage_Gpu.h"
-#define ASSERT_OWNED_PROXY_PRIV(P) \
+#define ASSERT_OWNED_PROXY(P) \
SkASSERT(!(P) || !((P)->peekTexture()) || (P)->peekTexture()->getContext() == fContext)
-#define ASSERT_SINGLE_OWNER_PRIV \
+#define ASSERT_SINGLE_OWNER \
SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fContext->singleOwner());)
-#define RETURN_IF_ABANDONED_PRIV if (fContext->abandoned()) { return; }
-#define RETURN_FALSE_IF_ABANDONED_PRIV if (fContext->abandoned()) { return false; }
+#define RETURN_VALUE_IF_ABANDONED(value) if (fContext->abandoned()) { return (value); }
+#define RETURN_IF_ABANDONED RETURN_VALUE_IF_ABANDONED(void)
sk_sp<const GrCaps> GrContextPriv::refCaps() const {
return fContext->refCaps();
@@ -103,7 +103,7 @@
sk_sp<GrTextureContext> GrContextPriv::makeBackendTextureContext(const GrBackendTexture& tex,
GrSurfaceOrigin origin,
sk_sp<SkColorSpace> colorSpace) {
- ASSERT_SINGLE_OWNER_PRIV
+ ASSERT_SINGLE_OWNER
sk_sp<GrSurfaceProxy> proxy = this->proxyProvider()->wrapBackendTexture(
tex, origin, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, kRW_GrIOType);
@@ -122,7 +122,7 @@
const SkSurfaceProps* props,
ReleaseProc releaseProc,
ReleaseContext releaseCtx) {
- ASSERT_SINGLE_OWNER_PRIV
+ ASSERT_SINGLE_OWNER
SkASSERT(sampleCnt > 0);
sk_sp<GrTextureProxy> proxy(this->proxyProvider()->wrapRenderableBackendTexture(
@@ -143,7 +143,7 @@
const SkSurfaceProps* surfaceProps,
ReleaseProc releaseProc,
ReleaseContext releaseCtx) {
- ASSERT_SINGLE_OWNER_PRIV
+ ASSERT_SINGLE_OWNER
sk_sp<GrSurfaceProxy> proxy = this->proxyProvider()->wrapBackendRenderTarget(
backendRT, origin, releaseProc, releaseCtx);
@@ -162,7 +162,7 @@
int sampleCnt,
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* props) {
- ASSERT_SINGLE_OWNER_PRIV
+ ASSERT_SINGLE_OWNER
SkASSERT(sampleCnt > 0);
sk_sp<GrSurfaceProxy> proxy(
this->proxyProvider()->wrapBackendTextureAsRenderTarget(tex, origin, sampleCnt));
@@ -177,7 +177,7 @@
sk_sp<GrRenderTargetContext> GrContextPriv::makeVulkanSecondaryCBRenderTargetContext(
const SkImageInfo& imageInfo, const GrVkDrawableInfo& vkInfo, const SkSurfaceProps* props) {
- ASSERT_SINGLE_OWNER_PRIV
+ ASSERT_SINGLE_OWNER
sk_sp<GrSurfaceProxy> proxy(
this->proxyProvider()->wrapVulkanSecondaryCBAsRenderTarget(imageInfo, vkInfo));
if (!proxy) {
@@ -189,22 +189,23 @@
props);
}
-void GrContextPriv::flush(GrSurfaceProxy* proxy) {
- ASSERT_SINGLE_OWNER_PRIV
- RETURN_IF_ABANDONED_PRIV
- ASSERT_OWNED_PROXY_PRIV(proxy);
-
- fContext->drawingManager()->flush(proxy, SkSurface::BackendSurfaceAccess::kNoAccess,
- GrFlushInfo());
+GrSemaphoresSubmitted GrContextPriv::flushSurfaces(GrSurfaceProxy* proxies[], int numProxies,
+ const GrFlushInfo& info) {
+ ASSERT_SINGLE_OWNER
+ RETURN_VALUE_IF_ABANDONED(GrSemaphoresSubmitted::kNo)
+ GR_CREATE_TRACE_MARKER_CONTEXT("GrContextPriv", "flushSurfaces", fContext);
+ SkASSERT(numProxies >= 0);
+ SkASSERT(!numProxies || proxies);
+ for (int i = 0; i < numProxies; ++i) {
+ SkASSERT(proxies[i]);
+ ASSERT_OWNED_PROXY(proxies[i]);
+ }
+ return fContext->drawingManager()->flushSurfaces(
+ proxies, numProxies, SkSurface::BackendSurfaceAccess::kNoAccess, info);
}
void GrContextPriv::flushSurface(GrSurfaceProxy* proxy) {
- ASSERT_SINGLE_OWNER_PRIV
- RETURN_IF_ABANDONED_PRIV
- SkASSERT(proxy);
- ASSERT_OWNED_PROXY_PRIV(proxy);
- fContext->drawingManager()->flushSurface(proxy,
- SkSurface::BackendSurfaceAccess::kNoAccess, GrFlushInfo());
+ this->flushSurfaces(proxy ? &proxy : nullptr, proxy ? 1 : 0, {});
}
static bool valid_premul_color_type(GrColorType ct) {
@@ -277,11 +278,11 @@
int height, GrColorType dstColorType,
SkColorSpace* dstColorSpace, void* buffer, size_t rowBytes,
uint32_t pixelOpsFlags) {
- ASSERT_SINGLE_OWNER_PRIV
- RETURN_FALSE_IF_ABANDONED_PRIV
+ ASSERT_SINGLE_OWNER
+ RETURN_VALUE_IF_ABANDONED(false)
SkASSERT(src);
SkASSERT(buffer);
- ASSERT_OWNED_PROXY_PRIV(src->asSurfaceProxy());
+ ASSERT_OWNED_PROXY(src->asSurfaceProxy());
GR_CREATE_TRACE_MARKER_CONTEXT("GrContextPriv", "readSurfacePixels", fContext);
GrSurfaceProxy* srcProxy = src->asSurfaceProxy();
@@ -431,7 +432,7 @@
sk_bzero(buffer, tempPixmap.computeByteSize());
}
- this->flush(srcProxy);
+ this->flushSurface(srcProxy);
if (!fContext->fGpu->readPixels(srcSurface, left, top, width, height, allowedColorType, buffer,
rowBytes)) {
@@ -461,11 +462,11 @@
int height, GrColorType srcColorType,
SkColorSpace* srcColorSpace, const void* buffer,
size_t rowBytes, uint32_t pixelOpsFlags) {
- ASSERT_SINGLE_OWNER_PRIV
- RETURN_FALSE_IF_ABANDONED_PRIV
+ ASSERT_SINGLE_OWNER
+ RETURN_VALUE_IF_ABANDONED(false)
SkASSERT(dst);
SkASSERT(buffer);
- ASSERT_OWNED_PROXY_PRIV(dst->asSurfaceProxy());
+ ASSERT_OWNED_PROXY(dst->asSurfaceProxy());
GR_CREATE_TRACE_MARKER_CONTEXT("GrContextPriv", "writeSurfacePixels", fContext);
if (GrColorType::kUnknown == srcColorType) {
@@ -632,7 +633,7 @@
// giving the drawing manager the chance of skipping the flush (i.e., by passing in the
// destination proxy)
// TODO: should this policy decision just be moved into the drawing manager?
- this->flush(caps->preferVRAMUseOverFlushes() ? dstProxy : nullptr);
+ this->flushSurface(caps->preferVRAMUseOverFlushes() ? dstProxy : nullptr);
return this->getGpu()->writePixels(dstSurface, left, top, width, height, srcColorType, buffer,
rowBytes);
diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h
index ebf3f6a..86af1f3 100644
--- a/src/gpu/GrContextPriv.h
+++ b/src/gpu/GrContextPriv.h
@@ -164,22 +164,19 @@
const SkImageInfo&, const GrVkDrawableInfo&, const SkSurfaceProps* = nullptr);
/**
- * Call to ensure all drawing to the context has been issued to the
- * underlying 3D API.
- * The 'proxy' parameter is a hint. If it is supplied the context will guarantee that
- * the draws required for that proxy are flushed but it could do more. If no 'proxy' is
- * provided then all current work will be flushed.
- */
- void flush(GrSurfaceProxy*);
-
- /**
- * Finalizes all pending reads and writes to the surface and also performs an MSAA resolve
- * if necessary.
+ * Finalizes all pending reads and writes to the surfaces and also performs an MSAA resolves
+ * if necessary. The GrSurfaceProxy array is treated as a hint. If it is supplied the context
+ * will guarantee that the draws required for those proxies are flushed but it could do more.
+ * If no array is provided then all current work will be flushed.
*
* It is not necessary to call this before reading the render target via Skia/GrContext.
* GrContext will detect when it must perform a resolve before reading pixels back from the
* surface or using it as a texture.
*/
+ GrSemaphoresSubmitted flushSurfaces(GrSurfaceProxy*[], int numProxies, const GrFlushInfo&);
+
+ /** Version of above that flushes for a single proxy and uses a default GrFlushInfo. Null is
+ * allowed. */
void flushSurface(GrSurfaceProxy*);
/**
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 4d00261..208940b 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -194,9 +194,12 @@
}
// MDB TODO: make use of the 'proxy' parameter.
-GrSemaphoresSubmitted GrDrawingManager::flush(GrSurfaceProxy* proxy,
+GrSemaphoresSubmitted GrDrawingManager::flush(GrSurfaceProxy* proxies[],
+ int numProxies,
SkSurface::BackendSurfaceAccess access,
const GrFlushInfo& info) {
+ SkASSERT(numProxies >= 0);
+ SkASSERT(!numProxies || proxies);
GR_CREATE_TRACE_MARKER_CONTEXT("GrDrawingManager", "flush", fContext);
if (fFlushing || this->wasAbandoned()) {
@@ -208,9 +211,14 @@
SkDEBUGCODE(this->validate());
- if (kNone_GrFlushFlags == info.fFlags && !info.fNumSemaphores && !info.fFinishedProc &&
- proxy && !this->isDDLTarget(proxy) && !fDAG.isUsed(proxy)) {
- return GrSemaphoresSubmitted::kNo;
+ if (kNone_GrFlushFlags == info.fFlags && !info.fNumSemaphores && !info.fFinishedProc) {
+ bool canSkip = numProxies > 0;
+ for (int i = 0; i < numProxies && canSkip; ++i) {
+ canSkip = !fDAG.isUsed(proxies[i]) && !this->isDDLTarget(proxies[i]);
+ }
+ if (canSkip) {
+ return GrSemaphoresSubmitted::kNo;
+ }
}
auto direct = fContext->priv().asDirectContext();
@@ -349,7 +357,7 @@
opMemoryPool->isEmpty();
#endif
- GrSemaphoresSubmitted result = gpu->finishFlush(proxy, access, info);
+ GrSemaphoresSubmitted result = gpu->finishFlush(proxies, numProxies, access, info);
flushState.deinstantiateProxyTracker()->deinstantiateAllProxies();
@@ -432,7 +440,7 @@
onFlushOpList = nullptr;
(*numOpListsExecuted)++;
if (*numOpListsExecuted >= kMaxOpListsBeforeFlush) {
- flushState->gpu()->finishFlush(nullptr, SkSurface::BackendSurfaceAccess::kNoAccess,
+ flushState->gpu()->finishFlush(nullptr, 0, SkSurface::BackendSurfaceAccess::kNoAccess,
GrFlushInfo());
*numOpListsExecuted = 0;
}
@@ -450,7 +458,7 @@
}
(*numOpListsExecuted)++;
if (*numOpListsExecuted >= kMaxOpListsBeforeFlush) {
- flushState->gpu()->finishFlush(nullptr, SkSurface::BackendSurfaceAccess::kNoAccess,
+ flushState->gpu()->finishFlush(nullptr, 0, SkSurface::BackendSurfaceAccess::kNoAccess,
GrFlushInfo());
*numOpListsExecuted = 0;
}
@@ -469,13 +477,15 @@
return anyOpListsExecuted;
}
-GrSemaphoresSubmitted GrDrawingManager::flushSurface(
- GrSurfaceProxy* proxy, SkSurface::BackendSurfaceAccess access, const GrFlushInfo& info) {
+GrSemaphoresSubmitted GrDrawingManager::flushSurfaces(GrSurfaceProxy* proxies[], int numProxies,
+ SkSurface::BackendSurfaceAccess access,
+ const GrFlushInfo& info) {
if (this->wasAbandoned()) {
return GrSemaphoresSubmitted::kNo;
}
SkDEBUGCODE(this->validate());
- SkASSERT(proxy);
+ SkASSERT(numProxies >= 0);
+ SkASSERT(!numProxies || proxies);
auto direct = fContext->priv().asDirectContext();
if (!direct) {
@@ -488,21 +498,25 @@
}
// TODO: It is important to upgrade the drawingmanager to just flushing the
- // portion of the DAG required by 'proxy' in order to restore some of the
+ // portion of the DAG required by 'proxies' in order to restore some of the
// semantics of this method.
- GrSemaphoresSubmitted result = this->flush(proxy, access, info);
- if (!proxy->isInstantiated()) {
- return result;
+ GrSemaphoresSubmitted result = this->flush(proxies, numProxies, access, info);
+ for (int i = 0; i < numProxies; ++i) {
+ if (!proxies[i]->isInstantiated()) {
+ return result;
+ }
}
- GrSurface* surface = proxy->peekSurface();
- if (auto* rt = surface->asRenderTarget()) {
- gpu->resolveRenderTarget(rt);
- }
- if (auto* tex = surface->asTexture()) {
- if (tex->texturePriv().mipMapped() == GrMipMapped::kYes &&
- tex->texturePriv().mipMapsAreDirty()) {
- gpu->regenerateMipMapLevels(tex);
+ for (int i = 0; i < numProxies; ++i) {
+ GrSurface* surface = proxies[i]->peekSurface();
+ if (auto* rt = surface->asRenderTarget()) {
+ gpu->resolveRenderTarget(rt);
+ }
+ if (auto* tex = surface->asTexture()) {
+ if (tex->texturePriv().mipMapped() == GrMipMapped::kYes &&
+ tex->texturePriv().mipMapsAreDirty()) {
+ gpu->regenerateMipMapLevels(tex);
+ }
}
}
@@ -731,7 +745,7 @@
auto resourceCache = direct->priv().getResourceCache();
if (resourceCache && resourceCache->requestsFlush()) {
- this->flush(nullptr, SkSurface::BackendSurfaceAccess::kNoAccess, GrFlushInfo());
+ this->flush(nullptr, 0, SkSurface::BackendSurfaceAccess::kNoAccess, GrFlushInfo());
resourceCache->purgeAsNeeded();
}
}
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
index 2b04b9a..521ed66 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -71,9 +71,15 @@
static bool ProgramUnitTest(GrContext* context, int maxStages, int maxLevels);
- GrSemaphoresSubmitted flushSurface(GrSurfaceProxy*,
+ GrSemaphoresSubmitted flushSurfaces(GrSurfaceProxy* proxies[],
+ int cnt,
+ SkSurface::BackendSurfaceAccess access,
+ const GrFlushInfo& info);
+ GrSemaphoresSubmitted flushSurface(GrSurfaceProxy* proxy,
SkSurface::BackendSurfaceAccess access,
- const GrFlushInfo& info);
+ const GrFlushInfo& info) {
+ return this->flushSurfaces(&proxy, 1, access, info);
+ }
void addOnFlushCallbackObject(GrOnFlushCallbackObject*);
@@ -147,7 +153,8 @@
// return true if any opLists were actually executed; false otherwise
bool executeOpLists(int startIndex, int stopIndex, GrOpFlushState*, int* numOpListsExecuted);
- GrSemaphoresSubmitted flush(GrSurfaceProxy* proxy,
+ GrSemaphoresSubmitted flush(GrSurfaceProxy* proxies[],
+ int numProxies,
SkSurface::BackendSurfaceAccess access,
const GrFlushInfo&);
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index c57b169..479d733 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -412,7 +412,8 @@
return fSamplePatternDictionary.findOrAssignSamplePatternKey(sampleLocations);
}
-GrSemaphoresSubmitted GrGpu::finishFlush(GrSurfaceProxy* proxy,
+GrSemaphoresSubmitted GrGpu::finishFlush(GrSurfaceProxy* proxies[],
+ int n,
SkSurface::BackendSurfaceAccess access,
const GrFlushInfo& info) {
this->stats()->incNumFinishFlushes();
@@ -436,7 +437,7 @@
}
}
}
- this->onFinishFlush(proxy, access, info);
+ this->onFinishFlush(proxies, n, access, info);
return this->caps()->semaphoreSupport() ? GrSemaphoresSubmitted::kYes
: GrSemaphoresSubmitted::kNo;
}
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 5b90f05..be4a9bf 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -303,8 +303,8 @@
// Provides a hook for post-flush actions (e.g. Vulkan command buffer submits). This will also
// insert any numSemaphore semaphores on the gpu and set the backendSemaphores to match the
// inserted semaphores.
- GrSemaphoresSubmitted finishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
- const GrFlushInfo&);
+ GrSemaphoresSubmitted finishFlush(GrSurfaceProxy*[], int n,
+ SkSurface::BackendSurfaceAccess access, const GrFlushInfo&);
virtual void submit(GrGpuCommandBuffer*) = 0;
@@ -547,7 +547,7 @@
const SkIRect& srcRect, const SkIPoint& dstPoint,
bool canDiscardOutsideDstRect) = 0;
- virtual void onFinishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
+ virtual void onFinishFlush(GrSurfaceProxy*[], int n, SkSurface::BackendSurfaceAccess access,
const GrFlushInfo&) = 0;
#ifdef SK_ENABLE_DUMP_GPU
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 197a1a6..f41733c 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -4274,7 +4274,7 @@
return attribState;
}
-void GrGLGpu::onFinishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
+void GrGLGpu::onFinishFlush(GrSurfaceProxy*[], int, SkSurface::BackendSurfaceAccess access,
const GrFlushInfo& info) {
// If we inserted semaphores during the flush, we need to call GLFlush.
bool insertedSemaphore = info.fNumSemaphores > 0 && this->caps()->semaphoreSupport();
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index b2821e4..fde6d22 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -295,7 +295,7 @@
void flushBlend(const GrXferProcessor::BlendInfo& blendInfo, const GrSwizzle&);
- void onFinishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
+ void onFinishFlush(GrSurfaceProxy*[], int n, SkSurface::BackendSurfaceAccess access,
const GrFlushInfo&) override;
bool waitSync(GrGLsync, uint64_t timeout, bool flush);
diff --git a/src/gpu/mock/GrMockGpu.h b/src/gpu/mock/GrMockGpu.h
index 57d8f7a..5df9c02 100644
--- a/src/gpu/mock/GrMockGpu.h
+++ b/src/gpu/mock/GrMockGpu.h
@@ -111,7 +111,7 @@
void onResolveRenderTarget(GrRenderTarget* target) override { return; }
- void onFinishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
+ void onFinishFlush(GrSurfaceProxy*[], int n, SkSurface::BackendSurfaceAccess access,
const GrFlushInfo& info) override {
if (info.fFinishedProc) {
info.fFinishedProc(info.fFinishedContext);
diff --git a/src/gpu/mtl/GrMtlGpu.h b/src/gpu/mtl/GrMtlGpu.h
index d16ae2d..0eed4ed 100644
--- a/src/gpu/mtl/GrMtlGpu.h
+++ b/src/gpu/mtl/GrMtlGpu.h
@@ -184,7 +184,7 @@
void onResolveRenderTarget(GrRenderTarget* target) override { return; }
- void onFinishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
+ void onFinishFlush(GrSurfaceProxy*[], int n, SkSurface::BackendSurfaceAccess access,
const GrFlushInfo& info) override {
if (info.fFlags & kSyncCpu_GrFlushFlag) {
this->submitCommandBuffer(kForce_SyncQueue);
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index a82775a..b1c9979 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -1889,21 +1889,25 @@
barrier);
}
-void GrVkGpu::onFinishFlush(GrSurfaceProxy* proxy, SkSurface::BackendSurfaceAccess access,
- const GrFlushInfo& info) {
+void GrVkGpu::onFinishFlush(GrSurfaceProxy* proxies[], int n,
+ SkSurface::BackendSurfaceAccess access, const GrFlushInfo& info) {
+ SkASSERT(n >= 0);
+ SkASSERT(!n || proxies);
// Submit the current command buffer to the Queue. Whether we inserted semaphores or not does
// not effect what we do here.
- if (proxy && access == SkSurface::BackendSurfaceAccess::kPresent) {
+ if (n && access == SkSurface::BackendSurfaceAccess::kPresent) {
GrVkImage* image;
- SkASSERT(proxy->isInstantiated());
- if (GrTexture* tex = proxy->peekTexture()) {
- image = static_cast<GrVkTexture*>(tex);
- } else {
- GrRenderTarget* rt = proxy->peekRenderTarget();
- SkASSERT(rt);
- image = static_cast<GrVkRenderTarget*>(rt);
+ for (int i = 0; i < n; ++i) {
+ SkASSERT(proxies[i]->isInstantiated());
+ if (GrTexture* tex = proxies[i]->peekTexture()) {
+ image = static_cast<GrVkTexture*>(tex);
+ } else {
+ GrRenderTarget* rt = proxies[i]->peekRenderTarget();
+ SkASSERT(rt);
+ image = static_cast<GrVkRenderTarget*>(rt);
+ }
+ image->prepareForPresent(this);
}
- image->prepareForPresent(this);
}
if (info.fFlags & kSyncCpu_GrFlushFlag) {
this->submitCommandBuffer(kForce_SyncQueue, info.fFinishedProc, info.fFinishedContext);
diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h
index 2321f9a..9446467 100644
--- a/src/gpu/vk/GrVkGpu.h
+++ b/src/gpu/vk/GrVkGpu.h
@@ -225,7 +225,7 @@
GrSurfaceOrigin srcOrigin, const SkIRect& srcRect,
const SkIPoint& dstPoint, bool canDiscardOutsideDstRect) override;
- void onFinishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
+ void onFinishFlush(GrSurfaceProxy*[], int, SkSurface::BackendSurfaceAccess access,
const GrFlushInfo&) override;
// Ends and submits the current command buffer to the queue and then creates a new command