diff options
author | Greg Daniel <egdaniel@google.com> | 2018-04-16 11:24:10 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-16 17:05:20 +0000 |
commit | e3204864899651a132d3387422d7fd599c21b3ac (patch) | |
tree | dcc19da5c650a435de56317f73044eb03b82a3c4 /src/gpu/GrSurfaceProxy.cpp | |
parent | 45c92203ef43d09ca6444430bd4081ac97b71237 (diff) |
Don't allow ganesh to allocate mip maps for wrapped textures.
We will not allocate new mips on a wrapped texture but we will use mips
if the wrapped texture already has one. If we need mips for a draw this
will trigger a copy to occur.
Also some cleanup up of our InternalSurfaceFlags in general.
Bug: skia:7806
Change-Id: I7aa666478cc91bba6e0644b323825fcc9b49793a
Reviewed-on: https://skia-review.googlesource.com/121348
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrSurfaceProxy.cpp')
-rw-r--r-- | src/gpu/GrSurfaceProxy.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp index 1016390f7e..ff3ae3b560 100644 --- a/src/gpu/GrSurfaceProxy.cpp +++ b/src/gpu/GrSurfaceProxy.cpp @@ -51,13 +51,13 @@ static bool is_valid_non_lazy(const GrSurfaceDesc& desc) { GrSurfaceProxy::GrSurfaceProxy(LazyInstantiateCallback&& callback, LazyInstantiationType lazyType, const GrSurfaceDesc& desc, GrSurfaceOrigin origin, SkBackingFit fit, SkBudgeted budgeted, GrInternalSurfaceFlags surfaceFlags) - : fConfig(desc.fConfig) + : fSurfaceFlags(surfaceFlags) + , fConfig(desc.fConfig) , fWidth(desc.fWidth) , fHeight(desc.fHeight) , fOrigin(origin) , fFit(fit) , fBudgeted(budgeted) - , fSurfaceFlags(surfaceFlags) , fLazyInstantiateCallback(std::move(callback)) , fLazyInstantiationType(lazyType) , fNeedsClear(SkToBool(desc.fFlags & kPerformInitialClear_GrSurfaceFlag)) @@ -74,13 +74,13 @@ GrSurfaceProxy::GrSurfaceProxy(LazyInstantiateCallback&& callback, LazyInstantia // Wrapped version GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface, GrSurfaceOrigin origin, SkBackingFit fit) : INHERITED(std::move(surface)) + , fSurfaceFlags(fTarget->surfacePriv().flags()) , fConfig(fTarget->config()) , fWidth(fTarget->width()) , fHeight(fTarget->height()) , fOrigin(origin) , fFit(fit) , fBudgeted(fTarget->resourcePriv().isBudgeted()) - , fSurfaceFlags(fTarget->surfacePriv().flags()) , fUniqueID(fTarget->uniqueID()) // Note: converting from unique resource ID to a proxy ID! , fNeedsClear(false) , fGpuMemorySize(kInvalidGpuMemorySize) @@ -425,6 +425,10 @@ bool GrSurfaceProxyPriv::doLazyInstantiation(GrResourceProvider* resourceProvide GrSurfaceProxyPriv::AttachStencilIfNeeded(resourceProvider, surface.get(), needsStencil); SkASSERT(surface->config() == fProxy->fConfig); + // Assert the flags are the same except for kNoPendingIO which is not passed onto the GrSurface. + SkDEBUGCODE(GrInternalSurfaceFlags proxyFlags = + fProxy->fSurfaceFlags & ~GrInternalSurfaceFlags::kNoPendingIO); + SkASSERT(surface->surfacePriv().flags() == proxyFlags); SkDEBUGCODE(fProxy->validateLazySurface(surface.get());) this->assign(std::move(surface)); return true; |