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

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

Issue 772513002: create and thread batch tracker object (Closed) Base URL: https://skia.googlesource.com/skia.git@2_vertex_attr
Patch Set: one tweak 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 for (int i = firstCoverageStageIdx; i < drawState.numCoverageStages(); ++i) { 115 for (int i = firstCoverageStageIdx; i < drawState.numCoverageStages(); ++i) {
116 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, 116 SkNEW_APPEND_TO_TARRAY(&fFragmentStages,
117 GrPendingFragmentStage, 117 GrPendingFragmentStage,
118 (drawState.fCoverageStages[i], hasLocalCoords)); 118 (drawState.fCoverageStages[i], hasLocalCoords));
119 } 119 }
120 120
121 this->setOutputStateInfo(drawState, blendOpt, *gpu->caps(), &descInfo); 121 this->setOutputStateInfo(drawState, blendOpt, *gpu->caps(), &descInfo);
122 122
123 // now create a key 123 // now create a key
124 gpu->buildProgramDesc(*this, descInfo, drawType, &fDesc); 124 gpu->buildProgramDesc(*this, descInfo, drawType, &fDesc);
125
126 // let the GP init the batch tracker
127 if (drawState.hasGeometryProcessor()) {
128 GrGeometryProcessor::InitBT init;
129 init.fOutputColor = descInfo.fInputColorIsUsed;
130 init.fOutputCoverage = descInfo.fInputCoverageIsUsed;
131 init.fColor = this->getColor();
132 init.fCoverage = this->getCoverage();
133 fGeometryProcessor->initBatchTracker(&fBatchTracker, init);
134 }
125 }; 135 };
126 136
127 void GrOptDrawState::setOutputStateInfo(const GrDrawState& ds, 137 void GrOptDrawState::setOutputStateInfo(const GrDrawState& ds,
128 GrDrawState::BlendOpt blendOpt, 138 GrDrawState::BlendOpt blendOpt,
129 const GrDrawTargetCaps& caps, 139 const GrDrawTargetCaps& caps,
130 GrProgramDesc::DescInfo* descInfo) { 140 GrProgramDesc::DescInfo* descInfo) {
131 // Set this default and then possibly change our mind if there is coverage. 141 // Set this default and then possibly change our mind if there is coverage.
132 descInfo->fPrimaryOutputType = GrProgramDesc::kModulate_PrimaryOutputType; 142 descInfo->fPrimaryOutputType = GrProgramDesc::kModulate_PrimaryOutputType;
133 descInfo->fSecondaryOutputType = GrProgramDesc::kNone_SecondaryOutputType; 143 descInfo->fSecondaryOutputType = GrProgramDesc::kNone_SecondaryOutputType;
134 144
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); 276 SkASSERT(this->numFragmentStages() == that.numFragmentStages());
267 for (int i = 0; i < this->numFragmentStages(); i++) { 277 for (int i = 0; i < this->numFragmentStages(); i++) {
268 278
269 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { 279 if (this->getFragmentStage(i) != that.getFragmentStage(i)) {
270 return false; 280 return false;
271 } 281 }
272 } 282 }
273 return true; 283 return true;
274 } 284 }
275 285
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698