| Index: src/gpu/gl/GrGLGpu.cpp
|
| diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
|
| index e37f8430fb870d3253e6f168465f55a8875ea4ea..e002d5101bab5a114a75f5ea8d0e219989d0a675 100644
|
| --- a/src/gpu/gl/GrGLGpu.cpp
|
| +++ b/src/gpu/gl/GrGLGpu.cpp
|
| @@ -3775,11 +3775,20 @@
|
| fshaderTxt.append(";");
|
| uTexture.appendDecl(glslCaps, &fshaderTxt);
|
| fshaderTxt.append(";");
|
| + const char* fsOutName;
|
| + if (glslCaps->mustDeclareFragmentShaderOutput()) {
|
| + oFragColor.appendDecl(glslCaps, &fshaderTxt);
|
| + fshaderTxt.append(";");
|
| + fsOutName = oFragColor.c_str();
|
| + } else {
|
| + fsOutName = "gl_FragColor";
|
| + }
|
| fshaderTxt.appendf(
|
| "// Copy Program FS\n"
|
| "void main() {"
|
| - " sk_FragColor = %s(u_texture, v_texCoord);"
|
| + " %s = %s(u_texture, v_texCoord);"
|
| "}",
|
| + fsOutName,
|
| GrGLSLTexture2DFunctionName(kVec2f_GrSLType, kSamplerTypes[progIdx], this->glslGeneration())
|
| );
|
|
|
| @@ -3912,6 +3921,14 @@
|
| }
|
| uTexture.appendDecl(glslCaps, &fshaderTxt);
|
| fshaderTxt.append(";");
|
| + const char* fsOutName;
|
| + if (glslCaps->mustDeclareFragmentShaderOutput()) {
|
| + oFragColor.appendDecl(glslCaps, &fshaderTxt);
|
| + fshaderTxt.append(";");
|
| + fsOutName = oFragColor.c_str();
|
| + } else {
|
| + fsOutName = "gl_FragColor";
|
| + }
|
| const char* sampleFunction = GrGLSLTexture2DFunctionName(kVec2f_GrSLType,
|
| kTexture2DSampler_GrSLType,
|
| this->glslGeneration());
|
| @@ -3922,19 +3939,19 @@
|
|
|
| if (oddWidth && oddHeight) {
|
| fshaderTxt.appendf(
|
| - " sk_FragColor = (%s(u_texture, v_texCoord0) + %s(u_texture, v_texCoord1) + "
|
| - " %s(u_texture, v_texCoord2) + %s(u_texture, v_texCoord3)) * 0.25;",
|
| - sampleFunction, sampleFunction, sampleFunction, sampleFunction
|
| + " %s = (%s(u_texture, v_texCoord0) + %s(u_texture, v_texCoord1) + "
|
| + " %s(u_texture, v_texCoord2) + %s(u_texture, v_texCoord3)) * 0.25;",
|
| + fsOutName, sampleFunction, sampleFunction, sampleFunction, sampleFunction
|
| );
|
| } else if (oddWidth || oddHeight) {
|
| fshaderTxt.appendf(
|
| - " sk_FragColor = (%s(u_texture, v_texCoord0) + %s(u_texture, v_texCoord1)) * 0.5;",
|
| - sampleFunction, sampleFunction
|
| + " %s = (%s(u_texture, v_texCoord0) + %s(u_texture, v_texCoord1)) * 0.5;",
|
| + fsOutName, sampleFunction, sampleFunction
|
| );
|
| } else {
|
| fshaderTxt.appendf(
|
| - " sk_FragColor = %s(u_texture, v_texCoord0);",
|
| - sampleFunction
|
| + " %s = %s(u_texture, v_texCoord0);",
|
| + fsOutName, sampleFunction
|
| );
|
| }
|
|
|
| @@ -4021,11 +4038,20 @@
|
| &fshaderTxt);
|
| uColor.appendDecl(this->glCaps().glslCaps(), &fshaderTxt);
|
| fshaderTxt.append(";");
|
| + const char* fsOutName;
|
| + if (this->glCaps().glslCaps()->mustDeclareFragmentShaderOutput()) {
|
| + oFragColor.appendDecl(this->glCaps().glslCaps(), &fshaderTxt);
|
| + fshaderTxt.append(";");
|
| + fsOutName = oFragColor.c_str();
|
| + } else {
|
| + fsOutName = "gl_FragColor";
|
| + }
|
| fshaderTxt.appendf(
|
| "// Write Rect Program FS\n"
|
| "void main() {"
|
| - " sk_FragColor = %s;"
|
| + " %s = %s;"
|
| "}",
|
| + fsOutName,
|
| uColor.c_str()
|
| );
|
|
|
|
|