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

Side by Side Diff: src/gpu/GrDefaultGeoProcFactory.cpp

Issue 827973002: ViewMatrix uniform upload moved to GeometryProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@vm-on-gp
Patch Set: feedback inc 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrGeometryProcessor.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrDefaultGeoProcFactory.h" 8 #include "GrDefaultGeoProcFactory.h"
9 9
10 #include "GrDrawState.h" 10 #include "GrDrawState.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputC olor, gp.inColor(), 96 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputC olor, gp.inColor(),
97 &fColorUniform); 97 &fColorUniform);
98 98
99 // Setup local coords if needed 99 // Setup local coords if needed
100 if (gp.inLocalCoords()) { 100 if (gp.inLocalCoords()) {
101 vs->codeAppendf("%s = %s;", vs->localCoords(), gp.inLocalCoords( )->fName); 101 vs->codeAppendf("%s = %s;", vs->localCoords(), gp.inLocalCoords( )->fName);
102 } else { 102 } else {
103 vs->codeAppendf("%s = %s;", vs->localCoords(), gp.inPosition()-> fName); 103 vs->codeAppendf("%s = %s;", vs->localCoords(), gp.inPosition()-> fName);
104 } 104 }
105 105
106 // setup uniform viewMatrix
107 this->addUniformViewMatrix(pb);
108
106 // setup position varying 109 // setup position varying
107 vs->codeAppendf("%s = %s * vec3(%s, 1);", vs->glPosition(), vs->uVie wM(), 110 vs->codeAppendf("%s = %s * vec3(%s, 1);", vs->glPosition(), this->uV iewM(),
108 gp.inPosition()->fName); 111 gp.inPosition()->fName);
109 112
110 // Setup coverage as pass through 113 // Setup coverage as pass through
111 if (kUniform_GrGPInput == local.fInputCoverageType) { 114 if (kUniform_GrGPInput == local.fInputCoverageType) {
112 const char* fragCoverage; 115 const char* fragCoverage;
113 fCoverageUniform = pb->addUniform(GrGLProgramBuilder::kFragment_ Visibility, 116 fCoverageUniform = pb->addUniform(GrGLProgramBuilder::kFragment_ Visibility,
114 kFloat_GrSLType, 117 kFloat_GrSLType,
115 kDefault_GrSLPrecision, 118 kDefault_GrSLPrecision,
116 "Coverage", 119 "Coverage",
117 &fragCoverage); 120 &fragCoverage);
(...skipping 16 matching lines...) Expand all
134 const BatchTracker& local = bt.cast<BatchTracker>(); 137 const BatchTracker& local = bt.cast<BatchTracker>();
135 uint32_t key = def.fFlags; 138 uint32_t key = def.fFlags;
136 key |= local.fInputColorType << 8 | local.fInputCoverageType << 16; 139 key |= local.fInputColorType << 8 | local.fInputCoverageType << 16;
137 key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x1 << 24 : 0x0; 140 key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x1 << 24 : 0x0;
138 b->add32(key); 141 b->add32(key);
139 } 142 }
140 143
141 virtual void setData(const GrGLProgramDataManager& pdman, 144 virtual void setData(const GrGLProgramDataManager& pdman,
142 const GrPrimitiveProcessor& gp, 145 const GrPrimitiveProcessor& gp,
143 const GrBatchTracker& bt) SK_OVERRIDE { 146 const GrBatchTracker& bt) SK_OVERRIDE {
147 this->setUniformViewMatrix(pdman, gp.viewMatrix());
148
144 const BatchTracker& local = bt.cast<BatchTracker>(); 149 const BatchTracker& local = bt.cast<BatchTracker>();
145 if (kUniform_GrGPInput == local.fInputColorType && local.fColor != f Color) { 150 if (kUniform_GrGPInput == local.fInputColorType && local.fColor != f Color) {
146 GrGLfloat c[4]; 151 GrGLfloat c[4];
147 GrColorToRGBAFloat(local.fColor, c); 152 GrColorToRGBAFloat(local.fColor, c);
148 pdman.set4fv(fColorUniform, 1, c); 153 pdman.set4fv(fColorUniform, 1, c);
149 fColor = local.fColor; 154 fColor = local.fColor;
150 } 155 }
151 if (kUniform_GrGPInput == local.fInputCoverageType && local.fCoverag e != fCoverage) { 156 if (kUniform_GrGPInput == local.fInputCoverageType && local.fCoverag e != fCoverage) {
152 pdman.set1f(fCoverageUniform, GrNormalizeByteToFloat(local.fCove rage)); 157 pdman.set1f(fCoverageUniform, GrNormalizeByteToFloat(local.fCove rage));
153 fCoverage = local.fCoverage; 158 fCoverage = local.fCoverage;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 const SkMatrix& local Matrix, 277 const SkMatrix& local Matrix,
273 bool opaqueVertexColo rs, 278 bool opaqueVertexColo rs,
274 uint8_t coverage) { 279 uint8_t coverage) {
275 return DefaultGeoProc::Create(gpTypeFlags, 280 return DefaultGeoProc::Create(gpTypeFlags,
276 color, 281 color,
277 viewMatrix, 282 viewMatrix,
278 localMatrix, 283 localMatrix,
279 opaqueVertexColors, 284 opaqueVertexColors,
280 coverage); 285 coverage);
281 } 286 }
OLDNEW
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrGeometryProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698