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

Unified Diff: src/gpu/GrDefaultGeoProcFactory.cpp

Issue 1151693005: Remove uniform view matrix from GrGLPrimitiveProcessor base class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more Created 5 years, 7 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 | « no previous file | src/gpu/GrOvalRenderer.cpp » ('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 6e2ea060dfa8606b89d8202f591408c9c0015a17..a72c88052c7270bd0f099da06e011786dd226d7f 100644
--- a/src/gpu/GrDefaultGeoProcFactory.cpp
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp
@@ -55,7 +55,7 @@ public:
class GLProcessor : public GrGLGeometryProcessor {
public:
GLProcessor(const GrGeometryProcessor& gp, const GrBatchTracker&)
- : fColor(GrColor_ILLEGAL), fCoverage(0xff) {}
+ : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL), fCoverage(0xff) {}
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
const DefaultGeoProc& gp = args.fGP.cast<DefaultGeoProc>();
@@ -76,7 +76,8 @@ public:
}
// Setup position
- this->setupPosition(pb, gpArgs, gp.inPosition()->fName, gp.viewMatrix());
+ this->setupPosition(pb, gpArgs, gp.inPosition()->fName, gp.viewMatrix(),
+ &fViewMatrixUniform);
if (gp.inLocalCoords()) {
// emit transforms with explicit local coords
@@ -128,7 +129,13 @@ public:
const GrPrimitiveProcessor& gp,
const GrBatchTracker& bt) override {
const DefaultGeoProc& dgp = gp.cast<DefaultGeoProc>();
- this->setUniformViewMatrix(pdman, dgp.viewMatrix());
+
+ if (!dgp.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dgp.viewMatrix())) {
+ fViewMatrix = dgp.viewMatrix();
+ GrGLfloat viewMatrix[3 * 3];
+ GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
+ pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
+ }
if (dgp.color() != fColor && !dgp.hasVertexColor()) {
GrGLfloat c[4];
@@ -151,8 +158,10 @@ public:
}
private:
+ SkMatrix fViewMatrix;
GrColor fColor;
uint8_t fCoverage;
+ UniformHandle fViewMatrixUniform;
UniformHandle fColorUniform;
UniformHandle fCoverageUniform;
« no previous file with comments | « no previous file | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698