diff options
author | Brian Osman <brianosman@google.com> | 2017-10-02 16:38:32 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-02 21:04:08 +0000 |
commit | 099fa0fb9801a138f12cf7cdf46b6581d81acce8 (patch) | |
tree | 2c3fcfa090c75737f528591095db6604d1f3ccce /src/gpu/GrTextureProxy.cpp | |
parent | 74a8296d7c47efc6e23bd978efd1fdf4dbe29eb9 (diff) |
Revert^6 "Make threaded proxy generation MDB-friendly, and defer instantiation"
ANGLE bots were getting lots of corrupted GMs - we set fPreferVRAMUseOverFlushes
to false. In that case, multiple deferred proxies were instantiating to the same
scratch resource. Any proxy that we're going to fill with an ASAP upload needs
to have no pending IO - we hoist all those loads to the front of the flush, so
normal IO tracking doesn't really help.
Bug: skia:
Change-Id: Id36fd8700e522db412a3c992b93c778e2ebb1188
Reviewed-on: https://skia-review.googlesource.com/53940
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/GrTextureProxy.cpp')
-rw-r--r-- | src/gpu/GrTextureProxy.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp index 8b9e58b594..534adaa709 100644 --- a/src/gpu/GrTextureProxy.cpp +++ b/src/gpu/GrTextureProxy.cpp @@ -6,10 +6,11 @@ */ #include "GrTextureProxy.h" +#include "GrTextureProxyPriv.h" #include "GrContext.h" +#include "GrDeferredProxyUploader.h" #include "GrResourceCache.h" - #include "GrTexturePriv.h" GrTextureProxy::GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit fit, SkBudgeted budgeted, @@ -17,7 +18,8 @@ GrTextureProxy::GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit fit, S : INHERITED(srcDesc, fit, budgeted, flags) , fIsMipMapped(false) , fMipColorMode(SkDestinationSurfaceColorMode::kLegacy) - , fCache(nullptr) { + , fCache(nullptr) + , fDeferredUploader(nullptr) { SkASSERT(!srcData); // currently handled in Make() } @@ -25,7 +27,8 @@ GrTextureProxy::GrTextureProxy(sk_sp<GrSurface> surf, GrSurfaceOrigin origin) : INHERITED(std::move(surf), origin, SkBackingFit::kExact) , fIsMipMapped(fTarget->asTexture()->texturePriv().hasMipMaps()) , fMipColorMode(fTarget->asTexture()->texturePriv().mipColorMode()) - , fCache(nullptr) { + , fCache(nullptr) + , fDeferredUploader(nullptr) { if (fTarget->getUniqueKey().isValid()) { fCache = fTarget->asTexture()->getContext()->getResourceCache(); fCache->adoptUniqueKeyFromSurface(this, fTarget); @@ -67,6 +70,25 @@ sk_sp<GrSurface> GrTextureProxy::createSurface(GrResourceProvider* resourceProvi return surface; } +void GrTextureProxyPriv::setDeferredUploader(std::unique_ptr<GrDeferredProxyUploader> uploader) { + SkASSERT(!fTextureProxy->fDeferredUploader); + fTextureProxy->fDeferredUploader = std::move(uploader); +} + +void GrTextureProxyPriv::scheduleUpload(GrOpFlushState* flushState) { + SkASSERT(fTextureProxy->fDeferredUploader); + + // Instantiate might have failed + if (fTextureProxy->fTarget) { + fTextureProxy->fDeferredUploader->scheduleUpload(flushState, fTextureProxy); + } +} + +void GrTextureProxyPriv::resetDeferredUploader() { + SkASSERT(fTextureProxy->fDeferredUploader); + fTextureProxy->fDeferredUploader.reset(); +} + // This method parallels the highest_filter_mode functions in GrGLTexture & GrVkTexture. GrSamplerState::Filter GrTextureProxy::highestFilterMode() const { if (fTarget) { |