Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Unified Diff: src/gpu/GrDefaultGeoProcFactory.cpp

Issue 822423004: Move most of the transform logic into the primitive processors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrGeometryProcessor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDefaultGeoProcFactory.cpp
diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp
index 49c663dcec75c41267994d118e5cca7e6571f03c..a6eaa6d14d6294d8378ec3816243afe74d86c99c 100644
--- a/src/gpu/GrDefaultGeoProcFactory.cpp
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp
@@ -83,33 +83,37 @@ public:
GLProcessor(const GrGeometryProcessor& gp, const GrBatchTracker&)
: fColor(GrColor_ILLEGAL), fCoverage(0xff) {}
- void emitCode(const EmitArgs& args) SK_OVERRIDE {
+ void onEmitCode(EmitArgs& args) SK_OVERRIDE {
const DefaultGeoProc& gp = args.fGP.cast<DefaultGeoProc>();
GrGLGPBuilder* pb = args.fPB;
GrGLVertexBuilder* vs = pb->getVertexShaderBuilder();
GrGLGPFragmentBuilder* fs = args.fPB->getFragmentShaderBuilder();
const BatchTracker& local = args.fBT.cast<BatchTracker>();
- vs->codeAppendf("%s = %s;", vs->positionCoords(), gp.inPosition()->fName);
+ // emit attributes
+ vs->emitAttributes(gp);
// Setup pass through color
this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputColor, gp.inColor(),
&fColorUniform);
- // Setup local coords if needed
- if (gp.inLocalCoords()) {
- vs->codeAppendf("%s = %s;", vs->localCoords(), gp.inLocalCoords()->fName);
- } else {
- vs->codeAppendf("%s = %s;", vs->localCoords(), gp.inPosition()->fName);
- }
-
// setup uniform viewMatrix
this->addUniformViewMatrix(pb);
- // setup position varying
- vs->codeAppendf("%s = %s * vec3(%s, 1);", vs->glPosition(), this->uViewM(),
+ // Setup position
+ vs->codeAppendf("%s = %s * vec3(%s, 1);", this->position(), this->uViewM(),
gp.inPosition()->fName);
+ if (gp.inLocalCoords()) {
+ // emit transforms with explicit local coords
+ this->emitTransforms(pb, this->position(), gp.inLocalCoords()->fName,
+ gp.localMatrix(), args.fTransformsIn, args.fTransformsOut);
+ } else {
+ // emit transforms with position
+ this->emitTransforms(pb, this->position(), gp.inPosition()->fName,
+ gp.localMatrix(), args.fTransformsIn, args.fTransformsOut);
+ }
+
// Setup coverage as pass through
if (kUniform_GrGPInput == local.fInputCoverageType) {
const char* fragCoverage;
@@ -174,7 +178,8 @@ public:
GLProcessor::GenKey(*this, bt, caps, b);
}
- GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) const SK_OVERRIDE {
+ virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
+ const GrGLCaps&) const SK_OVERRIDE {
return SkNEW_ARGS(GLProcessor, (*this, bt));
}
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrGeometryProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698