Don't emit declaration of gl_FragPos unless also changing the origin.

R=jvanverth@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/182003002

git-svn-id: http://skia.googlecode.com/svn/trunk@13648 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2014-03-03 23:25:26 +00:00
parent b83ec64dde
commit 5f6ac03b00

View File

@ -404,14 +404,11 @@ const char* GrGLShaderBuilder::fragmentPosition() {
return ""; return "";
} }
} }
// We only declare "gl_FragCoord" when we're in the case where we want to use layout qualifiers
// to reverse y. Otherwise it isn't necessary and whether the "in" qualifier appears in the
// declaration varies in earlier GLSL specs. So it is simpler to omit it.
if (fTopLeftFragPosRead) { if (fTopLeftFragPosRead) {
if (!fSetupFragPosition) { fSetupFragPosition = true;
fFSInputs.push_back().set(kVec4f_GrSLType,
GrGLShaderVar::kIn_TypeModifier,
"gl_FragCoord",
GrGLShaderVar::kDefault_Precision);
fSetupFragPosition = true;
}
return "gl_FragCoord"; return "gl_FragCoord";
} else if (fGpu->glCaps().fragCoordConventionsSupport()) { } else if (fGpu->glCaps().fragCoordConventionsSupport()) {
if (!fSetupFragPosition) { if (!fSetupFragPosition) {