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/SkSurfaceCharacterization.h | 15 | ||||
-rw-r--r-- | src/core/SkDeferredDisplayListRecorder.cpp | 17 | ||||
-rw-r--r-- | src/gpu/GrProxyProvider.cpp | 19 | ||||
-rw-r--r-- | src/gpu/GrProxyProvider.h | 11 | ||||
-rw-r--r-- | src/gpu/GrRenderTargetProxy.cpp | 10 | ||||
-rw-r--r-- | src/gpu/GrSurfaceProxy.cpp | 15 | ||||
-rw-r--r-- | src/gpu/GrTextureProxy.cpp | 8 | ||||
-rw-r--r-- | src/gpu/GrTextureRenderTargetProxy.cpp | 13 | ||||
-rw-r--r-- | src/gpu/GrTextureRenderTargetProxy.h | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLGpu.cpp | 3 | ||||
-rw-r--r-- | src/image/SkSurface_Gpu.cpp | 20 | ||||
-rw-r--r-- | tests/DeferredDisplayListTest.cpp | 100 | ||||
-rw-r--r-- | tools/gpu/gl/debug/DebugGLTestContext.cpp | 6 |
16 files changed, 201 insertions, 46 deletions
diff --git a/include/private/GrRenderTargetProxy.h b/include/private/GrRenderTargetProxy.h index efe282318f..b0018a7ad8 100644 --- a/include/private/GrRenderTargetProxy.h +++ b/include/private/GrRenderTargetProxy.h @@ -87,7 +87,7 @@ protected: private: size_t onUninstantiatedGpuMemorySize() const override; - SkDEBUGCODE(void validateLazyTexture(const GrTexture*) override { SkASSERT(0); }) + SkDEBUGCODE(void validateLazySurface(const GrSurface*) override;) int fSampleCnt; bool fNeedsStencil; diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h index d05d3ad1cb..84353eee12 100644 --- a/include/private/GrSurfaceProxy.h +++ b/include/private/GrSurfaceProxy.h @@ -355,7 +355,7 @@ protected: // Note: this ctor pulls a new uniqueID from the same pool at the GrGpuResources } - using LazyInstantiateCallback = std::function<sk_sp<GrTexture>(GrResourceProvider*, + using LazyInstantiateCallback = std::function<sk_sp<GrSurface>(GrResourceProvider*, GrSurfaceOrigin* outOrigin)>; // Lazy-callback version @@ -408,7 +408,7 @@ private: const UniqueID fUniqueID; // set from the backing resource for wrapped resources LazyInstantiateCallback fLazyInstantiateCallback; - SkDEBUGCODE(virtual void validateLazyTexture(const GrTexture*) = 0;) + SkDEBUGCODE(virtual void validateLazySurface(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 e9d4c50eeb..3aee3de361 100644 --- a/include/private/GrTextureProxy.h +++ b/include/private/GrTextureProxy.h @@ -113,7 +113,7 @@ private: void setUniqueKey(GrProxyProvider*, const GrUniqueKey&); void clearUniqueKey(); - SkDEBUGCODE(void validateLazyTexture(const GrTexture*) override;) + SkDEBUGCODE(void validateLazySurface(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/SkSurfaceCharacterization.h b/include/private/SkSurfaceCharacterization.h index 07838968b9..9e5f40df64 100644 --- a/include/private/SkSurfaceCharacterization.h +++ b/include/private/SkSurfaceCharacterization.h @@ -32,6 +32,9 @@ class SkColorSpace; */ class SkSurfaceCharacterization { public: + enum class Textureable : bool { kNo = false, kYes = true }; + enum class MipMapped : bool { kNo = false, kYes = true }; + SkSurfaceCharacterization() : fCacheMaxResourceCount(0) , fCacheMaxResourceBytes(0) @@ -41,6 +44,8 @@ public: , fConfig(kUnknown_GrPixelConfig) , fFSAAType(GrFSAAType::kNone) , fStencilCnt(0) + , fIsTextureable(Textureable::kYes) + , fIsMipMapped(MipMapped::kYes) , fSurfaceProps(0, kUnknown_SkPixelGeometry) { } @@ -60,6 +65,8 @@ public: GrPixelConfig config() const { return fConfig; } GrFSAAType fsaaType() const { return fFSAAType; } int stencilCount() const { return fStencilCnt; } + bool isTextureable() const { return Textureable::kYes == fIsTextureable; } + bool isMipMapped() const { return MipMapped::kYes == fIsMipMapped; } SkColorSpace* colorSpace() const { return fColorSpace.get(); } sk_sp<SkColorSpace> refColorSpace() const { return fColorSpace; } const SkSurfaceProps& surfaceProps()const { return fSurfaceProps; } @@ -75,8 +82,12 @@ private: GrPixelConfig config, GrFSAAType fsaaType, int stencilCnt, + Textureable isTextureable, + MipMapped isMipMapped, sk_sp<SkColorSpace> colorSpace, const SkSurfaceProps& surfaceProps) { + SkASSERT(MipMapped::kNo == isMipMapped || Textureable::kYes == isTextureable); + fContextInfo = contextInfo; fCacheMaxResourceCount = cacheMaxResourceCount; fCacheMaxResourceBytes = cacheMaxResourceBytes; @@ -87,6 +98,8 @@ private: fConfig = config; fFSAAType = fsaaType; fStencilCnt = stencilCnt; + fIsTextureable = isTextureable; + fIsMipMapped = isMipMapped; fColorSpace = std::move(colorSpace); fSurfaceProps = surfaceProps; } @@ -101,6 +114,8 @@ private: GrPixelConfig fConfig; GrFSAAType fFSAAType; int fStencilCnt; + Textureable fIsTextureable; + MipMapped fIsMipMapped; sk_sp<SkColorSpace> fColorSpace; SkSurfaceProps fSurfaceProps; }; diff --git a/src/core/SkDeferredDisplayListRecorder.cpp b/src/core/SkDeferredDisplayListRecorder.cpp index b5442c69f8..14e5926637 100644 --- a/src/core/SkDeferredDisplayListRecorder.cpp +++ b/src/core/SkDeferredDisplayListRecorder.cpp @@ -76,22 +76,21 @@ bool SkDeferredDisplayListRecorder::init() { sk_sp<SkDeferredDisplayList::LazyProxyData> lazyProxyData = fLazyProxyData; // What we're doing here is we're creating a lazy proxy to back the SkSurface. The lazy - // proxy, when instantiated, will use the GrTexture that backs the SkSurface that the + // proxy, when instantiated, will use the GrRenderTarget that backs the SkSurface that the // DDL is being replayed into. - sk_sp<GrSurfaceProxy> proxy = proxyProvider->createLazyProxy( + sk_sp<GrRenderTargetProxy> proxy = proxyProvider->createLazyRenderTargetProxy( [ lazyProxyData ] (GrResourceProvider* resourceProvider, GrSurfaceOrigin* /* outOrigin */) { if (!resourceProvider) { - return sk_sp<GrTexture>(); + return sk_sp<GrSurface>(); } // The proxy backing the destination surface had better have been instantiated - // prior to the proxy backing the DLL's surface. Steal its GrTexture. - // DDL TODO: What do we do in the case where the Surface we're replaying into - // isn't texturable? - SkASSERT(lazyProxyData->fReplayDest->priv().peekTexture()); - return sk_ref_sp<GrTexture>(lazyProxyData->fReplayDest->priv().peekTexture()); - }, desc, GrMipMapped::kNo, SkBackingFit::kExact, SkBudgeted::kYes); + // prior to the proxy backing the DLL's surface. Steal its GrRenderTarget. + SkASSERT(lazyProxyData->fReplayDest->priv().peekSurface()); + return sk_ref_sp<GrSurface>(lazyProxyData->fReplayDest->priv().peekSurface()); + }, desc, GrProxyProvider::Textureable(fCharacterization.isTextureable()), + GrMipMapped::kNo, SkBackingFit::kExact, SkBudgeted::kYes); sk_sp<GrSurfaceContext> c = fContext->contextPriv().makeWrappedSurfaceContext( std::move(proxy), diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp index 6641bcf9a8..8410a0a882 100644 --- a/src/gpu/GrProxyProvider.cpp +++ b/src/gpu/GrProxyProvider.cpp @@ -473,6 +473,25 @@ sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&& budgeted, flags)); } +sk_sp<GrRenderTargetProxy> GrProxyProvider::createLazyRenderTargetProxy( + LazyInstantiateCallback&& callback, + const GrSurfaceDesc& desc, + Textureable textureable, + GrMipMapped mipMapped, + SkBackingFit fit, SkBudgeted budgeted) { + SkASSERT((desc.fWidth <= 0 && desc.fHeight <= 0) || + (desc.fWidth > 0 && desc.fHeight > 0)); + uint32_t flags = GrResourceProvider::kNoPendingIO_Flag; + if (Textureable::kYes == textureable) { + return sk_sp<GrRenderTargetProxy>(new GrTextureRenderTargetProxy(std::move(callback), desc, + mipMapped, fit, budgeted, + flags)); + } + + return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(std::move(callback), desc, + fit, budgeted, flags)); +} + sk_sp<GrTextureProxy> GrProxyProvider::createFullyLazyProxy(LazyInstantiateCallback&& callback, Renderable renderable, GrPixelConfig config) { diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h index 91cd5f600f..c5191a681c 100644 --- a/src/gpu/GrProxyProvider.h +++ b/src/gpu/GrProxyProvider.h @@ -147,9 +147,14 @@ public: GrSurfaceOrigin origin, int sampleCnt); - using LazyInstantiateCallback = std::function<sk_sp<GrTexture>(GrResourceProvider*, + using LazyInstantiateCallback = std::function<sk_sp<GrSurface>(GrResourceProvider*, GrSurfaceOrigin* outOrigin)>; + enum class Textureable : bool { + kNo = false, + kYes = true + }; + enum class Renderable : bool { kNo = false, kYes = true @@ -171,6 +176,10 @@ public: sk_sp<GrTextureProxy> createFullyLazyProxy(LazyInstantiateCallback&&, Renderable, GrPixelConfig); + sk_sp<GrRenderTargetProxy> createLazyRenderTargetProxy(LazyInstantiateCallback&&, + const GrSurfaceDesc&, Textureable, + GrMipMapped, SkBackingFit, SkBudgeted); + // 'proxy' is about to be used as a texture src or drawn to. This query can be used to // determine if it is going to need a texture domain or a full clear. static bool IsFunctionallyExact(GrSurfaceProxy* proxy); diff --git a/src/gpu/GrRenderTargetProxy.cpp b/src/gpu/GrRenderTargetProxy.cpp index 841d4b18fd..59dcd73a3e 100644 --- a/src/gpu/GrRenderTargetProxy.cpp +++ b/src/gpu/GrRenderTargetProxy.cpp @@ -115,3 +115,13 @@ bool GrRenderTargetProxy::refsWrappedObjects() const { return fTarget->resourcePriv().refsWrappedObjects(); } + +#ifdef SK_DEBUG +void GrRenderTargetProxy::validateLazySurface(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()); +} +#endif diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp index 4020758259..c9cf535879 100644 --- a/src/gpu/GrSurfaceProxy.cpp +++ b/src/gpu/GrSurfaceProxy.cpp @@ -360,21 +360,20 @@ bool GrSurfaceProxyPriv::doLazyInstantiation(GrResourceProvider* resourceProvide outOrigin = &fProxy->fOrigin; } - sk_sp<GrTexture> texture = fProxy->fLazyInstantiateCallback(resourceProvider, outOrigin); - - if (!texture) { + sk_sp<GrSurface> surface = fProxy->fLazyInstantiateCallback(resourceProvider, outOrigin); + if (!surface) { fProxy->fWidth = 0; fProxy->fHeight = 0; fProxy->fOrigin = kTopLeft_GrSurfaceOrigin; return false; } - fProxy->fWidth = texture->width(); - fProxy->fHeight = texture->height(); + fProxy->fWidth = surface->width(); + fProxy->fHeight = surface->height(); - SkASSERT(texture->config() == fProxy->fConfig); - SkDEBUGCODE(fProxy->validateLazyTexture(texture.get());) - this->assign(std::move(texture)); + SkASSERT(surface->config() == fProxy->fConfig); + SkDEBUGCODE(fProxy->validateLazySurface(surface.get());) + this->assign(std::move(surface)); return true; } diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp index 54d0769a63..98c9ca0c6a 100644 --- a/src/gpu/GrTextureProxy.cpp +++ b/src/gpu/GrTextureProxy.cpp @@ -151,8 +151,12 @@ void GrTextureProxy::clearUniqueKey() { } #ifdef SK_DEBUG -void GrTextureProxy::validateLazyTexture(const GrTexture* texture) { - SkASSERT(!texture->asRenderTarget()); +void GrTextureProxy::validateLazySurface(const GrSurface* surface) { + SkASSERT(!surface->asRenderTarget()); + + // Anything that is checked here should be duplicated in GrTextureRenderTargetProxy's version + SkASSERT(surface->asTexture()); + SkASSERT(surface->asTexture()->texturePriv().mipMapped() == this->mipMapped()); } #endif diff --git a/src/gpu/GrTextureRenderTargetProxy.cpp b/src/gpu/GrTextureRenderTargetProxy.cpp index 843524c062..f1e47ec32b 100644 --- a/src/gpu/GrTextureRenderTargetProxy.cpp +++ b/src/gpu/GrTextureRenderTargetProxy.cpp @@ -9,6 +9,7 @@ #include "GrCaps.h" #include "GrTexture.h" +#include "GrTexturePriv.h" #include "GrRenderTarget.h" #include "GrSurfaceProxyPriv.h" @@ -104,10 +105,14 @@ sk_sp<GrSurface> GrTextureRenderTargetProxy::createSurface( } #ifdef SK_DEBUG -void GrTextureRenderTargetProxy::validateLazyTexture(const GrTexture* texture) { - SkASSERT(texture->asRenderTarget()); - SkASSERT(texture->asRenderTarget()->numStencilSamples() == this->numStencilSamples()); - SkASSERT(GrMipMapped::kNo == this->mipMapped()); +void GrTextureRenderTargetProxy::validateLazySurface(const GrSurface* surface) { + // Anything checked here should also be checking the GrTextureProxy version + SkASSERT(surface->asTexture()); + SkASSERT(surface->asTexture()->texturePriv().mipMapped() == this->mipMapped()); + + // Anything checked here should also be checking the GrRenderTargetProxy version + SkASSERT(surface->asRenderTarget()); + SkASSERT(surface->asRenderTarget()->numStencilSamples() == this->numStencilSamples()); } #endif diff --git a/src/gpu/GrTextureRenderTargetProxy.h b/src/gpu/GrTextureRenderTargetProxy.h index 63cc4872b6..2947dd42c7 100644 --- a/src/gpu/GrTextureRenderTargetProxy.h +++ b/src/gpu/GrTextureRenderTargetProxy.h @@ -43,7 +43,7 @@ private: size_t onUninstantiatedGpuMemorySize() const override; - SkDEBUGCODE(void validateLazyTexture(const GrTexture*) override;) + SkDEBUGCODE(void validateLazySurface(const GrSurface*) override;) }; #ifdef SK_BUILD_FOR_WIN diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index b4a0341174..1aebb1271d 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -4469,6 +4469,9 @@ GrBackendTexture GrGLGpu::createTestingOnlyBackendTexture(void* pixels, int w, i height = SkTMax(1, height / 2); } + // unbind the texture from the texture unit to avoid asserts + GL_CALL(BindTexture(info.fTarget, 0)); + return GrBackendTexture(w, h, mipMapped, info); } diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp index ff66844da7..d7c1a46c58 100644 --- a/src/image/SkSurface_Gpu.cpp +++ b/src/image/SkSurface_Gpu.cpp @@ -167,9 +167,14 @@ bool SkSurface_Gpu::onCharacterize(SkSurfaceCharacterization* data) const { size_t maxResourceBytes; ctx->getResourceCacheLimits(&maxResourceCount, &maxResourceBytes); + bool mipmapped = rtc->asTextureProxy() ? GrMipMapped::kYes == rtc->asTextureProxy()->mipMapped() + : false; + data->set(ctx->threadSafeProxy(), maxResourceCount, maxResourceBytes, rtc->origin(), rtc->width(), rtc->height(), rtc->colorSpaceInfo().config(), rtc->fsaaType(), rtc->numStencilSamples(), + SkSurfaceCharacterization::Textureable(SkToBool(rtc->asTextureProxy())), + SkSurfaceCharacterization::MipMapped(mipmapped), rtc->colorSpaceInfo().refColorSpace(), this->props()); return true; @@ -185,6 +190,21 @@ bool SkSurface_Gpu::isCompatible(const SkSurfaceCharacterization& data) const { size_t maxResourceBytes; ctx->getResourceCacheLimits(&maxResourceCount, &maxResourceBytes); + if (data.isTextureable()) { + if (!rtc->asTextureProxy()) { + // If the characterization was textureable we require the replay dest to also be + // textureable. If the characterized surface wasn't textureable we allow the replay + // dest to be textureable. + return false; + } + + if (data.isMipMapped() && GrMipMapped::kNo == rtc->asTextureProxy()->mipMapped()) { + // Fail if the DDL's surface was mipmapped but the replay surface is not. + // Allow drawing to proceed if the DDL was not mipmapped but the replay surface is. + return false; + } + } + return data.contextInfo() && data.contextInfo()->matches(ctx) && data.cacheMaxResourceCount() <= maxResourceCount && data.cacheMaxResourceBytes() <= maxResourceBytes && diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp index b3637cbfa3..468a3695e9 100644 --- a/tests/DeferredDisplayListTest.cpp +++ b/tests/DeferredDisplayListTest.cpp @@ -22,8 +22,9 @@ class SurfaceParameters { public: - static const int kNumParams = 8; + static const int kNumParams = 9; static const int kSampleCount = 5; + static const int kMipMipCount = 8; SurfaceParameters() : fWidth(64) @@ -32,7 +33,9 @@ public: , fColorType(kRGBA_8888_SkColorType) , fColorSpace(SkColorSpace::MakeSRGB()) , fSampleCount(1) - , fSurfaceProps(0x0, kUnknown_SkPixelGeometry) {} + , fSurfaceProps(0x0, kUnknown_SkPixelGeometry) + , fShouldCreateMipMaps(true) { + } int sampleCount() const { return fSampleCount; } @@ -64,7 +67,30 @@ public: fSurfaceProps = SkSurfaceProps(SkSurfaceProps::kUseDeviceIndependentFonts_Flag, kUnknown_SkPixelGeometry); break; + case 8: + fShouldCreateMipMaps = false; + break; + } + } + + // Create a DDL whose characterization captures the current settings + std::unique_ptr<SkDeferredDisplayList> createDDL(GrContext* context) const { + sk_sp<SkSurface> s = this->make(context); + if (!s) { + return nullptr; + } + + SkSurfaceCharacterization c; + SkAssertResult(s->characterize(&c)); + + SkDeferredDisplayListRecorder r(c); + SkCanvas* canvas = r.getCanvas(); + if (!canvas) { + return nullptr; } + + canvas->drawRect(SkRect::MakeXYWH(10, 10, 10, 10), SkPaint()); + return r.detach(); } // Create the surface with the current set of parameters @@ -74,7 +100,37 @@ public: kPremul_SkAlphaType, fColorSpace); return SkSurface::MakeRenderTarget(context, SkBudgeted::kYes, ii, fSampleCount, - fOrigin, &fSurfaceProps); + fOrigin, &fSurfaceProps, fShouldCreateMipMaps); + } + + // Create a surface w/ the current parameters but make it non-textureable + sk_sp<SkSurface> makeNonTextureable(GrContext* context, GrBackendTexture* backend) const { + GrGpu* gpu = context->contextPriv().getGpu(); + + GrPixelConfig config = SkImageInfo2GrPixelConfig(fColorType, nullptr, *context->caps()); + + *backend = gpu->createTestingOnlyBackendTexture(nullptr, fWidth, fHeight, + config, true, GrMipMapped::kNo); + + if (!backend->isValid() || !gpu->isTestingOnlyBackendTexture(*backend)) { + return nullptr; + } + + sk_sp<SkSurface> surface = SkSurface::MakeFromBackendTextureAsRenderTarget( + context, *backend, fOrigin, fSampleCount, fColorType, nullptr, nullptr); + + if (!surface) { + gpu->deleteTestingOnlyBackendTexture(backend); + return nullptr; + } + + return surface; + } + + void cleanUpBackEnd(GrContext* context, GrBackendTexture* backend) const { + GrGpu* gpu = context->contextPriv().getGpu(); + + gpu->deleteTestingOnlyBackendTexture(backend); } private: @@ -85,10 +141,11 @@ private: sk_sp<SkColorSpace> fColorSpace; int fSampleCount; SkSurfaceProps fSurfaceProps; + bool fShouldCreateMipMaps; }; // This tests SkSurfaceCharacterization/SkSurface compatibility -DEF_GPUTEST_FOR_ALL_CONTEXTS(SkSurfaceCharacterization, reporter, ctxInfo) { +DEF_GPUTEST_FOR_ALL_CONTEXTS(DDLSurfaceCharacterizationTest, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); // Create a bitmap that we can readback into @@ -103,23 +160,14 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(SkSurfaceCharacterization, reporter, ctxInfo) { { SurfaceParameters params; + ddl = params.createDDL(context); + + // The DDL should draw into an SkSurface created with the same parameters sk_sp<SkSurface> s = params.make(context); if (!s) { return; } - SkSurfaceCharacterization c; - SkAssertResult(s->characterize(&c)); - - SkDeferredDisplayListRecorder r(c); - SkCanvas* canvas = r.getCanvas(); - if (!canvas) { - return; - } - - canvas->drawRect(SkRect::MakeXYWH(10, 10, 10, 10), SkPaint()); - ddl = r.detach(); - REPORTER_ASSERT(reporter, s->draw(ddl.get())); s->readPixels(imageInfo, bitmap.getPixels(), bitmap.rowBytes(), 0, 0); } @@ -147,7 +195,12 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(SkSurfaceCharacterization, reporter, ctxInfo) { } } - REPORTER_ASSERT(reporter, !s->draw(ddl.get())); + if (SurfaceParameters::kMipMipCount == i && !context->caps()->mipMapSupport()) { + continue; + } + + REPORTER_ASSERT(reporter, !s->draw(ddl.get()), + "DDLSurfaceCharacterizationTest failed on parameter: %d\n", i); } // Next test the compatibility of resource cache parameters @@ -183,6 +236,19 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(SkSurfaceCharacterization, reporter, ctxInfo) { #endif } + // Test that the textureability of the DDL characterization can block a DDL draw + { + GrBackendTexture backend; + const SurfaceParameters params; + sk_sp<SkSurface> s = params.makeNonTextureable(context, &backend); + if (s) { + REPORTER_ASSERT(reporter, !s->draw(ddl.get())); + + s = nullptr; + params.cleanUpBackEnd(context, &backend); + } + } + // Make sure non-GPU-backed surfaces fail characterization { SkImageInfo ii = SkImageInfo::MakeN32(64, 64, kOpaque_SkAlphaType); diff --git a/tools/gpu/gl/debug/DebugGLTestContext.cpp b/tools/gpu/gl/debug/DebugGLTestContext.cpp index 4152997b4d..2b05693366 100644 --- a/tools/gpu/gl/debug/DebugGLTestContext.cpp +++ b/tools/gpu/gl/debug/DebugGLTestContext.cpp @@ -102,6 +102,12 @@ public: this->setTexture(texture); } + GrGLboolean isTexture(GrGLuint textureID) override { + GrTextureObj *texture = FIND(textureID, GrTextureObj, kTexture_ObjTypes); + + return texture ? GR_GL_TRUE : GR_GL_FALSE; + } + //////////////////////////////////////////////////////////////////////////////// GrGLvoid bufferData(GrGLenum target, GrGLsizeiptr size, const GrGLvoid* data, GrGLenum usage) override { |