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:
Brian Salomon 2020-02-28 10:25:47 -05:00 committed by Skia Commit-Bot
parent 2ea588fe99
commit f539130d9e

View File

@ -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(