Improve consistency of GP::ProgramImpl subclasses
Named "Impl" and nested in GP or makeProgramImpl definition.
Remove unused INHERITED typedefs.
Remove GenKey pattern.
Bug: skia:11358
Change-Id: Icb4d5a0844184f51d92135de6cee6f6e77f57a5e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438478
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
diff --git a/src/gpu/ops/GrDrawAtlasPathOp.cpp b/src/gpu/ops/GrDrawAtlasPathOp.cpp
index db270cb..fc4c2fb 100644
--- a/src/gpu/ops/GrDrawAtlasPathOp.cpp
+++ b/src/gpu/ops/GrDrawAtlasPathOp.cpp
@@ -21,16 +21,18 @@
class DrawAtlasPathShader : public GrGeometryProcessor {
public:
- DrawAtlasPathShader(bool usesLocalCoords, const GrAtlasInstancedHelper* atlasHelper,
+ DrawAtlasPathShader(bool usesLocalCoords,
+ const GrAtlasInstancedHelper* atlasHelper,
const GrShaderCaps& shaderCaps)
: GrGeometryProcessor(kDrawAtlasPathShader_ClassID)
, fUsesLocalCoords(usesLocalCoords)
, fAtlasHelper(atlasHelper)
- , fAtlasAccess(GrSamplerState::Filter::kNearest, fAtlasHelper->proxy()->backendFormat(),
+ , fAtlasAccess(GrSamplerState::Filter::kNearest,
+ fAtlasHelper->proxy()->backendFormat(),
fAtlasHelper->atlasSwizzle()) {
if (!shaderCaps.vertexIDSupport()) {
- constexpr static Attribute kUnitCoordAttrib("unitCoord", kFloat2_GrVertexAttribType,
- kFloat2_GrSLType);
+ constexpr static Attribute kUnitCoordAttrib(
+ "unitCoord", kFloat2_GrVertexAttribType, kFloat2_GrSLType);
this->setVertexAttributes(&kUnitCoordAttrib, 1);
}
fAttribs.emplace_back("fillBounds", kFloat4_GrVertexAttribType, kFloat4_GrSLType);
@@ -47,6 +49,8 @@
}
private:
+ class Impl;
+
int colorAttribIdx() const { return fUsesLocalCoords ? 3 : 1; }
const char* name() const override { return "DrawAtlasPathShader"; }
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const override {
@@ -61,11 +65,18 @@
TextureSampler fAtlasAccess;
constexpr static int kMaxInstanceAttribs = 6;
SkSTArray<kMaxInstanceAttribs, GrGeometryProcessor::Attribute> fAttribs;
-
- class Impl;
};
class DrawAtlasPathShader::Impl : public ProgramImpl {
+public:
+ void setData(const GrGLSLProgramDataManager& pdman,
+ const GrShaderCaps&,
+ const GrGeometryProcessor& geomProc) override {
+ auto* atlasHelper = geomProc.cast<DrawAtlasPathShader>().fAtlasHelper;
+ atlasHelper->setUniformData(pdman, fAtlasAdjustUniform);
+ }
+
+private:
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
const auto& shader = args.fGeomProc.cast<DrawAtlasPathShader>();
args.fVaryingHandler->emitAttributes(shader);
@@ -97,13 +108,6 @@
GrGLSLVaryingHandler::Interpolation::kCanBeFlat);
}
- void setData(const GrGLSLProgramDataManager& pdman,
- const GrShaderCaps&,
- const GrGeometryProcessor& geomProc) override {
- auto* atlasHelper = geomProc.cast<DrawAtlasPathShader>().fAtlasHelper;
- atlasHelper->setUniformData(pdman, fAtlasAdjustUniform);
- }
-
GrGLSLUniformHandler::UniformHandle fAtlasAdjustUniform;
};