diff options
author | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-07-13 18:25:06 +0000 |
---|---|---|
committer | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-07-13 18:25:06 +0000 |
commit | f4770d7e841a34d74d7f76a33312f4c5624da831 (patch) | |
tree | 9cd573c206571218477e4119b97565047ebe5252 /src/gpu/effects/GrGradientEffects.cpp | |
parent | ac8fe134de58e6aa3c280a24fae0bcde8f7990c5 (diff) |
There were three different problems with lighting filters:
1) Texture offsets (fImageIncrement) have to be signed depending on
whether the texture is "right way up" (texture upload) or "upside down"
(render target), so the surface normals were coming out upside down.
2) Light normals have to y-negated on upload
These two bugs were cancelling each other out in SampleApp, (where we
were testing w/textures) but not in Chrome (where we were testing
w/render targets).
3) The extract-the-height-from-the-view-matrix hack I was using to
compare light positions vs. gl_FragCoord doesn't work in Chrome where we
compile with GR_STATIC_RECT_VB, and the view matrix contains more than
the viewport transform (to accomodate the canonical vertex buffer).
Fixed by passing the destination render target to
GrGLProgramStage::setData(), so it can flip the light positions in Y on
the CPU.
Review URL: http://codereview.appspot.com/6343109/
git-svn-id: http://skia.googlecode.com/svn/trunk@4605 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/effects/GrGradientEffects.cpp')
-rw-r--r-- | src/gpu/effects/GrGradientEffects.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gpu/effects/GrGradientEffects.cpp b/src/gpu/effects/GrGradientEffects.cpp index d4719b3a24..3125657af2 100644 --- a/src/gpu/effects/GrGradientEffects.cpp +++ b/src/gpu/effects/GrGradientEffects.cpp @@ -88,6 +88,7 @@ public: virtual void initUniforms(const GrGLInterface*, int programID) SK_OVERRIDE; virtual void setData(const GrGLInterface*, const GrCustomStage&, + const GrRenderTarget*, int stageNum) SK_OVERRIDE; static StageKey GenKey(const GrCustomStage& s) { @@ -258,6 +259,7 @@ void GrGLRadial2Gradient::initUniforms(const GrGLInterface* gl, int programID) { void GrGLRadial2Gradient::setData(const GrGLInterface* gl, const GrCustomStage& baseData, + const GrRenderTarget*, int stageNum) { const GrRadial2Gradient& data = static_cast<const GrRadial2Gradient&>(baseData); @@ -344,6 +346,7 @@ public: virtual void initUniforms(const GrGLInterface*, int programID) SK_OVERRIDE; virtual void setData(const GrGLInterface*, const GrCustomStage&, + const GrRenderTarget*, int stageNum) SK_OVERRIDE; static StageKey GenKey(const GrCustomStage& s) { @@ -573,6 +576,7 @@ void GrGLConical2Gradient::initUniforms(const GrGLInterface* gl, int programID) void GrGLConical2Gradient::setData(const GrGLInterface* gl, const GrCustomStage& baseData, + const GrRenderTarget*, int stageNum) { const GrConical2Gradient& data = static_cast<const GrConical2Gradient&>(baseData); |