Revert "Pass origins through the flushSurfaces calls."
This reverts commit ec3408169b
.
Reason for revert: This change actually isn't needed since a follow on change removes the use of origin from flushSurface anyways
Original change's description:
> Pass origins through the flushSurfaces calls.
>
> Bug: skia:9556
> Change-Id: Ie4a0b33dd35e50b93c30cb0010f60c2893140661
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270439
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,robertphillips@google.com
Change-Id: I4ea086d13d0bbef16c59e0abe2c42eb1eb6bf747
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9556
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270640
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
ec3408169b
commit
55f040bcb9
@ -40,8 +40,7 @@ void GrContextPriv::addOnFlushCallbackObject(GrOnFlushCallbackObject* onFlushCBO
|
||||
fContext->addOnFlushCallbackObject(onFlushCBObject);
|
||||
}
|
||||
|
||||
GrSemaphoresSubmitted GrContextPriv::flushSurfaces(GrSurfaceProxy* proxies[],
|
||||
GrSurfaceOrigin origins[], int numProxies,
|
||||
GrSemaphoresSubmitted GrContextPriv::flushSurfaces(GrSurfaceProxy* proxies[], int numProxies,
|
||||
const GrFlushInfo& info) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
RETURN_VALUE_IF_ABANDONED(GrSemaphoresSubmitted::kNo)
|
||||
@ -53,12 +52,11 @@ GrSemaphoresSubmitted GrContextPriv::flushSurfaces(GrSurfaceProxy* proxies[],
|
||||
ASSERT_OWNED_PROXY(proxies[i]);
|
||||
}
|
||||
return fContext->drawingManager()->flushSurfaces(
|
||||
proxies, origins, numProxies, SkSurface::BackendSurfaceAccess::kNoAccess, info);
|
||||
proxies, numProxies, SkSurface::BackendSurfaceAccess::kNoAccess, info);
|
||||
}
|
||||
|
||||
void GrContextPriv::flushSurface(GrSurfaceProxy* proxy, GrSurfaceOrigin origin) {
|
||||
SkASSERT(proxy);
|
||||
this->flushSurfaces(&proxy, &origin, 1, {});
|
||||
void GrContextPriv::flushSurface(GrSurfaceProxy* proxy) {
|
||||
this->flushSurfaces(proxy ? &proxy : nullptr, proxy ? 1 : 0, {});
|
||||
}
|
||||
|
||||
void GrContextPriv::moveRenderTasksToDDL(SkDeferredDisplayList* ddl) {
|
||||
|
@ -86,16 +86,11 @@ public:
|
||||
* 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*[], GrSurfaceOrigin[], int numProxies,
|
||||
const GrFlushInfo&);
|
||||
GrSemaphoresSubmitted flushSurfaces(GrSurfaceProxy*[], int numProxies, const GrFlushInfo&);
|
||||
|
||||
/** Version of above that flushes for a single proxy and uses a default GrFlushInfo. Null is not
|
||||
* allowed for the proxy. */
|
||||
void flushSurface(GrSurfaceProxy*, GrSurfaceOrigin);
|
||||
|
||||
void flushSurface() {
|
||||
this->flushSurfaces(nullptr, nullptr, 0, {});
|
||||
}
|
||||
/** Version of above that flushes for a single proxy and uses a default GrFlushInfo. Null is
|
||||
* allowed. */
|
||||
void flushSurface(GrSurfaceProxy*);
|
||||
|
||||
/**
|
||||
* Returns true if createPMToUPMEffect and createUPMToPMEffect will succeed. In other words,
|
||||
|
@ -494,8 +494,7 @@ bool GrDrawingManager::executeRenderTasks(int startIndex, int stopIndex, GrOpFlu
|
||||
return anyRenderTasksExecuted;
|
||||
}
|
||||
|
||||
GrSemaphoresSubmitted GrDrawingManager::flushSurfaces(GrSurfaceProxy* proxies[],
|
||||
GrSurfaceOrigin origins[], int numProxies,
|
||||
GrSemaphoresSubmitted GrDrawingManager::flushSurfaces(GrSurfaceProxy* proxies[], int numProxies,
|
||||
SkSurface::BackendSurfaceAccess access,
|
||||
const GrFlushInfo& info) {
|
||||
if (this->wasAbandoned()) {
|
||||
@ -535,7 +534,7 @@ GrSemaphoresSubmitted GrDrawingManager::flushSurfaces(GrSurfaceProxy* proxies[],
|
||||
if (rtProxy->isMSAADirty()) {
|
||||
SkASSERT(rtProxy->peekRenderTarget());
|
||||
gpu->resolveRenderTarget(rtProxy->peekRenderTarget(), rtProxy->msaaDirtyRect(),
|
||||
origins[i], GrGpu::ForExternalIO::kYes);
|
||||
rtProxy->origin(), GrGpu::ForExternalIO::kYes);
|
||||
rtProxy->markMSAAResolved();
|
||||
}
|
||||
}
|
||||
|
@ -93,14 +93,13 @@ public:
|
||||
static bool ProgramUnitTest(GrContext* context, int maxStages, int maxLevels);
|
||||
|
||||
GrSemaphoresSubmitted flushSurfaces(GrSurfaceProxy* proxies[],
|
||||
GrSurfaceOrigin origins[],
|
||||
int cnt,
|
||||
SkSurface::BackendSurfaceAccess access,
|
||||
const GrFlushInfo& info);
|
||||
GrSemaphoresSubmitted flushSurface(GrSurfaceProxy* proxy, GrSurfaceOrigin origin,
|
||||
GrSemaphoresSubmitted flushSurface(GrSurfaceProxy* proxy,
|
||||
SkSurface::BackendSurfaceAccess access,
|
||||
const GrFlushInfo& info) {
|
||||
return this->flushSurfaces(&proxy, &origin, 1, access, info);
|
||||
return this->flushSurfaces(&proxy, 1, access, info);
|
||||
}
|
||||
|
||||
void addOnFlushCallbackObject(GrOnFlushCallbackObject*);
|
||||
|
@ -2164,8 +2164,7 @@ GrSemaphoresSubmitted GrRenderTargetContext::flush(SkSurface::BackendSurfaceAcce
|
||||
SkDEBUGCODE(this->validate();)
|
||||
GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "flush", fContext);
|
||||
|
||||
return this->drawingManager()->flushSurface(this->asSurfaceProxy(), this->origin(), access,
|
||||
info);
|
||||
return this->drawingManager()->flushSurface(this->asSurfaceProxy(), access, info);
|
||||
}
|
||||
|
||||
bool GrRenderTargetContext::waitOnSemaphores(int numSemaphores,
|
||||
|
@ -240,7 +240,7 @@ bool GrSurfaceContext::readPixels(const GrImageInfo& origDstInfo, void* dst, siz
|
||||
return tempCtx->readPixels(dstInfo, dst, rowBytes, {0, 0}, direct);
|
||||
}
|
||||
|
||||
bool flip = this->origin() == kBottomLeft_GrSurfaceOrigin;
|
||||
bool flip = srcProxy->origin() == kBottomLeft_GrSurfaceOrigin;
|
||||
|
||||
auto supportedRead = caps->supportedReadPixelsColorType(
|
||||
this->colorInfo().colorType(), srcProxy->backendFormat(), dstInfo.colorType());
|
||||
@ -267,7 +267,7 @@ bool GrSurfaceContext::readPixels(const GrImageInfo& origDstInfo, void* dst, siz
|
||||
pt.fY = flip ? srcSurface->height() - pt.fY - dstInfo.height() : pt.fY;
|
||||
}
|
||||
|
||||
direct->priv().flushSurface(srcProxy, this->origin());
|
||||
direct->priv().flushSurface(srcProxy);
|
||||
|
||||
if (!direct->priv().getGpu()->readPixels(srcSurface, pt.fX, pt.fY, dstInfo.width(),
|
||||
dstInfo.height(), this->colorInfo().colorType(),
|
||||
@ -378,7 +378,7 @@ bool GrSurfaceContext::writePixels(const GrImageInfo& origSrcInfo, const void* s
|
||||
// we can use a draw instead which doesn't have this origin restriction. Thus for render
|
||||
// targets we will use top left and otherwise we will make the origins match.
|
||||
GrSurfaceOrigin tempOrigin =
|
||||
this->asRenderTargetContext() ? kTopLeft_GrSurfaceOrigin : this->origin();
|
||||
this->asRenderTargetContext() ? kTopLeft_GrSurfaceOrigin : dstProxy->origin();
|
||||
auto tempProxy = direct->priv().proxyProvider()->createProxy(
|
||||
format, srcInfo.dimensions(), tempReadSwizzle, GrRenderable::kNo, 1, tempOrigin,
|
||||
GrMipMapped::kNo, SkBackingFit::kApprox, SkBudgeted::kYes, GrProtected::kNo);
|
||||
@ -436,7 +436,7 @@ bool GrSurfaceContext::writePixels(const GrImageInfo& origSrcInfo, const void* s
|
||||
caps->supportedWritePixelsColorType(this->colorInfo().colorType(),
|
||||
dstProxy->backendFormat(),
|
||||
srcInfo.colorType()).fColorType;
|
||||
bool flip = this->origin() == kBottomLeft_GrSurfaceOrigin;
|
||||
bool flip = dstProxy->origin() == kBottomLeft_GrSurfaceOrigin;
|
||||
bool makeTight = !caps->writePixelsRowBytesSupport() && rowBytes != tightRowBytes;
|
||||
bool convert = premul || unpremul || needColorConversion || makeTight ||
|
||||
(srcInfo.colorType() != allowedColorType) || flip;
|
||||
@ -462,11 +462,7 @@ bool GrSurfaceContext::writePixels(const GrImageInfo& origSrcInfo, const void* s
|
||||
// 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?
|
||||
if (caps->preferVRAMUseOverFlushes()) {
|
||||
direct->priv().flushSurface(dstProxy, this->origin());
|
||||
} else {
|
||||
direct->priv().flushSurface();
|
||||
}
|
||||
direct->priv().flushSurface(caps->preferVRAMUseOverFlushes() ? dstProxy : nullptr);
|
||||
|
||||
return direct->priv().getGpu()->writePixels(dstSurface, pt.fX, pt.fY, srcInfo.width(),
|
||||
srcInfo.height(), this->colorInfo().colorType(),
|
||||
|
@ -71,8 +71,7 @@ GrSemaphoresSubmitted SkImage_Gpu::onFlush(GrContext* context, const GrFlushInfo
|
||||
}
|
||||
|
||||
GrSurfaceProxy* p[1] = {fView.proxy()};
|
||||
GrSurfaceOrigin origin = fView.origin();
|
||||
return context->priv().flushSurfaces(p, &origin, 1, info);
|
||||
return context->priv().flushSurfaces(p, 1, info);
|
||||
}
|
||||
|
||||
sk_sp<SkImage> SkImage_Gpu::onMakeColorTypeAndColorSpace(GrRecordingContext* context,
|
||||
@ -561,7 +560,7 @@ sk_sp<SkImage> SkImage::MakeCrossContextFromPixmap(GrContext* context,
|
||||
sk_sp<GrTexture> texture = sk_ref_sp(view.proxy()->peekTexture());
|
||||
|
||||
// Flush any writes or uploads
|
||||
context->priv().flushSurface(view.proxy(), view.origin());
|
||||
context->priv().flushSurface(view.proxy());
|
||||
GrGpu* gpu = context->priv().getGpu();
|
||||
|
||||
std::unique_ptr<GrSemaphore> sema = gpu->prepareTextureForCrossContextUsage(texture.get());
|
||||
@ -698,11 +697,8 @@ bool SkImage::MakeBackendTextureFromSkImage(GrContext* ctx,
|
||||
return false;
|
||||
}
|
||||
|
||||
const GrSurfaceProxyView* view = as_IB(image)->view(ctx);
|
||||
SkASSERT(view);
|
||||
|
||||
// Flush any pending IO on the texture.
|
||||
ctx->priv().flushSurface(view->proxy(), view->origin());
|
||||
ctx->priv().flushSurface(as_IB(image)->peekProxy());
|
||||
|
||||
// We must make a copy of the image if the image is not unique, if the GrTexture owned by the
|
||||
// image is not unique, or if the texture wraps an external object.
|
||||
@ -719,11 +715,8 @@ bool SkImage::MakeBackendTextureFromSkImage(GrContext* ctx,
|
||||
return false;
|
||||
}
|
||||
|
||||
view = as_IB(image)->view(ctx);
|
||||
SkASSERT(view);
|
||||
|
||||
// Flush to ensure that the copy is completed before we return the texture.
|
||||
ctx->priv().flushSurface(view->proxy(), view->origin());
|
||||
ctx->priv().flushSurface(as_IB(image)->peekProxy());
|
||||
}
|
||||
|
||||
SkASSERT(!texture->resourcePriv().refsWrappedObjects());
|
||||
|
@ -221,7 +221,7 @@ GrBackendTexture SkImage_GpuBase::onGetBackendTexture(bool flushPendingGrContext
|
||||
GrTexture* texture = proxy->peekTexture();
|
||||
if (texture) {
|
||||
if (flushPendingGrContextIO) {
|
||||
direct->priv().flushSurface(proxy, view->origin());
|
||||
direct->priv().flushSurface(proxy);
|
||||
}
|
||||
if (origin) {
|
||||
*origin = proxy->origin();
|
||||
|
@ -119,18 +119,15 @@ GrSemaphoresSubmitted SkImage_GpuYUVA::onFlush(GrContext* context, const GrFlush
|
||||
|
||||
GrSurfaceProxy* proxies[4] = {fViews[0].proxy(), fViews[1].proxy(), fViews[2].proxy(),
|
||||
fViews[3].proxy()};
|
||||
GrSurfaceOrigin origins[4] = {fViews[0].origin(), fViews[1].origin(), fViews[2].origin(),
|
||||
fViews[3].origin()};
|
||||
int numProxies = fNumViews;
|
||||
if (fRGBView.proxy()) {
|
||||
// Either we've already flushed the flattening draw or the flattening is unflushed. In the
|
||||
// latter case it should still be ok to just pass fRGBView proxy because it in turn depends
|
||||
// on the planar proxies and will cause all of their work to flush as well.
|
||||
proxies[0] = fRGBView.proxy();
|
||||
origins[0] = fRGBView.origin();
|
||||
numProxies = 1;
|
||||
}
|
||||
return context->priv().flushSurfaces(proxies, origins, numProxies, info);
|
||||
return context->priv().flushSurfaces(proxies, numProxies, info);
|
||||
}
|
||||
|
||||
GrTextureProxy* SkImage_GpuYUVA::peekProxy() const { return fRGBView.asTextureProxy(); }
|
||||
|
Loading…
Reference in New Issue
Block a user