Rename GrGLSLFragmentProcessor to GrFragmentProcessor::ProgramImpl
Bug: skia:11358
Change-Id: Ic179ddd9d52dca3fc0bd85b61db49097390b7f58
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437681
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/gm/destcolor.cpp b/gm/destcolor.cpp
index 1bbc9a8..6814d2e 100644
--- a/gm/destcolor.cpp
+++ b/gm/destcolor.cpp
@@ -50,7 +50,7 @@
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
bool onIsEqual(const GrFragmentProcessor&) const override { return true; }
- class Impl : public GrGLSLFragmentProcessor {
+ class Impl : public ProgramImpl {
void emitCode(EmitArgs& args) override {
SkString result = this->invokeChild(0, args);
args.fFragBuilder->codeAppendf("return (half4(1) - (%s)).rgb1;", result.c_str());
@@ -60,7 +60,7 @@
}
};
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override {
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
return std::make_unique<Impl>();
}
diff --git a/gm/dsl_processor_test.cpp b/gm/dsl_processor_test.cpp
index fab1f0b..258362c 100644
--- a/gm/dsl_processor_test.cpp
+++ b/gm/dsl_processor_test.cpp
@@ -26,8 +26,8 @@
bool onIsEqual(const GrFragmentProcessor& that) const override { return this == &that; }
std::unique_ptr<GrFragmentProcessor> clone() const override { return nullptr; }
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override {
- class Impl : public GrGLSLFragmentProcessor {
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
+ class Impl : public ProgramImpl {
void emitCode(EmitArgs& args) override {
using namespace SkSL::dsl;
StartFragmentProcessor(this, &args);
diff --git a/gm/fp_sample_chaining.cpp b/gm/fp_sample_chaining.cpp
index 22cda9b..c3a8537 100644
--- a/gm/fp_sample_chaining.cpp
+++ b/gm/fp_sample_chaining.cpp
@@ -36,8 +36,8 @@
bool onIsEqual(const GrFragmentProcessor& that) const override { return this == &that; }
std::unique_ptr<GrFragmentProcessor> clone() const override { return nullptr; }
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override {
- class Impl : public GrGLSLFragmentProcessor {
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
+ class Impl : public ProgramImpl {
void emitCode(EmitArgs& args) override {
fMatrixVar =
args.fUniformHandler->addUniform(&args.fFp,
@@ -74,8 +74,8 @@
bool onIsEqual(const GrFragmentProcessor& that) const override { return this == &that; }
std::unique_ptr<GrFragmentProcessor> clone() const override { return nullptr; }
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override {
- class Impl : public GrGLSLFragmentProcessor {
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
+ class Impl : public ProgramImpl {
void emitCode(EmitArgs& args) override {
args.fFragBuilder->codeAppendf("float2 coord = %s + float2(0, 8);",
args.fSampleCoord);
@@ -101,8 +101,8 @@
bool onIsEqual(const GrFragmentProcessor& that) const override { return this == &that; }
std::unique_ptr<GrFragmentProcessor> clone() const override { return nullptr; }
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override {
- class Impl : public GrGLSLFragmentProcessor {
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
+ class Impl : public ProgramImpl {
void emitCode(EmitArgs& args) override {
auto fb = args.fFragBuilder;
fb->codeAppendf("float2 coord = %s / 64.0;", args.fSampleCoord);
diff --git a/gm/fpcoordinateoverride.cpp b/gm/fpcoordinateoverride.cpp
index 62cdc80..74ee7c1 100644
--- a/gm/fpcoordinateoverride.cpp
+++ b/gm/fpcoordinateoverride.cpp
@@ -54,11 +54,11 @@
}
private:
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
using INHERITED = GrFragmentProcessor;
};
-class GLSLSampleCoordEffect : public GrGLSLFragmentProcessor {
+class GLSLSampleCoordEffect : public GrFragmentProcessor::ProgramImpl {
void emitCode(EmitArgs& args) override {
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
SkString sample1 = this->invokeChild(0, args, "float2(sk_FragCoord.x, sk_FragCoord.y)");
@@ -67,7 +67,7 @@
}
};
-std::unique_ptr<GrGLSLFragmentProcessor> SampleCoordEffect::onMakeProgramImpl() const {
+std::unique_ptr<GrFragmentProcessor::ProgramImpl> SampleCoordEffect::onMakeProgramImpl() const {
return std::make_unique<GLSLSampleCoordEffect>();
}
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index c94681b..0fb0d99 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -129,7 +129,7 @@
static constexpr int kInputFPIndex = 1;
private:
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
@@ -158,8 +158,8 @@
this->cloneAndRegisterAllChildProcessors(that);
}
-std::unique_ptr<GrGLSLFragmentProcessor> ColorTableEffect::onMakeProgramImpl() const {
- class Impl : public GrGLSLFragmentProcessor {
+std::unique_ptr<GrFragmentProcessor::ProgramImpl> ColorTableEffect::onMakeProgramImpl() const {
+ class Impl : public ProgramImpl {
public:
void emitCode(EmitArgs& args) override {
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
diff --git a/src/effects/imagefilters/SkDisplacementMapImageFilter.cpp b/src/effects/imagefilters/SkDisplacementMapImageFilter.cpp
index 4358af7..6617a5f 100644
--- a/src/effects/imagefilters/SkDisplacementMapImageFilter.cpp
+++ b/src/effects/imagefilters/SkDisplacementMapImageFilter.cpp
@@ -177,7 +177,7 @@
explicit GrDisplacementMapEffect(const GrDisplacementMapEffect&);
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
@@ -402,7 +402,7 @@
///////////////////////////////////////////////////////////////////////////////
#if SK_SUPPORT_GPU
-class GrDisplacementMapEffect::Impl : public GrGLSLFragmentProcessor {
+class GrDisplacementMapEffect::Impl : public GrFragmentProcessor::ProgramImpl {
public:
void emitCode(EmitArgs&) override;
@@ -416,7 +416,7 @@
UniformHandle fScaleUni;
- using INHERITED = GrGLSLFragmentProcessor;
+ using INHERITED = ProgramImpl;
};
///////////////////////////////////////////////////////////////////////////////
@@ -453,7 +453,8 @@
std::move(colorEffect)));
}
-std::unique_ptr<GrGLSLFragmentProcessor> GrDisplacementMapEffect::onMakeProgramImpl() const {
+std::unique_ptr<GrFragmentProcessor::ProgramImpl>
+GrDisplacementMapEffect::onMakeProgramImpl() const {
return std::make_unique<Impl>();
}
diff --git a/src/effects/imagefilters/SkLightingImageFilter.cpp b/src/effects/imagefilters/SkLightingImageFilter.cpp
index 2902c3d..6b695fb 100644
--- a/src/effects/imagefilters/SkLightingImageFilter.cpp
+++ b/src/effects/imagefilters/SkLightingImageFilter.cpp
@@ -664,7 +664,7 @@
SkScalar kd() const { return fKD; }
private:
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
@@ -709,7 +709,7 @@
return std::unique_ptr<GrFragmentProcessor>(new GrSpecularLightingEffect(*this));
}
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
SkScalar ks() const { return fKS; }
SkScalar shininess() const { return fShininess; }
@@ -1542,7 +1542,7 @@
return result;
}
-class GrGLLightingEffect : public GrGLSLFragmentProcessor {
+class GrGLLightingEffect : public GrFragmentProcessor::ProgramImpl {
public:
GrGLLightingEffect() : fLight(nullptr) { }
~GrGLLightingEffect() override { delete fLight; }
@@ -1563,7 +1563,7 @@
SkString* funcName) = 0;
private:
- using INHERITED = GrGLSLFragmentProcessor;
+ using INHERITED = ProgramImpl;
UniformHandle fSurfaceScaleUni;
GrGLLight* fLight;
@@ -1681,7 +1681,8 @@
GrGLDiffuseLightingEffect::GenKey(*this, caps, b);
}
-std::unique_ptr<GrGLSLFragmentProcessor> GrDiffuseLightingEffect::onMakeProgramImpl() const {
+std::unique_ptr<GrFragmentProcessor::ProgramImpl>
+GrDiffuseLightingEffect::onMakeProgramImpl() const {
return std::make_unique<GrGLDiffuseLightingEffect>();
}
@@ -1906,7 +1907,8 @@
GrGLSpecularLightingEffect::GenKey(*this, caps, b);
}
-std::unique_ptr<GrGLSLFragmentProcessor> GrSpecularLightingEffect::onMakeProgramImpl() const {
+std::unique_ptr<GrFragmentProcessor::ProgramImpl>
+GrSpecularLightingEffect::onMakeProgramImpl() const {
return std::make_unique<GrGLSpecularLightingEffect>();
}
diff --git a/src/effects/imagefilters/SkMorphologyImageFilter.cpp b/src/effects/imagefilters/SkMorphologyImageFilter.cpp
index 74afe25..148cad8 100644
--- a/src/effects/imagefilters/SkMorphologyImageFilter.cpp
+++ b/src/effects/imagefilters/SkMorphologyImageFilter.cpp
@@ -205,7 +205,7 @@
bool fUseRange;
float fRange[2];
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
@@ -220,8 +220,8 @@
using INHERITED = GrFragmentProcessor;
};
-std::unique_ptr<GrGLSLFragmentProcessor> GrMorphologyEffect::onMakeProgramImpl() const {
- class Impl : public GrGLSLFragmentProcessor {
+std::unique_ptr<GrFragmentProcessor::ProgramImpl> GrMorphologyEffect::onMakeProgramImpl() const {
+ class Impl : public ProgramImpl {
public:
void emitCode(EmitArgs& args) override {
constexpr int kInputFPIndex = 0;
diff --git a/src/gpu/GrColorSpaceXform.cpp b/src/gpu/GrColorSpaceXform.cpp
index 8ad15fc..623fa18 100644
--- a/src/gpu/GrColorSpaceXform.cpp
+++ b/src/gpu/GrColorSpaceXform.cpp
@@ -63,7 +63,7 @@
//////////////////////////////////////////////////////////////////////////////
-class GrGLColorSpaceXformEffect : public GrGLSLFragmentProcessor {
+class GrGLColorSpaceXformEffect : public GrFragmentProcessor::ProgramImpl {
public:
void emitCode(EmitArgs& args) override {
const GrColorSpaceXformEffect& proc = args.fFp.cast<GrColorSpaceXformEffect>();
@@ -88,7 +88,7 @@
GrGLSLColorSpaceXformHelper fColorSpaceHelper;
- using INHERITED = GrGLSLFragmentProcessor;
+ using INHERITED = ProgramImpl;
};
//////////////////////////////////////////////////////////////////////////////
@@ -119,7 +119,8 @@
b->add32(GrColorSpaceXform::XformKey(fColorXform.get()));
}
-std::unique_ptr<GrGLSLFragmentProcessor> GrColorSpaceXformEffect::onMakeProgramImpl() const {
+std::unique_ptr<GrFragmentProcessor::ProgramImpl>
+GrColorSpaceXformEffect::onMakeProgramImpl() const {
return std::make_unique<GrGLColorSpaceXformEffect>();
}
diff --git a/src/gpu/GrColorSpaceXform.h b/src/gpu/GrColorSpaceXform.h
index 3304fe4..c81667e 100644
--- a/src/gpu/GrColorSpaceXform.h
+++ b/src/gpu/GrColorSpaceXform.h
@@ -31,7 +31,7 @@
const SkColorSpaceXformSteps& steps() const { return fSteps; }
/**
- * GrGLSLFragmentProcessor::GenKey() must call this and include the returned value in its
+ * GrFragmentProcessor::addToKey() must call this and include the returned value in its
* computed key.
*/
static uint32_t XformKey(const GrColorSpaceXform* xform) {
@@ -95,7 +95,7 @@
static OptimizationFlags OptFlags(const GrFragmentProcessor* child);
SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& input) const override;
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
bool onIsEqual(const GrFragmentProcessor&) const override;
diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp
index dc1357b..676b23e 100644
--- a/src/gpu/GrFragmentProcessor.cpp
+++ b/src/gpu/GrFragmentProcessor.cpp
@@ -62,8 +62,8 @@
}
void GrFragmentProcessor::visitWithImpls(
- const std::function<void(const GrFragmentProcessor&, GrGLSLFragmentProcessor&)>& f,
- GrGLSLFragmentProcessor& impl) const {
+ const std::function<void(const GrFragmentProcessor&, ProgramImpl&)>& f,
+ ProgramImpl& impl) const {
f(*this, impl);
SkASSERT(impl.numChildProcessors() == this->numChildProcessors());
for (int i = 0; i < this->numChildProcessors(); ++i) {
@@ -111,15 +111,14 @@
}
#endif
-std::unique_ptr<GrGLSLFragmentProcessor> GrFragmentProcessor::makeProgramImpl() const {
- std::unique_ptr<GrGLSLFragmentProcessor> glFragProc = this->onMakeProgramImpl();
- glFragProc->fChildProcessors.push_back_n(fChildProcessors.count());
+std::unique_ptr<GrFragmentProcessor::ProgramImpl> GrFragmentProcessor::makeProgramImpl() const {
+ std::unique_ptr<ProgramImpl> impl = this->onMakeProgramImpl();
+ impl->fChildProcessors.push_back_n(fChildProcessors.count());
for (int i = 0; i < fChildProcessors.count(); ++i) {
- glFragProc->fChildProcessors[i] = fChildProcessors[i]
- ? fChildProcessors[i]->makeProgramImpl()
- : nullptr;
+ impl->fChildProcessors[i] = fChildProcessors[i] ? fChildProcessors[i]->makeProgramImpl()
+ : nullptr;
}
- return glFragProc;
+ return impl;
}
int GrFragmentProcessor::numNonNullChildProcessors() const {
@@ -286,8 +285,8 @@
this->registerChild(std::move(fp));
}
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override {
- class GLFP : public GrGLSLFragmentProcessor {
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
+ class GLFP : public ProgramImpl {
public:
void emitCode(EmitArgs& args) override {
SkString childColor = this->invokeChild(0, args);
@@ -352,8 +351,8 @@
this->registerChild(std::move(processor));
}
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override {
- class GLFP : public GrGLSLFragmentProcessor {
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
+ class GLFP : public ProgramImpl {
public:
void emitCode(EmitArgs& args) override {
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
@@ -471,8 +470,8 @@
}
private:
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override {
- class GLFP : public GrGLSLFragmentProcessor {
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
+ class GLFP : public ProgramImpl {
public:
void emitCode(EmitArgs& args) override {
SkString result = this->invokeChild(1, args); // g(x)
@@ -604,8 +603,8 @@
const char* name() const override { return "SurfaceColor"; }
private:
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override {
- class GLFP : public GrGLSLFragmentProcessor {
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
+ class GLFP : public ProgramImpl {
public:
void emitCode(EmitArgs& args) override {
const char* dstColor = args.fFragBuilder->dstColor();
@@ -660,11 +659,11 @@
return this->childProcessor(0)->constantOutputForConstantInput(f);
}
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override {
- class Impl : public GrGLSLFragmentProcessor {
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
+ class Impl : public ProgramImpl {
public:
Impl() = default;
- void emitCode(GrGLSLFragmentProcessor::EmitArgs& args) override {
+ void emitCode(ProgramImpl::EmitArgs& args) override {
auto child = this->invokeChild(0, args.fInputColor, args, "sk_FragCoord.xy");
args.fFragBuilder->codeAppendf("return %s;", child.c_str());
}
@@ -905,8 +904,8 @@
this->registerChild(std::move(fp));
}
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override {
- class GLFP : public GrGLSLFragmentProcessor {
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
+ class GLFP : public ProgramImpl {
public:
void emitCode(EmitArgs& args) override {
SkString childColor = this->invokeChild(0, args);
diff --git a/src/gpu/GrFragmentProcessor.h b/src/gpu/GrFragmentProcessor.h
index f7a48d3..3663342 100644
--- a/src/gpu/GrFragmentProcessor.h
+++ b/src/gpu/GrFragmentProcessor.h
@@ -13,7 +13,6 @@
#include "include/private/SkSLSampleUsage.h"
#include "src/gpu/GrProcessor.h"
-class GrGLSLFragmentProcessor;
class GrPaint;
class GrPipeline;
class GrProcessorKeyBuilder;
@@ -36,6 +35,14 @@
*/
class GrFragmentProcessor : public GrProcessor {
public:
+ /**
+ * Any GrFragmentProcessor is capable of creating a subclass of ProgramImpl. The ProgramImpl
+ * emits the fragment shader code that implements the GrFragmentProcessor, is attached to the
+ * generated backend API pipeline/program and used to extract uniform data from
+ * GrFragmentProcessor instances.
+ */
+ class ProgramImpl;
+
/** Always returns 'color'. */
static std::unique_ptr<GrFragmentProcessor> MakeColor(SkPMColor4f color);
@@ -195,7 +202,7 @@
// The FP this was registered with as a child function. This will be null if this is a root.
const GrFragmentProcessor* parent() const { return fParent; }
- std::unique_ptr<GrGLSLFragmentProcessor> makeProgramImpl() const;
+ std::unique_ptr<ProgramImpl> makeProgramImpl() const;
void addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
this->onAddToKey(caps, b);
@@ -303,9 +310,8 @@
void visitTextureEffects(const std::function<void(const GrTextureEffect&)>&) const;
- void visitWithImpls(
- const std::function<void(const GrFragmentProcessor&, GrGLSLFragmentProcessor&)>&,
- GrGLSLFragmentProcessor&) const;
+ void visitWithImpls(const std::function<void(const GrFragmentProcessor&, ProgramImpl&)>&,
+ ProgramImpl&) const;
GrTextureEffect* asTextureEffect();
const GrTextureEffect* asTextureEffect() const;
@@ -405,20 +411,20 @@
*/
void cloneAndRegisterAllChildProcessors(const GrFragmentProcessor& src);
- // FP implementations must call this function if their matching GrGLSLFragmentProcessor's
- // emitCode() function uses the EmitArgs::fSampleCoord variable in generated SkSL.
+ // FP implementations must call this function if their matching ProgramImpl's emitCode()
+ // function uses the EmitArgs::fSampleCoord variable in generated SkSL.
void setUsesSampleCoordsDirectly() {
fFlags |= kUsesSampleCoordsDirectly_Flag;
}
- // FP implementations must set this flag if their GrGLSLFragmentProcessor's emitCode() function
- // calls dstColor() to read back the framebuffer.
+ // FP implementations must set this flag if their ProgramImpl's emitCode() function calls
+ // dstColor() to read back the framebuffer.
void setWillReadDstColor() {
fFlags |= kWillReadDstColor_Flag;
}
- // FP implementations must set this flag if their GrGLSLFragmentProcessor's emitCode() function
- // emits a blend function (taking two color inputs instead of just one).
+ // FP implementations must set this flag if their ProgramImpl's emitCode() function emits a
+ // blend function (taking two color inputs instead of just one).
void setIsBlendFunction() {
fFlags |= kIsBlendFunction_Flag;
}
@@ -433,10 +439,12 @@
SK_ABORT("Subclass must override this if advertising this optimization.");
}
- /** Returns a new instance of the appropriate *GL* implementation class
- for the given GrFragmentProcessor; caller is responsible for deleting
- the object. */
- virtual std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const = 0;
+ /**
+ * Returns a new instance of the appropriate ProgramImpl subclass for the given
+ * GrFragmentProcessor. It will emit the appropriate code and live with the cached program
+ * to setup uniform data for each draw that uses the program.
+ */
+ virtual std::unique_ptr<ProgramImpl> onMakeProgramImpl() const = 0;
virtual void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const = 0;
diff --git a/src/gpu/d3d/GrD3DPipelineState.cpp b/src/gpu/d3d/GrD3DPipelineState.cpp
index ee1cb68..c2e5377 100644
--- a/src/gpu/d3d/GrD3DPipelineState.cpp
+++ b/src/gpu/d3d/GrD3DPipelineState.cpp
@@ -28,7 +28,7 @@
uint32_t numSamplers,
std::unique_ptr<GrGLSLGeometryProcessor> geometryProcessor,
std::unique_ptr<GrGLSLXferProcessor> xferProcessor,
- std::vector<std::unique_ptr<GrGLSLFragmentProcessor>> fpImpls,
+ std::vector<std::unique_ptr<GrFragmentProcessor::ProgramImpl>> fpImpls,
size_t vertexStride,
size_t instanceStride)
: fPipeline(std::move(pipeline))
@@ -51,7 +51,8 @@
for (int i = 0; i < programInfo.pipeline().numFragmentProcessors(); ++i) {
const auto& fp = programInfo.pipeline().getFragmentProcessor(i);
- fp.visitWithImpls([&](const GrFragmentProcessor& fp, GrGLSLFragmentProcessor& impl) {
+ fp.visitWithImpls([&](const GrFragmentProcessor& fp,
+ GrFragmentProcessor::ProgramImpl& impl) {
impl.setData(fDataManager, fp);
}, *fFPImpls[i]);
}
diff --git a/src/gpu/d3d/GrD3DPipelineState.h b/src/gpu/d3d/GrD3DPipelineState.h
index 836ffc2..67e3546 100644
--- a/src/gpu/d3d/GrD3DPipelineState.h
+++ b/src/gpu/d3d/GrD3DPipelineState.h
@@ -35,7 +35,7 @@
uint32_t numSamplers,
std::unique_ptr<GrGLSLGeometryProcessor> geometryProcessor,
std::unique_ptr<GrGLSLXferProcessor> xferProcessor,
- std::vector<std::unique_ptr<GrGLSLFragmentProcessor>> fpImpls,
+ std::vector<std::unique_ptr<GrFragmentProcessor::ProgramImpl>> fpImpls,
size_t vertexStride,
size_t instanceStride);
@@ -89,7 +89,7 @@
// Processors in the GrD3DPipelineState
std::unique_ptr<GrGLSLGeometryProcessor> fGeometryProcessor;
std::unique_ptr<GrGLSLXferProcessor> fXferProcessor;
- std::vector<std::unique_ptr<GrGLSLFragmentProcessor>> fFPImpls;
+ std::vector<std::unique_ptr<GrFragmentProcessor::ProgramImpl>> fFPImpls;
GrD3DPipelineStateDataManager fDataManager;
diff --git a/src/gpu/dawn/GrDawnProgramBuilder.cpp b/src/gpu/dawn/GrDawnProgramBuilder.cpp
index b585e9e..a156665 100644
--- a/src/gpu/dawn/GrDawnProgramBuilder.cpp
+++ b/src/gpu/dawn/GrDawnProgramBuilder.cpp
@@ -506,7 +506,8 @@
for (int i = 0; i < programInfo.pipeline().numFragmentProcessors(); ++i) {
const auto& fp = programInfo.pipeline().getFragmentProcessor(i);
- fp.visitWithImpls([&](const GrFragmentProcessor& fp, GrGLSLFragmentProcessor& impl) {
+ fp.visitWithImpls([&](const GrFragmentProcessor& fp,
+ GrFragmentProcessor::ProgramImpl& impl) {
impl.setData(fDataManager, fp);
}, *fFPImpls[i]);
}
diff --git a/src/gpu/dawn/GrDawnProgramBuilder.h b/src/gpu/dawn/GrDawnProgramBuilder.h
index a01670e..5c91140 100644
--- a/src/gpu/dawn/GrDawnProgramBuilder.h
+++ b/src/gpu/dawn/GrDawnProgramBuilder.h
@@ -38,7 +38,7 @@
}
std::unique_ptr<GrGLSLGeometryProcessor> fGeometryProcessor;
std::unique_ptr<GrGLSLXferProcessor> fXferProcessor;
- std::vector<std::unique_ptr<GrGLSLFragmentProcessor>> fFPImpls;
+ std::vector<std::unique_ptr<GrFragmentProcessor::ProgramImpl>> fFPImpls;
std::vector<wgpu::BindGroupLayout> fBindGroupLayouts;
wgpu::RenderPipeline fRenderPipeline;
GrDawnProgramDataManager fDataManager;
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index 56af0ba..d0ab3c5 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -16,7 +16,7 @@
#include "src/gpu/glsl/GrGLSLUniformHandler.h"
#include <cmath>
-class GrBicubicEffect::Impl : public GrGLSLFragmentProcessor {
+class GrBicubicEffect::Impl : public GrFragmentProcessor::ProgramImpl {
public:
Impl() : fKernel{-1, -1} {}
void emitCode(EmitArgs&) override;
@@ -27,7 +27,7 @@
private:
SkImage::CubicResampler fKernel;
UniformHandle fCoefficientUni;
- using INHERITED = GrGLSLFragmentProcessor;
+ using INHERITED = ProgramImpl;
};
void GrBicubicEffect::Impl::emitCode(EmitArgs& args) {
@@ -224,7 +224,7 @@
b->add32(key);
}
-std::unique_ptr<GrGLSLFragmentProcessor> GrBicubicEffect::onMakeProgramImpl() const {
+std::unique_ptr<GrFragmentProcessor::ProgramImpl> GrBicubicEffect::onMakeProgramImpl() const {
return std::make_unique<Impl>();
}
diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h
index b747b31..a98a6e5 100644
--- a/src/gpu/effects/GrBicubicEffect.h
+++ b/src/gpu/effects/GrBicubicEffect.h
@@ -112,7 +112,7 @@
explicit GrBicubicEffect(const GrBicubicEffect&);
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/gpu/effects/GrBlendFragmentProcessor.cpp b/src/gpu/effects/GrBlendFragmentProcessor.cpp
index 5165687..45c2f51 100644
--- a/src/gpu/effects/GrBlendFragmentProcessor.cpp
+++ b/src/gpu/effects/GrBlendFragmentProcessor.cpp
@@ -163,7 +163,7 @@
return SkBlendMode_Apply(fMode, srcColor, dstColor);
}
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
SkBlendMode fMode;
@@ -174,12 +174,12 @@
/////////////////////////////////////////////////////////////////////
-class GLBlendFragmentProcessor : public GrGLSLFragmentProcessor {
+class GLBlendFragmentProcessor : public GrFragmentProcessor::ProgramImpl {
public:
void emitCode(EmitArgs&) override;
private:
- using INHERITED = GrGLSLFragmentProcessor;
+ using INHERITED = ProgramImpl;
};
/////////////////////////////////////////////////////////////////////
@@ -208,7 +208,7 @@
return std::unique_ptr<GrFragmentProcessor>(new BlendFragmentProcessor(*this));
}
-std::unique_ptr<GrGLSLFragmentProcessor> BlendFragmentProcessor::onMakeProgramImpl() const {
+std::unique_ptr<GrFragmentProcessor::ProgramImpl> BlendFragmentProcessor::onMakeProgramImpl() const {
return std::make_unique<GLBlendFragmentProcessor>();
}
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index 2052244..64451c6 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -15,7 +15,7 @@
//////////////////////////////////////////////////////////////////////////////
-class GrGLConvexPolyEffect : public GrGLSLFragmentProcessor {
+class GrGLConvexPolyEffect : public GrFragmentProcessor::ProgramImpl {
public:
GrGLConvexPolyEffect() {
for (size_t i = 0; i < SK_ARRAY_COUNT(fPrevEdges); ++i) {
@@ -33,7 +33,7 @@
private:
GrGLSLProgramDataManager::UniformHandle fEdgeUniform;
SkScalar fPrevEdges[3 * GrConvexPolyEffect::kMaxEdges];
- using INHERITED = GrGLSLFragmentProcessor;
+ using INHERITED = ProgramImpl;
};
void GrGLConvexPolyEffect::emitCode(EmitArgs& args) {
@@ -161,7 +161,7 @@
GrGLConvexPolyEffect::GenKey(*this, caps, b);
}
-std::unique_ptr<GrGLSLFragmentProcessor> GrConvexPolyEffect::onMakeProgramImpl() const {
+std::unique_ptr<GrFragmentProcessor::ProgramImpl> GrConvexPolyEffect::onMakeProgramImpl() const {
return std::make_unique<GrGLConvexPolyEffect>();
}
diff --git a/src/gpu/effects/GrConvexPolyEffect.h b/src/gpu/effects/GrConvexPolyEffect.h
index 2010b99..bdc7a4f 100644
--- a/src/gpu/effects/GrConvexPolyEffect.h
+++ b/src/gpu/effects/GrConvexPolyEffect.h
@@ -69,7 +69,7 @@
int n, const SkScalar edges[]);
GrConvexPolyEffect(const GrConvexPolyEffect&);
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
index 9fb11f4..06e755a 100644
--- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
+++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
@@ -21,7 +21,7 @@
using UniformHandle = GrGLSLProgramDataManager::UniformHandle;
using Direction = GrGaussianConvolutionFragmentProcessor::Direction;
-class GrGaussianConvolutionFragmentProcessor::Impl : public GrGLSLFragmentProcessor {
+class GrGaussianConvolutionFragmentProcessor::Impl : public GrFragmentProcessor::ProgramImpl {
public:
void emitCode(EmitArgs&) override;
@@ -36,7 +36,7 @@
UniformHandle fKernelWidthUni;
UniformHandle fIncrementUni;
- using INHERITED = GrGLSLFragmentProcessor;
+ using INHERITED = ProgramImpl;
};
enum class LoopType {
@@ -241,7 +241,7 @@
Impl::GenKey(*this, caps, b);
}
-std::unique_ptr<GrGLSLFragmentProcessor>
+std::unique_ptr<GrFragmentProcessor::ProgramImpl>
GrGaussianConvolutionFragmentProcessor::onMakeProgramImpl() const {
return std::make_unique<Impl>();
}
diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h
index bae6ed7..5eff228 100644
--- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h
+++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h
@@ -66,7 +66,7 @@
}
#endif
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index a7ef6be..1b00840 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -20,7 +20,7 @@
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
#include "src/gpu/glsl/GrGLSLUniformHandler.h"
-class GrGLMatrixConvolutionEffect : public GrGLSLFragmentProcessor {
+class GrGLMatrixConvolutionEffect : public GrFragmentProcessor::ProgramImpl {
public:
void emitCode(EmitArgs&) override;
@@ -40,7 +40,7 @@
UniformHandle fBiasUni;
UniformHandle fKernelBiasUni;
- using INHERITED = GrGLSLFragmentProcessor;
+ using INHERITED = ProgramImpl;
};
GrMatrixConvolutionEffect::KernelWrapper::MakeResult
@@ -321,7 +321,8 @@
GrGLMatrixConvolutionEffect::GenKey(*this, caps, b);
}
-std::unique_ptr<GrGLSLFragmentProcessor> GrMatrixConvolutionEffect::onMakeProgramImpl() const {
+std::unique_ptr<GrFragmentProcessor::ProgramImpl>
+GrMatrixConvolutionEffect::onMakeProgramImpl() const {
return std::make_unique<GrGLMatrixConvolutionEffect>();
}
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.h b/src/gpu/effects/GrMatrixConvolutionEffect.h
index e7ee96c..2e29c2e 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.h
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.h
@@ -110,7 +110,7 @@
explicit GrMatrixConvolutionEffect(const GrMatrixConvolutionEffect&);
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/gpu/effects/GrMatrixEffect.cpp b/src/gpu/effects/GrMatrixEffect.cpp
index ab3bf04..4301570 100644
--- a/src/gpu/effects/GrMatrixEffect.cpp
+++ b/src/gpu/effects/GrMatrixEffect.cpp
@@ -14,7 +14,7 @@
#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
#include "src/sksl/SkSLUtil.h"
-class GrGLSLMatrixEffect : public GrGLSLFragmentProcessor {
+class GrGLSLMatrixEffect : public GrFragmentProcessor::ProgramImpl {
public:
GrGLSLMatrixEffect() {}
@@ -57,7 +57,7 @@
return std::unique_ptr<GrFragmentProcessor>(new GrMatrixEffect(matrix, std::move(child)));
}
-std::unique_ptr<GrGLSLFragmentProcessor> GrMatrixEffect::onMakeProgramImpl() const {
+std::unique_ptr<GrFragmentProcessor::ProgramImpl> GrMatrixEffect::onMakeProgramImpl() const {
return std::make_unique<GrGLSLMatrixEffect>();
}
diff --git a/src/gpu/effects/GrMatrixEffect.h b/src/gpu/effects/GrMatrixEffect.h
index 7852a7c..8016b4f 100644
--- a/src/gpu/effects/GrMatrixEffect.h
+++ b/src/gpu/effects/GrMatrixEffect.h
@@ -33,7 +33,7 @@
SkSL::SampleUsage::UniformMatrix(matrix.hasPerspective()));
}
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
bool onIsEqual(const GrFragmentProcessor&) const override;
SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& inputColor) const override {
diff --git a/src/gpu/effects/GrModulateAtlasCoverageEffect.cpp b/src/gpu/effects/GrModulateAtlasCoverageEffect.cpp
index c23e1e6..738e126 100644
--- a/src/gpu/effects/GrModulateAtlasCoverageEffect.cpp
+++ b/src/gpu/effects/GrModulateAtlasCoverageEffect.cpp
@@ -35,8 +35,9 @@
this->cloneAndRegisterAllChildProcessors(that);
}
-std::unique_ptr<GrGLSLFragmentProcessor> GrModulateAtlasCoverageEffect::onMakeProgramImpl() const {
- class Impl : public GrGLSLFragmentProcessor {
+std::unique_ptr<GrFragmentProcessor::ProgramImpl>
+GrModulateAtlasCoverageEffect::onMakeProgramImpl() const {
+ class Impl : public ProgramImpl {
void emitCode(EmitArgs& args) override {
auto fp = args.fFp.cast<GrModulateAtlasCoverageEffect>();
auto f = args.fFragBuilder;
diff --git a/src/gpu/effects/GrModulateAtlasCoverageEffect.h b/src/gpu/effects/GrModulateAtlasCoverageEffect.h
index 0096b40..5a12b28 100644
--- a/src/gpu/effects/GrModulateAtlasCoverageEffect.h
+++ b/src/gpu/effects/GrModulateAtlasCoverageEffect.h
@@ -40,7 +40,7 @@
auto fp = that.cast<GrModulateAtlasCoverageEffect>();
return fFlags == fp.fFlags && fBounds == fp.fBounds;
}
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
private:
const Flags fFlags;
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index e17b6ae..0daada2 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -65,7 +65,7 @@
GrClipEdgeType, uint32_t circularCornerFlags, const SkRRect&);
CircularRRectEffect(const CircularRRectEffect& that);
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
@@ -146,7 +146,7 @@
//////////////////////////////////////////////////////////////////////////////
-class GLCircularRRectEffect : public GrGLSLFragmentProcessor {
+class GLCircularRRectEffect : public GrFragmentProcessor::ProgramImpl {
public:
GLCircularRRectEffect() = default;
@@ -161,7 +161,7 @@
GrGLSLProgramDataManager::UniformHandle fInnerRectUniform;
GrGLSLProgramDataManager::UniformHandle fRadiusPlusHalfUniform;
SkRRect fPrevRRect;
- using INHERITED = GrGLSLFragmentProcessor;
+ using INHERITED = ProgramImpl;
};
void GLCircularRRectEffect::emitCode(EmitArgs& args) {
@@ -394,7 +394,7 @@
GLCircularRRectEffect::GenKey(*this, caps, b);
}
-std::unique_ptr<GrGLSLFragmentProcessor> CircularRRectEffect::onMakeProgramImpl() const {
+std::unique_ptr<GrFragmentProcessor::ProgramImpl> CircularRRectEffect::onMakeProgramImpl() const {
return std::make_unique<GLCircularRRectEffect>();
}
@@ -418,7 +418,7 @@
EllipticalRRectEffect(std::unique_ptr<GrFragmentProcessor>, GrClipEdgeType, const SkRRect&);
EllipticalRRectEffect(const EllipticalRRectEffect& that);
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
@@ -513,7 +513,7 @@
//////////////////////////////////////////////////////////////////////////////
-class GLEllipticalRRectEffect : public GrGLSLFragmentProcessor {
+class GLEllipticalRRectEffect : public GrFragmentProcessor::ProgramImpl {
public:
GLEllipticalRRectEffect() = default;
@@ -529,7 +529,7 @@
GrGLSLProgramDataManager::UniformHandle fInvRadiiSqdUniform;
GrGLSLProgramDataManager::UniformHandle fScaleUniform;
SkRRect fPrevRRect;
- using INHERITED = GrGLSLFragmentProcessor;
+ using INHERITED = ProgramImpl;
};
void GLEllipticalRRectEffect::emitCode(EmitArgs& args) {
@@ -699,7 +699,7 @@
GLEllipticalRRectEffect::GenKey(*this, caps, b);
}
-std::unique_ptr<GrGLSLFragmentProcessor> EllipticalRRectEffect::onMakeProgramImpl() const {
+std::unique_ptr<GrFragmentProcessor::ProgramImpl> EllipticalRRectEffect::onMakeProgramImpl() const {
return std::make_unique<GLEllipticalRRectEffect>();
}
diff --git a/src/gpu/effects/GrSkSLFP.cpp b/src/gpu/effects/GrSkSLFP.cpp
index c8c7d34..eb8a1e7 100644
--- a/src/gpu/effects/GrSkSLFP.cpp
+++ b/src/gpu/effects/GrSkSLFP.cpp
@@ -23,7 +23,7 @@
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
-class GrGLSLSkSLFP : public GrGLSLFragmentProcessor {
+class GrGLSLSkSLFP : public GrFragmentProcessor::ProgramImpl {
public:
void emitCode(EmitArgs& args) override {
const GrSkSLFP& fp = args.fFp.cast<GrSkSLFP>();
@@ -353,7 +353,7 @@
this->registerChild(std::move(destColorFP), SkSL::SampleUsage::PassThrough());
}
-std::unique_ptr<GrGLSLFragmentProcessor> GrSkSLFP::onMakeProgramImpl() const {
+std::unique_ptr<GrFragmentProcessor::ProgramImpl> GrSkSLFP::onMakeProgramImpl() const {
return std::make_unique<GrGLSLSkSLFP>();
}
diff --git a/src/gpu/effects/GrSkSLFP.h b/src/gpu/effects/GrSkSLFP.h
index c8953f2..31b6769 100644
--- a/src/gpu/effects/GrSkSLFP.h
+++ b/src/gpu/effects/GrSkSLFP.h
@@ -167,7 +167,7 @@
void setInput(std::unique_ptr<GrFragmentProcessor> input);
void setDestColorFP(std::unique_ptr<GrFragmentProcessor> destColorFP);
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/gpu/effects/GrTextureEffect.cpp b/src/gpu/effects/GrTextureEffect.cpp
index 578c246..2b2beaa 100644
--- a/src/gpu/effects/GrTextureEffect.cpp
+++ b/src/gpu/effects/GrTextureEffect.cpp
@@ -716,7 +716,7 @@
}
}
-std::unique_ptr<GrGLSLFragmentProcessor> GrTextureEffect::onMakeProgramImpl() const {
+std::unique_ptr<GrFragmentProcessor::ProgramImpl> GrTextureEffect::onMakeProgramImpl() const {
return std::make_unique<Impl>();
}
diff --git a/src/gpu/effects/GrTextureEffect.h b/src/gpu/effects/GrTextureEffect.h
index 79a16c5..072f22c 100644
--- a/src/gpu/effects/GrTextureEffect.h
+++ b/src/gpu/effects/GrTextureEffect.h
@@ -110,7 +110,7 @@
// after proxy instantiation with coordination from GrMatrixEffect.
SkMatrix coordAdjustmentMatrix() const;
- class Impl : public GrGLSLFragmentProcessor {
+ class Impl : public ProgramImpl {
public:
void emitCode(EmitArgs&) override;
void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
@@ -166,7 +166,7 @@
explicit GrTextureEffect(const GrTextureEffect& src);
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp
index e846aa2..57a68e3 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.cpp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp
@@ -238,8 +238,8 @@
}
#endif
-std::unique_ptr<GrGLSLFragmentProcessor> GrYUVtoRGBEffect::onMakeProgramImpl() const {
- class GrGLSLYUVtoRGBEffect : public GrGLSLFragmentProcessor {
+std::unique_ptr<GrFragmentProcessor::ProgramImpl> GrYUVtoRGBEffect::onMakeProgramImpl() const {
+ class GrGLSLYUVtoRGBEffect : public ProgramImpl {
public:
GrGLSLYUVtoRGBEffect() {}
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.h b/src/gpu/effects/GrYUVtoRGBEffect.h
index 7135f82..e617750 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.h
+++ b/src/gpu/effects/GrYUVtoRGBEffect.h
@@ -39,7 +39,7 @@
SkString onDumpInfo() const override;
#endif
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 8026264..297f8f2 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -33,7 +33,7 @@
const UniformInfoArray& textureSamplers,
std::unique_ptr<GrGLSLGeometryProcessor> geometryProcessor,
std::unique_ptr<GrGLSLXferProcessor> xferProcessor,
- std::vector<std::unique_ptr<GrGLSLFragmentProcessor>> fpImpls,
+ std::vector<std::unique_ptr<GrFragmentProcessor::ProgramImpl>> fpImpls,
std::unique_ptr<Attribute[]> attributes,
int vertexAttributeCnt,
int instanceAttributeCnt,
@@ -65,7 +65,7 @@
const UniformInfoArray& textureSamplers,
std::unique_ptr<GrGLSLGeometryProcessor> geometryProcessor,
std::unique_ptr<GrGLSLXferProcessor> xferProcessor,
- std::vector<std::unique_ptr<GrGLSLFragmentProcessor>> fpImpls,
+ std::vector<std::unique_ptr<GrFragmentProcessor::ProgramImpl>> fpImpls,
std::unique_ptr<Attribute[]> attributes,
int vertexAttributeCnt,
int instanceAttributeCnt,
@@ -114,7 +114,8 @@
for (int i = 0; i < programInfo.pipeline().numFragmentProcessors(); ++i) {
const auto& fp = programInfo.pipeline().getFragmentProcessor(i);
- fp.visitWithImpls([&](const GrFragmentProcessor& fp, GrGLSLFragmentProcessor& impl) {
+ fp.visitWithImpls([&](const GrFragmentProcessor& fp,
+ GrFragmentProcessor::ProgramImpl& impl) {
impl.setData(fProgramDataManager, fp);
}, *fFPImpls[i]);
}
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index b8762f6..d6f7f9b 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -9,13 +9,13 @@
#ifndef GrGLProgram_DEFINED
#define GrGLProgram_DEFINED
+#include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/gl/GrGLProgramDataManager.h"
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
#include "src/gpu/glsl/GrGLSLUniformHandler.h"
#include <vector>
-class GrGLSLFragmentProcessor;
class GrGLSLGeometryProcessor;
class GrGLSLXferProcessor;
class GrPipeline;
@@ -50,19 +50,20 @@
* The attribute array consists of vertexAttributeCnt + instanceAttributeCnt elements with
* the vertex attributes preceding the instance attributes.
*/
- static sk_sp<GrGLProgram> Make(GrGLGpu*,
- const GrGLSLBuiltinUniformHandles&,
- GrGLuint programID,
- const UniformInfoArray& uniforms,
- const UniformInfoArray& textureSamplers,
- std::unique_ptr<GrGLSLGeometryProcessor>,
- std::unique_ptr<GrGLSLXferProcessor>,
- std::vector<std::unique_ptr<GrGLSLFragmentProcessor>> fps,
- std::unique_ptr<Attribute[]>,
- int vertexAttributeCnt,
- int instanceAttributeCnt,
- int vertexStride,
- int instanceStride);
+ static sk_sp<GrGLProgram> Make(
+ GrGLGpu*,
+ const GrGLSLBuiltinUniformHandles&,
+ GrGLuint programID,
+ const UniformInfoArray& uniforms,
+ const UniformInfoArray& textureSamplers,
+ std::unique_ptr<GrGLSLGeometryProcessor>,
+ std::unique_ptr<GrGLSLXferProcessor>,
+ std::vector<std::unique_ptr<GrFragmentProcessor::ProgramImpl>> fps,
+ std::unique_ptr<Attribute[]>,
+ int vertexAttributeCnt,
+ int instanceAttributeCnt,
+ int vertexStride,
+ int instanceStride);
~GrGLProgram() override;
@@ -130,7 +131,7 @@
const UniformInfoArray& textureSamplers,
std::unique_ptr<GrGLSLGeometryProcessor>,
std::unique_ptr<GrGLSLXferProcessor>,
- std::vector<std::unique_ptr<GrGLSLFragmentProcessor>> fpImpls,
+ std::vector<std::unique_ptr<GrFragmentProcessor::ProgramImpl>> fpImpls,
std::unique_ptr<Attribute[]>,
int vertexAttributeCnt,
int instanceAttributeCnt,
@@ -148,7 +149,7 @@
// the installed effects
std::unique_ptr<GrGLSLGeometryProcessor> fGeometryProcessor;
std::unique_ptr<GrGLSLXferProcessor> fXferProcessor;
- std::vector<std::unique_ptr<GrGLSLFragmentProcessor>> fFPImpls;
+ std::vector<std::unique_ptr<GrFragmentProcessor::ProgramImpl>> fFPImpls;
std::unique_ptr<Attribute[]> fAttributes;
int fVertexAttributeCnt;
diff --git a/src/gpu/glsl/GrGLSLFragmentProcessor.cpp b/src/gpu/glsl/GrGLSLFragmentProcessor.cpp
index 0f342a2..a9d4e81 100644
--- a/src/gpu/glsl/GrGLSLFragmentProcessor.cpp
+++ b/src/gpu/glsl/GrGLSLFragmentProcessor.cpp
@@ -14,14 +14,16 @@
#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
#include "src/gpu/glsl/GrGLSLUniformHandler.h"
-void GrGLSLFragmentProcessor::setData(const GrGLSLProgramDataManager& pdman,
- const GrFragmentProcessor& processor) {
+using ProgramImpl = GrFragmentProcessor::ProgramImpl;
+
+void ProgramImpl::setData(const GrGLSLProgramDataManager& pdman,
+ const GrFragmentProcessor& processor) {
this->onSetData(pdman, processor);
}
-void GrGLSLFragmentProcessor::emitChildFunctions(EmitArgs& args) {
+void ProgramImpl::emitChildFunctions(EmitArgs& args) {
for (int i = 0; i < this->numChildProcessors(); ++i) {
- GrGLSLFragmentProcessor* childGLSLFP = this->childProcessor(i);
+ ProgramImpl* childGLSLFP = this->childProcessor(i);
if (!childGLSLFP) {
continue;
}
@@ -40,9 +42,11 @@
}
}
-SkString GrGLSLFragmentProcessor::invokeChild(int childIndex,
- const char* inputColor, const char* destColor,
- EmitArgs& args, SkSL::String skslCoords) {
+SkString ProgramImpl::invokeChild(int childIndex,
+ const char* inputColor,
+ const char* destColor,
+ EmitArgs& args,
+ SkSL::String skslCoords) {
SkASSERT(childIndex >= 0);
if (!inputColor) {
@@ -79,8 +83,10 @@
return invocation;
}
-SkString GrGLSLFragmentProcessor::invokeChildWithMatrix(int childIndex, const char* inputColor,
- const char* destColor, EmitArgs& args) {
+SkString ProgramImpl::invokeChildWithMatrix(int childIndex,
+ const char* inputColor,
+ const char* destColor,
+ EmitArgs& args) {
SkASSERT(childIndex >= 0);
if (!inputColor) {
diff --git a/src/gpu/glsl/GrGLSLFragmentProcessor.h b/src/gpu/glsl/GrGLSLFragmentProcessor.h
index 67f96a7..56f9e67 100644
--- a/src/gpu/glsl/GrGLSLFragmentProcessor.h
+++ b/src/gpu/glsl/GrGLSLFragmentProcessor.h
@@ -14,16 +14,13 @@
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
#include "src/gpu/glsl/GrGLSLUniformHandler.h"
-class GrProcessor;
-class GrProcessorKeyBuilder;
-class GrGLSLFPBuilder;
class GrGLSLFPFragmentBuilder;
-class GrGLSLFragmentProcessor {
+class GrFragmentProcessor::ProgramImpl {
public:
- GrGLSLFragmentProcessor() = default;
+ ProgramImpl() = default;
- virtual ~GrGLSLFragmentProcessor() = default;
+ virtual ~ProgramImpl() = default;
using UniformHandle = GrGLSLUniformHandler::UniformHandle;
using SamplerHandle = GrGLSLUniformHandler::SamplerHandle;
@@ -80,9 +77,7 @@
int numChildProcessors() const { return fChildProcessors.count(); }
- GrGLSLFragmentProcessor* childProcessor(int index) const {
- return fChildProcessors[index].get();
- }
+ ProgramImpl* childProcessor(int index) const { return fChildProcessors[index].get(); }
void setFunctionName(SkString name) {
SkASSERT(fFunctionName.isEmpty());
@@ -152,11 +147,11 @@
*/
class Iter {
public:
- Iter(std::unique_ptr<GrGLSLFragmentProcessor> fps[], int cnt);
- Iter(GrGLSLFragmentProcessor& fp) { fFPStack.push_back(&fp); }
+ Iter(std::unique_ptr<ProgramImpl> fps[], int cnt);
+ Iter(ProgramImpl& fp) { fFPStack.push_back(&fp); }
- GrGLSLFragmentProcessor& operator*() const;
- GrGLSLFragmentProcessor* operator->() const;
+ ProgramImpl& operator*() const;
+ ProgramImpl* operator->() const;
Iter& operator++();
operator bool() const { return !fFPStack.empty(); }
@@ -165,22 +160,24 @@
Iter& operator=(const Iter&) = delete;
private:
- SkSTArray<4, GrGLSLFragmentProcessor*, true> fFPStack;
+ SkSTArray<4, ProgramImpl*, true> fFPStack;
};
protected:
- /** A GrGLSLFragmentProcessor instance can be reused with any GrFragmentProcessor that produces
- the same stage key; this function reads data from a GrFragmentProcessor and uploads any
- uniform variables required by the shaders created in emitCode(). The GrFragmentProcessor
- parameter is guaranteed to be of the same type that created this GrGLSLFragmentProcessor and
- to have an identical processor key as the one that created this GrGLSLFragmentProcessor. */
+ /**
+ * A ProgramImpl instance can be reused with any GrFragmentProcessor that produces the same
+ * the same key; this function reads data from a GrFragmentProcessor and uploads any
+ * uniform variables required by the shaders created in emitCode(). The GrFragmentProcessor
+ * parameter is guaranteed to be of the same type that created this ProgramImpl and
+ * to have an identical key as the one that created this ProgramImpl.
+ */
virtual void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) {}
private:
// The (mangled) name of our entry-point function
SkString fFunctionName;
- SkTArray<std::unique_ptr<GrGLSLFragmentProcessor>, true> fChildProcessors;
+ SkTArray<std::unique_ptr<ProgramImpl>, true> fChildProcessors;
friend class GrFragmentProcessor;
};
diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
index 1e44460..ad2c64f 100644
--- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
@@ -18,8 +18,9 @@
fSubstageIndices.push_back(0);
}
-void GrGLSLFPFragmentBuilder::writeProcessorFunction(GrGLSLFragmentProcessor* fp,
- GrGLSLFragmentProcessor::EmitArgs& args) {
+void GrGLSLFPFragmentBuilder::writeProcessorFunction(
+ GrFragmentProcessor::ProgramImpl* fp,
+ GrFragmentProcessor::ProgramImpl::EmitArgs& args) {
this->onBeforeChildProcEmitCode();
this->nextStage();
diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h
index 0639da4..bfb0375 100644
--- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h
+++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h
@@ -38,7 +38,8 @@
kInsideLoop = (1 << 2)
};
- void writeProcessorFunction(GrGLSLFragmentProcessor*, GrGLSLFragmentProcessor::EmitArgs&);
+ void writeProcessorFunction(GrFragmentProcessor::ProgramImpl*,
+ GrFragmentProcessor::ProgramImpl::EmitArgs&);
virtual void forceHighPrecision() = 0;
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
index 315254e..ac8bae0 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
@@ -155,7 +155,7 @@
}
SkString GrGLSLProgramBuilder::emitFragProc(const GrFragmentProcessor& fp,
- GrGLSLFragmentProcessor& impl,
+ GrFragmentProcessor::ProgramImpl& impl,
const SkString& input,
SkString output) {
SkASSERT(input.size());
@@ -166,7 +166,7 @@
fFS.codeAppendf("half4 %s;", output.c_str());
bool ok = true;
fp.visitWithImpls([&, samplerIdx = 0](const GrFragmentProcessor& fp,
- GrGLSLFragmentProcessor& impl) mutable {
+ GrFragmentProcessor::ProgramImpl& impl) mutable {
if (auto* te = fp.asTextureEffect()) {
SkString name;
name.printf("TextureSampler_%d", samplerIdx++);
@@ -186,13 +186,13 @@
return {};
}
- GrGLSLFragmentProcessor::EmitArgs args(&fFS,
- this->uniformHandler(),
- this->shaderCaps(),
- fp,
- fp.isBlendFunction() ? "_src" : "_input",
- "_dst",
- "_coords");
+ GrFragmentProcessor::ProgramImpl::EmitArgs args(&fFS,
+ this->uniformHandler(),
+ this->shaderCaps(),
+ fp,
+ fp.isBlendFunction() ? "_src" : "_input",
+ "_dst",
+ "_coords");
fFS.writeProcessorFunction(&impl, args);
if (fp.isBlendFunction()) {
fFS.codeAppendf(
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.h b/src/gpu/glsl/GrGLSLProgramBuilder.h
index 97e41f7..bd2b78d 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.h
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.h
@@ -119,7 +119,7 @@
std::unique_ptr<GrGLSLGeometryProcessor> fGeometryProcessor;
std::unique_ptr<GrGLSLXferProcessor> fXferProcessor;
- std::vector<std::unique_ptr<GrGLSLFragmentProcessor>> fFPImpls;
+ std::vector<std::unique_ptr<GrFragmentProcessor::ProgramImpl>> fFPImpls;
SamplerHandle fDstTextureSamplerHandle;
GrSurfaceOrigin fDstTextureOrigin;
@@ -165,7 +165,7 @@
bool emitAndInstallDstTexture();
bool emitAndInstallFragProcs(SkString* colorInOut, SkString* coverageInOut);
SkString emitFragProc(const GrFragmentProcessor&,
- GrGLSLFragmentProcessor&,
+ GrFragmentProcessor::ProgramImpl&,
const SkString& input,
SkString output);
bool emitAndInstallXferProc(const SkString& colorIn, const SkString& coverageIn);
diff --git a/src/gpu/mtl/GrMtlPipelineState.h b/src/gpu/mtl/GrMtlPipelineState.h
index 131dc9a..0f1cd9c 100644
--- a/src/gpu/mtl/GrMtlPipelineState.h
+++ b/src/gpu/mtl/GrMtlPipelineState.h
@@ -45,7 +45,7 @@
uint32_t numSamplers,
std::unique_ptr<GrGLSLGeometryProcessor>,
std::unique_ptr<GrGLSLXferProcessor>,
- std::vector<std::unique_ptr<GrGLSLFragmentProcessor>> fpImpls);
+ std::vector<std::unique_ptr<GrFragmentProcessor::ProgramImpl>> fpImpls);
const sk_sp<GrMtlRenderPipeline>& pipeline() const { return fPipeline; }
@@ -114,7 +114,7 @@
std::unique_ptr<GrGLSLGeometryProcessor> fGeometryProcessor;
std::unique_ptr<GrGLSLXferProcessor> fXferProcessor;
- std::vector<std::unique_ptr<GrGLSLFragmentProcessor>> fFPImpls;
+ std::vector<std::unique_ptr<GrFragmentProcessor::ProgramImpl>> fFPImpls;
GrMtlPipelineStateDataManager fDataManager;
};
diff --git a/src/gpu/mtl/GrMtlPipelineState.mm b/src/gpu/mtl/GrMtlPipelineState.mm
index b4610b0..7c5dc9c 100644
--- a/src/gpu/mtl/GrMtlPipelineState.mm
+++ b/src/gpu/mtl/GrMtlPipelineState.mm
@@ -44,7 +44,7 @@
uint32_t numSamplers,
std::unique_ptr<GrGLSLGeometryProcessor> geometryProcessor,
std::unique_ptr<GrGLSLXferProcessor> xferProcessor,
- std::vector<std::unique_ptr<GrGLSLFragmentProcessor>> fpImpls)
+ std::vector<std::unique_ptr<GrFragmentProcessor::ProgramImpl>> fpImpls)
: fGpu(gpu)
, fPipeline(pipeline)
, fPixelFormat(pixelFormat)
@@ -66,7 +66,8 @@
for (int i = 0; i < programInfo.pipeline().numFragmentProcessors(); ++i) {
const auto& fp = programInfo.pipeline().getFragmentProcessor(i);
- fp.visitWithImpls([&](const GrFragmentProcessor& fp, GrGLSLFragmentProcessor& impl) {
+ fp.visitWithImpls([&](const GrFragmentProcessor& fp,
+ GrFragmentProcessor::ProgramImpl& impl) {
impl.setData(fDataManager, fp);
}, *fFPImpls[i]);
}
diff --git a/src/gpu/vk/GrVkPipelineState.cpp b/src/gpu/vk/GrVkPipelineState.cpp
index 96445e4..d9dcf85 100644
--- a/src/gpu/vk/GrVkPipelineState.cpp
+++ b/src/gpu/vk/GrVkPipelineState.cpp
@@ -38,7 +38,7 @@
const UniformInfoArray& samplers,
std::unique_ptr<GrGLSLGeometryProcessor> geometryProcessor,
std::unique_ptr<GrGLSLXferProcessor> xferProcessor,
- std::vector<std::unique_ptr<GrGLSLFragmentProcessor>> fpImpls)
+ std::vector<std::unique_ptr<GrFragmentProcessor::ProgramImpl>> fpImpls)
: fPipeline(std::move(pipeline))
, fSamplerDSHandle(samplerDSHandle)
, fBuiltinUniformHandles(builtinUniformHandles)
@@ -83,7 +83,8 @@
for (int i = 0; i < programInfo.pipeline().numFragmentProcessors(); ++i) {
const auto& fp = programInfo.pipeline().getFragmentProcessor(i);
- fp.visitWithImpls([&](const GrFragmentProcessor& fp, GrGLSLFragmentProcessor& impl) {
+ fp.visitWithImpls([&](const GrFragmentProcessor& fp,
+ GrFragmentProcessor::ProgramImpl& impl) {
impl.setData(fDataManager, fp);
}, *fFPImpls[i]);
}
diff --git a/src/gpu/vk/GrVkPipelineState.h b/src/gpu/vk/GrVkPipelineState.h
index 550cb8f..cd0d4e1 100644
--- a/src/gpu/vk/GrVkPipelineState.h
+++ b/src/gpu/vk/GrVkPipelineState.h
@@ -49,7 +49,7 @@
const UniformInfoArray& samplers,
std::unique_ptr<GrGLSLGeometryProcessor>,
std::unique_ptr<GrGLSLXferProcessor>,
- std::vector<std::unique_ptr<GrGLSLFragmentProcessor>> fpImpls);
+ std::vector<std::unique_ptr<GrFragmentProcessor::ProgramImpl>> fpImpls);
~GrVkPipelineState();
@@ -107,7 +107,7 @@
// Processors in the GrVkPipelineState
std::unique_ptr<GrGLSLGeometryProcessor> fGeometryProcessor;
std::unique_ptr<GrGLSLXferProcessor> fXferProcessor;
- std::vector<std::unique_ptr<GrGLSLFragmentProcessor>> fFPImpls;
+ std::vector<std::unique_ptr<GrFragmentProcessor::ProgramImpl>> fFPImpls;
GrVkPipelineStateDataManager fDataManager;
diff --git a/src/shaders/SkPerlinNoiseShader.cpp b/src/shaders/SkPerlinNoiseShader.cpp
index 1db7d24..91b6c18 100644
--- a/src/shaders/SkPerlinNoiseShader.cpp
+++ b/src/shaders/SkPerlinNoiseShader.cpp
@@ -569,7 +569,7 @@
#if SK_SUPPORT_GPU
-class GrGLPerlinNoise : public GrGLSLFragmentProcessor {
+class GrGLPerlinNoise : public GrFragmentProcessor::ProgramImpl {
public:
void emitCode(EmitArgs&) override;
@@ -582,7 +582,7 @@
GrGLSLProgramDataManager::UniformHandle fStitchDataUni;
GrGLSLProgramDataManager::UniformHandle fBaseFrequencyUni;
- using INHERITED = GrGLSLFragmentProcessor;
+ using INHERITED = GrFragmentProcessor::ProgramImpl;
};
/////////////////////////////////////////////////////////////////////
@@ -626,7 +626,7 @@
int numOctaves() const { return fNumOctaves; }
private:
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override {
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
return std::make_unique<GrGLPerlinNoise>();
}
diff --git a/src/sksl/dsl/priv/DSLFPs.cpp b/src/sksl/dsl/priv/DSLFPs.cpp
index 6561b3b..c5c5540 100644
--- a/src/sksl/dsl/priv/DSLFPs.cpp
+++ b/src/sksl/dsl/priv/DSLFPs.cpp
@@ -16,8 +16,8 @@
namespace dsl {
-void StartFragmentProcessor(GrGLSLFragmentProcessor* processor,
- GrGLSLFragmentProcessor::EmitArgs* emitArgs) {
+void StartFragmentProcessor(GrFragmentProcessor::ProgramImpl* processor,
+ GrFragmentProcessor::ProgramImpl::EmitArgs* emitArgs) {
DSLWriter::StartFragmentProcessor(processor, emitArgs);
}
@@ -36,8 +36,8 @@
SkASSERT(expr->type().componentType().isFloat());
}
- GrGLSLFragmentProcessor* proc = DSLWriter::CurrentProcessor();
- GrGLSLFragmentProcessor::EmitArgs& emitArgs = *DSLWriter::CurrentEmitArgs();
+ GrFragmentProcessor::ProgramImpl* proc = DSLWriter::CurrentProcessor();
+ GrFragmentProcessor::ProgramImpl::EmitArgs& emitArgs = *DSLWriter::CurrentEmitArgs();
SkString code;
switch (expr ? expr->type().columns() : 0) {
default:
diff --git a/src/sksl/dsl/priv/DSLFPs.h b/src/sksl/dsl/priv/DSLFPs.h
index 3c14b05..372e921 100644
--- a/src/sksl/dsl/priv/DSLFPs.h
+++ b/src/sksl/dsl/priv/DSLFPs.h
@@ -18,8 +18,8 @@
namespace dsl {
-void StartFragmentProcessor(GrGLSLFragmentProcessor* processor,
- GrGLSLFragmentProcessor::EmitArgs* emitArgs);
+void StartFragmentProcessor(GrFragmentProcessor::ProgramImpl* processor,
+ GrFragmentProcessor::ProgramImpl::EmitArgs* emitArgs);
void EndFragmentProcessor();
diff --git a/src/sksl/dsl/priv/DSLWriter.cpp b/src/sksl/dsl/priv/DSLWriter.cpp
index 4da52be..8b29aee 100644
--- a/src/sksl/dsl/priv/DSLWriter.cpp
+++ b/src/sksl/dsl/priv/DSLWriter.cpp
@@ -111,8 +111,8 @@
}
#if !defined(SKSL_STANDALONE) && SK_SUPPORT_GPU
-void DSLWriter::StartFragmentProcessor(GrGLSLFragmentProcessor* processor,
- GrGLSLFragmentProcessor::EmitArgs* emitArgs) {
+void DSLWriter::StartFragmentProcessor(GrFragmentProcessor::ProgramImpl* processor,
+ GrFragmentProcessor::ProgramImpl::EmitArgs* emitArgs) {
DSLWriter& instance = Instance();
instance.fStack.push({processor, emitArgs, StatementArray{}});
CurrentEmitArgs()->fFragBuilder->fDeclarations.swap(instance.fStack.top().fSavedDeclarations);
diff --git a/src/sksl/dsl/priv/DSLWriter.h b/src/sksl/dsl/priv/DSLWriter.h
index 9665d6c..7cff3a4 100644
--- a/src/sksl/dsl/priv/DSLWriter.h
+++ b/src/sksl/dsl/priv/DSLWriter.h
@@ -150,7 +150,7 @@
* Returns the fragment processor for which DSL output is being generated for the current
* thread.
*/
- static GrGLSLFragmentProcessor* CurrentProcessor() {
+ static GrFragmentProcessor::ProgramImpl* CurrentProcessor() {
SkASSERTF(!Instance().fStack.empty(), "This feature requires a FragmentProcessor");
return Instance().fStack.top().fProcessor;
}
@@ -158,7 +158,7 @@
/**
* Returns the EmitArgs for fragment processor output in the current thread.
*/
- static GrGLSLFragmentProcessor::EmitArgs* CurrentEmitArgs() {
+ static GrFragmentProcessor::ProgramImpl::EmitArgs* CurrentEmitArgs() {
SkASSERTF(!Instance().fStack.empty(), "This feature requires a FragmentProcessor");
return Instance().fStack.top().fEmitArgs;
}
@@ -170,8 +170,8 @@
/**
* Pushes a new processor / emitArgs pair for the current thread.
*/
- static void StartFragmentProcessor(GrGLSLFragmentProcessor* processor,
- GrGLSLFragmentProcessor::EmitArgs* emitArgs);
+ static void StartFragmentProcessor(GrFragmentProcessor::ProgramImpl* processor,
+ GrFragmentProcessor::ProgramImpl::EmitArgs* emitArgs);
/**
* Pops the processor / emitArgs pair associated with the current thread.
@@ -292,8 +292,8 @@
bool fEncounteredErrors = false;
#if !defined(SKSL_STANDALONE) && SK_SUPPORT_GPU
struct StackFrame {
- GrGLSLFragmentProcessor* fProcessor;
- GrGLSLFragmentProcessor::EmitArgs* fEmitArgs;
+ GrFragmentProcessor::ProgramImpl* fProcessor;
+ GrFragmentProcessor::ProgramImpl::EmitArgs* fEmitArgs;
SkSL::StatementArray fSavedDeclarations;
};
std::stack<StackFrame, std::list<StackFrame>> fStack;
diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp
index dff8954..7c838b9 100644
--- a/tests/LazyProxyTest.cpp
+++ b/tests/LazyProxyTest.cpp
@@ -157,7 +157,7 @@
std::unique_ptr<GrFragmentProcessor> clone() const override {
return std::make_unique<ClipFP>(fContext, fProxyProvider, fTest, fAtlas);
}
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override {
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
return nullptr;
}
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index be3ad15..357094c 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -124,8 +124,8 @@
this->cloneAndRegisterAllChildProcessors(that);
}
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override {
- class TestGLSLFP : public GrGLSLFragmentProcessor {
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
+ class TestGLSLFP : public ProgramImpl {
public:
TestGLSLFP() {}
void emitCode(EmitArgs& args) override {
diff --git a/tests/ProgramsTest.cpp b/tests/ProgramsTest.cpp
index 8f6eb10..9593367 100644
--- a/tests/ProgramsTest.cpp
+++ b/tests/ProgramsTest.cpp
@@ -39,7 +39,7 @@
*/
static const uint32_t kMaxKeySize = 1024;
-class GLBigKeyProcessor : public GrGLSLFragmentProcessor {
+class GLBigKeyProcessor : public GrFragmentProcessor::ProgramImpl {
public:
void emitCode(EmitArgs& args) override {
args.fFragBuilder->codeAppendf("return half4(1);\n");
@@ -52,7 +52,7 @@
}
private:
- using INHERITED = GrGLSLFragmentProcessor;
+ using INHERITED = ProgramImpl;
};
class BigKeyProcessor : public GrFragmentProcessor {
@@ -63,7 +63,7 @@
const char* name() const override { return "Big_Ole_Key"; }
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override {
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
return std::make_unique<GLBigKeyProcessor>();
}
@@ -99,7 +99,7 @@
const char* name() const override { return "Block_Input"; }
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override {
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
return std::make_unique<GLFP>();
}
@@ -108,7 +108,7 @@
}
private:
- class GLFP : public GrGLSLFragmentProcessor {
+ class GLFP : public ProgramImpl {
public:
void emitCode(EmitArgs& args) override {
SkString temp = this->invokeChild(0, args);
@@ -116,7 +116,7 @@
}
private:
- using INHERITED = GrGLSLFragmentProcessor;
+ using INHERITED = ProgramImpl;
};
BlockInputFragmentProcessor(std::unique_ptr<GrFragmentProcessor> child)
diff --git a/tests/SkSLCross.cpp b/tests/SkSLCross.cpp
index b683ff5..a0b5680 100644
--- a/tests/SkSLCross.cpp
+++ b/tests/SkSLCross.cpp
@@ -52,7 +52,7 @@
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
bool onIsEqual(const GrFragmentProcessor&) const override { return true; }
- class Impl : public GrGLSLFragmentProcessor {
+ class Impl : public ProgramImpl {
void emitCode(EmitArgs& args) override {
auto& fp = args.fFp.cast<VisualizeCrossProductSignFP>();
const char* a, *b;
@@ -76,7 +76,7 @@
GrGLSLUniformHandler::UniformHandle fBUniform;
};
- std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override {
+ std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
return std::make_unique<Impl>();
}
const SkVector fA, fB;