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

Unified Diff: src/effects/SkLightingImageFilter.cpp

Issue 24853002: Make GPU coord transforms automatic (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 3 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/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkLumaXfermode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkLightingImageFilter.cpp
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index ca52b981e53bde666af997597ae00c0b3a4164dd..aac54625fee1a6197f125e4dee9f95eda7b0b704 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -16,7 +16,6 @@
#if SK_SUPPORT_GPU
#include "effects/GrSingleTextureEffect.h"
#include "gl/GrGLEffect.h"
-#include "gl/GrGLEffectMatrix.h"
#include "GrEffect.h"
#include "GrTBackendEffectFactory.h"
@@ -1075,6 +1074,7 @@ public:
EffectKey,
const char* outputColor,
const char* inputColor,
+ const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
static inline EffectKey GenKey(const GrDrawEffect&, const GrGLCaps&);
@@ -1093,7 +1093,6 @@ private:
UniformHandle fImageIncrementUni;
UniformHandle fSurfaceScaleUni;
GrGLLight* fLight;
- GrGLEffectMatrix fEffectMatrix;
};
///////////////////////////////////////////////////////////////////////////////
@@ -1196,8 +1195,7 @@ GrEffectRef* GrDiffuseLightingEffect::TestCreate(SkRandom* random,
GrGLLightingEffect::GrGLLightingEffect(const GrBackendEffectFactory& factory,
const GrDrawEffect& drawEffect)
- : INHERITED(factory)
- , fEffectMatrix(drawEffect.castEffect<GrLightingEffect>().coordsType()) {
+ : INHERITED(factory) {
const GrLightingEffect& m = drawEffect.castEffect<GrLightingEffect>();
fLight = m.light()->createGLLight();
}
@@ -1211,9 +1209,9 @@ void GrGLLightingEffect::emitCode(GrGLShaderBuilder* builder,
EffectKey key,
const char* outputColor,
const char* inputColor,
+ const TransformedCoordsArray& coords,
const TextureSamplerArray& samplers) {
- SkString coords;
- fEffectMatrix.emitCodeMakeFSCoords2D(builder, key, &coords);
+ SkString coords2D = builder->ensureFSCoords2D(coords, 0);
fImageIncrementUni = builder->addUniform(GrGLShaderBuilder::kFragment_Visibility,
kVec2f_GrSLType,
@@ -1272,7 +1270,7 @@ void GrGLLightingEffect::emitCode(GrGLShaderBuilder* builder,
interiorNormalBody.c_str(),
&interiorNormalName);
- builder->fsCodeAppendf("\t\tvec2 coord = %s;\n", coords.c_str());
+ builder->fsCodeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str());
builder->fsCodeAppend("\t\tfloat m[9];\n");
const char* imgInc = builder->getUniformCStr(fImageIncrementUni);
@@ -1304,14 +1302,7 @@ void GrGLLightingEffect::emitCode(GrGLShaderBuilder* builder,
GrGLEffect::EffectKey GrGLLightingEffect::GenKey(const GrDrawEffect& drawEffect,
const GrGLCaps& caps) {
- const GrLightingEffect& lighting = drawEffect.castEffect<GrLightingEffect>();
- EffectKey key = lighting.light()->type();
- key <<= GrGLEffectMatrix::kKeyBits;
- EffectKey matrixKey = GrGLEffectMatrix::GenKey(lighting.getMatrix(),
- drawEffect,
- lighting.coordsType(),
- lighting.texture(0));
- return key | matrixKey;
+ return drawEffect.castEffect<GrLightingEffect>().light()->type();
}
void GrGLLightingEffect::setData(const GrGLUniformManager& uman,
@@ -1323,10 +1314,6 @@ void GrGLLightingEffect::setData(const GrGLUniformManager& uman,
uman.set1f(fSurfaceScaleUni, lighting.surfaceScale());
SkAutoTUnref<SkLight> transformedLight(lighting.light()->transform(lighting.filterMatrix()));
fLight->setData(uman, transformedLight);
- fEffectMatrix.setData(uman,
- lighting.getMatrix(),
- drawEffect,
- lighting.texture(0));
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkLumaXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698