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

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

Issue 845103005: GrBatchPrototype (Closed) Base URL: https://skia.googlesource.com/skia.git@lc2
Patch Set: removing dstread Created 5 years, 10 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/GrPipelineBuilder.h ('k') | src/gpu/GrProcOptInfo.h » ('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 2015 Google Inc. 2 * Copyright 2015 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 "GrPipelineBuilder.h" 8 #include "GrPipelineBuilder.h"
9 9
10 #include "GrBlend.h" 10 #include "GrBlend.h"
11 #include "GrPaint.h" 11 #include "GrPaint.h"
12 #include "GrPipeline.h" 12 #include "GrPipeline.h"
13 #include "GrProcOptInfo.h" 13 #include "GrProcOptInfo.h"
14 #include "GrXferProcessor.h" 14 #include "GrXferProcessor.h"
15 #include "effects/GrPorterDuffXferProcessor.h" 15 #include "effects/GrPorterDuffXferProcessor.h"
16 16
17 GrPipelineBuilder::GrPipelineBuilder() 17 GrPipelineBuilder::GrPipelineBuilder()
18 : fFlagBits(0x0) 18 : fFlagBits(0x0)
19 , fDrawFace(kBoth_DrawFace) 19 , fDrawFace(kBoth_DrawFace)
20 , fColorProcInfoValid(false) 20 , fColorProcInfoValid(false)
21 , fCoverageProcInfoValid(false) 21 , fCoverageProcInfoValid(false)
22 , fColorCache(GrColor_ILLEGAL) 22 , fColorCache(GrColor_ILLEGAL)
23 , fCoverageCache(GrColor_ILLEGAL) 23 , fCoverageCache(GrColor_ILLEGAL) {
24 , fColorPrimProc(NULL)
25 , fCoveragePrimProc(NULL) {
26 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) 24 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;)
27 } 25 }
28 26
29 GrPipelineBuilder& GrPipelineBuilder::operator=(const GrPipelineBuilder& that) { 27 GrPipelineBuilder& GrPipelineBuilder::operator=(const GrPipelineBuilder& that) {
30 fRenderTarget.reset(SkSafeRef(that.fRenderTarget.get())); 28 fRenderTarget.reset(SkSafeRef(that.fRenderTarget.get()));
31 fFlagBits = that.fFlagBits; 29 fFlagBits = that.fFlagBits;
32 fStencilSettings = that.fStencilSettings; 30 fStencilSettings = that.fStencilSettings;
33 fDrawFace = that.fDrawFace; 31 fDrawFace = that.fDrawFace;
34 fXPFactory.reset(SkRef(that.getXPFactory())); 32 fXPFactory.reset(SkRef(that.getXPFactory()));
35 fColorStages = that.fColorStages; 33 fColorStages = that.fColorStages;
36 fCoverageStages = that.fCoverageStages; 34 fCoverageStages = that.fCoverageStages;
37 35
38 fColorProcInfoValid = that.fColorProcInfoValid; 36 fColorProcInfoValid = that.fColorProcInfoValid;
39 fCoverageProcInfoValid = that.fCoverageProcInfoValid; 37 fCoverageProcInfoValid = that.fCoverageProcInfoValid;
40 fColorCache = that.fColorCache; 38 fColorCache = that.fColorCache;
41 fCoverageCache = that.fCoverageCache; 39 fCoverageCache = that.fCoverageCache;
42 fColorPrimProc = that.fColorPrimProc;
43 fCoveragePrimProc = that.fCoveragePrimProc;
44 if (fColorProcInfoValid) { 40 if (fColorProcInfoValid) {
45 fColorProcInfo = that.fColorProcInfo; 41 fColorProcInfo = that.fColorProcInfo;
46 } 42 }
47 if (fCoverageProcInfoValid) { 43 if (fCoverageProcInfoValid) {
48 fCoverageProcInfo = that.fCoverageProcInfo; 44 fCoverageProcInfo = that.fCoverageProcInfo;
49 } 45 }
50 return *this; 46 return *this;
51 } 47 }
52 48
53 void GrPipelineBuilder::setFromPaint(const GrPaint& paint, GrRenderTarget* rt) { 49 void GrPipelineBuilder::setFromPaint(const GrPaint& paint, GrRenderTarget* rt) {
(...skipping 23 matching lines...) Expand all
77 this->enableState(GrPipelineBuilder::kClip_StateBit); 73 this->enableState(GrPipelineBuilder::kClip_StateBit);
78 74
79 this->setState(GrPipelineBuilder::kDither_StateBit, paint.isDither()); 75 this->setState(GrPipelineBuilder::kDither_StateBit, paint.isDither());
80 this->setState(GrPipelineBuilder::kHWAntialias_StateBit, paint.isAntiAlias() ); 76 this->setState(GrPipelineBuilder::kHWAntialias_StateBit, paint.isAntiAlias() );
81 77
82 fColorProcInfoValid = false; 78 fColorProcInfoValid = false;
83 fCoverageProcInfoValid = false; 79 fCoverageProcInfoValid = false;
84 80
85 fColorCache = GrColor_ILLEGAL; 81 fColorCache = GrColor_ILLEGAL;
86 fCoverageCache = GrColor_ILLEGAL; 82 fCoverageCache = GrColor_ILLEGAL;
87
88 fColorPrimProc = NULL;
89 fCoveragePrimProc = NULL;
90 } 83 }
91 84
92 //////////////////////////////////////////////////////////////////////////////// 85 ////////////////////////////////////////////////////////////////////////////////
93 86
94 bool GrPipelineBuilder::canUseFracCoveragePrimProc(GrColor color, 87 bool GrPipelineBuilder::canUseFracCoveragePrimProc(GrColor color,
95 const GrDrawTargetCaps& caps) const { 88 const GrDrawTargetCaps& caps) const {
96 if (caps.dualSourceBlendingSupport()) { 89 if (caps.dualSourceBlendingSupport()) {
97 return true; 90 return true;
98 } 91 }
99 92
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 bool GrPipelineBuilder::willBlendWithDst(const GrPrimitiveProcessor* pp) const { 147 bool GrPipelineBuilder::willBlendWithDst(const GrPrimitiveProcessor* pp) const {
155 this->calcColorInvariantOutput(pp); 148 this->calcColorInvariantOutput(pp);
156 this->calcCoverageInvariantOutput(pp); 149 this->calcCoverageInvariantOutput(pp);
157 150
158 GrXPFactory::InvariantOutput output; 151 GrXPFactory::InvariantOutput output;
159 fXPFactory->getInvariantOutput(fColorProcInfo, fCoverageProcInfo, &output); 152 fXPFactory->getInvariantOutput(fColorProcInfo, fCoverageProcInfo, &output);
160 return output.fWillBlendWithDst; 153 return output.fWillBlendWithDst;
161 } 154 }
162 155
163 void GrPipelineBuilder::calcColorInvariantOutput(const GrPrimitiveProcessor* pp) const { 156 void GrPipelineBuilder::calcColorInvariantOutput(const GrPrimitiveProcessor* pp) const {
164 if (!fColorProcInfoValid || fColorPrimProc != pp) { 157 fColorProcInfo.calcColorWithPrimProc(pp, fColorStages.begin(), this->numColo rStages());
165 fColorProcInfo.calcColorWithPrimProc(pp, fColorStages.begin(), this->num ColorStages()); 158 fColorProcInfoValid = false;
166 fColorProcInfoValid = true; 159
167 fColorPrimProc = pp;
168 }
169 } 160 }
170 161
171 void GrPipelineBuilder::calcCoverageInvariantOutput(const GrPrimitiveProcessor* pp) const { 162 void GrPipelineBuilder::calcCoverageInvariantOutput(const GrPrimitiveProcessor* pp) const {
172 if (!fCoverageProcInfoValid || fCoveragePrimProc != pp) { 163 fCoverageProcInfo.calcCoverageWithPrimProc(pp, fCoverageStages.begin(),
173 fCoverageProcInfo.calcCoverageWithPrimProc(pp, fCoverageStages.begin(), 164 this->numCoverageStages());
174 this->numCoverageStages()); 165 fCoverageProcInfoValid = false;
175 fCoverageProcInfoValid = true;
176 fCoveragePrimProc = pp;
177 }
178 } 166 }
179 167
168 void GrPipelineBuilder::calcColorInvariantOutput(const GrBatch* batch) const {
169 fColorProcInfo.calcColorWithBatch(batch, fColorStages.begin(), this->numColo rStages());
170 fColorProcInfoValid = false;
171 }
172
173 void GrPipelineBuilder::calcCoverageInvariantOutput(const GrBatch* batch) const {
174 fCoverageProcInfo.calcCoverageWithBatch(batch, fCoverageStages.begin(),
175 this->numCoverageStages());
176 fCoverageProcInfoValid = false;
177 }
178
179
180 void GrPipelineBuilder::calcColorInvariantOutput(GrColor color) const { 180 void GrPipelineBuilder::calcColorInvariantOutput(GrColor color) const {
181 if (!fColorProcInfoValid || color != fColorCache) { 181 if (!fColorProcInfoValid || color != fColorCache) {
182 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; 182 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags;
183 fColorProcInfo.calcWithInitialValues(fColorStages.begin(), this->numColo rStages(), color, 183 fColorProcInfo.calcWithInitialValues(fColorStages.begin(), this->numColo rStages(), color,
184 flags, false); 184 flags, false);
185 fColorProcInfoValid = true; 185 fColorProcInfoValid = true;
186 fColorCache = color; 186 fColorCache = color;
187 } 187 }
188 } 188 }
189 189
190 void GrPipelineBuilder::calcCoverageInvariantOutput(GrColor coverage) const { 190 void GrPipelineBuilder::calcCoverageInvariantOutput(GrColor coverage) const {
191 if (!fCoverageProcInfoValid || coverage != fCoverageCache) { 191 if (!fCoverageProcInfoValid || coverage != fCoverageCache) {
192 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; 192 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags;
193 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), 193 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(),
194 this->numCoverageStages(), cover age, flags, 194 this->numCoverageStages(), cover age, flags,
195 true); 195 true);
196 fCoverageProcInfoValid = true; 196 fCoverageProcInfoValid = true;
197 fCoverageCache = coverage; 197 fCoverageCache = coverage;
198 } 198 }
199 } 199 }
OLDNEW
« no previous file with comments | « src/gpu/GrPipelineBuilder.h ('k') | src/gpu/GrProcOptInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698