Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Unified Diff: src/gpu/gl/GrGLShaderBuilder.cpp

Issue 354663002: Make GrGLShaderBuilder::fragmentPosition() return a vec4, with 1.0 as the zw components when in the… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: line wraps Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/effects/GrRRectEffect.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « src/gpu/effects/GrRRectEffect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698