Switch GrTextureStripAtlas over to GrTextureProxies
This is split out of: https://skia-review.googlesource.com/c/8823/ (Remove GrFragmentProcessor-derived class' GrTexture-based ctors)
Change-Id: I9f602985b6010fc58b595e2be6d4e67e50179747
Reviewed-on: https://skia-review.googlesource.com/8881
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp
index 663527e..8214d2c 100644
--- a/src/gpu/GrProcessor.cpp
+++ b/src/gpu/GrProcessor.cpp
@@ -211,9 +211,7 @@
GrProcessor::TextureSampler::TextureSampler(GrTextureProvider* texProvider,
sk_sp<GrTextureProxy> proxy,
const GrSamplerParams& params) {
- // For now, end the deferral at this time. Once all the TextureSamplers are swapped over
- // to taking a GrSurfaceProxy just use the IORefs on the proxy
- this->reset(proxy->instantiate(texProvider), params);
+ this->reset(texProvider, std::move(proxy), params);
}
GrProcessor::TextureSampler::TextureSampler(GrTextureProvider* texProvider,
@@ -221,9 +219,7 @@
GrSamplerParams::FilterMode filterMode,
SkShader::TileMode tileXAndY,
GrShaderFlags visibility) {
- // For now, end the deferral at this time. Once all the TextureSamplers are swapped over
- // to taking a GrSurfaceProxy just use the IORefs on the proxy
- this->reset(proxy->instantiate(texProvider), filterMode, tileXAndY, visibility);
+ this->reset(texProvider, std::move(proxy), filterMode, tileXAndY, visibility);
}
void GrProcessor::TextureSampler::reset(GrTexture* texture,
@@ -247,6 +243,35 @@
fVisibility = visibility;
}
+void GrProcessor::TextureSampler::reset(GrTextureProvider* texProvider,
+ sk_sp<GrTextureProxy> proxy,
+ const GrSamplerParams& params,
+ GrShaderFlags visibility) {
+ // For now, end the deferral at this time. Once all the TextureSamplers are swapped over
+ // to taking a GrSurfaceProxy just use the IORefs on the proxy
+ GrTexture* texture = proxy->instantiate(texProvider);
+ SkASSERT(texture);
+ fTexture.set(SkRef(texture), kRead_GrIOType);
+ fParams = params;
+ fParams.setFilterMode(SkTMin(params.filterMode(), texture->texturePriv().highestFilterMode()));
+ fVisibility = visibility;
+}
+
+void GrProcessor::TextureSampler::reset(GrTextureProvider* texProvider,
+ sk_sp<GrTextureProxy> proxy,
+ GrSamplerParams::FilterMode filterMode,
+ SkShader::TileMode tileXAndY,
+ GrShaderFlags visibility) {
+ // For now, end the deferral at this time. Once all the TextureSamplers are swapped over
+ // to taking a GrSurfaceProxy just use the IORefs on the proxy
+ GrTexture* texture = proxy->instantiate(texProvider);
+ SkASSERT(texture);
+ fTexture.set(SkRef(texture), kRead_GrIOType);
+ filterMode = SkTMin(filterMode, texture->texturePriv().highestFilterMode());
+ fParams.reset(tileXAndY, filterMode);
+ fVisibility = visibility;
+}
+
///////////////////////////////////////////////////////////////////////////////////////////////////
GrProcessor::ImageStorageAccess::ImageStorageAccess(sk_sp<GrTexture> texture, GrIOType ioType,