aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/gradients
diff options
context:
space:
mode:
authorGravatar kkinnunen <kkinnunen@nvidia.com>2014-07-30 00:04:16 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-07-30 00:04:16 -0700
commit7510b224e52b9518a8ddf7418db0e9c258f79539 (patch)
tree179bdfba91742718ee02d1f39d5da856894abf29 /src/effects/gradients
parenta97e2702f42765775784d6d0f48b82356e1f6309 (diff)
Rename GrGLUniformManager to GrGLProgramDataManager
Rename GrGLUniformManager to GrGLProgramDataManager in anticipation that the class would be used to manage shader resources that are not uniforms. This is needed in order to implement NVPR on GLES. R=bsalomon@google.com Author: kkinnunen@nvidia.com Review URL: https://codereview.chromium.org/365853002
Diffstat (limited to 'src/effects/gradients')
-rw-r--r--src/effects/gradients/SkGradientShader.cpp52
-rw-r--r--src/effects/gradients/SkGradientShaderPriv.h10
-rw-r--r--src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp46
-rw-r--r--src/effects/gradients/SkTwoPointRadialGradient.cpp10
4 files changed, 59 insertions, 59 deletions
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 48904fa8fd..5f0983630b 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -884,29 +884,29 @@ void GrGLGradientEffect::emitUniforms(GrGLShaderBuilder* builder, uint32_t baseK
}
}
-static inline void set_color_uni(const GrGLUniformManager& uman,
- const GrGLUniformManager::UniformHandle uni,
+static inline void set_color_uni(const GrGLProgramDataManager& pdman,
+ const GrGLProgramDataManager::UniformHandle uni,
const SkColor* color) {
- uman.set4f(uni,
- SkColorGetR(*color) / 255.f,
- SkColorGetG(*color) / 255.f,
- SkColorGetB(*color) / 255.f,
- SkColorGetA(*color) / 255.f);
+ pdman.set4f(uni,
+ SkColorGetR(*color) / 255.f,
+ SkColorGetG(*color) / 255.f,
+ SkColorGetB(*color) / 255.f,
+ SkColorGetA(*color) / 255.f);
}
-static inline void set_mul_color_uni(const GrGLUniformManager& uman,
- const GrGLUniformManager::UniformHandle uni,
+static inline void set_mul_color_uni(const GrGLProgramDataManager& pdman,
+ const GrGLProgramDataManager::UniformHandle uni,
const SkColor* color){
float a = SkColorGetA(*color) / 255.f;
float aDiv255 = a / 255.f;
- uman.set4f(uni,
- SkColorGetR(*color) * aDiv255,
- SkColorGetG(*color) * aDiv255,
- SkColorGetB(*color) * aDiv255,
- a);
+ pdman.set4f(uni,
+ SkColorGetR(*color) * aDiv255,
+ SkColorGetG(*color) * aDiv255,
+ SkColorGetB(*color) * aDiv255,
+ a);
}
-void GrGLGradientEffect::setData(const GrGLUniformManager& uman,
+void GrGLGradientEffect::setData(const GrGLProgramDataManager& pdman,
const GrDrawEffect& drawEffect) {
const GrGradientEffect& e = drawEffect.castEffect<GrGradientEffect>();
@@ -915,29 +915,29 @@ void GrGLGradientEffect::setData(const GrGLUniformManager& uman,
if (SkGradientShaderBase::kTwo_GpuColorType == e.getColorType()){
if (GrGradientEffect::kBeforeInterp_PremulType == e.getPremulType()) {
- set_mul_color_uni(uman, fColorStartUni, e.getColors(0));
- set_mul_color_uni(uman, fColorEndUni, e.getColors(1));
+ set_mul_color_uni(pdman, fColorStartUni, e.getColors(0));
+ set_mul_color_uni(pdman, fColorEndUni, e.getColors(1));
} else {
- set_color_uni(uman, fColorStartUni, e.getColors(0));
- set_color_uni(uman, fColorEndUni, e.getColors(1));
+ set_color_uni(pdman, fColorStartUni, e.getColors(0));
+ set_color_uni(pdman, fColorEndUni, e.getColors(1));
}
} else if (SkGradientShaderBase::kThree_GpuColorType == e.getColorType()){
if (GrGradientEffect::kBeforeInterp_PremulType == e.getPremulType()) {
- set_mul_color_uni(uman, fColorStartUni, e.getColors(0));
- set_mul_color_uni(uman, fColorMidUni, e.getColors(1));
- set_mul_color_uni(uman, fColorEndUni, e.getColors(2));
+ set_mul_color_uni(pdman, fColorStartUni, e.getColors(0));
+ set_mul_color_uni(pdman, fColorMidUni, e.getColors(1));
+ set_mul_color_uni(pdman, fColorEndUni, e.getColors(2));
} else {
- set_color_uni(uman, fColorStartUni, e.getColors(0));
- set_color_uni(uman, fColorMidUni, e.getColors(1));
- set_color_uni(uman, fColorEndUni, e.getColors(2));
+ set_color_uni(pdman, fColorStartUni, e.getColors(0));
+ set_color_uni(pdman, fColorMidUni, e.getColors(1));
+ set_color_uni(pdman, fColorEndUni, e.getColors(2));
}
} else {
SkScalar yCoord = e.getYCoord();
if (yCoord != fCachedYCoord) {
- uman.set1f(fFSYUni, yCoord);
+ pdman.set1f(fFSYUni, yCoord);
fCachedYCoord = yCoord;
}
}
diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h
index 61acf3c8fe..ca0f417e39 100644
--- a/src/effects/gradients/SkGradientShaderPriv.h
+++ b/src/effects/gradients/SkGradientShaderPriv.h
@@ -376,7 +376,7 @@ public:
GrGLGradientEffect(const GrBackendEffectFactory& factory);
virtual ~GrGLGradientEffect();
- virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE;
protected:
/**
@@ -435,10 +435,10 @@ private:
}
SkScalar fCachedYCoord;
- GrGLUniformManager::UniformHandle fFSYUni;
- GrGLUniformManager::UniformHandle fColorStartUni;
- GrGLUniformManager::UniformHandle fColorMidUni;
- GrGLUniformManager::UniformHandle fColorEndUni;
+ GrGLProgramDataManager::UniformHandle fFSYUni;
+ GrGLProgramDataManager::UniformHandle fColorStartUni;
+ GrGLProgramDataManager::UniformHandle fColorMidUni;
+ GrGLProgramDataManager::UniformHandle fColorEndUni;
typedef GrGLEffect INHERITED;
};
diff --git a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
index 76f9a492b8..4298207ed7 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
+++ b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
@@ -14,7 +14,7 @@
#include "GrTBackendEffectFactory.h"
#include "gl/GrGLShaderBuilder.h"
// For brevity
-typedef GrGLUniformManager::UniformHandle UniformHandle;
+typedef GrGLProgramDataManager::UniformHandle UniformHandle;
static const SkScalar kErrorTol = 0.00001f;
static const SkScalar kEdgeErrorTol = 5.f * kErrorTol;
@@ -144,7 +144,7 @@ public:
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE;
static void GenKey(const GrDrawEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b);
@@ -273,9 +273,9 @@ void GLEdge2PtConicalEffect::emitCode(GrGLShaderBuilder* builder,
builder->fsCodeAppend("\t}\n");
}
-void GLEdge2PtConicalEffect::setData(const GrGLUniformManager& uman,
+void GLEdge2PtConicalEffect::setData(const GrGLProgramDataManager& pdman,
const GrDrawEffect& drawEffect) {
- INHERITED::setData(uman, drawEffect);
+ INHERITED::setData(pdman, drawEffect);
const Edge2PtConicalEffect& data = drawEffect.castEffect<Edge2PtConicalEffect>();
SkScalar radius0 = data.radius();
SkScalar diffRadius = data.diffRadius();
@@ -289,7 +289,7 @@ void GLEdge2PtConicalEffect::setData(const GrGLUniformManager& uman,
SkScalarToFloat(diffRadius)
};
- uman.set1fv(fParamUni, 3, values);
+ pdman.set1fv(fParamUni, 3, values);
fCachedRadius = radius0;
fCachedDiffRadius = diffRadius;
}
@@ -420,7 +420,7 @@ public:
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE;
static void GenKey(const GrDrawEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b);
@@ -541,9 +541,9 @@ void GLFocalOutside2PtConicalEffect::emitCode(GrGLShaderBuilder* builder,
builder->fsCodeAppend("\t}\n");
}
-void GLFocalOutside2PtConicalEffect::setData(const GrGLUniformManager& uman,
+void GLFocalOutside2PtConicalEffect::setData(const GrGLProgramDataManager& pdman,
const GrDrawEffect& drawEffect) {
- INHERITED::setData(uman, drawEffect);
+ INHERITED::setData(pdman, drawEffect);
const FocalOutside2PtConicalEffect& data = drawEffect.castEffect<FocalOutside2PtConicalEffect>();
SkASSERT(data.isFlipped() == fIsFlipped);
SkScalar focal = data.focal();
@@ -556,7 +556,7 @@ void GLFocalOutside2PtConicalEffect::setData(const GrGLUniformManager& uman,
SkScalarToFloat(oneMinus2F),
};
- uman.set1fv(fParamUni, 2, values);
+ pdman.set1fv(fParamUni, 2, values);
fCachedFocal = focal;
}
}
@@ -625,7 +625,7 @@ public:
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE;
static void GenKey(const GrDrawEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b);
@@ -723,14 +723,14 @@ void GLFocalInside2PtConicalEffect::emitCode(GrGLShaderBuilder* builder,
this->emitColor(builder, tName.c_str(), baseKey, outputColor, inputColor, samplers);
}
-void GLFocalInside2PtConicalEffect::setData(const GrGLUniformManager& uman,
+void GLFocalInside2PtConicalEffect::setData(const GrGLProgramDataManager& pdman,
const GrDrawEffect& drawEffect) {
- INHERITED::setData(uman, drawEffect);
+ INHERITED::setData(pdman, drawEffect);
const FocalInside2PtConicalEffect& data = drawEffect.castEffect<FocalInside2PtConicalEffect>();
SkScalar focal = data.focal();
if (fCachedFocal != focal) {
- uman.set1f(fFocalUni, SkScalarToFloat(focal));
+ pdman.set1f(fFocalUni, SkScalarToFloat(focal));
fCachedFocal = focal;
}
}
@@ -866,7 +866,7 @@ public:
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE;
static void GenKey(const GrDrawEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b);
@@ -985,9 +985,9 @@ void GLCircleInside2PtConicalEffect::emitCode(GrGLShaderBuilder* builder,
this->emitColor(builder, tName.c_str(), baseKey, outputColor, inputColor, samplers);
}
-void GLCircleInside2PtConicalEffect::setData(const GrGLUniformManager& uman,
+void GLCircleInside2PtConicalEffect::setData(const GrGLProgramDataManager& pdman,
const GrDrawEffect& drawEffect) {
- INHERITED::setData(uman, drawEffect);
+ INHERITED::setData(pdman, drawEffect);
const CircleInside2PtConicalEffect& data = drawEffect.castEffect<CircleInside2PtConicalEffect>();
SkScalar centerX = data.centerX();
SkScalar centerY = data.centerY();
@@ -998,8 +998,8 @@ void GLCircleInside2PtConicalEffect::setData(const GrGLUniformManager& uman,
if (fCachedCenterX != centerX || fCachedCenterY != centerY ||
fCachedA != A || fCachedB != B || fCachedC != C) {
- uman.set2f(fCenterUni, SkScalarToFloat(centerX), SkScalarToFloat(centerY));
- uman.set3f(fParamUni, SkScalarToFloat(A), SkScalarToFloat(B), SkScalarToFloat(C));
+ pdman.set2f(fCenterUni, SkScalarToFloat(centerX), SkScalarToFloat(centerY));
+ pdman.set3f(fParamUni, SkScalarToFloat(A), SkScalarToFloat(B), SkScalarToFloat(C));
fCachedCenterX = centerX;
fCachedCenterY = centerY;
@@ -1092,7 +1092,7 @@ public:
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE;
static void GenKey(const GrDrawEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b);
@@ -1234,9 +1234,9 @@ void GLCircleOutside2PtConicalEffect::emitCode(GrGLShaderBuilder* builder,
builder->fsCodeAppend("\t}\n");
}
-void GLCircleOutside2PtConicalEffect::setData(const GrGLUniformManager& uman,
+void GLCircleOutside2PtConicalEffect::setData(const GrGLProgramDataManager& pdman,
const GrDrawEffect& drawEffect) {
- INHERITED::setData(uman, drawEffect);
+ INHERITED::setData(pdman, drawEffect);
const CircleOutside2PtConicalEffect& data = drawEffect.castEffect<CircleOutside2PtConicalEffect>();
SkASSERT(data.isFlipped() == fIsFlipped);
SkScalar centerX = data.centerX();
@@ -1249,8 +1249,8 @@ void GLCircleOutside2PtConicalEffect::setData(const GrGLUniformManager& uman,
if (fCachedCenterX != centerX || fCachedCenterY != centerY ||
fCachedA != A || fCachedB != B || fCachedC != C || fCachedTLimit != tLimit) {
- uman.set2f(fCenterUni, SkScalarToFloat(centerX), SkScalarToFloat(centerY));
- uman.set4f(fParamUni, SkScalarToFloat(A), SkScalarToFloat(B), SkScalarToFloat(C),
+ pdman.set2f(fCenterUni, SkScalarToFloat(centerX), SkScalarToFloat(centerY));
+ pdman.set4f(fParamUni, SkScalarToFloat(A), SkScalarToFloat(B), SkScalarToFloat(C),
SkScalarToFloat(tLimit));
fCachedCenterX = centerX;
diff --git a/src/effects/gradients/SkTwoPointRadialGradient.cpp b/src/effects/gradients/SkTwoPointRadialGradient.cpp
index 5015274413..16b4da540c 100644
--- a/src/effects/gradients/SkTwoPointRadialGradient.cpp
+++ b/src/effects/gradients/SkTwoPointRadialGradient.cpp
@@ -387,7 +387,7 @@ void SkTwoPointRadialGradient::init() {
#include "SkGr.h"
// For brevity
-typedef GrGLUniformManager::UniformHandle UniformHandle;
+typedef GrGLProgramDataManager::UniformHandle UniformHandle;
class GrGLRadial2Gradient : public GrGLGradientEffect {
@@ -403,7 +403,7 @@ public:
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE;
static void GenKey(const GrDrawEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b);
@@ -625,9 +625,9 @@ void GrGLRadial2Gradient::emitCode(GrGLShaderBuilder* builder,
this->emitColor(builder, t.c_str(), baseKey, outputColor, inputColor, samplers);
}
-void GrGLRadial2Gradient::setData(const GrGLUniformManager& uman,
+void GrGLRadial2Gradient::setData(const GrGLProgramDataManager& pdman,
const GrDrawEffect& drawEffect) {
- INHERITED::setData(uman, drawEffect);
+ INHERITED::setData(pdman, drawEffect);
const GrRadial2Gradient& data = drawEffect.castEffect<GrRadial2Gradient>();
SkASSERT(data.isDegenerate() == fIsDegenerate);
SkScalar centerX1 = data.center();
@@ -652,7 +652,7 @@ void GrGLRadial2Gradient::setData(const GrGLUniformManager& uman,
data.isPosRoot() ? 1.f : -1.f
};
- uman.set1fv(fParamUni, 6, values);
+ pdman.set1fv(fParamUni, 6, values);
fCachedCenter = centerX1;
fCachedRadius = radius0;
fCachedPosRoot = data.isPosRoot();