diff options
author | robertphillips <robertphillips@google.com> | 2016-01-26 12:07:13 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-26 12:07:13 -0800 |
commit | 727b7d27afd01ab76771ba0b3279208cff728d1a (patch) | |
tree | 0c23eb272db4ad25c8a16f14ed4b70173ac882fd /src/gpu | |
parent | ed0bf1b43e192c9bcade24702e5d673d1974bf55 (diff) |
Add gpu backend for SkPixelXorXfermode
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1631873002
Review URL: https://codereview.chromium.org/1631873002
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrProcessor.cpp | 4 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLXferProcessor.cpp | 18 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLXferProcessor.h | 8 |
3 files changed, 28 insertions, 2 deletions
diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp index 1db9d76fda..20f7d7205b 100644 --- a/src/gpu/GrProcessor.cpp +++ b/src/gpu/GrProcessor.cpp @@ -48,9 +48,9 @@ GrProcessorTestFactory<GrGeometryProcessor>::GetFactories() { * we verify the count is as expected. If a new factory is added, then these numbers must be * manually adjusted. */ -static const int kFPFactoryCount = 38; +static const int kFPFactoryCount = 39; static const int kGPFactoryCount = 14; -static const int kXPFactoryCount = 5; +static const int kXPFactoryCount = 6; template<> void GrProcessorTestFactory<GrFragmentProcessor>::VerifyFactoryCount() { diff --git a/src/gpu/glsl/GrGLSLXferProcessor.cpp b/src/gpu/glsl/GrGLSLXferProcessor.cpp index 81bd015718..9d2538f081 100644 --- a/src/gpu/glsl/GrGLSLXferProcessor.cpp +++ b/src/gpu/glsl/GrGLSLXferProcessor.cpp @@ -88,3 +88,21 @@ void GrGLSLXferProcessor::setData(const GrGLSLProgramDataManager& pdm, const GrX this->onSetData(pdm, xp); } +void GrGLSLXferProcessor::DefaultCoverageModulation(GrGLSLXPFragmentBuilder* fragBuilder, + const char* srcCoverage, + const char* dstColor, + const char* outColor, + const char* outColorSecondary, + const GrXferProcessor& proc) { + if (proc.dstReadUsesMixedSamples()) { + if (srcCoverage) { + fragBuilder->codeAppendf("%s *= %s;", outColor, srcCoverage); + fragBuilder->codeAppendf("%s = %s;", outColorSecondary, srcCoverage); + } else { + fragBuilder->codeAppendf("%s = vec4(1.0);", outColorSecondary); + } + } else if (srcCoverage) { + fragBuilder->codeAppendf("%s = %s * %s + (vec4(1.0) - %s) * %s;", + outColor, srcCoverage, outColor, srcCoverage, dstColor); + } +} diff --git a/src/gpu/glsl/GrGLSLXferProcessor.h b/src/gpu/glsl/GrGLSLXferProcessor.h index ed8099b6f3..6886740584 100644 --- a/src/gpu/glsl/GrGLSLXferProcessor.h +++ b/src/gpu/glsl/GrGLSLXferProcessor.h @@ -68,6 +68,14 @@ public: */ void setData(const GrGLSLProgramDataManager& pdm, const GrXferProcessor& xp); +protected: + static void DefaultCoverageModulation(GrGLSLXPFragmentBuilder* fragBuilder, + const char* srcCoverage, + const char* dstColor, + const char* outColor, + const char* outColorSecondary, + const GrXferProcessor& proc); + private: /** * Called by emitCode() when the XP will not be performing a dst read. This method is |