Remove batchtracker

BUG=skia:

Review URL: https://codereview.chromium.org/1332923003
This commit is contained in:
joshualitt 2015-09-11 08:19:35 -07:00 committed by Commit bot
parent ae48877c37
commit 465283cdf9
36 changed files with 154 additions and 493 deletions

View File

@ -55,7 +55,7 @@ public:
class GLProcessor : public GrGLGeometryProcessor {
public:
GLProcessor(const GrGeometryProcessor& gp, const GrBatchTracker&)
GLProcessor()
: fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL), fCoverage(0xff) {}
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
@ -115,7 +115,6 @@ public:
}
static inline void GenKey(const GrGeometryProcessor& gp,
const GrBatchTracker& bt,
const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
const DefaultGeoProc& def = gp.cast<DefaultGeoProc>();
@ -131,9 +130,7 @@ public:
b->add32(key);
}
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& gp,
const GrBatchTracker& bt) override {
void setData(const GrGLProgramDataManager& pdman, const GrPrimitiveProcessor& gp) override {
const DefaultGeoProc& dgp = gp.cast<DefaultGeoProc>();
if (!dgp.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dgp.viewMatrix())) {
@ -175,15 +172,12 @@ public:
typedef GrGLGeometryProcessor INHERITED;
};
virtual void getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override {
GLProcessor::GenKey(*this, bt, caps, b);
void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override {
GLProcessor::GenKey(*this, caps, b);
}
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const override {
return new GLProcessor(*this, bt);
GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override {
return new GLProcessor();
}
private:

View File

@ -26,17 +26,6 @@ public:
bool willUseGeoShader() const override { return fWillUseGeoShader; }
// TODO delete when paths are in batch
void initBatchTracker(GrBatchTracker*, const GrPipelineOptimizations&) const override {}
// TODO Delete when paths are in batch
void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
SkFAIL("Unsupported\n");
}
void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
SkFAIL("Unsupported\n");
}
bool hasTransformedLocalCoords() const override {
return kHasTransformed_LocalCoordsType == fLocalCoordsType;
}

View File

@ -286,8 +286,7 @@ public:
virtual void buildProgramDesc(GrProgramDesc*,
const GrPrimitiveProcessor&,
const GrPipeline&,
const GrBatchTracker&) const = 0;
const GrPipeline&) const = 0;
// Called to perform a surface to surface copy. Fallbacks to issuing a draw from the src to dst
// take place at the GrDrawTarget level and this function implement faster copy paths. The rect
@ -301,18 +300,15 @@ public:
struct DrawArgs {
DrawArgs(const GrPrimitiveProcessor* primProc,
const GrPipeline* pipeline,
const GrProgramDesc* desc,
const GrBatchTracker* batchTracker)
const GrProgramDesc* desc)
: fPrimitiveProcessor(primProc)
, fPipeline(pipeline)
, fDesc(desc)
, fBatchTracker(batchTracker) {
SkASSERT(primProc && pipeline && desc && batchTracker);
, fDesc(desc) {
SkASSERT(primProc && pipeline && desc);
}
const GrPrimitiveProcessor* fPrimitiveProcessor;
const GrPipeline* fPipeline;
const GrProgramDesc* fDesc;
const GrBatchTracker* fBatchTracker;
};
void draw(const DrawArgs&, const GrVertices&);

View File

@ -89,8 +89,7 @@ public:
class GLProcessor : public GrGLGeometryProcessor {
public:
GLProcessor(const GrGeometryProcessor&,
const GrBatchTracker&)
GLProcessor()
: fColor(GrColor_ILLEGAL) {}
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
@ -130,7 +129,6 @@ public:
}
static void GenKey(const GrGeometryProcessor& gp,
const GrBatchTracker& bt,
const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
const CircleEdgeEffect& ce = gp.cast<CircleEdgeEffect>();
@ -140,9 +138,7 @@ public:
b->add32(key);
}
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& gp,
const GrBatchTracker& bt) override {
void setData(const GrGLProgramDataManager& pdman, const GrPrimitiveProcessor& gp) override {
const CircleEdgeEffect& ce = gp.cast<CircleEdgeEffect>();
if (ce.color() != fColor) {
GrGLfloat c[4];
@ -165,15 +161,12 @@ public:
typedef GrGLGeometryProcessor INHERITED;
};
virtual void getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override {
GLProcessor::GenKey(*this, bt, caps, b);
void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override {
GLProcessor::GenKey(*this, caps, b);
}
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const override {
return new GLProcessor(*this, bt);
GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override {
return new GLProcessor();
}
private:
@ -243,8 +236,7 @@ public:
class GLProcessor : public GrGLGeometryProcessor {
public:
GLProcessor(const GrGeometryProcessor&,
const GrBatchTracker&)
GLProcessor()
: fColor(GrColor_ILLEGAL) {}
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
@ -305,7 +297,6 @@ public:
}
static void GenKey(const GrGeometryProcessor& gp,
const GrBatchTracker& bt,
const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
const EllipseEdgeEffect& ee = gp.cast<EllipseEdgeEffect>();
@ -315,9 +306,7 @@ public:
b->add32(key);
}
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& gp,
const GrBatchTracker& bt) override {
void setData(const GrGLProgramDataManager& pdman, const GrPrimitiveProcessor& gp) override {
const EllipseEdgeEffect& ee = gp.cast<EllipseEdgeEffect>();
if (ee.color() != fColor) {
GrGLfloat c[4];
@ -341,15 +330,12 @@ public:
typedef GrGLGeometryProcessor INHERITED;
};
virtual void getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override {
GLProcessor::GenKey(*this, bt, caps, b);
void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override {
GLProcessor::GenKey(*this, caps, b);
}
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const override {
return new GLProcessor(*this, bt);
GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override {
return new GLProcessor();
}
private:
@ -425,8 +411,7 @@ public:
class GLProcessor : public GrGLGeometryProcessor {
public:
GLProcessor(const GrGeometryProcessor&,
const GrBatchTracker&)
GLProcessor()
: fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL) {}
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
@ -502,7 +487,6 @@ public:
}
static void GenKey(const GrGeometryProcessor& gp,
const GrBatchTracker& bt,
const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
const DIEllipseEdgeEffect& ellipseEffect = gp.cast<DIEllipseEdgeEffect>();
@ -512,9 +496,7 @@ public:
b->add32(key);
}
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& gp,
const GrBatchTracker& bt) override {
void setData(const GrGLProgramDataManager& pdman, const GrPrimitiveProcessor& gp) override {
const DIEllipseEdgeEffect& dee = gp.cast<DIEllipseEdgeEffect>();
if (!dee.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dee.viewMatrix())) {
@ -541,15 +523,12 @@ public:
typedef GrGLGeometryProcessor INHERITED;
};
virtual void getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override {
GLProcessor::GenKey(*this, bt, caps, b);
void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override {
GLProcessor::GenKey(*this, caps, b);
}
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const override {
return new GLProcessor(*this, bt);
GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override {
return new GLProcessor();
}
private:

View File

@ -24,67 +24,12 @@ GrPathProcessor::GrPathProcessor(GrColor color,
this->initClassID<GrPathProcessor>();
}
void GrPathProcessor::getInvariantOutputColor(GrInitInvariantOutput* out) const {
out->setKnownFourComponents(fColor);
}
void GrPathProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out) const {
out->setKnownSingleComponent(0xff);
}
void GrPathProcessor::initBatchTracker(GrBatchTracker* bt, const GrPipelineOptimizations& opt) const {
PathBatchTracker* local = bt->cast<PathBatchTracker>();
if (!opt.readsColor()) {
local->fInputColorType = kIgnored_GrGPInput;
local->fColor = GrColor_ILLEGAL;
} else {
local->fInputColorType = kUniform_GrGPInput;
if (!opt.getOverrideColorIfSet(&local->fColor)) {
local->fColor = this->color();
}
}
local->fInputCoverageType = opt.readsCoverage() ? kAllOnes_GrGPInput : kIgnored_GrGPInput;
local->fUsesLocalCoords = opt.readsLocalCoords();
}
bool GrPathProcessor::isEqual(const GrBatchTracker& m,
const GrPrimitiveProcessor& that,
const GrBatchTracker& t) const {
if (this->classID() != that.classID() || !this->hasSameTextureAccesses(that)) {
return false;
}
const GrPathProcessor& other = that.cast<GrPathProcessor>();
if (!this->viewMatrix().cheapEqualTo(other.viewMatrix())) {
return false;
}
const PathBatchTracker& mine = m.cast<PathBatchTracker>();
const PathBatchTracker& theirs = t.cast<PathBatchTracker>();
if (mine.fColor != theirs.fColor) {
return false;
}
if (mine.fUsesLocalCoords != theirs.fUsesLocalCoords) {
return false;
}
if (mine.fUsesLocalCoords && !this->localMatrix().cheapEqualTo(other.localMatrix())) {
return false;
}
return true;
}
void GrPathProcessor::getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
void GrPathProcessor::getGLProcessorKey(const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const {
GrGLPathProcessor::GenKey(*this, bt, caps, b);
GrGLPathProcessor::GenKey(*this, caps, b);
}
GrGLPrimitiveProcessor* GrPathProcessor::createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps& caps) const {
GrGLPrimitiveProcessor* GrPathProcessor::createGLInstance(const GrGLSLCaps& caps) const {
SkASSERT(caps.pathRenderingSupport());
return new GrGLPathProcessor(*this, bt);
return new GrGLPathProcessor();
}

View File

@ -10,13 +10,6 @@
#include "GrPrimitiveProcessor.h"
struct PathBatchTracker {
GrGPInput fInputColorType;
GrGPInput fInputCoverageType;
GrColor fColor;
bool fUsesLocalCoords;
};
/*
* The path equivalent of the GP. For now this just manages color. In the long term we plan on
* extending this class to handle all nvpr uniform / varying / program work.
@ -30,29 +23,18 @@ public:
return new GrPathProcessor(color, opts, viewMatrix, localMatrix);
}
void initBatchTracker(GrBatchTracker*, const GrPipelineOptimizations&) const override;
bool isEqual(const GrBatchTracker& mine,
const GrPrimitiveProcessor& that,
const GrBatchTracker& theirs) const;
const char* name() const override { return "PathProcessor"; }
GrColor color() const { return fColor; }
const SkMatrix& viewMatrix() const { return fViewMatrix; }
const SkMatrix& localMatrix() const { return fLocalMatrix; }
void getInvariantOutputColor(GrInitInvariantOutput* out) const override;
void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override;
bool willUseGeoShader() const override { return false; }
virtual void getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
virtual void getGLProcessorKey(const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override;
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps& caps) const override;
virtual GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps& caps) const override;
bool hasTransformedLocalCoords() const override { return false; }

View File

@ -156,9 +156,8 @@ public:
DrawPathArgs(const GrPrimitiveProcessor* primProc,
const GrPipeline* pipeline,
const GrProgramDesc* desc,
const GrBatchTracker* batchTracker,
const GrStencilSettings* stencil)
: DrawArgs(primProc, pipeline, desc, batchTracker)
: DrawArgs(primProc, pipeline, desc)
, fStencil(stencil) {
}

View File

@ -96,17 +96,6 @@ GrPipelineBuilder::~GrPipelineBuilder() {
////////////////////////////////////////////////////////////////////////////////
void GrPipelineBuilder::calcColorInvariantOutput(const GrPrimitiveProcessor* pp) const {
fColorProcInfo.calcColorWithPrimProc(pp, fColorFragmentProcessors.begin(),
this->numColorFragmentProcessors());
}
void GrPipelineBuilder::calcCoverageInvariantOutput(const GrPrimitiveProcessor* pp) const {
fCoverageProcInfo.calcCoverageWithPrimProc(pp, fCoverageFragmentProcessors.begin(),
this->numCoverageFragmentProcessors());
}
void GrPipelineBuilder::calcColorInvariantOutput(const GrDrawBatch* batch) const {
fColorProcInfo.calcColorWithBatch(batch, fColorFragmentProcessors.begin(),
this->numColorFragmentProcessors());

View File

@ -381,17 +381,6 @@ public:
///////////////////////////////////////////////////////////////////////////
// TODO delete when we have Batch
const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const {
this->calcColorInvariantOutput(pp);
return fColorProcInfo;
}
const GrProcOptInfo& coverageProcInfo(const GrPrimitiveProcessor* pp) const {
this->calcCoverageInvariantOutput(pp);
return fCoverageProcInfo;
}
const GrProcOptInfo& colorProcInfo(const GrDrawBatch* batch) const {
this->calcColorInvariantOutput(batch);
return fColorProcInfo;
@ -416,13 +405,6 @@ private:
// specific color and coverage. May be called multiple times
// GrOptDrawState constructor - never caches results
/**
* Primproc variants of the calc functions
* TODO remove these when batch is everywhere
*/
void calcColorInvariantOutput(const GrPrimitiveProcessor*) const;
void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const;
/**
* GrBatch provides the initial seed for these loops based off of its initial geometry data
*/

View File

@ -42,30 +42,6 @@
* it emits the appropriate color, or none at all, as directed.
*/
/*
* A struct for tracking batching decisions. While this lives on GrOptState, it is managed
* entirely by the derived classes of the GP.
* // TODO this was an early attempt at handling out of order batching. It should be
* used carefully as it is being replaced by GrBatch
*/
class GrBatchTracker {
public:
template <typename T> const T& cast() const {
SkASSERT(sizeof(T) <= kMaxSize);
return *reinterpret_cast<const T*>(fData.get());
}
template <typename T> T* cast() {
SkASSERT(sizeof(T) <= kMaxSize);
return reinterpret_cast<T*>(fData.get());
}
static const size_t kMaxSize = 32;
private:
SkAlignedSStorage<kMaxSize> fData;
};
class GrGLSLCaps;
class GrGLPrimitiveProcessor;
@ -154,17 +130,6 @@ private:
friend class GrPipeline; // To initialize this
};
/*
* This enum is shared by GrPrimitiveProcessors and GrGLPrimitiveProcessors to coordinate shaders
* with vertex attributes / uniforms.
*/
enum GrGPInput {
kAllOnes_GrGPInput,
kAttribute_GrGPInput,
kUniform_GrGPInput,
kIgnored_GrGPInput,
};
/*
* GrPrimitiveProcessor defines an interface which all subclasses must implement. All
* GrPrimitiveProcessors must proivide seed color and coverage for the Ganesh color / coverage
@ -172,11 +137,6 @@ enum GrGPInput {
*/
class GrPrimitiveProcessor : public GrProcessor {
public:
virtual void initBatchTracker(GrBatchTracker*, const GrPipelineOptimizations&) const = 0;
virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0;
virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const = 0;
// Only the GrGeometryProcessor subclass actually has a geo shader or vertex attributes, but
// we put these calls on the base class to prevent having to cast
virtual bool willUseGeoShader() const = 0;
@ -230,16 +190,14 @@ public:
*
* TODO: A better name for this function would be "compute" instead of "get".
*/
virtual void getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
virtual void getGLProcessorKey(const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const = 0;
/** Returns a new instance of the appropriate *GL* implementation class
for the given GrProcessor; caller is responsible for deleting
the object. */
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps& caps) const = 0;
virtual GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps& caps) const = 0;
bool isPathRendering() const { return fIsPathRendering; }

View File

@ -29,24 +29,6 @@ void GrProcOptInfo::calcCoverageWithBatch(const GrDrawBatch* batch,
this->internalCalc(processors, cnt, batch->willReadFragmentPosition());
}
void GrProcOptInfo::calcColorWithPrimProc(const GrPrimitiveProcessor* primProc,
const GrFragmentProcessor * const processors[],
int cnt) {
GrInitInvariantOutput out;
primProc->getInvariantOutputColor(&out);
fInOut.reset(out);
this->internalCalc(processors, cnt, primProc->willReadFragmentPosition());
}
void GrProcOptInfo::calcCoverageWithPrimProc(const GrPrimitiveProcessor* primProc,
const GrFragmentProcessor * const processors[],
int cnt) {
GrInitInvariantOutput out;
primProc->getInvariantOutputCoverage(&out);
fInOut.reset(out);
this->internalCalc(processors, cnt, primProc->willReadFragmentPosition());
}
void GrProcOptInfo::calcWithInitialValues(const GrFragmentProcessor * const processors[],
int cnt,
GrColor startColor,

View File

@ -36,12 +36,6 @@ public:
void calcColorWithBatch(const GrDrawBatch*, const GrFragmentProcessor* const[], int cnt);
void calcCoverageWithBatch(const GrDrawBatch*, const GrFragmentProcessor* const[], int cnt);
// TODO delete these when batch is everywhere
void calcColorWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentProcessor* const[],
int cnt);
void calcCoverageWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentProcessor* const[],
int cnt);
bool isSolidWhite() const { return fInOut.isSolidWhite(); }
bool isOpaque() const { return fInOut.isOpaque(); }
bool isSingleComponent() const { return fInOut.isSingleComponent(); }

View File

@ -192,8 +192,7 @@ public:
WritePixelTempDrawInfo*) override { return false; }
void buildProgramDesc(GrProgramDesc*, const GrPrimitiveProcessor&,
const GrPipeline&,
const GrBatchTracker&) const override {}
const GrPipeline&) const override {}
void discard(GrRenderTarget*) override {}

View File

@ -543,8 +543,7 @@ public:
class GLProcessor : public GrGLGeometryProcessor {
public:
GLProcessor(const GrGeometryProcessor&,
const GrBatchTracker&)
GLProcessor()
: fColor(GrColor_ILLEGAL) {}
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
@ -597,7 +596,6 @@ public:
}
static inline void GenKey(const GrGeometryProcessor& gp,
const GrBatchTracker& bt,
const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
const QuadEdgeEffect& qee = gp.cast<QuadEdgeEffect>();
@ -607,9 +605,7 @@ public:
b->add32(key);
}
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& gp,
const GrBatchTracker& bt) override {
void setData(const GrGLProgramDataManager& pdman, const GrPrimitiveProcessor& gp) override {
const QuadEdgeEffect& qe = gp.cast<QuadEdgeEffect>();
if (qe.color() != fColor) {
GrGLfloat c[4];
@ -633,15 +629,12 @@ public:
typedef GrGLGeometryProcessor INHERITED;
};
virtual void getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override {
GLProcessor::GenKey(*this, bt, caps, b);
void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override {
GLProcessor::GenKey(*this, caps, b);
}
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const override {
return new GLProcessor(*this, bt);
GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override {
return new GLProcessor();
}
private:

View File

@ -19,10 +19,9 @@ void GrDrawPathBatch::onDraw(GrBatchFlushState* state) {
SkAutoTUnref<GrPathProcessor> pathProc(GrPathProcessor::Create(this->color(),
this->opts(),
this->viewMatrix()));
state->gpu()->buildProgramDesc(&desc, *pathProc,
*this->pipeline(), *this->tracker());
state->gpu()->buildProgramDesc(&desc, *pathProc, *this->pipeline());
GrPathRendering::DrawPathArgs args(pathProc, this->pipeline(),
&desc, this->tracker(), &this->stencilSettings());
&desc, &this->stencilSettings());
state->gpu()->pathRendering()->drawPath(args, fPath.get());
}
@ -113,10 +112,9 @@ void GrDrawPathRangeBatch::onDraw(GrBatchFlushState* state) {
this->opts(),
this->viewMatrix(),
fLocalMatrix));
state->gpu()->buildProgramDesc(&desc, *pathProc, *this->pipeline(),
*this->tracker());
state->gpu()->buildProgramDesc(&desc, *pathProc, *this->pipeline());
GrPathRendering::DrawPathArgs args(pathProc, this->pipeline(),
&desc, this->tracker(), &this->stencilSettings());
&desc, &this->stencilSettings());
if (fDraws.count() == 1) {
const GrPathRangeDraw& draw = **fDraws.head();
state->gpu()->pathRendering()->drawPaths(args, draw.range(), draw.indices(),

View File

@ -39,9 +39,6 @@ protected:
const SkMatrix& viewMatrix() const { return fViewMatrix; }
GrColor color() const { return fColor; }
// TODO delete
const GrBatchTracker* tracker() const { return &fBatchTracker; }
private:
void initBatchTracker(const GrPipelineOptimizations& opts) override {
opts.getOverrideColorIfSet(&fColor);
@ -53,9 +50,6 @@ private:
GrStencilSettings fStencilSettings;
GrPipelineOptimizations fOpts;
// TODO delete
GrBatchTracker fBatchTracker;
typedef GrDrawBatch INHERITED;
};

View File

@ -75,8 +75,8 @@ void GrVertexBatch::onDraw(GrBatchFlushState* state) {
GrProgramDesc desc;
const GrPipeline* pipeline = this->pipeline();
const GrPrimitiveProcessor* primProc = drawArray.fPrimitiveProcessor.get();
state->gpu()->buildProgramDesc(&desc, *primProc, *pipeline, fBatchTracker);
GrGpu::DrawArgs args(primProc, pipeline, &desc, &fBatchTracker);
state->gpu()->buildProgramDesc(&desc, *primProc, *pipeline);
GrGpu::DrawArgs args(primProc, pipeline, &desc);
int drawCount = drawArray.fDraws.count();
for (int i = 0; i < drawCount; i++) {

View File

@ -79,9 +79,6 @@ private:
// may use a different primitive processor.
SkTLList<DrawArray> fDrawArrays;
// What is this?
GrBatchTracker fBatchTracker;
typedef GrDrawBatch INHERITED;
};

View File

@ -13,19 +13,16 @@
class GrGLConicEffect : public GrGLGeometryProcessor {
public:
GrGLConicEffect(const GrGeometryProcessor&,
const GrBatchTracker&);
GrGLConicEffect(const GrGeometryProcessor&);
void onEmitCode(EmitArgs&, GrGPArgs*) override;
static inline void GenKey(const GrGeometryProcessor&,
const GrBatchTracker&,
const GrGLSLCaps&,
GrProcessorKeyBuilder*);
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& primProc,
const GrBatchTracker& bt) override {
void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& primProc) override {
const GrConicEffect& ce = primProc.cast<GrConicEffect>();
if (!ce.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(ce.viewMatrix())) {
@ -67,8 +64,7 @@ private:
typedef GrGLGeometryProcessor INHERITED;
};
GrGLConicEffect::GrGLConicEffect(const GrGeometryProcessor& processor,
const GrBatchTracker& bt)
GrGLConicEffect::GrGLConicEffect(const GrGeometryProcessor& processor)
: fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL), fCoverageScale(0xff) {
const GrConicEffect& ce = processor.cast<GrConicEffect>();
fEdgeType = ce.getEdgeType();
@ -170,7 +166,6 @@ void GrGLConicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
}
void GrGLConicEffect::GenKey(const GrGeometryProcessor& gp,
const GrBatchTracker& bt,
const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
const GrConicEffect& ce = gp.cast<GrConicEffect>();
@ -186,15 +181,13 @@ void GrGLConicEffect::GenKey(const GrGeometryProcessor& gp,
GrConicEffect::~GrConicEffect() {}
void GrConicEffect::getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
void GrConicEffect::getGLProcessorKey(const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const {
GrGLConicEffect::GenKey(*this, bt, caps, b);
GrGLConicEffect::GenKey(*this, caps, b);
}
GrGLPrimitiveProcessor* GrConicEffect::createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const {
return new GrGLConicEffect(*this, bt);
GrGLPrimitiveProcessor* GrConicEffect::createGLInstance(const GrGLSLCaps&) const {
return new GrGLConicEffect(*this);
}
GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t coverage,
@ -236,19 +229,16 @@ const GrGeometryProcessor* GrConicEffect::TestCreate(GrProcessorTestData* d) {
class GrGLQuadEffect : public GrGLGeometryProcessor {
public:
GrGLQuadEffect(const GrGeometryProcessor&,
const GrBatchTracker&);
GrGLQuadEffect(const GrGeometryProcessor&);
void onEmitCode(EmitArgs&, GrGPArgs*) override;
static inline void GenKey(const GrGeometryProcessor&,
const GrBatchTracker&,
const GrGLSLCaps&,
GrProcessorKeyBuilder*);
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& primProc,
const GrBatchTracker& bt) override {
void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& primProc) override {
const GrQuadEffect& qe = primProc.cast<GrQuadEffect>();
if (!qe.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(qe.viewMatrix())) {
@ -290,8 +280,7 @@ private:
typedef GrGLGeometryProcessor INHERITED;
};
GrGLQuadEffect::GrGLQuadEffect(const GrGeometryProcessor& processor,
const GrBatchTracker& bt)
GrGLQuadEffect::GrGLQuadEffect(const GrGeometryProcessor& processor)
: fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL), fCoverageScale(0xff) {
const GrQuadEffect& ce = processor.cast<GrQuadEffect>();
fEdgeType = ce.getEdgeType();
@ -378,7 +367,6 @@ void GrGLQuadEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
}
void GrGLQuadEffect::GenKey(const GrGeometryProcessor& gp,
const GrBatchTracker& bt,
const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
const GrQuadEffect& ce = gp.cast<GrQuadEffect>();
@ -394,15 +382,13 @@ void GrGLQuadEffect::GenKey(const GrGeometryProcessor& gp,
GrQuadEffect::~GrQuadEffect() {}
void GrQuadEffect::getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
void GrQuadEffect::getGLProcessorKey(const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const {
GrGLQuadEffect::GenKey(*this, bt, caps, b);
GrGLQuadEffect::GenKey(*this, caps, b);
}
GrGLPrimitiveProcessor* GrQuadEffect::createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const {
return new GrGLQuadEffect(*this, bt);
GrGLPrimitiveProcessor* GrQuadEffect::createGLInstance(const GrGLSLCaps&) const {
return new GrGLQuadEffect(*this);
}
GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t coverage,
@ -445,19 +431,16 @@ const GrGeometryProcessor* GrQuadEffect::TestCreate(GrProcessorTestData* d) {
class GrGLCubicEffect : public GrGLGeometryProcessor {
public:
GrGLCubicEffect(const GrGeometryProcessor&,
const GrBatchTracker&);
GrGLCubicEffect(const GrGeometryProcessor&);
void onEmitCode(EmitArgs&, GrGPArgs*) override;
static inline void GenKey(const GrGeometryProcessor&,
const GrBatchTracker&,
const GrGLSLCaps&,
GrProcessorKeyBuilder*);
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& primProc,
const GrBatchTracker& bt) override {
void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& primProc) override {
const GrCubicEffect& ce = primProc.cast<GrCubicEffect>();
if (!ce.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(ce.viewMatrix())) {
@ -485,8 +468,7 @@ private:
typedef GrGLGeometryProcessor INHERITED;
};
GrGLCubicEffect::GrGLCubicEffect(const GrGeometryProcessor& processor,
const GrBatchTracker&)
GrGLCubicEffect::GrGLCubicEffect(const GrGeometryProcessor& processor)
: fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL) {
const GrCubicEffect& ce = processor.cast<GrCubicEffect>();
fEdgeType = ce.getEdgeType();
@ -604,7 +586,6 @@ void GrGLCubicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
}
void GrGLCubicEffect::GenKey(const GrGeometryProcessor& gp,
const GrBatchTracker& bt,
const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
const GrCubicEffect& ce = gp.cast<GrCubicEffect>();
@ -618,15 +599,12 @@ void GrGLCubicEffect::GenKey(const GrGeometryProcessor& gp,
GrCubicEffect::~GrCubicEffect() {}
void GrCubicEffect::getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const {
GrGLCubicEffect::GenKey(*this, bt, caps, b);
void GrCubicEffect::getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const {
GrGLCubicEffect::GenKey(*this, caps, b);
}
GrGLPrimitiveProcessor* GrCubicEffect::createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const {
return new GrGLCubicEffect(*this, bt);
GrGLPrimitiveProcessor* GrCubicEffect::createGLInstance(const GrGLSLCaps&) const {
return new GrGLCubicEffect(*this);
}
GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix,

View File

@ -103,12 +103,9 @@ public:
bool usesLocalCoords() const { return fUsesLocalCoords; }
uint8_t coverageScale() const { return fCoverageScale; }
virtual void getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override;
void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override;
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const override;
GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override;
private:
GrConicEffect(GrColor, const SkMatrix& viewMatrix, uint8_t coverage, GrPrimitiveEdgeType,
@ -186,12 +183,9 @@ public:
bool usesLocalCoords() const { return fUsesLocalCoords; }
uint8_t coverageScale() const { return fCoverageScale; }
virtual void getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override;
void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override;
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const override;
GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override;
private:
GrQuadEffect(GrColor, const SkMatrix& viewMatrix, uint8_t coverage, GrPrimitiveEdgeType,
@ -261,12 +255,9 @@ public:
bool colorIgnored() const { return GrColor_ILLEGAL == fColor; }
const SkMatrix& viewMatrix() const { return fViewMatrix; }
virtual void getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override;
void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override;
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const override;
GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override;
private:
GrCubicEffect(GrColor, const SkMatrix& viewMatrix, GrPrimitiveEdgeType);

View File

@ -15,8 +15,7 @@
class GrGLBitmapTextGeoProc : public GrGLGeometryProcessor {
public:
GrGLBitmapTextGeoProc(const GrGeometryProcessor&, const GrBatchTracker&)
: fColor(GrColor_ILLEGAL) {}
GrGLBitmapTextGeoProc() : fColor(GrColor_ILLEGAL) {}
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
const GrBitmapTextGeoProc& cte = args.fGP.cast<GrBitmapTextGeoProc>();
@ -73,9 +72,7 @@ public:
}
}
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& gp,
const GrBatchTracker& bt) override {
void setData(const GrGLProgramDataManager& pdman, const GrPrimitiveProcessor& gp) override {
const GrBitmapTextGeoProc& btgp = gp.cast<GrBitmapTextGeoProc>();
if (btgp.color() != fColor && !btgp.hasVertexColor()) {
GrGLfloat c[4];
@ -93,7 +90,6 @@ public:
}
static inline void GenKey(const GrGeometryProcessor& proc,
const GrBatchTracker& bt,
const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
const GrBitmapTextGeoProc& gp = proc.cast<GrBitmapTextGeoProc>();
@ -143,16 +139,12 @@ GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture,
this->addTextureAccess(&fTextureAccess);
}
void GrBitmapTextGeoProc::getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const {
GrGLBitmapTextGeoProc::GenKey(*this, bt, caps, b);
void GrBitmapTextGeoProc::getGLProcessorKey(const GrGLSLCaps& caps,GrProcessorKeyBuilder* b) const {
GrGLBitmapTextGeoProc::GenKey(*this, caps, b);
}
GrGLPrimitiveProcessor*
GrBitmapTextGeoProc::createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps& caps) const {
return new GrGLBitmapTextGeoProc(*this, bt);
GrGLPrimitiveProcessor* GrBitmapTextGeoProc::createGLInstance(const GrGLSLCaps& caps) const {
return new GrGLBitmapTextGeoProc();
}
///////////////////////////////////////////////////////////////////////////////

View File

@ -41,12 +41,9 @@ public:
const SkMatrix& localMatrix() const { return fLocalMatrix; }
bool usesLocalCoords() const { return fUsesLocalCoords; }
virtual void getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override;
void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override;
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps& caps) const override;
GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps& caps) const override;
private:
GrBitmapTextGeoProc(GrColor, GrTexture* texture, const GrTextureParams& params,

View File

@ -784,12 +784,9 @@ public:
bool usesLocalCoords() const { return fUsesLocalCoords; }
virtual void getGLProcessorKey(const GrBatchTracker&,
const GrGLSLCaps&,
GrProcessorKeyBuilder* b) const override;
void getGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder* b) const override;
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker&,
const GrGLSLCaps&) const override;
GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override;
private:
DashingCircleEffect(GrColor, DashAAMode aaMode, const SkMatrix& localMatrix,
@ -812,18 +809,15 @@ private:
class GLDashingCircleEffect : public GrGLGeometryProcessor {
public:
GLDashingCircleEffect(const GrGeometryProcessor&, const GrBatchTracker&);
GLDashingCircleEffect();
void onEmitCode(EmitArgs&, GrGPArgs*) override;
static inline void GenKey(const GrGeometryProcessor&,
const GrBatchTracker&,
const GrGLSLCaps&,
GrProcessorKeyBuilder*);
virtual void setData(const GrGLProgramDataManager&,
const GrPrimitiveProcessor&,
const GrBatchTracker&) override;
void setData(const GrGLProgramDataManager&, const GrPrimitiveProcessor&) override;
void setTransformData(const GrPrimitiveProcessor& primProc,
const GrGLProgramDataManager& pdman,
@ -842,8 +836,7 @@ private:
typedef GrGLGeometryProcessor INHERITED;
};
GLDashingCircleEffect::GLDashingCircleEffect(const GrGeometryProcessor&,
const GrBatchTracker&) {
GLDashingCircleEffect::GLDashingCircleEffect() {
fColor = GrColor_ILLEGAL;
fPrevRadius = SK_ScalarMin;
fPrevCenterX = SK_ScalarMin;
@ -900,8 +893,7 @@ void GLDashingCircleEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
}
void GLDashingCircleEffect::setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& processor,
const GrBatchTracker& bt) {
const GrPrimitiveProcessor& processor) {
const DashingCircleEffect& dce = processor.cast<DashingCircleEffect>();
if (dce.color() != fColor) {
GrGLfloat c[4];
@ -912,7 +904,6 @@ void GLDashingCircleEffect::setData(const GrGLProgramDataManager& pdman,
}
void GLDashingCircleEffect::GenKey(const GrGeometryProcessor& gp,
const GrBatchTracker& bt,
const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
const DashingCircleEffect& dce = gp.cast<DashingCircleEffect>();
@ -932,15 +923,12 @@ GrGeometryProcessor* DashingCircleEffect::Create(GrColor color,
return new DashingCircleEffect(color, aaMode, localMatrix, usesLocalCoords);
}
void DashingCircleEffect::getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const {
GLDashingCircleEffect::GenKey(*this, bt, caps, b);
void DashingCircleEffect::getGLProcessorKey(const GrGLSLCaps& caps,GrProcessorKeyBuilder* b) const {
GLDashingCircleEffect::GenKey(*this, caps, b);
}
GrGLPrimitiveProcessor* DashingCircleEffect::createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const {
return new GLDashingCircleEffect(*this, bt);
GrGLPrimitiveProcessor* DashingCircleEffect::createGLInstance(const GrGLSLCaps&) const {
return new GLDashingCircleEffect();
}
DashingCircleEffect::DashingCircleEffect(GrColor color,
@ -1007,12 +995,9 @@ public:
bool usesLocalCoords() const { return fUsesLocalCoords; }
virtual void getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override;
void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override;
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const override;
GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override;
private:
DashingLineEffect(GrColor, DashAAMode aaMode, const SkMatrix& localMatrix,
@ -1035,18 +1020,15 @@ private:
class GLDashingLineEffect : public GrGLGeometryProcessor {
public:
GLDashingLineEffect(const GrGeometryProcessor&, const GrBatchTracker&);
GLDashingLineEffect();
void onEmitCode(EmitArgs&, GrGPArgs*) override;
static inline void GenKey(const GrGeometryProcessor&,
const GrBatchTracker&,
const GrGLSLCaps&,
GrProcessorKeyBuilder*);
virtual void setData(const GrGLProgramDataManager&,
const GrPrimitiveProcessor&,
const GrBatchTracker&) override;
void setData(const GrGLProgramDataManager&, const GrPrimitiveProcessor&) override;
void setTransformData(const GrPrimitiveProcessor& primProc,
const GrGLProgramDataManager& pdman,
@ -1061,8 +1043,7 @@ private:
typedef GrGLGeometryProcessor INHERITED;
};
GLDashingLineEffect::GLDashingLineEffect(const GrGeometryProcessor&,
const GrBatchTracker&) {
GLDashingLineEffect::GLDashingLineEffect() {
fColor = GrColor_ILLEGAL;
}
@ -1136,8 +1117,7 @@ void GLDashingLineEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
}
void GLDashingLineEffect::setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& processor,
const GrBatchTracker& bt) {
const GrPrimitiveProcessor& processor) {
const DashingLineEffect& de = processor.cast<DashingLineEffect>();
if (de.color() != fColor) {
GrGLfloat c[4];
@ -1148,7 +1128,6 @@ void GLDashingLineEffect::setData(const GrGLProgramDataManager& pdman,
}
void GLDashingLineEffect::GenKey(const GrGeometryProcessor& gp,
const GrBatchTracker& bt,
const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
const DashingLineEffect& de = gp.cast<DashingLineEffect>();
@ -1168,15 +1147,13 @@ GrGeometryProcessor* DashingLineEffect::Create(GrColor color,
return new DashingLineEffect(color, aaMode, localMatrix, usesLocalCoords);
}
void DashingLineEffect::getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
void DashingLineEffect::getGLProcessorKey(const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const {
GLDashingLineEffect::GenKey(*this, bt, caps, b);
GLDashingLineEffect::GenKey(*this, caps, b);
}
GrGLPrimitiveProcessor* DashingLineEffect::createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const {
return new GLDashingLineEffect(*this, bt);
GrGLPrimitiveProcessor* DashingLineEffect::createGLInstance(const GrGLSLCaps&) const {
return new GLDashingLineEffect();
}
DashingLineEffect::DashingLineEffect(GrColor color,

View File

@ -21,8 +21,7 @@
class GrGLDistanceFieldA8TextGeoProc : public GrGLGeometryProcessor {
public:
GrGLDistanceFieldA8TextGeoProc(const GrGeometryProcessor&,
const GrBatchTracker&)
GrGLDistanceFieldA8TextGeoProc()
: fViewMatrix(SkMatrix::InvalidMatrix())
, fColor(GrColor_ILLEGAL)
#ifdef SK_GAMMA_APPLY_TO_A8
@ -144,9 +143,7 @@ public:
fsBuilder->codeAppendf("%s = vec4(val);", args.fOutputCoverage);
}
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& proc,
const GrBatchTracker& bt) override {
void setData(const GrGLProgramDataManager& pdman, const GrPrimitiveProcessor& proc) override {
#ifdef SK_GAMMA_APPLY_TO_A8
const GrDistanceFieldA8TextGeoProc& dfTexEffect = proc.cast<GrDistanceFieldA8TextGeoProc>();
float distanceAdjust = dfTexEffect.getDistanceAdjust();
@ -173,7 +170,6 @@ public:
}
static inline void GenKey(const GrGeometryProcessor& gp,
const GrBatchTracker& bt,
const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
const GrDistanceFieldA8TextGeoProc& dfTexEffect = gp.cast<GrDistanceFieldA8TextGeoProc>();
@ -236,16 +232,13 @@ GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrColor color,
this->addTextureAccess(&fTextureAccess);
}
void GrDistanceFieldA8TextGeoProc::getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
void GrDistanceFieldA8TextGeoProc::getGLProcessorKey(const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const {
GrGLDistanceFieldA8TextGeoProc::GenKey(*this, bt, caps, b);
GrGLDistanceFieldA8TextGeoProc::GenKey(*this, caps, b);
}
GrGLPrimitiveProcessor*
GrDistanceFieldA8TextGeoProc::createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const {
return new GrGLDistanceFieldA8TextGeoProc(*this, bt);
GrGLPrimitiveProcessor* GrDistanceFieldA8TextGeoProc::createGLInstance(const GrGLSLCaps&) const {
return new GrGLDistanceFieldA8TextGeoProc();
}
///////////////////////////////////////////////////////////////////////////////
@ -282,8 +275,7 @@ const GrGeometryProcessor* GrDistanceFieldA8TextGeoProc::TestCreate(GrProcessorT
class GrGLDistanceFieldPathGeoProc : public GrGLGeometryProcessor {
public:
GrGLDistanceFieldPathGeoProc(const GrGeometryProcessor&,
const GrBatchTracker&)
GrGLDistanceFieldPathGeoProc()
: fViewMatrix(SkMatrix::InvalidMatrix())
, fColor(GrColor_ILLEGAL)
, fTextureSize(SkISize::Make(-1, -1)) {}
@ -378,9 +370,7 @@ public:
fsBuilder->codeAppendf("%s = vec4(val);", args.fOutputCoverage);
}
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& proc,
const GrBatchTracker& bt) override {
void setData(const GrGLProgramDataManager& pdman, const GrPrimitiveProcessor& proc) override {
SkASSERT(fTextureSizeUni.isValid());
GrTexture* texture = proc.texture(0);
@ -410,7 +400,6 @@ public:
}
static inline void GenKey(const GrGeometryProcessor& gp,
const GrBatchTracker& bt,
const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
const GrDistanceFieldPathGeoProc& dfTexEffect = gp.cast<GrDistanceFieldPathGeoProc>();
@ -460,15 +449,13 @@ GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc(
this->addTextureAccess(&fTextureAccess);
}
void GrDistanceFieldPathGeoProc::getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
void GrDistanceFieldPathGeoProc::getGLProcessorKey(const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const {
GrGLDistanceFieldPathGeoProc::GenKey(*this, bt, caps, b);
GrGLDistanceFieldPathGeoProc::GenKey(*this, caps, b);
}
GrGLPrimitiveProcessor*
GrDistanceFieldPathGeoProc::createGLInstance(const GrBatchTracker& bt, const GrGLSLCaps&) const {
return new GrGLDistanceFieldPathGeoProc(*this, bt);
GrGLPrimitiveProcessor* GrDistanceFieldPathGeoProc::createGLInstance(const GrGLSLCaps&) const {
return new GrGLDistanceFieldPathGeoProc();
}
///////////////////////////////////////////////////////////////////////////////
@ -503,7 +490,7 @@ const GrGeometryProcessor* GrDistanceFieldPathGeoProc::TestCreate(GrProcessorTes
class GrGLDistanceFieldLCDTextGeoProc : public GrGLGeometryProcessor {
public:
GrGLDistanceFieldLCDTextGeoProc(const GrGeometryProcessor&, const GrBatchTracker&)
GrGLDistanceFieldLCDTextGeoProc()
: fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL) {
fDistanceAdjust = GrDistanceFieldLCDTextGeoProc::DistanceAdjust::Make(1.0f, 1.0f, 1.0f);
}
@ -650,9 +637,8 @@ public:
fsBuilder->codeAppendf("%s = vec4(val);", args.fOutputCoverage);
}
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& processor,
const GrBatchTracker& bt) override {
void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& processor) override {
SkASSERT(fDistanceAdjustUni.isValid());
const GrDistanceFieldLCDTextGeoProc& dflcd = processor.cast<GrDistanceFieldLCDTextGeoProc>();
@ -681,7 +667,6 @@ public:
}
static inline void GenKey(const GrGeometryProcessor& gp,
const GrBatchTracker& bt,
const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
const GrDistanceFieldLCDTextGeoProc& dfTexEffect = gp.cast<GrDistanceFieldLCDTextGeoProc>();
@ -732,16 +717,13 @@ GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc(
this->addTextureAccess(&fTextureAccess);
}
void GrDistanceFieldLCDTextGeoProc::getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
void GrDistanceFieldLCDTextGeoProc::getGLProcessorKey(const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const {
GrGLDistanceFieldLCDTextGeoProc::GenKey(*this, bt, caps, b);
GrGLDistanceFieldLCDTextGeoProc::GenKey(*this, caps, b);
}
GrGLPrimitiveProcessor*
GrDistanceFieldLCDTextGeoProc::createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const {
return new GrGLDistanceFieldLCDTextGeoProc(*this, bt);
GrGLPrimitiveProcessor* GrDistanceFieldLCDTextGeoProc::createGLInstance(const GrGLSLCaps&) const {
return new GrGLDistanceFieldLCDTextGeoProc();
}
///////////////////////////////////////////////////////////////////////////////

View File

@ -79,12 +79,9 @@ public:
#endif
uint32_t getFlags() const { return fFlags; }
virtual void getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override;
void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override;
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const override;
GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override;
private:
GrDistanceFieldA8TextGeoProc(GrColor, const SkMatrix& viewMatrix,
@ -141,12 +138,9 @@ public:
uint32_t getFlags() const { return fFlags; }
bool usesLocalCoords() const { return fUsesLocalCoords; }
virtual void getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override;
void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override;
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const override;
GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override;
private:
GrDistanceFieldPathGeoProc(GrColor, const SkMatrix& viewMatrix, GrTexture* texture,
@ -211,12 +205,9 @@ public:
uint32_t getFlags() const { return fFlags; }
bool usesLocalCoords() const { return fUsesLocalCoords; }
virtual void getGLProcessorKey(const GrBatchTracker& bt,
const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override;
void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override;
virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
const GrGLSLCaps&) const override;
GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override;
private:
GrDistanceFieldLCDTextGeoProc(GrColor, const SkMatrix& viewMatrix,

View File

@ -1577,7 +1577,7 @@ bool GrGLGpu::flushGLState(const DrawArgs& args) {
}
SkSTArray<8, const GrTextureAccess*> textureAccesses;
program->setData(*args.fPrimitiveProcessor, pipeline, *args.fBatchTracker, &textureAccesses);
program->setData(*args.fPrimitiveProcessor, pipeline, &textureAccesses);
int numTextureAccesses = textureAccesses.count();
for (int i = 0; i < numTextureAccesses; i++) {
@ -1652,9 +1652,8 @@ void GrGLGpu::setupGeometry(const GrPrimitiveProcessor& primProc,
void GrGLGpu::buildProgramDesc(GrProgramDesc* desc,
const GrPrimitiveProcessor& primProc,
const GrPipeline& pipeline,
const GrBatchTracker& batchTracker) const {
if (!GrGLProgramDescBuilder::Build(desc, primProc, pipeline, this, batchTracker)) {
const GrPipeline& pipeline) const {
if (!GrGLProgramDescBuilder::Build(desc, primProc, pipeline, this)) {
SkDEBUGFAIL("Failed to generate GL program descriptor");
}
}

View File

@ -93,8 +93,7 @@ public:
void buildProgramDesc(GrProgramDesc*,
const GrPrimitiveProcessor&,
const GrPipeline&,
const GrBatchTracker&) const override;
const GrPipeline&) const override;
const GrGLContext* glContextForTesting() const override {
return &this->glContext();

View File

@ -11,7 +11,7 @@
#include "GrGLGpu.h"
#include "GrGLPathRendering.h"
GrGLPathProcessor::GrGLPathProcessor(const GrPathProcessor&, const GrBatchTracker&)
GrGLPathProcessor::GrGLPathProcessor()
: fColor(GrColor_ILLEGAL) {}
void GrGLPathProcessor::emitCode(EmitArgs& args) {
@ -40,7 +40,6 @@ void GrGLPathProcessor::emitCode(EmitArgs& args) {
}
void GrGLPathProcessor::GenKey(const GrPathProcessor& pathProc,
const GrBatchTracker& bt,
const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
b->add32(SkToInt(pathProc.opts().readsColor()) |
@ -48,8 +47,7 @@ void GrGLPathProcessor::GenKey(const GrPathProcessor& pathProc,
}
void GrGLPathProcessor::setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& primProc,
const GrBatchTracker& bt) {
const GrPrimitiveProcessor& primProc) {
const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>();
if (pathProc.opts().readsColor() && pathProc.color() != fColor) {
GrGLfloat c[4];

View File

@ -17,10 +17,9 @@ class GrGLPathProgramDataManager;
class GrGLPathProcessor : public GrGLPrimitiveProcessor {
public:
GrGLPathProcessor(const GrPathProcessor&, const GrBatchTracker&);
GrGLPathProcessor();
static void GenKey(const GrPathProcessor&,
const GrBatchTracker& bt,
const GrGLSLCaps&,
GrProcessorKeyBuilder* b);
@ -31,9 +30,7 @@ public:
void bindSeparableVaryings(GrGLGpu* gpu, GrGLuint programID);
void resolveSeparableVaryings(GrGLGpu* gpu, GrGLuint programId);
void setData(const GrGLProgramDataManager&,
const GrPrimitiveProcessor&,
const GrBatchTracker&) override;
void setData(const GrGLProgramDataManager&, const GrPrimitiveProcessor&) override;
void setTransformData(const GrPrimitiveProcessor&,
const GrGLPathProgramDataManager&,

View File

@ -31,7 +31,6 @@ public:
struct EmitArgs {
EmitArgs(GrGLGPBuilder* pb,
const GrPrimitiveProcessor& gp,
const GrBatchTracker& bt,
const char* outputColor,
const char* outputCoverage,
const TextureSamplerArray& samplers,
@ -39,7 +38,6 @@ public:
TransformsOut* transformsOut)
: fPB(pb)
, fGP(gp)
, fBT(bt)
, fOutputColor(outputColor)
, fOutputCoverage(outputCoverage)
, fSamplers(samplers)
@ -47,7 +45,6 @@ public:
, fTransformsOut(transformsOut) {}
GrGLGPBuilder* fPB;
const GrPrimitiveProcessor& fGP;
const GrBatchTracker& fBT;
const char* fOutputColor;
const char* fOutputCoverage;
const TextureSamplerArray& fSamplers;
@ -68,9 +65,7 @@ public:
GrPrimitiveProcessor parameter is guaranteed to be of the same type that created this
GrGLPrimitiveProcessor and to have an identical processor key as the one that created this
GrGLPrimitiveProcessor. */
virtual void setData(const GrGLProgramDataManager&,
const GrPrimitiveProcessor&,
const GrBatchTracker&) = 0;
virtual void setData(const GrGLProgramDataManager&, const GrPrimitiveProcessor&) = 0;
static SkMatrix GetTransformMatrix(const SkMatrix& localMatrix, const GrCoordTransform&);

View File

@ -82,13 +82,12 @@ static void append_texture_bindings(const Proc* ip,
void GrGLProgram::setData(const GrPrimitiveProcessor& primProc,
const GrPipeline& pipeline,
const GrBatchTracker& batchTracker,
SkTArray<const GrTextureAccess*>* textureBindings) {
this->setRenderTargetState(primProc, pipeline);
// we set the textures, and uniforms for installed processors in a generic way, but subclasses
// of GLProgram determine how to set coord transforms
fGeometryProcessor->fGLProc->setData(fProgramDataManager, primProc, batchTracker);
fGeometryProcessor->fGLProc->setData(fProgramDataManager, primProc);
append_texture_bindings(fGeometryProcessor.get(), primProc, textureBindings);
this->setFragmentData(primProc, pipeline, textureBindings);

View File

@ -94,7 +94,7 @@ public:
* the program is bound before calling, and to bind the outgoing textures to their respective
* units upon return. (Each index in the array corresponds to its matching GL texture unit.)
*/
void setData(const GrPrimitiveProcessor&, const GrPipeline&, const GrBatchTracker&,
void setData(const GrPrimitiveProcessor&, const GrPipeline&,
SkTArray<const GrTextureAccess*>* textureBindings);
protected:

View File

@ -111,8 +111,7 @@ static bool get_frag_proc_and_meta_keys(const GrPrimitiveProcessor& primProc,
bool GrGLProgramDescBuilder::Build(GrProgramDesc* desc,
const GrPrimitiveProcessor& primProc,
const GrPipeline& pipeline,
const GrGLGpu* gpu,
const GrBatchTracker& batchTracker) {
const GrGLGpu* gpu) {
// The descriptor is used as a cache key. Thus when a field of the
// descriptor will not affect program generation (because of the attribute
// bindings in use or other descriptor field settings) it should be set
@ -127,7 +126,7 @@ bool GrGLProgramDescBuilder::Build(GrProgramDesc* desc,
GrProcessorKeyBuilder b(&glDesc->key());
primProc.getGLProcessorKey(batchTracker, *gpu->glCaps().glslCaps(), &b);
primProc.getGLProcessorKey(*gpu->glCaps().glslCaps(), &b);
//**** use glslCaps here?
if (!get_meta_key(primProc, gpu->glCaps(), 0, &b)) {
glDesc->key().reset();

View File

@ -59,8 +59,7 @@ public:
static bool Build(GrProgramDesc*,
const GrPrimitiveProcessor&,
const GrPipeline&,
const GrGLGpu*,
const GrBatchTracker&);
const GrGLGpu*);
};
#endif

View File

@ -302,13 +302,12 @@ void GrGLProgramBuilder::emitAndInstallProc(const GrPrimitiveProcessor& gp,
SkASSERT(!fGeometryProcessor);
fGeometryProcessor = new GrGLInstalledGeoProc;
const GrBatchTracker& bt = this->batchTracker();
fGeometryProcessor->fGLProc.reset(gp.createGLInstance(bt, *fGpu->glCaps().glslCaps()));
fGeometryProcessor->fGLProc.reset(gp.createGLInstance(*fGpu->glCaps().glslCaps()));
SkSTArray<4, GrGLProcessor::TextureSampler> samplers(gp.numTextures());
this->emitSamplers(gp, &samplers, fGeometryProcessor);
GrGLGeometryProcessor::EmitArgs args(this, gp, bt, outColor, outCoverage, samplers,
GrGLGeometryProcessor::EmitArgs args(this, gp, outColor, outCoverage, samplers,
fCoordTransforms, &fOutCoords);
fGeometryProcessor->fGLProc->emitCode(args);

View File

@ -290,7 +290,6 @@ protected:
const GrPrimitiveProcessor& primitiveProcessor() const { return *fArgs.fPrimitiveProcessor; }
const GrPipeline& pipeline() const { return *fArgs.fPipeline; }
const GrProgramDesc& desc() const { return *fArgs.fDesc; }
const GrBatchTracker& batchTracker() const { return *fArgs.fBatchTracker; }
const GrProgramDesc::KeyHeader& header() const { return fArgs.fDesc->header(); }
// Generates a name for a variable. The generated string will be name prefixed by the prefix