aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTextureAdjuster.cpp
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2018-06-08 17:22:23 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-08 23:07:25 +0000
commit8f5bbda0071e5663f454804e370e66f86b87078b (patch)
tree7214467a0ba834ae948b8f108c0ccc5b7cb2dde5 /src/gpu/GrTextureAdjuster.cpp
parent09c9400695c87be11f0ef5268e0f6efce0e62831 (diff)
Fall back to bilerp if we are undable to do a copy for mips.
Bug: skia: Change-Id: I52b86d83aaec1fa245be2ee17bbd56defcb5881f Reviewed-on: https://skia-review.googlesource.com/133587 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrTextureAdjuster.cpp')
-rw-r--r--src/gpu/GrTextureAdjuster.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/gpu/GrTextureAdjuster.cpp b/src/gpu/GrTextureAdjuster.cpp
index cb296f9ce9..05b1cf4241 100644
--- a/src/gpu/GrTextureAdjuster.cpp
+++ b/src/gpu/GrTextureAdjuster.cpp
@@ -92,15 +92,29 @@ sk_sp<GrTextureProxy> GrTextureAdjuster::onRefTextureProxyForParams(
SkASSERT(this->width() <= fContext->contextPriv().caps()->maxTextureSize() &&
this->height() <= fContext->contextPriv().caps()->maxTextureSize());
- if (!GrGpu::IsACopyNeededForTextureParams(fContext->contextPriv().caps(), proxy.get(),
- proxy->width(), proxy->height(), params, &copyParams,
- scaleAdjust)) {
- return proxy;
+ bool needsCopyForMipsOnly = false;
+ if (!params.isRepeated() ||
+ !GrGpu::IsACopyNeededForRepeatWrapMode(fContext->contextPriv().caps(), proxy.get(),
+ proxy->width(), proxy->height(), params.filter(),
+ &copyParams, scaleAdjust)) {
+ needsCopyForMipsOnly = GrGpu::IsACopyNeededForMips(fContext->contextPriv().caps(),
+ proxy.get(), params.filter(),
+ &copyParams);
+ if (!needsCopyForMipsOnly) {
+ return proxy;
+ }
}
bool willBeMipped = GrSamplerState::Filter::kMipMap == params.filter() &&
fContext->contextPriv().caps()->mipMapSupport();
- return this->refTextureProxyCopy(copyParams, willBeMipped);
+ sk_sp<GrTextureProxy> result = this->refTextureProxyCopy(copyParams, willBeMipped);
+ if (!result && needsCopyForMipsOnly) {
+ // 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 this->originalProxyRef();
+ }
+ return result;
}
std::unique_ptr<GrFragmentProcessor> GrTextureAdjuster::createFragmentProcessor(