Remove code from GrTextureMaker that tries to make a MIP map copy.
All subclasses implement "willBeMipped" param to refOriginalTextureProxyView() Change-Id: I85a5540857255bdb6f79b536979f938d94a9591a Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273990 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
2ea588fe99
commit
f539130d9e
@ -20,51 +20,7 @@ GrSurfaceProxyView GrTextureMaker::onRefTextureProxyViewForParams(GrSamplerState
|
||||
this->height() > this->context()->priv().caps()->maxTextureSize()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
GrSurfaceProxyView original = this->refOriginalTextureProxyView(willBeMipped);
|
||||
if (!original) {
|
||||
return {};
|
||||
}
|
||||
SkASSERT(original.asTextureProxy());
|
||||
|
||||
GrTextureProxy* texProxy = original.asTextureProxy();
|
||||
if (!GrGpu::IsACopyNeededForMips(this->context()->priv().caps(), texProxy, params.filter())) {
|
||||
return original;
|
||||
}
|
||||
|
||||
GrProxyProvider* proxyProvider = this->context()->priv().proxyProvider();
|
||||
|
||||
GrSurfaceOrigin origOrigin = original.proxy() ? original.origin() : kTopLeft_GrSurfaceOrigin;
|
||||
GrUniqueKey mipMappedKey;
|
||||
this->makeMipMappedKey(&mipMappedKey);
|
||||
if (mipMappedKey.isValid()) {
|
||||
auto cachedProxy =
|
||||
proxyProvider->findOrCreateProxyByUniqueKey(mipMappedKey, this->colorType());
|
||||
if (cachedProxy) {
|
||||
SkASSERT(cachedProxy->mipMapped() == GrMipMapped::kYes);
|
||||
return GrSurfaceProxyView(std::move(cachedProxy), origOrigin, original.swizzle());
|
||||
}
|
||||
}
|
||||
|
||||
GrSurfaceProxyView result = GrCopyBaseMipMapToTextureProxy(
|
||||
this->context(), original.proxy(), original.origin(), this->colorType());
|
||||
if (!result) {
|
||||
// If we were unable to make a copy and we only needed a copy for mips, then we will return
|
||||
// the source texture here and require that the GPU backend is able to fall back to using
|
||||
// bilerp if mips are required.
|
||||
return original;
|
||||
}
|
||||
|
||||
// We believe all Makers already have tried to add MIP maps in refOriginalTextureProxyView()
|
||||
// if willBeMipped was true and therefore we should never get here.
|
||||
SkASSERT(false);
|
||||
|
||||
if (mipMappedKey.isValid()) {
|
||||
SkASSERT(result.origin() == origOrigin);
|
||||
proxyProvider->assignUniqueKeyToProxy(mipMappedKey, result.asTextureProxy());
|
||||
this->didCacheMipMappedCopy(mipMappedKey, proxyProvider->contextID());
|
||||
}
|
||||
return result;
|
||||
return this->refOriginalTextureProxyView(willBeMipped);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor> GrTextureMaker::createFragmentProcessor(
|
||||
|
Loading…
Reference in New Issue
Block a user