Add return value to doLazyInstantiation to know if it succeedes.
This allows us to return nullptr in places where we try to instantiate immediately and it fails. Bug: skia: Change-Id: Ic3da26b0e6270b3de114d80533f0580b4d6bf0e7 Reviewed-on: https://skia-review.googlesource.com/99381 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
5373aa2a66
commit
bddcc95383
@ -367,7 +367,9 @@ sk_sp<GrTextureProxy> GrProxyProvider::createWrappedTextureProxy(
|
||||
if (fResourceProvider) {
|
||||
// In order to reuse code we always create a lazy proxy. When we aren't in DDL mode however,
|
||||
// we're better off instantiating the proxy immediately here.
|
||||
proxy->priv().doLazyInstantiation(fResourceProvider);
|
||||
if (!proxy->priv().doLazyInstantiation(fResourceProvider)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return proxy;
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ void GrSurfaceProxyPriv::exactify() {
|
||||
// exact amount.
|
||||
}
|
||||
|
||||
void GrSurfaceProxyPriv::doLazyInstantiation(GrResourceProvider* resourceProvider) {
|
||||
bool GrSurfaceProxyPriv::doLazyInstantiation(GrResourceProvider* resourceProvider) {
|
||||
SkASSERT(fProxy->fLazyInstantiateCallback);
|
||||
SkASSERT(!fProxy->fTarget);
|
||||
|
||||
@ -372,7 +372,7 @@ void GrSurfaceProxyPriv::doLazyInstantiation(GrResourceProvider* resourceProvide
|
||||
fProxy->fWidth = 0;
|
||||
fProxy->fHeight = 0;
|
||||
fProxy->fOrigin = kTopLeft_GrSurfaceOrigin;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
fProxy->fWidth = texture->width();
|
||||
@ -381,5 +381,6 @@ void GrSurfaceProxyPriv::doLazyInstantiation(GrResourceProvider* resourceProvide
|
||||
SkASSERT(texture->config() == fProxy->fConfig);
|
||||
SkDEBUGCODE(fProxy->validateLazyTexture(texture.get());)
|
||||
this->assign(std::move(texture));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
// Don't. Just don't.
|
||||
void exactify();
|
||||
|
||||
void doLazyInstantiation(GrResourceProvider*);
|
||||
bool doLazyInstantiation(GrResourceProvider*);
|
||||
|
||||
static bool AttachStencilIfNeeded(GrResourceProvider*, GrSurface*, bool needsStencil);
|
||||
|
||||
|
@ -164,6 +164,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter,
|
||||
}
|
||||
|
||||
REPORTER_ASSERT(reporter, genProxy->priv().isInstantiated());
|
||||
if (!genProxy->priv().isInstantiated()) {
|
||||
gpu->deleteTestingOnlyBackendTexture(&backendTex);
|
||||
return;
|
||||
}
|
||||
|
||||
GrTexture* genTexture = genProxy->priv().peekTexture();
|
||||
REPORTER_ASSERT(reporter, genTexture);
|
||||
|
Loading…
Reference in New Issue
Block a user