diff options
-rw-r--r-- | include/private/GrRenderTargetProxy.h | 2 | ||||
-rw-r--r-- | include/private/GrSurfaceProxy.h | 4 | ||||
-rw-r--r-- | include/private/GrTextureProxy.h | 2 | ||||
-rw-r--r-- | include/private/GrTypesPriv.h | 8 | ||||
-rw-r--r-- | src/gpu/GrRenderTargetProxy.cpp | 10 | ||||
-rw-r--r-- | src/gpu/GrSurfaceProxy.cpp | 24 | ||||
-rw-r--r-- | src/gpu/GrTextureProxy.cpp | 8 | ||||
-rw-r--r-- | src/gpu/GrTextureRenderTargetProxy.cpp | 12 | ||||
-rw-r--r-- | src/gpu/GrTextureRenderTargetProxy.h | 2 |
9 files changed, 53 insertions, 19 deletions
diff --git a/include/private/GrRenderTargetProxy.h b/include/private/GrRenderTargetProxy.h index f1e1b7d9ff..29c4fc300a 100644 --- a/include/private/GrRenderTargetProxy.h +++ b/include/private/GrRenderTargetProxy.h @@ -84,7 +84,7 @@ protected: private: size_t onUninstantiatedGpuMemorySize() const override; - SkDEBUGCODE(void validateLazySurface(const GrSurface*) override;) + SkDEBUGCODE(void onValidateSurface(const GrSurface*) override;) int fSampleCnt; bool fNeedsStencil; diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h index d8fd33cc76..20ee9a4d97 100644 --- a/include/private/GrSurfaceProxy.h +++ b/include/private/GrSurfaceProxy.h @@ -464,7 +464,9 @@ private: // we make lazy proxies and instantiate them immediately. // Note: This is ignored if fLazyInstantiateCallback is null. LazyInstantiationType fLazyInstantiationType; - SkDEBUGCODE(virtual void validateLazySurface(const GrSurface*) = 0;) + + SkDEBUGCODE(void validateSurface(const GrSurface*);) + SkDEBUGCODE(virtual void onValidateSurface(const GrSurface*) = 0;) static const size_t kInvalidGpuMemorySize = ~static_cast<size_t>(0); SkDEBUGCODE(size_t getRawGpuMemorySize_debugOnly() const { return fGpuMemorySize; }) diff --git a/include/private/GrTextureProxy.h b/include/private/GrTextureProxy.h index 5954f1b6f4..b9373a55f8 100644 --- a/include/private/GrTextureProxy.h +++ b/include/private/GrTextureProxy.h @@ -130,7 +130,7 @@ private: void setUniqueKey(GrProxyProvider*, const GrUniqueKey&); void clearUniqueKey(); - SkDEBUGCODE(void validateLazySurface(const GrSurface*) override;) + SkDEBUGCODE(void onValidateSurface(const GrSurface*) override;) // For wrapped proxies the GrTexture pointer is stored in GrIORefProxy. // For deferred proxies that pointer will be filled in when we need to instantiate diff --git a/include/private/GrTypesPriv.h b/include/private/GrTypesPriv.h index 8cabb94f35..737582a7c5 100644 --- a/include/private/GrTypesPriv.h +++ b/include/private/GrTypesPriv.h @@ -867,6 +867,8 @@ enum class GrInternalSurfaceFlags { // Surface-level kNoPendingIO = 1 << 0, + kSurfaceMask = kNoPendingIO, + // Texture-only flags // This flag is set when the internal texture target doesn't support mipmaps (e.g., @@ -881,6 +883,8 @@ enum class GrInternalSurfaceFlags { // into Ganesh. kIsClampOnly = 1 << 2, + kTextureMask = kDoesNotSupportMipMaps | kIsClampOnly, + // RT-only // For internal resources: @@ -896,7 +900,9 @@ enum class GrInternalSurfaceFlags { // For wrapped resources1 // this is disabled for FBO0 // but, otherwise, is enabled whenever GrCaps reports window rect support - kWindowRectsSupport = 1 << 4 + kWindowRectsSupport = 1 << 4, + + kRenderTargetMask = kMixedSampled | kWindowRectsSupport, }; GR_MAKE_BITFIELD_CLASS_OPS(GrInternalSurfaceFlags) diff --git a/src/gpu/GrRenderTargetProxy.cpp b/src/gpu/GrRenderTargetProxy.cpp index 2526de8db4..c5d096d5db 100644 --- a/src/gpu/GrRenderTargetProxy.cpp +++ b/src/gpu/GrRenderTargetProxy.cpp @@ -12,6 +12,7 @@ #include "GrRenderTargetOpList.h" #include "GrRenderTargetPriv.h" #include "GrResourceProvider.h" +#include "GrSurfacePriv.h" #include "GrTextureRenderTargetProxy.h" #include "SkMathPriv.h" @@ -105,11 +106,18 @@ bool GrRenderTargetProxy::refsWrappedObjects() const { } #ifdef SK_DEBUG -void GrRenderTargetProxy::validateLazySurface(const GrSurface* surface) { +void GrRenderTargetProxy::onValidateSurface(const GrSurface* surface) { SkASSERT(!surface->asTexture()); // Anything that is checked here should be duplicated in GrTextureRenderTargetProxy's version SkASSERT(surface->asRenderTarget()); SkASSERT(surface->asRenderTarget()->numStencilSamples() == this->numStencilSamples()); + + // DDL TODO: re-enable this after skbug.com/7748 (Add FBO-0-ness to SkSurfaceCharacterization) + // is fixed. + // GrInternalSurfaceFlags proxyFlags = fSurfaceFlags; + // GrInternalSurfaceFlags surfaceFlags = surface->surfacePriv().flags(); + // SkASSERT((proxyFlags & GrInternalSurfaceFlags::kRenderTargetMask) == + // (surfaceFlags & GrInternalSurfaceFlags::kRenderTargetMask)); } #endif diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp index ff3ae3b560..4d44d1ecc6 100644 --- a/src/gpu/GrSurfaceProxy.cpp +++ b/src/gpu/GrSurfaceProxy.cpp @@ -180,11 +180,7 @@ sk_sp<GrSurface> GrSurfaceProxy::createSurfaceImpl( void GrSurfaceProxy::assign(sk_sp<GrSurface> surface) { SkASSERT(!fTarget && surface); - // Check that our a priori computation matched the ultimate reality - // DDL TODO: re-enable this after skbug.com/7748 (Add FBO-0-ness to SkSurfaceCharacterization) - // is fixed. -// SkASSERT((fSurfaceFlags & ~GrInternalSurfaceFlags::kNoPendingIO) == -// surface->surfacePriv().flags()); + SkDEBUGCODE(this->validateSurface(surface.get());) fTarget = surface.release(); @@ -424,13 +420,19 @@ 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; } +#ifdef SK_DEBUG +void GrSurfaceProxy::validateSurface(const GrSurface* surface) { + SkASSERT(surface->config() == fConfig); + + // Assert the flags are the same except for kNoPendingIO which is not passed onto the GrSurface. + GrInternalSurfaceFlags proxyFlags = fSurfaceFlags & ~GrInternalSurfaceFlags::kNoPendingIO; + GrInternalSurfaceFlags surfaceFlags = surface->surfacePriv().flags(); + SkASSERT((proxyFlags & GrInternalSurfaceFlags::kSurfaceMask) == + (surfaceFlags & GrInternalSurfaceFlags::kSurfaceMask)); + this->onValidateSurface(surface); +} +#endif diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp index 03acd7ce44..b25efd95f5 100644 --- a/src/gpu/GrTextureProxy.cpp +++ b/src/gpu/GrTextureProxy.cpp @@ -12,6 +12,7 @@ #include "GrContextPriv.h" #include "GrDeferredProxyUploader.h" #include "GrProxyProvider.h" +#include "GrSurfacePriv.h" #include "GrTexturePriv.h" // Deferred version - with data @@ -159,13 +160,18 @@ void GrTextureProxy::clearUniqueKey() { } #ifdef SK_DEBUG -void GrTextureProxy::validateLazySurface(const GrSurface* surface) { +void GrTextureProxy::onValidateSurface(const GrSurface* surface) { SkASSERT(!surface->asRenderTarget()); // Anything that is checked here should be duplicated in GrTextureRenderTargetProxy's version SkASSERT(surface->asTexture()); SkASSERT(GrMipMapped::kNo == this->texPriv().proxyMipMapped() || GrMipMapped::kYes == surface->asTexture()->texturePriv().mipMapped()); + + GrInternalSurfaceFlags proxyFlags = fSurfaceFlags; + GrInternalSurfaceFlags surfaceFlags = surface->surfacePriv().flags(); + SkASSERT((proxyFlags & GrInternalSurfaceFlags::kTextureMask) == + (surfaceFlags & GrInternalSurfaceFlags::kTextureMask)); } #endif diff --git a/src/gpu/GrTextureRenderTargetProxy.cpp b/src/gpu/GrTextureRenderTargetProxy.cpp index 61bec05a29..dfc3d13432 100644 --- a/src/gpu/GrTextureRenderTargetProxy.cpp +++ b/src/gpu/GrTextureRenderTargetProxy.cpp @@ -12,6 +12,7 @@ #include "GrTexturePriv.h" #include "GrTextureProxyPriv.h" #include "GrRenderTarget.h" +#include "GrSurfacePriv.h" #include "GrSurfaceProxyPriv.h" // Deferred version @@ -110,7 +111,7 @@ sk_sp<GrSurface> GrTextureRenderTargetProxy::createSurface( } #ifdef SK_DEBUG -void GrTextureRenderTargetProxy::validateLazySurface(const GrSurface* surface) { +void GrTextureRenderTargetProxy::onValidateSurface(const GrSurface* surface) { // Anything checked here should also be checking the GrTextureProxy version SkASSERT(surface->asTexture()); SkASSERT(GrMipMapped::kNo == this->texPriv().proxyMipMapped() || @@ -119,6 +120,15 @@ void GrTextureRenderTargetProxy::validateLazySurface(const GrSurface* surface) { // Anything checked here should also be checking the GrRenderTargetProxy version SkASSERT(surface->asRenderTarget()); SkASSERT(surface->asRenderTarget()->numStencilSamples() == this->numStencilSamples()); + + GrInternalSurfaceFlags proxyFlags = fSurfaceFlags; + GrInternalSurfaceFlags surfaceFlags = surface->surfacePriv().flags(); + SkASSERT((proxyFlags & GrInternalSurfaceFlags::kTextureMask) == + (surfaceFlags & GrInternalSurfaceFlags::kTextureMask)); + // DDL TODO: re-enable this after skbug.com/7748 (Add FBO-0-ness to SkSurfaceCharacterization) + // is fixed. + // SkASSERT((proxyFlags & GrInternalSurfaceFlags::kRenderTargetMask) == + // (surfaceFlags & GrInternalSurfaceFlags::kRenderTargetMask)); } #endif diff --git a/src/gpu/GrTextureRenderTargetProxy.h b/src/gpu/GrTextureRenderTargetProxy.h index 193d8a74e2..141597ec76 100644 --- a/src/gpu/GrTextureRenderTargetProxy.h +++ b/src/gpu/GrTextureRenderTargetProxy.h @@ -44,7 +44,7 @@ private: size_t onUninstantiatedGpuMemorySize() const override; - SkDEBUGCODE(void validateLazySurface(const GrSurface*) override;) + SkDEBUGCODE(void onValidateSurface(const GrSurface*) override;) }; #ifdef SK_BUILD_FOR_WIN |