aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-04-04 10:15:51 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-04 15:27:44 +0000
commitab015efc48c462ffdffebb45c02cd19efb254983 (patch)
tree0b120fe0e4238f89f7e4bb73a88a00301ecf1378 /src/gpu/effects
parent19aff5dd5cd83141f12c234c4255a35f63e564cd (diff)
Move the ability to access textures, buffers, and image storages out from GrProcessor.
GrXferProcessor can no longer use this functionality so it is moved to a new intermediate class inherited by GrFragmentProcessor and GrPrimitiveProcessor. Change-Id: I4f30c89bdceb2d77b602bf0646107e0780881c26 Reviewed-on: https://skia-review.googlesource.com/11202 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/effects')
-rw-r--r--src/gpu/effects/GrBicubicEffect.cpp4
-rw-r--r--src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp3
-rw-r--r--src/gpu/effects/GrConstColorProcessor.cpp3
-rw-r--r--src/gpu/effects/GrConvexPolyEffect.cpp8
-rw-r--r--src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp4
-rw-r--r--src/gpu/effects/GrMatrixConvolutionEffect.cpp4
-rw-r--r--src/gpu/effects/GrNonlinearColorSpaceXformEffect.cpp3
-rw-r--r--src/gpu/effects/GrOvalEffect.cpp8
-rw-r--r--src/gpu/effects/GrRRectEffect.cpp8
-rw-r--r--src/gpu/effects/GrSimpleTextureEffect.cpp3
-rw-r--r--src/gpu/effects/GrTextureDomain.cpp6
-rw-r--r--src/gpu/effects/GrYUVEffect.cpp4
12 files changed, 32 insertions, 26 deletions
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index b418096da5..c60400e383 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -27,7 +27,7 @@ public:
}
protected:
- void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override;
+ void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
private:
typedef GrGLSLProgramDataManager::UniformHandle UniformHandle;
@@ -118,7 +118,7 @@ void GrGLBicubicEffect::emitCode(EmitArgs& args) {
}
void GrGLBicubicEffect::onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& processor) {
+ const GrFragmentProcessor& processor) {
const GrBicubicEffect& bicubicEffect = processor.cast<GrBicubicEffect>();
GrTexture* texture = processor.textureSampler(0).texture();
float imageIncrement[2];
diff --git a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp
index 2d49883066..95b08d2f0d 100644
--- a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp
+++ b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp
@@ -48,7 +48,8 @@ public:
}
protected:
- void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& proc) override {}
+ void onSetData(const GrGLSLProgramDataManager& pdman,
+ const GrFragmentProcessor& proc) override {}
GrBlurredEdgeFP::Mode fMode;
};
diff --git a/src/gpu/effects/GrConstColorProcessor.cpp b/src/gpu/effects/GrConstColorProcessor.cpp
index 1013ff318a..9f46712f29 100644
--- a/src/gpu/effects/GrConstColorProcessor.cpp
+++ b/src/gpu/effects/GrConstColorProcessor.cpp
@@ -42,7 +42,8 @@ public:
}
protected:
- void onSetData(const GrGLSLProgramDataManager& pdm, const GrProcessor& processor) override {
+ void onSetData(const GrGLSLProgramDataManager& pdm,
+ const GrFragmentProcessor& processor) override {
GrColor4f color = processor.cast<GrConstColorProcessor>().color();
// We use the "illegal" color value as an uninit sentinel. With GrColor4f, the "illegal"
// color is *really* illegal (not just unpremultiplied), so this check is simple.
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index d94d94a29a..312c038201 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -85,7 +85,7 @@ public:
static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
protected:
- void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override;
+ void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
private:
GrGLSLProgramDataManager::UniformHandle fRectUniform;
@@ -137,7 +137,7 @@ void GLAARectEffect::emitCode(EmitArgs& args) {
}
void GLAARectEffect::onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& processor) {
+ const GrFragmentProcessor& processor) {
const AARectEffect& aare = processor.cast<AARectEffect>();
const SkRect& rect = aare.getRect();
if (rect != fPrevRect) {
@@ -176,7 +176,7 @@ public:
static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
protected:
- void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override;
+ void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
private:
GrGLSLProgramDataManager::UniformHandle fEdgeUniform;
@@ -217,7 +217,7 @@ void GrGLConvexPolyEffect::emitCode(EmitArgs& args) {
}
void GrGLConvexPolyEffect::onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& effect) {
+ const GrFragmentProcessor& effect) {
const GrConvexPolyEffect& cpe = effect.cast<GrConvexPolyEffect>();
size_t byteSize = 3 * cpe.getEdgeCount() * sizeof(SkScalar);
if (0 != memcmp(fPrevEdges, cpe.getEdges(), byteSize)) {
diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
index 4fa462e3bf..b4f13143d8 100644
--- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
+++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
@@ -25,7 +25,7 @@ public:
static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
protected:
- void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor&) override;
+ void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
private:
UniformHandle fKernelUni;
@@ -98,7 +98,7 @@ void GrGLConvolutionEffect::emitCode(EmitArgs& args) {
}
void GrGLConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& processor) {
+ const GrFragmentProcessor& processor) {
const GrGaussianConvolutionFragmentProcessor& conv =
processor.cast<GrGaussianConvolutionFragmentProcessor>();
GrTexture& texture = *conv.textureSampler(0).texture();
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index 62a53dd380..03d90ea675 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -20,7 +20,7 @@ public:
static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
protected:
- void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override;
+ void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
private:
typedef GrGLSLProgramDataManager::UniformHandle UniformHandle;
@@ -131,7 +131,7 @@ void GrGLMatrixConvolutionEffect::GenKey(const GrProcessor& processor,
}
void GrGLMatrixConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& processor) {
+ const GrFragmentProcessor& processor) {
const GrMatrixConvolutionEffect& conv = processor.cast<GrMatrixConvolutionEffect>();
GrTexture* texture = conv.textureSampler(0).texture();
diff --git a/src/gpu/effects/GrNonlinearColorSpaceXformEffect.cpp b/src/gpu/effects/GrNonlinearColorSpaceXformEffect.cpp
index d4c0a392d6..c6c0c26574 100644
--- a/src/gpu/effects/GrNonlinearColorSpaceXformEffect.cpp
+++ b/src/gpu/effects/GrNonlinearColorSpaceXformEffect.cpp
@@ -108,7 +108,8 @@ public:
}
protected:
- void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& processor) override {
+ void onSetData(const GrGLSLProgramDataManager& pdman,
+ const GrFragmentProcessor& processor) override {
const GrNonlinearColorSpaceXformEffect& csxe =
processor.cast<GrNonlinearColorSpaceXformEffect>();
if (SkToBool(csxe.ops() & GrNonlinearColorSpaceXformEffect::kSrcTransfer_Op)) {
diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp
index a8b0c847b9..672f5d873c 100644
--- a/src/gpu/effects/GrOvalEffect.cpp
+++ b/src/gpu/effects/GrOvalEffect.cpp
@@ -98,7 +98,7 @@ public:
static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
protected:
- void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override;
+ void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
private:
GrGLSLProgramDataManager::UniformHandle fCircleUniform;
@@ -151,7 +151,7 @@ void GLCircleEffect::GenKey(const GrProcessor& processor, const GrShaderCaps&,
}
void GLCircleEffect::onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& processor) {
+ const GrFragmentProcessor& processor) {
const CircleEffect& ce = processor.cast<CircleEffect>();
if (ce.getRadius() != fPrevRadius || ce.getCenter() != fPrevCenter) {
SkScalar radius = ce.getRadius();
@@ -266,7 +266,7 @@ public:
static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
protected:
- void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override;
+ void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
private:
GrGLSLProgramDataManager::UniformHandle fEllipseUniform;
@@ -344,7 +344,7 @@ void GLEllipseEffect::GenKey(const GrProcessor& effect, const GrShaderCaps&,
}
void GLEllipseEffect::onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& effect) {
+ const GrFragmentProcessor& effect) {
const EllipseEffect& ee = effect.cast<EllipseEffect>();
if (ee.getRadii() != fPrevRadii || ee.getCenter() != fPrevCenter) {
float invRXSqd;
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index 1b4772d155..887bc00bda 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -135,7 +135,7 @@ public:
static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
protected:
- void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override;
+ void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
private:
GrGLSLProgramDataManager::UniformHandle fInnerRectUniform;
@@ -291,7 +291,7 @@ void GLCircularRRectEffect::GenKey(const GrProcessor& processor, const GrShaderC
}
void GLCircularRRectEffect::onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& processor) {
+ const GrFragmentProcessor& processor) {
const CircularRRectEffect& crre = processor.cast<CircularRRectEffect>();
const SkRRect& rrect = crre.getRRect();
if (rrect != fPrevRRect) {
@@ -487,7 +487,7 @@ public:
static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
protected:
- void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override;
+ void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
private:
GrGLSLProgramDataManager::UniformHandle fInnerRectUniform;
@@ -602,7 +602,7 @@ void GLEllipticalRRectEffect::GenKey(const GrProcessor& effect, const GrShaderCa
}
void GLEllipticalRRectEffect::onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& effect) {
+ const GrFragmentProcessor& effect) {
const EllipticalRRectEffect& erre = effect.cast<EllipticalRRectEffect>();
const SkRRect& rrect = erre.getRRect();
// If we're using a scale factor to work around precision issues, choose the largest radius
diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp
index 5d2c2882e5..a41ed8b0b9 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.cpp
+++ b/src/gpu/effects/GrSimpleTextureEffect.cpp
@@ -63,7 +63,8 @@ public:
}
protected:
- void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& processor) override {
+ void onSetData(const GrGLSLProgramDataManager& pdman,
+ const GrFragmentProcessor& processor) override {
const GrSimpleTextureEffect& textureEffect = processor.cast<GrSimpleTextureEffect>();
if (SkToBool(textureEffect.colorSpaceXform())) {
fColorSpaceHelper.setData(pdman, textureEffect.colorSpaceXform());
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index 91b1e552b9..ee21841656 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -305,7 +305,8 @@ GrGLSLFragmentProcessor* GrTextureDomainEffect::onCreateGLSLInstance() const {
}
protected:
- void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& fp) override {
+ void onSetData(const GrGLSLProgramDataManager& pdman,
+ const GrFragmentProcessor& fp) override {
const GrTextureDomainEffect& tde = fp.cast<GrTextureDomainEffect>();
const GrTextureDomain& domain = tde.fTextureDomain;
fGLDomain.setData(pdman, domain, tde.textureSampler(0).texture());
@@ -407,7 +408,8 @@ GrGLSLFragmentProcessor* GrDeviceSpaceTextureDecalFragmentProcessor::onCreateGLS
}
protected:
- void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& fp) override {
+ void onSetData(const GrGLSLProgramDataManager& pdman,
+ const GrFragmentProcessor& fp) override {
const GrDeviceSpaceTextureDecalFragmentProcessor& dstdfp =
fp.cast<GrDeviceSpaceTextureDecalFragmentProcessor>();
GrTexture* texture = dstdfp.textureSampler(0).texture();
diff --git a/src/gpu/effects/GrYUVEffect.cpp b/src/gpu/effects/GrYUVEffect.cpp
index f43f60a29f..be4d6c2d5c 100644
--- a/src/gpu/effects/GrYUVEffect.cpp
+++ b/src/gpu/effects/GrYUVEffect.cpp
@@ -131,7 +131,7 @@ public:
protected:
void onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& processor) override {
+ const GrFragmentProcessor& processor) override {
const YUVtoRGBEffect& yuvEffect = processor.cast<YUVtoRGBEffect>();
switch (yuvEffect.getColorSpace()) {
case kJPEG_SkYUVColorSpace:
@@ -285,7 +285,7 @@ public:
private:
void onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& processor) override {
+ const GrFragmentProcessor& processor) override {
const RGBToYUVEffect& effect = processor.cast<RGBToYUVEffect>();
OutputChannels oc = effect.outputChannels();
if (effect.getColorSpace() != fLastColorSpace || oc != fLastOutputChannels) {