From 706f66831a575bdc2b1ab1331b48b793cd487356 Mon Sep 17 00:00:00 2001 From: "bsalomon@google.com" Date: Tue, 23 Oct 2012 14:53:55 +0000 Subject: [PATCH] Reland r6330 thru r6333 but do without enabling GL_ARB_fragment_coord_conventions on Intel GPUs. git-svn-id: http://skia.googlecode.com/svn/trunk@6048 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/effects/SkColorMatrixFilter.cpp | 4 +- src/effects/SkLightingImageFilter.cpp | 89 +++++++------------ src/effects/SkMagnifierImageFilter.cpp | 8 +- .../SkMatrixConvolutionImageFilter.cpp | 9 +- src/effects/SkMorphologyImageFilter.cpp | 10 +-- src/effects/SkTableColorFilter.cpp | 5 +- src/effects/gradients/SkGradientShader.cpp | 5 +- src/effects/gradients/SkGradientShaderPriv.h | 5 +- .../gradients/SkTwoPointConicalGradient.cpp | 12 +-- .../gradients/SkTwoPointRadialGradient.cpp | 13 +-- src/gpu/GrAAHairLinePathRenderer.cpp | 15 +--- src/gpu/GrContext.cpp | 4 +- src/gpu/effects/GrConvolutionEffect.cpp | 10 +-- src/gpu/effects/GrTextureDomainEffect.cpp | 10 +-- src/gpu/gl/GrGLCaps.cpp | 10 +++ src/gpu/gl/GrGLCaps.h | 4 + src/gpu/gl/GrGLProgram.cpp | 83 +++++++++-------- src/gpu/gl/GrGLProgram.h | 7 +- src/gpu/gl/GrGLProgramStage.cpp | 5 +- src/gpu/gl/GrGLProgramStage.h | 5 +- src/gpu/gl/GrGLShaderBuilder.cpp | 39 +++++++- src/gpu/gl/GrGLShaderBuilder.h | 22 +++-- 22 files changed, 174 insertions(+), 200 deletions(-) diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp index f054f72d3..feb2d623f 100644 --- a/src/effects/SkColorMatrixFilter.cpp +++ b/src/effects/SkColorMatrixFilter.cpp @@ -383,9 +383,7 @@ public: } virtual void setData(const GrGLUniformManager& uniManager, - const GrCustomStage& stage, - const GrRenderTarget*, - int /* stageNum */) SK_OVERRIDE { + const GrCustomStage& stage) SK_OVERRIDE { const ColorMatrixEffect& cme = static_cast(stage); const float* m = cme.fMatrix.fMat; // The GL matrix is transposed from SkColorMatrix. diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index ddb31936c..07acde3f3 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -42,14 +42,7 @@ void setUniformPoint3(const GrGLUniformManager& uman, UniformHandle uni, const S } void setUniformNormal3(const GrGLUniformManager& uman, UniformHandle uni, const SkPoint3& point) { - setUniformPoint3(uman, uni, SkPoint3(point.fX, -point.fY, point.fZ)); -} - -void setUniformPoint3FlipY(const GrGLUniformManager& uman, - UniformHandle uni, - const SkPoint3& point, - int height) { - setUniformPoint3(uman, uni, SkPoint3(point.fX, height-point.fY, point.fZ)); + setUniformPoint3(uman, uni, SkPoint3(point.fX, point.fY, point.fZ)); } #endif @@ -376,12 +369,12 @@ public: virtual void setupVariables(GrGLShaderBuilder* builder); virtual void emitVS(SkString* out) const {} virtual void emitFuncs(GrGLShaderBuilder* builder) {} - virtual void emitSurfaceToLight(const GrGLShaderBuilder*, + virtual void emitSurfaceToLight(GrGLShaderBuilder*, SkString* out, const char* z) const = 0; virtual void emitLightColor(GrGLShaderBuilder*, const char *surfaceToLight) const; - virtual void setData(const GrGLUniformManager&, const GrRenderTarget* rt, const SkLight* light) const; + virtual void setData(const GrGLUniformManager&, const SkLight* light) const; private: typedef SkRefCnt INHERITED; @@ -396,8 +389,8 @@ class GrGLDistantLight : public GrGLLight { public: virtual ~GrGLDistantLight() {} virtual void setupVariables(GrGLShaderBuilder* builder) SK_OVERRIDE; - virtual void setData(const GrGLUniformManager&, const GrRenderTarget* rt, const SkLight* light) const SK_OVERRIDE; - virtual void emitSurfaceToLight(const GrGLShaderBuilder*, + virtual void setData(const GrGLUniformManager&, const SkLight* light) const SK_OVERRIDE; + virtual void emitSurfaceToLight(GrGLShaderBuilder*, SkString* out, const char* z) const SK_OVERRIDE; private: @@ -411,9 +404,9 @@ class GrGLPointLight : public GrGLLight { public: virtual ~GrGLPointLight() {} virtual void setupVariables(GrGLShaderBuilder* builder) SK_OVERRIDE; - virtual void setData(const GrGLUniformManager&, const GrRenderTarget* rt, const SkLight* light) const SK_OVERRIDE; + virtual void setData(const GrGLUniformManager&, const SkLight* light) const SK_OVERRIDE; virtual void emitVS(SkString* out) const SK_OVERRIDE; - virtual void emitSurfaceToLight(const GrGLShaderBuilder*, + virtual void emitSurfaceToLight(GrGLShaderBuilder*, SkString* out, const char* z) const SK_OVERRIDE; private: @@ -428,10 +421,10 @@ class GrGLSpotLight : public GrGLLight { public: virtual ~GrGLSpotLight() {} virtual void setupVariables(GrGLShaderBuilder* builder) SK_OVERRIDE; - virtual void setData(const GrGLUniformManager&, const GrRenderTarget* rt, const SkLight* light) const SK_OVERRIDE; + virtual void setData(const GrGLUniformManager&, const SkLight* light) const SK_OVERRIDE; virtual void emitVS(SkString* out) const SK_OVERRIDE; virtual void emitFuncs(GrGLShaderBuilder* builder); - virtual void emitSurfaceToLight(const GrGLShaderBuilder* builder, + virtual void emitSurfaceToLight(GrGLShaderBuilder* builder, SkString* out, const char* z) const SK_OVERRIDE; virtual void emitLightColor(GrGLShaderBuilder*, @@ -964,10 +957,7 @@ public: static inline StageKey GenKey(const GrCustomStage& s, const GrGLCaps& caps); - virtual void setData(const GrGLUniformManager&, - const GrCustomStage&, - const GrRenderTarget*, - int stageNum) SK_OVERRIDE; + virtual void setData(const GrGLUniformManager&, const GrCustomStage&) SK_OVERRIDE; private: typedef GrGLProgramStage INHERITED; @@ -985,10 +975,7 @@ public: const GrCustomStage& stage); virtual void setupVariables(GrGLShaderBuilder* builder) SK_OVERRIDE; virtual void emitLightFunc(GrGLShaderBuilder*, SkString* funcName) SK_OVERRIDE; - virtual void setData(const GrGLUniformManager&, - const GrCustomStage&, - const GrRenderTarget*, - int stageNum) SK_OVERRIDE; + virtual void setData(const GrGLUniformManager&, const GrCustomStage&) SK_OVERRIDE; private: typedef GrGLLightingEffect INHERITED; @@ -1004,10 +991,7 @@ public: const GrCustomStage& stage); virtual void setupVariables(GrGLShaderBuilder* builder) SK_OVERRIDE; virtual void emitLightFunc(GrGLShaderBuilder*, SkString* funcName) SK_OVERRIDE; - virtual void setData(const GrGLUniformManager&, - const GrCustomStage&, - const GrRenderTarget*, - int stageNum) SK_OVERRIDE; + virtual void setData(const GrGLUniformManager&, const GrCustomStage&) SK_OVERRIDE; private: typedef GrGLLightingEffect INHERITED; @@ -1133,7 +1117,7 @@ void GrGLLightingEffect::emitFS(GrGLShaderBuilder* builder, "pointToNormal", SK_ARRAY_COUNT(gPointToNormalArgs), gPointToNormalArgs, - "\treturn normalize(vec3(-x * scale, -y * scale, 1));\n", + "\treturn normalize(vec3(-x * scale, y * scale, 1));\n", &pointToNormalName); static const GrGLShaderVar gInteriorNormalArgs[] = { @@ -1189,17 +1173,14 @@ GrGLProgramStage::StageKey GrGLLightingEffect::GenKey(const GrCustomStage& s, return static_cast(s).light()->type(); } -void GrGLLightingEffect::setData(const GrGLUniformManager& uman, - const GrCustomStage& data, - const GrRenderTarget* rt, - int stageNum) { +void GrGLLightingEffect::setData(const GrGLUniformManager& uman, const GrCustomStage& data) { const GrLightingEffect& effect = static_cast(data); GrGLTexture* texture = static_cast(data.texture(0)); float ySign = texture->orientation() == GrGLTexture::kTopDown_Orientation ? -1.0f : 1.0f; uman.set2f(fImageIncrementUni, 1.0f / texture->width(), ySign / texture->height()); uman.set1f(fSurfaceScaleUni, effect.surfaceScale()); - fLight->setData(uman, rt, effect.light()); + fLight->setData(uman, effect.light()); } /////////////////////////////////////////////////////////////////////////////// @@ -1236,11 +1217,8 @@ void GrGLDiffuseLightingEffect::emitLightFunc(GrGLShaderBuilder* builder, SkStri funcName); } -void GrGLDiffuseLightingEffect::setData(const GrGLUniformManager& uman, - const GrCustomStage& data, - const GrRenderTarget* rt, - int stageNum) { - INHERITED::setData(uman, data, rt, stageNum); +void GrGLDiffuseLightingEffect::setData(const GrGLUniformManager& uman, const GrCustomStage& data) { + INHERITED::setData(uman, data); const GrDiffuseLightingEffect& effect = static_cast(data); uman.set1f(fKDUni, effect.kd()); @@ -1319,10 +1297,8 @@ void GrGLSpecularLightingEffect::emitLightFunc(GrGLShaderBuilder* builder, SkStr } void GrGLSpecularLightingEffect::setData(const GrGLUniformManager& uman, - const GrCustomStage& data, - const GrRenderTarget* rt, - int stageNum) { - INHERITED::setData(uman, data, rt, stageNum); + const GrCustomStage& data) { + INHERITED::setData(uman, data); const GrSpecularLightingEffect& effect = static_cast(data); uman.set1f(fKSUni, effect.ks()); uman.set1f(fShininessUni, effect.shininess()); @@ -1342,7 +1318,6 @@ void GrGLLight::setupVariables(GrGLShaderBuilder* builder) { } void GrGLLight::setData(const GrGLUniformManager& uman, - const GrRenderTarget* rt, const SkLight* light) const { setUniformPoint3(uman, fColorUni, light->color() * SkScalarInvert(SkIntToScalar(255))); } @@ -1355,16 +1330,14 @@ void GrGLDistantLight::setupVariables(GrGLShaderBuilder* builder) { "LightDirection"); } -void GrGLDistantLight::setData(const GrGLUniformManager& uman, - const GrRenderTarget* rt, - const SkLight* light) const { - INHERITED::setData(uman, rt, light); +void GrGLDistantLight::setData(const GrGLUniformManager& uman, const SkLight* light) const { + INHERITED::setData(uman, light); SkASSERT(light->type() == SkLight::kDistant_LightType); const SkDistantLight* distantLight = static_cast(light); setUniformNormal3(uman, fDirectionUni, distantLight->direction()); } -void GrGLDistantLight::emitSurfaceToLight(const GrGLShaderBuilder* builder, +void GrGLDistantLight::emitSurfaceToLight(GrGLShaderBuilder* builder, SkString* out, const char* z) const { const char* dir = builder->getUniformCStr(fDirectionUni); @@ -1380,22 +1353,21 @@ void GrGLPointLight::setupVariables(GrGLShaderBuilder* builder) { } void GrGLPointLight::setData(const GrGLUniformManager& uman, - const GrRenderTarget* rt, const SkLight* light) const { - INHERITED::setData(uman, rt, light); + INHERITED::setData(uman, light); SkASSERT(light->type() == SkLight::kPoint_LightType); const SkPointLight* pointLight = static_cast(light); - setUniformPoint3FlipY(uman, fLocationUni, pointLight->location(), rt->height()); + setUniformPoint3(uman, fLocationUni, pointLight->location()); } void GrGLPointLight::emitVS(SkString* out) const { } -void GrGLPointLight::emitSurfaceToLight(const GrGLShaderBuilder* builder, +void GrGLPointLight::emitSurfaceToLight(GrGLShaderBuilder* builder, SkString* out, const char* z) const { const char* loc = builder->getUniformCStr(fLocationUni); - out->appendf("normalize(%s - vec3(gl_FragCoord.xy, %s))", loc, z); + out->appendf("normalize(%s - vec3(%s.xy, %s))", loc, builder->fragmentPosition(), z); } /////////////////////////////////////////////////////////////////////////////// @@ -1417,12 +1389,11 @@ void GrGLSpotLight::setupVariables(GrGLShaderBuilder* builder) { } void GrGLSpotLight::setData(const GrGLUniformManager& uman, - const GrRenderTarget* rt, const SkLight* light) const { - INHERITED::setData(uman, rt, light); + INHERITED::setData(uman, light); SkASSERT(light->type() == SkLight::kSpot_LightType); const SkSpotLight* spotLight = static_cast(light); - setUniformPoint3FlipY(uman, fLocationUni, spotLight->location(), rt->height()); + setUniformPoint3(uman, fLocationUni, spotLight->location()); uman.set1f(fExponentUni, spotLight->specularExponent()); uman.set1f(fCosInnerConeAngleUni, spotLight->cosInnerConeAngle()); uman.set1f(fCosOuterConeAngleUni, spotLight->cosOuterConeAngle()); @@ -1463,11 +1434,11 @@ void GrGLSpotLight::emitFuncs(GrGLShaderBuilder* builder) { &fLightColorFunc); } -void GrGLSpotLight::emitSurfaceToLight(const GrGLShaderBuilder* builder, +void GrGLSpotLight::emitSurfaceToLight(GrGLShaderBuilder* builder, SkString* out, const char* z) const { const char* location= builder->getUniformCStr(fLocationUni); - out->appendf("normalize(%s - vec3(gl_FragCoord.xy, %s))", location, z); + out->appendf("normalize(%s - vec3(%s.xy, %s))", location, builder->fragmentPosition(), z); } void GrGLSpotLight::emitLightColor(GrGLShaderBuilder* builder, diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp index 9871fc0d2..3b7f9e3ac 100644 --- a/src/effects/SkMagnifierImageFilter.cpp +++ b/src/effects/SkMagnifierImageFilter.cpp @@ -86,9 +86,7 @@ public: const TextureSamplerArray&) SK_OVERRIDE; virtual void setData(const GrGLUniformManager& uman, - const GrCustomStage& data, - const GrRenderTarget*, - int stageNum) SK_OVERRIDE; + const GrCustomStage& data) SK_OVERRIDE; static inline StageKey GenKey(const GrCustomStage&, const GrGLCaps&); @@ -167,9 +165,7 @@ void GrGLMagnifierEffect::emitFS(GrGLShaderBuilder* state, } void GrGLMagnifierEffect::setData(const GrGLUniformManager& uman, - const GrCustomStage& data, - const GrRenderTarget*, - int stageNum) { + const GrCustomStage& data) { const GrMagnifierEffect& zoom = static_cast(data); diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp index 234a74ac0..e6067ea96 100644 --- a/src/effects/SkMatrixConvolutionImageFilter.cpp +++ b/src/effects/SkMatrixConvolutionImageFilter.cpp @@ -293,10 +293,7 @@ public: static inline StageKey GenKey(const GrCustomStage& s, const GrGLCaps& caps); - virtual void setData(const GrGLUniformManager&, - const GrCustomStage&, - const GrRenderTarget*, - int stageNum) SK_OVERRIDE; + virtual void setData(const GrGLUniformManager&, const GrCustomStage&) SK_OVERRIDE; private: typedef GrGLUniformManager::UniformHandle UniformHandle; @@ -426,9 +423,7 @@ GrGLProgramStage::StageKey GrGLMatrixConvolutionEffect::GenKey(const GrCustomSta } void GrGLMatrixConvolutionEffect::setData(const GrGLUniformManager& uman, - const GrCustomStage& data, - const GrRenderTarget*, - int stageNum) { + const GrCustomStage& data) { const GrMatrixConvolutionEffect& effect = static_cast(data); GrGLTexture& texture = diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index 9bddb9b9e..3c2c28450 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -281,10 +281,7 @@ public: static inline StageKey GenKey(const GrCustomStage& s, const GrGLCaps& caps); - virtual void setData(const GrGLUniformManager&, - const GrCustomStage&, - const GrRenderTarget*, - int stageNum) SK_OVERRIDE; + virtual void setData(const GrGLUniformManager&, const GrCustomStage&) SK_OVERRIDE; private: int width() const { return GrMorphologyEffect::WidthFromRadius(fRadius); } @@ -352,10 +349,7 @@ GrGLProgramStage::StageKey GrGLMorphologyEffect::GenKey(const GrCustomStage& s, return key; } -void GrGLMorphologyEffect::setData(const GrGLUniformManager& uman, - const GrCustomStage& data, - const GrRenderTarget*, - int stageNum) { +void GrGLMorphologyEffect::setData(const GrGLUniformManager& uman, const GrCustomStage& data) { const Gr1DKernelEffect& kern = static_cast(data); GrGLTexture& texture = diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp index 83049f29c..6066e684f 100644 --- a/src/effects/SkTableColorFilter.cpp +++ b/src/effects/SkTableColorFilter.cpp @@ -257,10 +257,7 @@ public: const char* inputColor, const TextureSamplerArray&) SK_OVERRIDE; - virtual void setData(const GrGLUniformManager&, - const GrCustomStage&, - const GrRenderTarget*, - int stageNum) SK_OVERRIDE {} + virtual void setData(const GrGLUniformManager&, const GrCustomStage&) SK_OVERRIDE {} static StageKey GenKey(const GrCustomStage&, const GrGLCaps&); diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp index cc7e13ccb..443eec6fb 100644 --- a/src/effects/gradients/SkGradientShader.cpp +++ b/src/effects/gradients/SkGradientShader.cpp @@ -687,10 +687,7 @@ void GrGLGradientStage::setupVariables(GrGLShaderBuilder* builder) { kFloat_GrSLType, "GradientYCoordFS"); } -void GrGLGradientStage::setData(const GrGLUniformManager& uman, - const GrCustomStage& stage, - const GrRenderTarget*, - int stageNum) { +void GrGLGradientStage::setData(const GrGLUniformManager& uman, const GrCustomStage& stage) { GrScalar yCoord = static_cast(stage).getYCoord(); if (yCoord != fCachedYCoord) { uman.set1f(fFSYUni, yCoord); diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h index 61b9c3577..8c0bae9c9 100644 --- a/src/effects/gradients/SkGradientShaderPriv.h +++ b/src/effects/gradients/SkGradientShaderPriv.h @@ -278,10 +278,7 @@ public: virtual ~GrGLGradientStage(); virtual void setupVariables(GrGLShaderBuilder* builder) SK_OVERRIDE; - virtual void setData(const GrGLUniformManager&, - const GrCustomStage&, - const GrRenderTarget*, - int stageNum) SK_OVERRIDE; + virtual void setData(const GrGLUniformManager&, const GrCustomStage&) SK_OVERRIDE; // emit code that gets a fragment's color from an expression for t; for now // this always uses the texture, but for simpler cases we'll be able to lerp diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp index 19b1228c8..b78b3febc 100644 --- a/src/effects/gradients/SkTwoPointConicalGradient.cpp +++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp @@ -333,10 +333,7 @@ public: const char* outputColor, const char* inputColor, const TextureSamplerArray&) SK_OVERRIDE; - virtual void setData(const GrGLUniformManager&, - const GrCustomStage&, - const GrRenderTarget*, - int stageNum) SK_OVERRIDE; + virtual void setData(const GrGLUniformManager&, const GrCustomStage&) SK_OVERRIDE; static StageKey GenKey(const GrCustomStage& s, const GrGLCaps& caps); @@ -629,11 +626,8 @@ void GrGLConical2Gradient::emitFS(GrGLShaderBuilder* builder, } } -void GrGLConical2Gradient::setData(const GrGLUniformManager& uman, - const GrCustomStage& baseData, - const GrRenderTarget* target, - int stageNum) { - INHERITED::setData(uman, baseData, target, stageNum); +void GrGLConical2Gradient::setData(const GrGLUniformManager& uman, const GrCustomStage& baseData) { + INHERITED::setData(uman, baseData); const GrConical2Gradient& data = static_cast(baseData); GrAssert(data.isDegenerate() == fIsDegenerate); diff --git a/src/effects/gradients/SkTwoPointRadialGradient.cpp b/src/effects/gradients/SkTwoPointRadialGradient.cpp index 3476c398c..00578aadb 100644 --- a/src/effects/gradients/SkTwoPointRadialGradient.cpp +++ b/src/effects/gradients/SkTwoPointRadialGradient.cpp @@ -368,10 +368,7 @@ public: const char* outputColor, const char* inputColor, const TextureSamplerArray&) SK_OVERRIDE; - virtual void setData(const GrGLUniformManager&, - const GrCustomStage&, - const GrRenderTarget*, - int stageNum) SK_OVERRIDE; + virtual void setData(const GrGLUniformManager&, const GrCustomStage&) SK_OVERRIDE; static StageKey GenKey(const GrCustomStage& s, const GrGLCaps& caps); @@ -566,7 +563,6 @@ void GrGLRadial2Gradient::emitFS(GrGLShaderBuilder* builder, bVar = fFSVaryingName; } else { bVar = "b"; - //bVar.appendS32(stageNum); code->appendf("\tfloat %s = 2.0 * (%s * %s.x - %s);\n", bVar.c_str(), p2.c_str(), builder->defaultTexCoordsName(), p3.c_str()); @@ -605,11 +601,8 @@ void GrGLRadial2Gradient::emitFS(GrGLShaderBuilder* builder, this->emitColorLookup(builder, t.c_str(), outputColor, inputColor, samplers[0]); } -void GrGLRadial2Gradient::setData(const GrGLUniformManager& uman, - const GrCustomStage& baseData, - const GrRenderTarget* target, - int stageNum) { - INHERITED::setData(uman, baseData, target, stageNum); +void GrGLRadial2Gradient::setData(const GrGLUniformManager& uman, const GrCustomStage& baseData) { + INHERITED::setData(uman, baseData); const GrRadial2Gradient& data = static_cast(baseData); GrAssert(data.isDegenerate() == fIsDegenerate); diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp index 06d8e71f9..411b0e32b 100644 --- a/src/gpu/GrAAHairLinePathRenderer.cpp +++ b/src/gpu/GrAAHairLinePathRenderer.cpp @@ -458,16 +458,7 @@ void add_line(const SkPoint p[2], if (orthVec.setLength(SK_Scalar1)) { orthVec.setOrthog(orthVec); - // the values we pass down to the frag shader - // have to be in y-points-up space; - SkVector normal; - normal.fX = orthVec.fX; - normal.fY = -orthVec.fY; - SkPoint aYDown; - aYDown.fX = a.fX; - aYDown.fY = rtHeight - a.fY; - - SkScalar lineC = -(aYDown.dot(normal)); + SkScalar lineC = -(a.dot(orthVec)); for (int i = 0; i < kVertsPerLineSeg; ++i) { (*vert)[i].fPos = (i < 2) ? a : b; if (0 == i || 3 == i) { @@ -475,8 +466,8 @@ void add_line(const SkPoint p[2], } else { (*vert)[i].fPos += orthVec; } - (*vert)[i].fLine.fA = normal.fX; - (*vert)[i].fLine.fB = normal.fY; + (*vert)[i].fLine.fA = orthVec.fX; + (*vert)[i].fLine.fB = orthVec.fY; (*vert)[i].fLine.fC = lineC; } if (NULL != toSrc) { diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 81f971727..e729e6d4c 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -1061,9 +1061,7 @@ void GrContext::drawOval(const GrPaint& paint, verts[3].fPos = SkPoint::Make(R, B); for (int i = 0; i < 4; ++i) { - // this goes to fragment shader, it should be in y-points-up space. - verts[i].fCenter = SkPoint::Make(center.fX, rt->height() - center.fY); - + verts[i].fCenter = center; verts[i].fOuterRadius = outerRadius; verts[i].fInnerRadius = innerRadius; } diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp index c189ec0a2..d7750826b 100644 --- a/src/gpu/effects/GrConvolutionEffect.cpp +++ b/src/gpu/effects/GrConvolutionEffect.cpp @@ -28,10 +28,7 @@ public: const char* inputColor, const TextureSamplerArray&) SK_OVERRIDE; - virtual void setData(const GrGLUniformManager& uman, - const GrCustomStage&, - const GrRenderTarget*, - int stageNum) SK_OVERRIDE; + virtual void setData(const GrGLUniformManager& uman, const GrCustomStage&) SK_OVERRIDE; static inline StageKey GenKey(const GrCustomStage&, const GrGLCaps&); @@ -91,10 +88,7 @@ void GrGLConvolutionEffect::emitFS(GrGLShaderBuilder* builder, GrGLSLMulVarBy4f(&builder->fFSCode, 2, outputColor, inputColor); } -void GrGLConvolutionEffect::setData(const GrGLUniformManager& uman, - const GrCustomStage& data, - const GrRenderTarget*, - int stageNum) { +void GrGLConvolutionEffect::setData(const GrGLUniformManager& uman, const GrCustomStage& data) { const GrConvolutionEffect& conv = static_cast(data); GrTexture& texture = *data.texture(0); diff --git a/src/gpu/effects/GrTextureDomainEffect.cpp b/src/gpu/effects/GrTextureDomainEffect.cpp index c00f40f08..219a752ab 100644 --- a/src/gpu/effects/GrTextureDomainEffect.cpp +++ b/src/gpu/effects/GrTextureDomainEffect.cpp @@ -22,10 +22,7 @@ public: const char* inputColor, const TextureSamplerArray&) SK_OVERRIDE; - virtual void setData(const GrGLUniformManager&, - const GrCustomStage&, - const GrRenderTarget*, - int stageNum) SK_OVERRIDE; + virtual void setData(const GrGLUniformManager&, const GrCustomStage&) SK_OVERRIDE; static inline StageKey GenKey(const GrCustomStage&, const GrGLCaps&) { return 0; } @@ -63,10 +60,7 @@ void GrGLTextureDomainEffect::emitFS(GrGLShaderBuilder* builder, builder->fFSCode.append(";\n"); } -void GrGLTextureDomainEffect::setData(const GrGLUniformManager& uman, - const GrCustomStage& data, - const GrRenderTarget*, - int stageNum) { +void GrGLTextureDomainEffect::setData(const GrGLUniformManager& uman, const GrCustomStage& data) { const GrTextureDomainEffect& effect = static_cast(data); const GrRect& domain = effect.domain(); diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 52c480ad3..ec80cda76 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -36,6 +36,7 @@ void GrGLCaps::reset() { fTextureRedSupport = false; fImagingSupport = false; fTwoFormatLimit = false; + fFragCoordsConventionSupport = false; } GrGLCaps::GrGLCaps(const GrGLCaps& caps) { @@ -65,6 +66,7 @@ GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) { fTextureRedSupport = caps.fTextureRedSupport; fImagingSupport = caps.fImagingSupport; fTwoFormatLimit = caps.fTwoFormatLimit; + fFragCoordsConventionSupport = caps.fFragCoordsConventionSupport; return *this; } @@ -158,6 +160,13 @@ void GrGLCaps::init(const GrGLContextInfo& ctxInfo) { // can change based on which render target is bound fTwoFormatLimit = kES2_GrGLBinding == binding; + // Known issue on at least some Intel platforms: + // http://code.google.com/p/skia/issues/detail?id=946 + if (kIntel_GrGLVendor != ctxInfo.vendor()) { + fFragCoordsConventionSupport = ctxInfo.glslGeneration() >= k150_GrGLSLGeneration || + ctxInfo.hasExtension("GL_ARB_fragment_coord_conventions"); + } + this->initFSAASupport(ctxInfo); this->initStencilFormats(ctxInfo); } @@ -415,5 +424,6 @@ void GrGLCaps::print() const { GrPrintf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); GrPrintf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); + GrPrintf("Fragment coord conventions support: %s\n", (fFragCoordsConventionSupport ? "YES": "NO")); } diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h index 1cc50c222..9dfbf23cb 100644 --- a/src/gpu/gl/GrGLCaps.h +++ b/src/gpu/gl/GrGLCaps.h @@ -216,6 +216,9 @@ public: /// Is GL_ARB_IMAGING supported bool imagingSupport() const { return fImagingSupport; } + /// Is GL_ARB_fragment_coord_conventions supported? + bool fragCoordConventionsSupport() const { return fFragCoordsConventionSupport; } + // Does ReadPixels support the provided format/type combo? bool readPixelsSupported(const GrGLInterface* intf, GrGLenum format, @@ -293,6 +296,7 @@ private: bool fTextureRedSupport : 1; bool fImagingSupport : 1; bool fTwoFormatLimit : 1; + bool fFragCoordsConventionSupport : 1; }; #endif diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp index 066da357a..aca42f7c0 100644 --- a/src/gpu/gl/GrGLProgram.cpp +++ b/src/gpu/gl/GrGLProgram.cpp @@ -77,6 +77,7 @@ GrGLProgram::GrGLProgram(const GrGLContextInfo& gl, fViewportSize.set(-1, -1); fColor = GrColor_ILLEGAL; fColorFilterColor = GrColor_ILLEGAL; + fRTHeight = -1; for (int s = 0; s < GrDrawState::kNumStages; ++s) { fProgramStage[s] = NULL; @@ -234,56 +235,57 @@ static void addColorFilter(SkString* fsCode, const char * outputVar, } bool GrGLProgram::genEdgeCoverage(SkString* coverageVar, - GrGLShaderBuilder* segments) const { + GrGLShaderBuilder* builder) const { if (fDesc.fVertexLayout & GrDrawTarget::kEdge_VertexLayoutBit) { const char *vsName, *fsName; - segments->addVarying(kVec4f_GrSLType, "Edge", &vsName, &fsName); - segments->fVSAttrs.push_back().set(kVec4f_GrSLType, - GrGLShaderVar::kAttribute_TypeModifier, EDGE_ATTR_NAME); - segments->fVSCode.appendf("\t%s = " EDGE_ATTR_NAME ";\n", vsName); + builder->addVarying(kVec4f_GrSLType, "Edge", &vsName, &fsName); + builder->fVSAttrs.push_back().set(kVec4f_GrSLType, + GrGLShaderVar::kAttribute_TypeModifier, + EDGE_ATTR_NAME); + builder->fVSCode.appendf("\t%s = " EDGE_ATTR_NAME ";\n", vsName); switch (fDesc.fVertexEdgeType) { case GrDrawState::kHairLine_EdgeType: - segments->fFSCode.appendf("\tfloat edgeAlpha = abs(dot(vec3(gl_FragCoord.xy,1), %s.xyz));\n", fsName); - segments->fFSCode.append("\tedgeAlpha = max(1.0 - edgeAlpha, 0.0);\n"); + builder->fFSCode.appendf("\tfloat edgeAlpha = abs(dot(vec3(%s.xy,1), %s.xyz));\n", builder->fragmentPosition(), fsName); + builder->fFSCode.append("\tedgeAlpha = max(1.0 - edgeAlpha, 0.0);\n"); break; case GrDrawState::kQuad_EdgeType: - segments->fFSCode.append("\tfloat edgeAlpha;\n"); + builder->fFSCode.append("\tfloat edgeAlpha;\n"); // keep the derivative instructions outside the conditional - segments->fFSCode.appendf("\tvec2 duvdx = dFdx(%s.xy);\n", fsName); - segments->fFSCode.appendf("\tvec2 duvdy = dFdy(%s.xy);\n", fsName); - segments->fFSCode.appendf("\tif (%s.z > 0.0 && %s.w > 0.0) {\n", fsName, fsName); + builder->fFSCode.appendf("\tvec2 duvdx = dFdx(%s.xy);\n", fsName); + builder->fFSCode.appendf("\tvec2 duvdy = dFdy(%s.xy);\n", fsName); + builder->fFSCode.appendf("\tif (%s.z > 0.0 && %s.w > 0.0) {\n", fsName, fsName); // today we know z and w are in device space. We could use derivatives - segments->fFSCode.appendf("\t\tedgeAlpha = min(min(%s.z, %s.w) + 0.5, 1.0);\n", fsName, fsName); - segments->fFSCode.append ("\t} else {\n"); - segments->fFSCode.appendf("\t\tvec2 gF = vec2(2.0*%s.x*duvdx.x - duvdx.y,\n" - "\t\t 2.0*%s.x*duvdy.x - duvdy.y);\n", - fsName, fsName); - segments->fFSCode.appendf("\t\tedgeAlpha = (%s.x*%s.x - %s.y);\n", fsName, fsName, fsName); - segments->fFSCode.append("\t\tedgeAlpha = clamp(0.5 - edgeAlpha / length(gF), 0.0, 1.0);\n" - "\t}\n"); + builder->fFSCode.appendf("\t\tedgeAlpha = min(min(%s.z, %s.w) + 0.5, 1.0);\n", fsName, fsName); + builder->fFSCode.append ("\t} else {\n"); + builder->fFSCode.appendf("\t\tvec2 gF = vec2(2.0*%s.x*duvdx.x - duvdx.y,\n" + "\t\t 2.0*%s.x*duvdy.x - duvdy.y);\n", + fsName, fsName); + builder->fFSCode.appendf("\t\tedgeAlpha = (%s.x*%s.x - %s.y);\n", fsName, fsName, fsName); + builder->fFSCode.append("\t\tedgeAlpha = clamp(0.5 - edgeAlpha / length(gF), 0.0, 1.0);\n" + "\t}\n"); if (kES2_GrGLBinding == fContextInfo.binding()) { - segments->fHeader.printf("#extension GL_OES_standard_derivatives: enable\n"); + builder->fHeader.printf("#extension GL_OES_standard_derivatives: enable\n"); } break; case GrDrawState::kHairQuad_EdgeType: - segments->fFSCode.appendf("\tvec2 duvdx = dFdx(%s.xy);\n", fsName); - segments->fFSCode.appendf("\tvec2 duvdy = dFdy(%s.xy);\n", fsName); - segments->fFSCode.appendf("\tvec2 gF = vec2(2.0*%s.x*duvdx.x - duvdx.y,\n" - "\t 2.0*%s.x*duvdy.x - duvdy.y);\n", - fsName, fsName); - segments->fFSCode.appendf("\tfloat edgeAlpha = (%s.x*%s.x - %s.y);\n", fsName, fsName, fsName); - segments->fFSCode.append("\tedgeAlpha = sqrt(edgeAlpha*edgeAlpha / dot(gF, gF));\n"); - segments->fFSCode.append("\tedgeAlpha = max(1.0 - edgeAlpha, 0.0);\n"); + builder->fFSCode.appendf("\tvec2 duvdx = dFdx(%s.xy);\n", fsName); + builder->fFSCode.appendf("\tvec2 duvdy = dFdy(%s.xy);\n", fsName); + builder->fFSCode.appendf("\tvec2 gF = vec2(2.0*%s.x*duvdx.x - duvdx.y,\n" + "\t 2.0*%s.x*duvdy.x - duvdy.y);\n", + fsName, fsName); + builder->fFSCode.appendf("\tfloat edgeAlpha = (%s.x*%s.x - %s.y);\n", fsName, fsName, fsName); + builder->fFSCode.append("\tedgeAlpha = sqrt(edgeAlpha*edgeAlpha / dot(gF, gF));\n"); + builder->fFSCode.append("\tedgeAlpha = max(1.0 - edgeAlpha, 0.0);\n"); if (kES2_GrGLBinding == fContextInfo.binding()) { - segments->fHeader.printf("#extension GL_OES_standard_derivatives: enable\n"); + builder->fHeader.printf("#extension GL_OES_standard_derivatives: enable\n"); } break; case GrDrawState::kCircle_EdgeType: - segments->fFSCode.append("\tfloat edgeAlpha;\n"); - segments->fFSCode.appendf("\tfloat d = distance(gl_FragCoord.xy, %s.xy);\n", fsName); - segments->fFSCode.appendf("\tfloat outerAlpha = smoothstep(d - 0.5, d + 0.5, %s.z);\n", fsName); - segments->fFSCode.appendf("\tfloat innerAlpha = %s.w == 0.0 ? 1.0 : smoothstep(%s.w - 0.5, %s.w + 0.5, d);\n", fsName, fsName, fsName); - segments->fFSCode.append("\tedgeAlpha = outerAlpha * innerAlpha;\n"); + builder->fFSCode.append("\tfloat edgeAlpha;\n"); + builder->fFSCode.appendf("\tfloat d = distance(%s.xy, %s.xy);\n", builder->fragmentPosition(), fsName); + builder->fFSCode.appendf("\tfloat outerAlpha = smoothstep(d - 0.5, d + 0.5, %s.z);\n", fsName); + builder->fFSCode.appendf("\tfloat innerAlpha = %s.w == 0.0 ? 1.0 : smoothstep(%s.w - 0.5, %s.w + 0.5, d);\n", fsName, fsName, fsName); + builder->fFSCode.append("\tedgeAlpha = outerAlpha * innerAlpha;\n"); break; default: GrCrash("Unknown Edge Type!"); @@ -807,6 +809,7 @@ bool GrGLProgram::genProgram(const GrCustomStage** customStages) { builder.finished(fProgramID); this->initSamplerUniforms(); + fUniforms.fRTHeight = builder.getRTHeightUniform(); return true; } @@ -964,15 +967,17 @@ GrGLProgramStage* GrGLProgram::GenStageCode(const GrCustomStage* stage, return glStage; } -void GrGLProgram::setData(const GrDrawState& drawState) const { +void GrGLProgram::setData(const GrDrawState& drawState) { + int rtHeight = drawState.getRenderTarget()->height(); + if (GrGLUniformManager::kInvalidUniformHandle != fUniforms.fRTHeight && fRTHeight != rtHeight) { + fUniformManager.set1f(fUniforms.fRTHeight, GrIntToScalar(rtHeight)); + fRTHeight = rtHeight; + } for (int s = 0; s < GrDrawState::kNumStages; ++s) { if (NULL != fProgramStage[s]) { const GrSamplerState& sampler = drawState.getSampler(s); GrAssert(NULL != sampler.getCustomStage()); - fProgramStage[s]->setData(fUniformManager, - *sampler.getCustomStage(), - drawState.getRenderTarget(), - s); + fProgramStage[s]->setData(fUniformManager, *sampler.getCustomStage()); } } } diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h index 520f6a035..2500417ba 100644 --- a/src/gpu/gl/GrGLProgram.h +++ b/src/gpu/gl/GrGLProgram.h @@ -70,7 +70,7 @@ public: * This function uploads uniforms and calls each GrCustomStage's setData. It is called before a * draw occurs using the program after the program has already been bound. */ - void setData(const GrDrawState& drawState) const; + void setData(const GrDrawState& drawState); // Parameters that affect code generation // These structs should be kept compact; they are the input to an @@ -219,12 +219,16 @@ private: UniformHandle fColorUni; UniformHandle fCoverageUni; UniformHandle fColorFilterUni; + // We use the render target height to provide a y-down frag coord when specifying + // origin_upper_left is not supported. + UniformHandle fRTHeight; StageUniforms fStages[GrDrawState::kNumStages]; Uniforms() { fViewMatrixUni = GrGLUniformManager::kInvalidUniformHandle; fColorUni = GrGLUniformManager::kInvalidUniformHandle; fCoverageUni = GrGLUniformManager::kInvalidUniformHandle; fColorFilterUni = GrGLUniformManager::kInvalidUniformHandle; + fRTHeight = GrGLUniformManager::kInvalidUniformHandle; } }; @@ -244,6 +248,7 @@ private: GrColor fColor; GrColor fCoverage; GrColor fColorFilterColor; + int fRTHeight; /// When it is sent to GL, the texture matrix will be flipped if the texture orientation /// (below) requires. GrMatrix fTextureMatrices[GrDrawState::kNumStages]; diff --git a/src/gpu/gl/GrGLProgramStage.cpp b/src/gpu/gl/GrGLProgramStage.cpp index b7d0c656d..8a7060800 100644 --- a/src/gpu/gl/GrGLProgramStage.cpp +++ b/src/gpu/gl/GrGLProgramStage.cpp @@ -21,10 +21,7 @@ void GrGLProgramStage::setupVariables(GrGLShaderBuilder*) { } -void GrGLProgramStage::setData(const GrGLUniformManager&, - const GrCustomStage&, - const GrRenderTarget*, - int stageNum) { +void GrGLProgramStage::setData(const GrGLUniformManager&, const GrCustomStage&) { } GrGLProgramStage::StageKey GrGLProgramStage::GenTextureKey(const GrCustomStage& stage, diff --git a/src/gpu/gl/GrGLProgramStage.h b/src/gpu/gl/GrGLProgramStage.h index 28d3f4938..2cb5ae554 100644 --- a/src/gpu/gl/GrGLProgramStage.h +++ b/src/gpu/gl/GrGLProgramStage.h @@ -73,10 +73,7 @@ public: that produces the same stage key; this function reads data from a stage and uploads any uniform variables required by the shaders created in emit*(). */ - virtual void setData(const GrGLUniformManager&, - const GrCustomStage& stage, - const GrRenderTarget* renderTarget, - int stageNum); + virtual void setData(const GrGLUniformManager&, const GrCustomStage& stage); const char* name() const { return fFactory.name(); } diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp index 3ce118ccc..2f24b07c1 100644 --- a/src/gpu/gl/GrGLShaderBuilder.cpp +++ b/src/gpu/gl/GrGLShaderBuilder.cpp @@ -93,13 +93,15 @@ GrGLShaderBuilder::GrGLShaderBuilder(const GrGLContextInfo& ctx, GrGLUniformMana , fContext(ctx) , fUniformManager(uniformManager) , fCurrentStage(kNonStageIdx) + , fSetupFragPosition(false) + , fRTHeightUniform(GrGLUniformManager::kInvalidUniformHandle) , fTexCoordVaryingType(kVoid_GrSLType) { } void GrGLShaderBuilder::setupTextureAccess(const char* varyingFSName, GrSLType varyingType) { // FIXME: We don't know how the custom stage will manipulate the coords. So we give up on using // projective texturing and always give the stage 2D coords. This will be fixed when custom - // stages are repsonsible for setting up their own tex coords / tex matrices. + // stages are responsible for setting up their own tex coords / tex matrices. switch (varyingType) { case kVec2f_GrSLType: fDefaultTexCoordsName = varyingFSName; @@ -283,6 +285,40 @@ void GrGLShaderBuilder::addVarying(GrSLType type, } } +const char* GrGLShaderBuilder::fragmentPosition() { + if (fContext.caps().fragCoordConventionsSupport()) { + if (!fSetupFragPosition) { + fFSHeader.append("#extension GL_ARB_fragment_coord_conventions: require\n"); + fFSHeader.append("layout(origin_upper_left) in vec4 gl_FragCoord;\n"); + fSetupFragPosition = true; + } + return "gl_FragCoord"; + } else { + static const char* kCoordName = "fragCoordYDown"; + if (!fSetupFragPosition) { + GrAssert(GrGLUniformManager::kInvalidUniformHandle == fRTHeightUniform); + const char* rtHeightName; + + // temporarily change the stage index because we're inserting a uniform whose name + // shouldn't be mangled to be stage-specific. + int oldStageIdx = fCurrentStage; + fCurrentStage = kNonStageIdx; + fRTHeightUniform = this->addUniform(kFragment_ShaderType, + kFloat_GrSLType, + "RTHeight", + &rtHeightName); + fCurrentStage = oldStageIdx; + + this->fFSCode.prependf("\tvec4 %s = vec4(gl_FragCoord.x, %s - gl_FragCoord.y, gl_FragCoord.zw);\n", + kCoordName, rtHeightName); + fSetupFragPosition = true; + } + GrAssert(GrGLUniformManager::kInvalidUniformHandle != fRTHeightUniform); + return kCoordName; + } +} + + void GrGLShaderBuilder::emitFunction(ShaderType shader, GrSLType returnType, const char* name, @@ -381,6 +417,7 @@ void GrGLShaderBuilder::getShader(ShaderType type, SkString* shaderStr) const { append_default_precision_qualifier(kDefaultFragmentPrecision, fContext.binding(), shaderStr); + shaderStr->append(fFSHeader); this->appendUniformDecls(kFragment_ShaderType, shaderStr); this->appendDecls(fFSInputs, shaderStr); // We shouldn't have declared outputs on 1.10 diff --git a/src/gpu/gl/GrGLShaderBuilder.h b/src/gpu/gl/GrGLShaderBuilder.h index f143af39a..aa88cf2b1 100644 --- a/src/gpu/gl/GrGLShaderBuilder.h +++ b/src/gpu/gl/GrGLShaderBuilder.h @@ -129,7 +129,7 @@ public: the generated shader code. This potentially allows greater reuse of cached shaders. */ static const GrGLenum* GetTexParamSwizzle(GrPixelConfig config, const GrGLCaps& caps); - /** Add a uniform variable to the current program, that has visibilty in one or more shaders. + /** Add a uniform variable to the current program, that has visibility in one or more shaders. visibility is a bitfield of ShaderType values indicating from which shaders the uniform should be accessible. At least one bit must be set. Geometry shader uniforms are not supported at this time. The actual uniform name will be mangled. If outName is not NULL then @@ -151,7 +151,7 @@ public: const GrGLShaderVar& getUniformVariable(GrGLUniformManager::UniformHandle) const; /** - * Shorcut for getUniformVariable(u).c_str() + * Shortcut for getUniformVariable(u).c_str() */ const char* getUniformCStr(GrGLUniformManager::UniformHandle u) const { return this->getUniformVariable(u).c_str(); @@ -165,6 +165,10 @@ public: const char** vsOutName = NULL, const char** fsInName = NULL); + /** Returns a variable name that represents the position of the fragment in the FS. The position + is in device space (e.g. 0,0 is the top left and pixel centers are at half-integers). */ + const char* fragmentPosition(); + /** Called after building is complete to get the final shader string. */ void getShader(ShaderType, SkString*) const; @@ -180,6 +184,8 @@ public: void setCurrentStage(int stage) { fCurrentStage = stage; } void setNonStage() { fCurrentStage = kNonStageIdx; } + GrGLUniformManager::UniformHandle getRTHeightUniform() const { return fRTHeightUniform; } + private: typedef GrTAllocator VarArray; @@ -211,10 +217,14 @@ private: kNonStageIdx = -1, }; - const GrGLContextInfo& fContext; - GrGLUniformManager& fUniformManager; - int fCurrentStage; - SkString fFSFunctions; + const GrGLContextInfo& fContext; + GrGLUniformManager& fUniformManager; + int fCurrentStage; + SkString fFSFunctions; + SkString fFSHeader; + + bool fSetupFragPosition; + GrGLUniformManager::UniformHandle fRTHeightUniform; /// Per-stage settings - only valid while we're inside GrGLProgram::genStageCode(). //@{