Add GrMipMapsStatus to GrTextureProxy
Bug: skia:
Change-Id: I5adf10f730b04c2b3b62c3b12aa5899da4db3431
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229922
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrTextureProxy.h b/src/gpu/GrTextureProxy.h
index c0f24dc..091d0ca 100644
--- a/src/gpu/GrTextureProxy.h
+++ b/src/gpu/GrTextureProxy.h
@@ -36,6 +36,12 @@
// generation later.
GrMipMapped mipMapped() const;
+ bool mipMapsAreDirty() const {
+ SkASSERT((GrMipMapped::kNo == fMipMapped) ==
+ (GrMipMapsStatus::kNotAllocated == fMipMapsStatus));
+ return GrMipMapped::kYes == fMipMapped && GrMipMapsStatus::kValid != fMipMapsStatus;
+ }
+
// Returns the GrMipMapped value of the proxy from creation time regardless of whether it has
// been instantiated or not.
GrMipMapped proxyMipMapped() const { return fMipMapped; }
@@ -93,8 +99,8 @@
// Deferred version - no data.
GrTextureProxy(const GrBackendFormat&, const GrSurfaceDesc& srcDesc, GrSurfaceOrigin,
- GrMipMapped, const GrSwizzle& textureSwizzle, SkBackingFit, SkBudgeted,
- GrProtected, GrInternalSurfaceFlags);
+ GrMipMapped, GrMipMapsStatus, const GrSwizzle& textureSwizzle, SkBackingFit,
+ SkBudgeted, GrProtected, GrInternalSurfaceFlags);
// Lazy-callback version
// There are two main use cases for lazily-instantiated proxies:
@@ -107,8 +113,8 @@
// The minimal knowledge version is used for CCPR where we are generating an atlas but we do not
// know the final size until flush time.
GrTextureProxy(LazyInstantiateCallback&&, LazyInstantiationType, const GrBackendFormat&,
- const GrSurfaceDesc& desc, GrSurfaceOrigin, GrMipMapped, const GrSwizzle&,
- SkBackingFit, SkBudgeted, GrProtected, GrInternalSurfaceFlags);
+ const GrSurfaceDesc& desc, GrSurfaceOrigin, GrMipMapped, GrMipMapsStatus,
+ const GrSwizzle&, SkBackingFit, SkBudgeted, GrProtected, GrInternalSurfaceFlags);
// Wrapped version
GrTextureProxy(sk_sp<GrSurface>, GrSurfaceOrigin, const GrSwizzle&);
@@ -129,6 +135,19 @@
// address of other types, leading to this problem.
GrMipMapped fMipMapped;
+
+ // This tracks the mipmap status at the proxy level and is thus somewhat distinct from the
+ // backing GrTexture's mipmap status. In particular, this status is used to determine when
+ // mipmap levels need to be explicitly regenerated during the execution of a DAG of opLists.
+ GrMipMapsStatus fMipMapsStatus;
+ // TEMPORARY: We are in the process of moving GrMipMapsStatus from the texture to the proxy.
+ // We track the fInitialMipMapsStatus here so we can assert that the proxy did indeed expect
+ // the correct mipmap status immediately after instantiation.
+ //
+ // NOTE: fMipMapsStatus may no longer be equal to fInitialMipMapsStatus by the time the texture
+ // is instantiated, since it tracks mipmaps in the time frame in which the DAG is being built.
+ SkDEBUGCODE(const GrMipMapsStatus fInitialMipMapsStatus);
+
bool fSyncTargetKey = true; // Should target's unique key be sync'ed with ours.
GrUniqueKey fUniqueKey;