Revert "Revert "Start of rewrite of GrFragmentProcessor optimizations.""
This reverts commit 052fd5158f7f85e478a9f87c45fecaacf7d0f5f3.
Disables the test (of unused code) until platform-specific issues are addressed.
Change-Id: I7aa23a07954fccf382aa07d28afcbffb0bebcd6d
Reviewed-on: https://skia-review.googlesource.com/7656
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index 095f100..7ab598f 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -208,14 +208,25 @@
}
}
+inline GrFragmentProcessor::OptimizationFlags GrTextureDomainEffect::OptFlags(
+ GrTexture* texture, GrTextureDomain::Mode mode) {
+ if (mode == GrTextureDomain::kDecal_Mode || !GrPixelConfigIsOpaque(texture->config())) {
+ return GrFragmentProcessor::kModulatesInput_OptimizationFlag;
+ } else {
+ return GrFragmentProcessor::kModulatesInput_OptimizationFlag |
+ GrFragmentProcessor::kPreservesOpaqueInput_OptimizationFlag;
+ }
+}
+
GrTextureDomainEffect::GrTextureDomainEffect(GrTexture* texture,
sk_sp<GrColorSpaceXform> colorSpaceXform,
const SkMatrix& matrix,
const SkRect& domain,
GrTextureDomain::Mode mode,
GrSamplerParams::FilterMode filterMode)
- : GrSingleTextureEffect(texture, std::move(colorSpaceXform), matrix, filterMode)
- , fTextureDomain(texture, domain, mode) {
+ : GrSingleTextureEffect(texture, std::move(colorSpaceXform), matrix, filterMode,
+ OptFlags(texture, mode))
+ , fTextureDomain(texture, domain, mode) {
SkASSERT(mode != GrTextureDomain::kRepeat_Mode ||
filterMode == GrSamplerParams::kNone_FilterMode);
this->initClassID<GrTextureDomainEffect>();
@@ -323,7 +334,8 @@
GrDeviceSpaceTextureDecalFragmentProcessor::GrDeviceSpaceTextureDecalFragmentProcessor(
GrTexture* texture, const SkIRect& subset, const SkIPoint& deviceSpaceOffset)
- : fTextureSampler(texture, GrSamplerParams::ClampNoFilter())
+ : INHERITED(kModulatesInput_OptimizationFlag)
+ , fTextureSampler(texture, GrSamplerParams::ClampNoFilter())
, fTextureDomain(texture, GrTextureDomain::MakeTexelDomain(subset),
GrTextureDomain::kDecal_Mode) {
this->addTextureSampler(&fTextureSampler);