Temporarily restore old behavior of read/writeSurfacePixels
In the interest of only changing one thing at a time, this should fix the putImageData perf regression in Chrome. It will be followed up by a CL to change prepareSurfaceForExternalIO to always flush (which could have a different perf impact).
On Chrome's putImageData benchmark we get:
w/o this CL: avg 293.1247823176651 runs/s
w/ this CL: avg 374.8427288397461 runs/s
Bug: 942538
Change-Id: I9b9bc752532890f4313a45e5a6aa34b915d5e43d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205003
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp
index 85a312f..362c469 100644
--- a/src/gpu/GrTextureProxy.cpp
+++ b/src/gpu/GrTextureProxy.cpp
@@ -76,13 +76,15 @@
}
}
-bool GrTextureProxy::instantiate(GrResourceProvider* resourceProvider) {
+bool GrTextureProxy::instantiate(GrResourceProvider* resourceProvider,
+ bool dontForceNoPendingIO) {
if (LazyState::kNot != this->lazyInstantiationState()) {
return false;
}
if (!this->instantiateImpl(resourceProvider, 1, /* needsStencil = */ false,
kNone_GrSurfaceFlags, fMipMapped,
- fUniqueKey.isValid() ? &fUniqueKey : nullptr)) {
+ fUniqueKey.isValid() ? &fUniqueKey : nullptr,
+ dontForceNoPendingIO)) {
return false;
}
@@ -92,10 +94,12 @@
}
sk_sp<GrSurface> GrTextureProxy::createSurface(GrResourceProvider* resourceProvider) const {
+ SkASSERT(resourceProvider->explicitlyAllocateGPUResources());
+
sk_sp<GrSurface> surface = this->createSurfaceImpl(resourceProvider, 1,
/* needsStencil = */ false,
kNone_GrSurfaceFlags,
- fMipMapped);
+ fMipMapped, true);
if (!surface) {
return nullptr;
}