Index: src/gpu/glsl/GrGLSLXferProcessor.cpp |
diff --git a/src/gpu/glsl/GrGLSLXferProcessor.cpp b/src/gpu/glsl/GrGLSLXferProcessor.cpp |
index f0f5efd37ba2f174318a81cd7d0130328ccfd488..0f7a3db718fa44e3c2b0c1d52b49a92e49e01bc2 100644 |
--- a/src/gpu/glsl/GrGLSLXferProcessor.cpp |
+++ b/src/gpu/glsl/GrGLSLXferProcessor.cpp |
@@ -22,6 +22,8 @@ void GrGLSLXferProcessor::emitCode(const EmitArgs& args) { |
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; |
const char* dstColor = fragBuilder->dstColor(); |
+ bool needsLocalOutColor = false; |
+ |
if (args.fXP.getDstTexture()) { |
bool topDown = kTopLeft_GrSurfaceOrigin == args.fXP.getDstTexture()->origin(); |
@@ -59,6 +61,15 @@ void GrGLSLXferProcessor::emitCode(const EmitArgs& args) { |
fragBuilder->codeAppendf("vec4 %s = ", dstColor); |
fragBuilder->appendTextureLookup(args.fTexSamplers[0], "_dstTexCoord", kVec2f_GrSLType); |
fragBuilder->codeAppend(";"); |
+ } else { |
+ needsLocalOutColor = args.fGLSLCaps->requiresLocalOutputColorForFBFetch(); |
+ } |
+ |
+ const char* outColor = "_localColorOut"; |
+ if (!needsLocalOutColor) { |
+ outColor = args.fOutputPrimary; |
+ } else { |
+ fragBuilder->codeAppendf("vec4 %s;", outColor); |
} |
this->emitBlendCodeForDstRead(fragBuilder, |
@@ -66,9 +77,12 @@ void GrGLSLXferProcessor::emitCode(const EmitArgs& args) { |
args.fInputColor, |
args.fInputCoverage, |
dstColor, |
- args.fOutputPrimary, |
+ outColor, |
args.fOutputSecondary, |
args.fXP); |
+ if (needsLocalOutColor) { |
+ fragBuilder->codeAppendf("%s = %s;", args.fOutputPrimary, outColor); |
+ } |
} |
void GrGLSLXferProcessor::setData(const GrGLSLProgramDataManager& pdm, const GrXferProcessor& xp) { |