diff options
author | 2017-02-10 16:16:21 -0500 | |
---|---|---|
committer | 2017-02-10 21:58:47 +0000 | |
commit | 246a3c269d8dc91a47ff27f7b71508bf9e74edf5 (patch) | |
tree | f3d43857df373f21a39e8fb5a52917ca5616279e /src | |
parent | 33064926c729ad71287252f9ae205dc64a80638f (diff) |
Re-enable ProcessorOptimizationValidationTest on iOS.
Change-Id: I05aae2e86cd7a219ab98e882bb6041263b4aca71
Reviewed-on: https://skia-review.googlesource.com/8318
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/effects/GrXfermodeFragmentProcessor.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp index 935b29406b..78918ce201 100644 --- a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp +++ b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp @@ -15,6 +15,18 @@ #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "SkGrPriv.h" +// Some of the cpu implementations of blend modes differ too much from the GPU enough that +// we can't use the cpu implementation to implement constantOutputForConstantInput. +static inline bool does_cpu_blend_impl_match_gpu(SkBlendMode mode) { + // The non-seperable modes differ too much. So does SoftLight. ColorBurn differs too much on our + // test iOS device (but we just disable it across the aboard since it may happen on untested + // GPUs). + return mode <= SkBlendMode::kLastSeparableMode && mode != SkBlendMode::kSoftLight && + mode != SkBlendMode::kColorBurn; +} + +////////////////////////////////////////////////////////////////////////////// + class ComposeTwoFragmentProcessor : public GrFragmentProcessor { public: ComposeTwoFragmentProcessor(sk_sp<GrFragmentProcessor> src, sk_sp<GrFragmentProcessor> dst, @@ -38,11 +50,8 @@ public: private: static OptimizationFlags OptFlags(const GrFragmentProcessor* src, const GrFragmentProcessor* dst, SkBlendMode mode) { - // We only attempt the constant output optimization. - // The CPU and GPU implementations differ significantly for the advanced modes and - // softlight. - if (mode <= SkBlendMode::kLastSeparableMode && mode != SkBlendMode::kSoftLight && - src->hasConstantOutputForConstantInput() && dst->hasConstantOutputForConstantInput()) { + if (does_cpu_blend_impl_match_gpu(mode) && src->hasConstantOutputForConstantInput() && + dst->hasConstantOutputForConstantInput()) { return kConstantOutputForConstantInput_OptimizationFlag; } return kNone_OptimizationFlags; @@ -197,11 +206,7 @@ public: private: OptimizationFlags OptFlags(const GrFragmentProcessor* child, SkBlendMode mode) { - // We only attempt the constant output optimization. - // The CPU and GPU implementations differ significantly for the advanced modes and - // softlight. - if (mode <= SkBlendMode::kLastSeparableMode && mode != SkBlendMode::kSoftLight && - child->hasConstantOutputForConstantInput()) { + if (does_cpu_blend_impl_match_gpu(mode) && child->hasConstantOutputForConstantInput()) { return kConstantOutputForConstantInput_OptimizationFlag; } return kNone_OptimizationFlags; |