Index: src/gpu/gl/GrGLShaderBuilder.cpp |
diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp |
index c2ebce2a912ae984ad5a7c54b74057c30715de1e..764d482389a122415d10f340b0404bd7e39d3947 100644 |
--- a/src/gpu/gl/GrGLShaderBuilder.cpp |
+++ b/src/gpu/gl/GrGLShaderBuilder.cpp |
@@ -499,7 +499,7 @@ const char* GrGLShaderBuilder::fragmentPosition() { |
// declaration varies in earlier GLSL specs. So it is simpler to omit it. |
if (fTopLeftFragPosRead) { |
fSetupFragPosition = true; |
- return "(gl_FragCoord.xy)"; |
+ return "gl_FragCoord"; |
} else if (fGpu->glCaps().fragCoordConventionsSupport()) { |
if (!fSetupFragPosition) { |
SkAssertResult(this->enablePrivateFeature(kFragCoordConventions_GLSLPrivateFeature)); |
@@ -510,7 +510,7 @@ const char* GrGLShaderBuilder::fragmentPosition() { |
GrGLShaderVar::kUpperLeft_Origin); |
fSetupFragPosition = true; |
} |
- return "(gl_FragCoord.xy)"; |
+ return "gl_FragCoord"; |
} else { |
static const char* kCoordName = "fragCoordYDown"; |
if (!fSetupFragPosition) { |
@@ -523,8 +523,11 @@ const char* GrGLShaderBuilder::fragmentPosition() { |
fOutput.fUniformHandles.fRTHeightUni = |
this->addUniform(kFragment_Visibility, kFloat_GrSLType, "RTHeight", &rtHeightName); |
- this->fFSCode.prependf("\tvec2 %s = vec2(gl_FragCoord.x, %s - gl_FragCoord.y);\n", |
- kCoordName, rtHeightName); |
+ // Using glFragCoord.zw for the last two components tickles an Adreno driver bug that |
+ // causes programs to fail to link. Making this function return a vec2() didn't fix the |
+ // problem but using 1.0 for the last two components does. |
+ this->fFSCode.prependf("\tvec4 %s = vec4(gl_FragCoord.x, %s - gl_FragCoord.y, 1.0, " |
+ "1.0);\n", kCoordName, rtHeightName); |
fSetupFragPosition = true; |
} |
SkASSERT(fOutput.fUniformHandles.fRTHeightUni.isValid()); |