aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-03-28 16:21:27 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-29 12:48:17 +0000
commit1ec1faaff415a95022edfd504f552853a9af5d0a (patch)
tree2f414792e5a62d7b29074cf890b62b8509dd56de
parent334e88c21ab51e2a9fa8a8352da7380f420cdb96 (diff)
Remove GrSurface::flushWrites
Change-Id: Ifac5af00ef852ee212964baa113b490a03e0168d Reviewed-on: https://skia-review.googlesource.com/10293 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
-rw-r--r--include/gpu/GrSurface.h5
-rw-r--r--src/gpu/GrSurface.cpp6
-rw-r--r--src/gpu/GrTextureContext.cpp2
-rw-r--r--tests/ProxyRefTest.cpp20
4 files changed, 11 insertions, 22 deletions
diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h
index 7bfed3c1d4..328731c38f 100644
--- a/include/gpu/GrSurface.h
+++ b/include/gpu/GrSurface.h
@@ -166,11 +166,6 @@ public:
rowBytes, pixelOpsFlags);
}
- /**
- * After this returns any pending writes to the surface will be issued to the backend 3D API.
- */
- void flushWrites();
-
/** Access methods that are only to be used within Skia code. */
inline GrSurfacePriv surfacePriv();
inline const GrSurfacePriv surfacePriv() const;
diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp
index 302ba43973..49753af8f9 100644
--- a/src/gpu/GrSurface.cpp
+++ b/src/gpu/GrSurface.cpp
@@ -163,12 +163,6 @@ bool GrSurface::readPixels(SkColorSpace* srcColorSpace, int left, int top, int w
dstColorSpace, buffer, rowBytes, pixelOpsFlags);
}
-void GrSurface::flushWrites() {
- if (!this->wasDestroyed()) {
- this->getContext()->flushSurfaceWrites(this);
- }
-}
-
bool GrSurface::hasPendingRead() const {
const GrTexture* thisTex = this->asTexture();
if (thisTex && thisTex->internalHasPendingRead()) {
diff --git a/src/gpu/GrTextureContext.cpp b/src/gpu/GrTextureContext.cpp
index 0fbc951ff3..bc48e8eeb1 100644
--- a/src/gpu/GrTextureContext.cpp
+++ b/src/gpu/GrTextureContext.cpp
@@ -85,7 +85,7 @@ bool GrTextureContext::onCopy(GrSurfaceProxy* srcProxy,
#ifndef ENABLE_MDB
// We can't yet fully defer copies to textures, so GrTextureContext::copySurface will
// execute the copy immediately. Ensure the data is ready.
- src->flushWrites();
+ fContext->flushSurfaceWrites(src.get());
#endif
// TODO: this needs to be fixed up since it ends the deferrable of the GrTexture
diff --git a/tests/ProxyRefTest.cpp b/tests/ProxyRefTest.cpp
index ec47597b97..67132a1a21 100644
--- a/tests/ProxyRefTest.cpp
+++ b/tests/ProxyRefTest.cpp
@@ -65,28 +65,28 @@ static void check_refs(skiatest::Reporter* reporter,
SkASSERT(proxy->getPendingWriteCnt_TestOnly() == expectedNumWrites);
}
-static sk_sp<GrSurfaceProxy> make_deferred(GrResourceProvider* provider) {
+static sk_sp<GrSurfaceProxy> make_deferred(GrContext* context) {
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = kWidthHeight;
desc.fHeight = kWidthHeight;
desc.fConfig = kRGBA_8888_GrPixelConfig;
- return GrSurfaceProxy::MakeDeferred(provider, desc,
+ return GrSurfaceProxy::MakeDeferred(context->resourceProvider(), desc,
SkBackingFit::kApprox, SkBudgeted::kYes);
}
-static sk_sp<GrSurfaceProxy> make_wrapped(GrResourceProvider* provider) {
+static sk_sp<GrSurfaceProxy> make_wrapped(GrContext* context) {
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = kWidthHeight;
desc.fHeight = kWidthHeight;
desc.fConfig = kRGBA_8888_GrPixelConfig;
- sk_sp<GrTexture> tex(provider->createTexture(desc, SkBudgeted::kNo));
+ sk_sp<GrTexture> tex(context->resourceProvider()->createTexture(desc, SkBudgeted::kNo));
// Flush the IOWrite from the initial discard or it will confuse the later ref count checks
- tex->flushWrites();
+ context->flushSurfaceWrites(tex.get());
return GrSurfaceProxy::MakeWrapped(std::move(tex));
}
@@ -100,7 +100,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
for (auto make : { make_deferred, make_wrapped }) {
// A single write
{
- sk_sp<GrSurfaceProxy> sProxy((*make)(provider));
+ sk_sp<GrSurfaceProxy> sProxy((*make)(ctxInfo.grContext()));
GrPendingIOResource<GrSurfaceProxy, kWrite_GrIOType> fWrite(sProxy.get());
@@ -120,7 +120,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
// A single read
{
- sk_sp<GrSurfaceProxy> sProxy((*make)(provider));
+ sk_sp<GrSurfaceProxy> sProxy((*make)(ctxInfo.grContext()));
GrPendingIOResource<GrSurfaceProxy, kRead_GrIOType> fRead(sProxy.get());
@@ -140,7 +140,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
// A single read/write pair
{
- sk_sp<GrSurfaceProxy> sProxy((*make)(provider));
+ sk_sp<GrSurfaceProxy> sProxy((*make)(ctxInfo.grContext()));
GrPendingIOResource<GrSurfaceProxy, kRW_GrIOType> fRW(sProxy.get());
@@ -160,7 +160,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
// Multiple normal refs
{
- sk_sp<GrSurfaceProxy> sProxy((*make)(provider));
+ sk_sp<GrSurfaceProxy> sProxy((*make)(ctxInfo.grContext()));
sProxy->ref();
sProxy->ref();
@@ -181,7 +181,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
// Continue using (reffing) proxy after instantiation
{
- sk_sp<GrSurfaceProxy> sProxy((*make)(provider));
+ sk_sp<GrSurfaceProxy> sProxy((*make)(ctxInfo.grContext()));
sProxy->ref();
GrPendingIOResource<GrSurfaceProxy, kWrite_GrIOType> fWrite(sProxy.get());