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

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

Issue 746423007: Draft change to start pulling uniform color into GP (Closed) Base URL: https://skia.googlesource.com/skia.git@no_factories
Patch Set: cleanup Created 6 years 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
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 "GrOptDrawState.h" 8 #include "GrOptDrawState.h"
9 9
10 #include "GrDrawState.h" 10 #include "GrDrawState.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, 141 SkNEW_APPEND_TO_TARRAY(&fFragmentStages,
142 GrPendingFragmentStage, 142 GrPendingFragmentStage,
143 (drawState.fCoverageStages[i], hasLocalCoords)); 143 (drawState.fCoverageStages[i], hasLocalCoords));
144 } 144 }
145 145
146 // let the GP init the batch tracker 146 // let the GP init the batch tracker
147 if (gp) { 147 if (gp) {
148 GrGeometryProcessor::InitBT init; 148 GrGeometryProcessor::InitBT init;
149 init.fOutputColor = fDescInfo.fInputColorIsUsed; 149 init.fOutputColor = fDescInfo.fInputColorIsUsed;
150 init.fOutputCoverage = fDescInfo.fInputCoverageIsUsed; 150 init.fOutputCoverage = fDescInfo.fInputCoverageIsUsed;
151 init.fRemoveColorAttr = !fDescInfo.fHasVertexColor;
152 init.fRemoveCoverageAttr = !fDescInfo.fHasVertexCoverage;
151 init.fColor = this->getColor(); 153 init.fColor = this->getColor();
152 init.fCoverage = this->getCoverage(); 154 init.fCoverage = this->getCoverageColor();
153 fGeometryProcessor->initBatchTracker(&fBatchTracker, init); 155 fGeometryProcessor->initBatchTracker(&fBatchTracker, init);
154 } 156 }
155 } 157 }
156 158
157 void GrOptDrawState::adjustProgramFromOptimizations(const GrDrawState& ds, 159 void GrOptDrawState::adjustProgramFromOptimizations(const GrDrawState& ds,
158 GrXferProcessor::OptFlags fl ags, 160 GrXferProcessor::OptFlags fl ags,
159 const GrProcOptInfo& colorPO I, 161 const GrProcOptInfo& colorPO I,
160 const GrProcOptInfo& coverag ePOI, 162 const GrProcOptInfo& coverag ePOI,
161 int* firstColorStageIdx, 163 int* firstColorStageIdx,
162 int* firstCoverageStageIdx) { 164 int* firstCoverageStageIdx) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 222
221 if (!fDescInfo.fHasVertexCoverage && this->fCoverage != that.fCoverage) { 223 if (!fDescInfo.fHasVertexCoverage && this->fCoverage != that.fCoverage) {
222 return false; 224 return false;
223 } 225 }
224 226
225 if (this->hasGeometryProcessor()) { 227 if (this->hasGeometryProcessor()) {
226 if (!that.hasGeometryProcessor()) { 228 if (!that.hasGeometryProcessor()) {
227 return false; 229 return false;
228 } else if (!this->getGeometryProcessor()->isEqual(*that.getGeometryProce ssor())) { 230 } else if (!this->getGeometryProcessor()->isEqual(*that.getGeometryProce ssor())) {
229 return false; 231 return false;
232 // TODO remove canBatch when we have deferred geometry
233 } else if (!this->getGeometryProcessor()->canBatch(this->getBatchTracker (),
234 that.getBatchTracker( ))) {
235 return false;
230 } 236 }
231 } else if (that.hasGeometryProcessor()) { 237 } else if (that.hasGeometryProcessor()) {
232 return false; 238 return false;
233 } 239 }
234 240
235 if (!this->getXferProcessor()->isEqual(*that.getXferProcessor())) { 241 if (!this->getXferProcessor()->isEqual(*that.getXferProcessor())) {
236 return false; 242 return false;
237 } 243 }
238 244
239 // The program desc comparison should have already assured that the stage co unts match. 245 // The program desc comparison should have already assured that the stage co unts match.
240 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); 246 SkASSERT(this->numFragmentStages() == that.numFragmentStages());
241 for (int i = 0; i < this->numFragmentStages(); i++) { 247 for (int i = 0; i < this->numFragmentStages(); i++) {
242 248
243 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { 249 if (this->getFragmentStage(i) != that.getFragmentStage(i)) {
244 return false; 250 return false;
245 } 251 }
246 } 252 }
247 return true; 253 return true;
248 } 254 }
249 255
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698