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

Unified Diff: src/gpu/GrDefaultGeoProcFactory.cpp

Issue 854013002: Refactor position computation to enable device space "nudge" (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT 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
Index: src/gpu/GrDefaultGeoProcFactory.cpp
diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp
index 25c34ed929aaa3673931e523c0f52f3b69222971..3e32e65c627492c5995cfd90361e567731a7e940 100644
--- a/src/gpu/GrDefaultGeoProcFactory.cpp
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp
@@ -83,15 +83,15 @@ public:
GLProcessor(const GrGeometryProcessor& gp, const GrBatchTracker&)
: fColor(GrColor_ILLEGAL), fCoverage(0xff) {}
- void onEmitCode(EmitArgs& args) SK_OVERRIDE {
+ void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) SK_OVERRIDE {
const DefaultGeoProc& gp = args.fGP.cast<DefaultGeoProc>();
GrGLGPBuilder* pb = args.fPB;
- GrGLVertexBuilder* vs = pb->getVertexShaderBuilder();
+ GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
GrGLGPFragmentBuilder* fs = args.fPB->getFragmentShaderBuilder();
const BatchTracker& local = args.fBT.cast<BatchTracker>();
// emit attributes
- vs->emitAttributes(gp);
+ vsBuilder->emitAttributes(gp);
// Setup pass through color
this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputColor, gp.inColor(),
@@ -101,16 +101,16 @@ public:
this->addUniformViewMatrix(pb);
// Setup position
- vs->codeAppendf("%s = %s * vec3(%s, 1);", this->position(), this->uViewM(),
- gp.inPosition()->fName);
+ SetupPosition(vsBuilder, gpArgs, gp.inPosition()->fName,
+ gp.viewMatrix(), this->uViewM());
if (gp.inLocalCoords()) {
// emit transforms with explicit local coords
- this->emitTransforms(pb, this->position(), gp.inLocalCoords()->fName,
+ this->emitTransforms(pb, gpArgs->fPositionVar, gp.inLocalCoords()->fName,
gp.localMatrix(), args.fTransformsIn, args.fTransformsOut);
} else {
// emit transforms with position
- this->emitTransforms(pb, this->position(), gp.inPosition()->fName,
+ this->emitTransforms(pb, gpArgs->fPositionVar, gp.inPosition()->fName,
gp.localMatrix(), args.fTransformsIn, args.fTransformsOut);
}
@@ -142,6 +142,7 @@ public:
uint32_t key = def.fFlags;
key |= local.fInputColorType << 8 | local.fInputCoverageType << 16;
key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x1 << 24 : 0x0;
+ key |= ComputePosKey(gp.viewMatrix()) << 25;
b->add32(key);
}

Powered by Google App Engine
This is Rietveld 408576698