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 /include | |
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 'include')
-rw-r--r-- | include/private/GrSurfaceProxy.h | 30 | ||||
-rw-r--r-- | include/private/GrTextureProxy.h | 13 |
2 files changed, 21 insertions, 22 deletions
diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h index 3c503faeb8..d8fd33cc76 100644 --- a/include/private/GrSurfaceProxy.h +++ b/include/private/GrSurfaceProxy.h @@ -420,20 +420,6 @@ protected: bool instantiateImpl(GrResourceProvider* resourceProvider, int sampleCnt, bool needsStencil, GrSurfaceDescFlags descFlags, GrMipMapped, const GrUniqueKey*); - void setDoesNotSupportMipMaps() { - SkASSERT(this->asTextureProxy()); - fSurfaceFlags |= GrInternalSurfaceFlags::kDoesNotSupportMipMaps; - } - bool doesNotSupportMipMaps() const { - return fSurfaceFlags & GrInternalSurfaceFlags::kDoesNotSupportMipMaps; - } - - void setIsClampOnly() { - SkASSERT(this->asTextureProxy()); - fSurfaceFlags |= GrInternalSurfaceFlags::kIsClampOnly; - } - bool isClampOnly() const { return fSurfaceFlags & GrInternalSurfaceFlags::kIsClampOnly; } - void setHasMixedSamples() { SkASSERT(this->asRenderTargetProxy()); fSurfaceFlags |= GrInternalSurfaceFlags::kMixedSampled; @@ -448,6 +434,14 @@ protected: return fSurfaceFlags & GrInternalSurfaceFlags::kWindowRectsSupport; } + // In many cases these flags aren't actually known until the proxy has been instantiated. + // However, Ganesh frequently needs to change its behavior based on these settings. For + // internally create proxies we will know these properties ahead of time. For wrapped + // proxies we will copy the properties off of the GrSurface. For lazy proxies we force the + // call sites to provide the required information ahead of time. At instantiation time + // we verify that the assumed properties match the actual properties. + GrInternalSurfaceFlags fSurfaceFlags; + private: // For wrapped resources, 'fConfig', 'fWidth', 'fHeight', and 'fOrigin; will always be filled in // from the wrapped resource. @@ -461,14 +455,6 @@ private: // set from the backing resource for wrapped resources // mutable bc of SkSurface/SkImage wishy-washiness - // In many cases these flags aren't actually known until the proxy has been instantiated. - // However, Ganesh frequently needs to change its behavior based on these settings. For - // internally create proxies we will know these properties ahead of time. For wrapped - // proxies we will copy the properties off of the GrSurface. For lazy proxies we force the - // call sites to provide the required information ahead of time. At instantiation time - // we verify that the assumed properties match the actual properties. - GrInternalSurfaceFlags fSurfaceFlags; - const UniqueID fUniqueID; // set from the backing resource for wrapped resources LazyInstantiateCallback fLazyInstantiateCallback; diff --git a/include/private/GrTextureProxy.h b/include/private/GrTextureProxy.h index 2ded566475..5954f1b6f4 100644 --- a/include/private/GrTextureProxy.h +++ b/include/private/GrTextureProxy.h @@ -100,6 +100,19 @@ protected: sk_sp<GrSurface> createSurface(GrResourceProvider*) const override; + void setDoesNotSupportMipMaps() { + fSurfaceFlags |= GrInternalSurfaceFlags::kDoesNotSupportMipMaps; + } + bool doesNotSupportMipMaps() const { + return fSurfaceFlags & GrInternalSurfaceFlags::kDoesNotSupportMipMaps; + } + + void setIsClampOnly() { + fSurfaceFlags |= GrInternalSurfaceFlags::kIsClampOnly; + } + bool isClampOnly() const { return fSurfaceFlags & GrInternalSurfaceFlags::kIsClampOnly; } + + private: GrMipMapped fMipMapped; |