Remove GrPrimitiveProcessor::hasTransformedLocalCoords

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2327613002

Review-Url: https://codereview.chromium.org/2327613002
This commit is contained in:
bsalomon 2016-09-12 12:02:11 -07:00 committed by Commit bot
parent 42943c8aa9
commit cc6aeee675
5 changed files with 4 additions and 38 deletions

View File

@ -26,7 +26,6 @@ enum GPFlag {
kColor_GPFlag = 0x1,
kLocalCoord_GPFlag = 0x2,
kCoverage_GPFlag= 0x4,
kTransformedLocalCoord_GPFlag = 0x8,
};
class DefaultGeoProc : public GrGeometryProcessor {
@ -102,13 +101,6 @@ public:
gp.localMatrix(),
args.fTransformsIn,
args.fTransformsOut);
} else if(gp.hasTransformedLocalCoords()) {
// transforms have already been applied to vertex attributes on the cpu
this->emitTransforms(vertBuilder,
varyingHandler,
gp.inLocalCoords()->fName,
args.fTransformsIn,
args.fTransformsOut);
} else {
// emit transforms with position
this->emitTransforms(vertBuilder,
@ -231,22 +223,15 @@ private:
this->initClassID<DefaultGeoProc>();
bool hasColor = SkToBool(gpTypeFlags & kColor_GPFlag);
bool hasExplicitLocalCoords = SkToBool(gpTypeFlags & kLocalCoord_GPFlag);
bool hasTransformedLocalCoords = SkToBool(gpTypeFlags & kTransformedLocalCoord_GPFlag);
bool hasLocalCoord = hasExplicitLocalCoords || hasTransformedLocalCoords;
bool hasCoverage = SkToBool(gpTypeFlags & kCoverage_GPFlag);
fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
kHigh_GrSLPrecision);
if (hasColor) {
fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
}
if (hasLocalCoord) {
if (hasExplicitLocalCoords) {
fInLocalCoords = &this->addVertexAttrib("inLocalCoord", kVec2f_GrVertexAttribType);
if (hasExplicitLocalCoords) {
this->setHasExplicitLocalCoords();
} else {
SkASSERT(hasTransformedLocalCoords);
this->setHasTransformedLocalCoords();
}
this->setHasExplicitLocalCoords();
}
if (hasCoverage) {
fInCoverage = &this->addVertexAttrib("inCoverage", kFloat_GrVertexAttribType);
@ -283,9 +268,6 @@ sk_sp<GrGeometryProcessor> DefaultGeoProc::TestCreate(GrProcessorTestData* d) {
if (d->fRandom->nextBool()) {
flags |= kLocalCoord_GPFlag;
}
if (d->fRandom->nextBool()) {
flags |= kTransformedLocalCoord_GPFlag;
}
return DefaultGeoProc::Make(flags,
GrRandomColor(d->fRandom),
@ -304,8 +286,6 @@ sk_sp<GrGeometryProcessor> GrDefaultGeoProcFactory::Make(const Color& color,
flags |= color.fType == Color::kAttribute_Type ? kColor_GPFlag : 0;
flags |= coverage.fType == Coverage::kAttribute_Type ? kCoverage_GPFlag : 0;
flags |= localCoords.fType == LocalCoords::kHasExplicit_Type ? kLocalCoord_GPFlag : 0;
flags |= localCoords.fType == LocalCoords::kHasTransformed_Type ?
kTransformedLocalCoord_GPFlag : 0;
uint8_t inCoverage = coverage.fCoverage;
bool coverageWillBeIgnored = coverage.fType == Coverage::kNone_Type;

View File

@ -26,10 +26,6 @@ public:
bool willUseGeoShader() const override { return fWillUseGeoShader; }
bool hasTransformedLocalCoords() const override {
return kHasTransformed_LocalCoordsType == fLocalCoordsType;
}
bool hasExplicitLocalCoords() const override {
return kHasExplicit_LocalCoordsType == fLocalCoordsType;
}

View File

@ -36,8 +36,6 @@ public:
virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps& caps) const override;
bool hasTransformedLocalCoords() const override { return false; }
const GrXPOverridesForBatch& overrides() const { return fOverrides; }
virtual bool isPathRendering() const override { return true; }

View File

@ -201,12 +201,6 @@ public:
virtual bool isPathRendering() const { return false; }
/**
* No Local Coord Transformation is needed in the shader, instead transformed local coords will
* be provided via vertex attribute.
*/
virtual bool hasTransformedLocalCoords() const = 0;
virtual GrPixelLocalStorageState getPixelLocalStorageState() const {
return kDisabled_GrPixelLocalStorageState;
}

View File

@ -56,10 +56,8 @@ bool GrGLSLProgramBuilder::emitAndInstallProcs(GrGLSLExpr4* inputColor,
for (int i = 0; i < this->pipeline().numFragmentProcessors(); i++) {
const GrFragmentProcessor& processor = this->pipeline().getFragmentProcessor(i);
if (!primProc.hasTransformedLocalCoords()) {
SkTArray<const GrCoordTransform*, true>& procCoords = fCoordTransforms.push_back();
processor.gatherCoordTransforms(&procCoords);
}
SkTArray<const GrCoordTransform*, true>& procCoords = fCoordTransforms.push_back();
processor.gatherCoordTransforms(&procCoords);
}
this->emitAndInstallPrimProc(primProc, inputColor, inputCoverage);