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

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

Issue 1842753002: Style bikeshed - remove extraneous whitespace (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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/GrPathRendererChain.cpp ('k') | src/gpu/GrPipelineBuilder.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 "GrPipeline.h" 8 #include "GrPipeline.h"
9 9
10 #include "GrCaps.h" 10 #include "GrCaps.h"
(...skipping 28 matching lines...) Expand all
39 builder. hasMixedSamples(), 39 builder. hasMixedSamples(),
40 &args.fD stTexture)); 40 &args.fD stTexture));
41 } 41 }
42 GrColor overrideColor = GrColor_ILLEGAL; 42 GrColor overrideColor = GrColor_ILLEGAL;
43 if (args.fOpts.fColorPOI.firstEffectiveProcessorIndex() != 0) { 43 if (args.fOpts.fColorPOI.firstEffectiveProcessorIndex() != 0) {
44 overrideColor = args.fOpts.fColorPOI.inputColorToFirstEffectiveProccesor (); 44 overrideColor = args.fOpts.fColorPOI.inputColorToFirstEffectiveProccesor ();
45 } 45 }
46 46
47 GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_OptFlags; 47 GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_OptFlags;
48 48
49 const GrXferProcessor* xpForOpts = xferProcessor ? xferProcessor.get() : 49 const GrXferProcessor* xpForOpts = xferProcessor ? xferProcessor.get() :
50 &GrPorterDuffXPFactory::S impleSrcOverXP(); 50 &GrPorterDuffXPFactory::S impleSrcOverXP();
51 optFlags = xpForOpts->getOptimizations(args.fOpts, 51 optFlags = xpForOpts->getOptimizations(args.fOpts,
52 builder.getStencil().doesWrite(), 52 builder.getStencil().doesWrite(),
53 &overrideColor, 53 &overrideColor,
54 *args.fCaps); 54 *args.fCaps);
55 55
56 // When path rendering the stencil settings are not always set on the GrPipe lineBuilder 56 // When path rendering the stencil settings are not always set on the GrPipe lineBuilder
57 // so we must check the draw type. In cases where we will skip drawing we si mply return a 57 // so we must check the draw type. In cases where we will skip drawing we si mply return a
58 // null GrPipeline. 58 // null GrPipeline.
59 if (GrXferProcessor::kSkipDraw_OptFlag & optFlags) { 59 if (GrXferProcessor::kSkipDraw_OptFlag & optFlags) {
(...skipping 25 matching lines...) Expand all
85 pipeline->fFlags |= kDisableOutputConversionToSRGB_Flag; 85 pipeline->fFlags |= kDisableOutputConversionToSRGB_Flag;
86 } 86 }
87 87
88 int firstColorProcessorIdx = args.fOpts.fColorPOI.firstEffectiveProcessorInd ex(); 88 int firstColorProcessorIdx = args.fOpts.fColorPOI.firstEffectiveProcessorInd ex();
89 89
90 // TODO: Once we can handle single or four channel input into coverage GrFra gmentProcessors 90 // TODO: Once we can handle single or four channel input into coverage GrFra gmentProcessors
91 // then we can use GrPipelineBuilder's coverageProcInfo (like color above) t o set this initial 91 // then we can use GrPipelineBuilder's coverageProcInfo (like color above) t o set this initial
92 // information. 92 // information.
93 int firstCoverageProcessorIdx = 0; 93 int firstCoverageProcessorIdx = 0;
94 94
95 pipeline->adjustProgramFromOptimizations(builder, optFlags, args.fOpts.fColo rPOI, 95 pipeline->adjustProgramFromOptimizations(builder, optFlags, args.fOpts.fColo rPOI,
96 args.fOpts.fCoveragePOI, &firstColo rProcessorIdx, 96 args.fOpts.fCoveragePOI, &firstColo rProcessorIdx,
97 &firstCoverageProcessorIdx); 97 &firstCoverageProcessorIdx);
98 98
99 bool usesLocalCoords = false; 99 bool usesLocalCoords = false;
100 100
101 // Copy GrFragmentProcessors from GrPipelineBuilder to Pipeline 101 // Copy GrFragmentProcessors from GrPipelineBuilder to Pipeline
102 pipeline->fNumColorProcessors = builder.numColorFragmentProcessors() - first ColorProcessorIdx; 102 pipeline->fNumColorProcessors = builder.numColorFragmentProcessors() - first ColorProcessorIdx;
103 int numTotalProcessors = pipeline->fNumColorProcessors + 103 int numTotalProcessors = pipeline->fNumColorProcessors +
104 builder.numCoverageFragmentProcessors() - firstCove rageProcessorIdx; 104 builder.numCoverageFragmentProcessors() - firstCove rageProcessorIdx;
105 pipeline->fFragmentProcessors.reset(numTotalProcessors); 105 pipeline->fFragmentProcessors.reset(numTotalProcessors);
106 int currFPIdx = 0; 106 int currFPIdx = 0;
(...skipping 20 matching lines...) Expand all
127 overrides->fFlags |= GrXPOverridesForBatch::kUseOverrideColor_Flag; 127 overrides->fFlags |= GrXPOverridesForBatch::kUseOverrideColor_Flag;
128 overrides->fOverrideColor = overrideColor; 128 overrides->fOverrideColor = overrideColor;
129 } 129 }
130 if (!SkToBool(optFlags & GrXferProcessor::kIgnoreCoverage_OptFlag)) { 130 if (!SkToBool(optFlags & GrXferProcessor::kIgnoreCoverage_OptFlag)) {
131 overrides->fFlags |= GrXPOverridesForBatch::kReadsCoverage_Flag; 131 overrides->fFlags |= GrXPOverridesForBatch::kReadsCoverage_Flag;
132 } 132 }
133 if (usesLocalCoords) { 133 if (usesLocalCoords) {
134 overrides->fFlags |= GrXPOverridesForBatch::kReadsLocalCoords_Flag; 134 overrides->fFlags |= GrXPOverridesForBatch::kReadsLocalCoords_Flag;
135 } 135 }
136 if (SkToBool(optFlags & GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag)) { 136 if (SkToBool(optFlags & GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag)) {
137 overrides->fFlags |= GrXPOverridesForBatch::kCanTweakAlphaForCoverage_Fl ag; 137 overrides->fFlags |= GrXPOverridesForBatch::kCanTweakAlphaForCoverage_Fl ag;
138 } 138 }
139 139
140 GrXPFactory::InvariantBlendedColor blendedColor; 140 GrXPFactory::InvariantBlendedColor blendedColor;
141 if (xpFactory) { 141 if (xpFactory) {
142 xpFactory->getInvariantBlendedColor(args.fOpts.fColorPOI, &blendedColor) ; 142 xpFactory->getInvariantBlendedColor(args.fOpts.fColorPOI, &blendedColor) ;
143 } else { 143 } else {
144 GrPorterDuffXPFactory::SrcOverInvariantBlendedColor(args.fOpts.fColorPOI .color(), 144 GrPorterDuffXPFactory::SrcOverInvariantBlendedColor(args.fOpts.fColorPOI .color(),
145 args.fOpts.fColorPOI .validFlags(), 145 args.fOpts.fColorPOI .validFlags(),
146 args.fOpts.fColorPOI .isOpaque(), 146 args.fOpts.fColorPOI .isOpaque(),
147 &blendedColor); 147 &blendedColor);
148 } 148 }
149 if (blendedColor.fWillBlendWithDst) { 149 if (blendedColor.fWillBlendWithDst) {
150 overrides->fFlags |= GrXPOverridesForBatch::kWillColorBlendWithDst_Flag; 150 overrides->fFlags |= GrXPOverridesForBatch::kWillColorBlendWithDst_Flag;
151 } 151 }
152 152
153 return pipeline; 153 return pipeline;
154 } 154 }
155 155
156 static void add_dependencies_for_processor(const GrFragmentProcessor* proc, GrRe nderTarget* rt) { 156 static void add_dependencies_for_processor(const GrFragmentProcessor* proc, GrRe nderTarget* rt) {
157 for (int i = 0; i < proc->numChildProcessors(); ++i) { 157 for (int i = 0; i < proc->numChildProcessors(); ++i) {
158 // need to recurse 158 // need to recurse
159 add_dependencies_for_processor(&proc->childProcessor(i), rt); 159 add_dependencies_for_processor(&proc->childProcessor(i), rt);
160 } 160 }
161 161
162 for (int i = 0; i < proc->numTextures(); ++i) { 162 for (int i = 0; i < proc->numTextures(); ++i) {
163 GrTexture* texture = proc->textureAccess(i).getTexture(); 163 GrTexture* texture = proc->textureAccess(i).getTexture();
164 SkASSERT(rt->getLastDrawTarget()); 164 SkASSERT(rt->getLastDrawTarget());
165 rt->getLastDrawTarget()->addDependency(texture); 165 rt->getLastDrawTarget()->addDependency(texture);
166 } 166 }
167 } 167 }
168 168
169 void GrPipeline::addDependenciesTo(GrRenderTarget* rt) const { 169 void GrPipeline::addDependenciesTo(GrRenderTarget* rt) const {
170 for (int i = 0; i < fFragmentProcessors.count(); ++i) { 170 for (int i = 0; i < fFragmentProcessors.count(); ++i) {
171 add_dependencies_for_processor(fFragmentProcessors[i].get(), rt); 171 add_dependencies_for_processor(fFragmentProcessors[i].get(), rt);
172 } 172 }
173 173
174 const GrXferProcessor& xfer = this->getXferProcessor(); 174 const GrXferProcessor& xfer = this->getXferProcessor();
175 175
176 for (int i = 0; i < xfer.numTextures(); ++i) { 176 for (int i = 0; i < xfer.numTextures(); ++i) {
177 GrTexture* texture = xfer.textureAccess(i).getTexture(); 177 GrTexture* texture = xfer.textureAccess(i).getTexture();
178 SkASSERT(rt->getLastDrawTarget()); 178 SkASSERT(rt->getLastDrawTarget());
179 rt->getLastDrawTarget()->addDependency(texture); 179 rt->getLastDrawTarget()->addDependency(texture);
180 } 180 }
181 } 181 }
182 182
183 void GrPipeline::adjustProgramFromOptimizations(const GrPipelineBuilder& pipelin eBuilder, 183 void GrPipeline::adjustProgramFromOptimizations(const GrPipelineBuilder& pipelin eBuilder,
184 GrXferProcessor::OptFlags flags, 184 GrXferProcessor::OptFlags flags,
185 const GrProcOptInfo& colorPOI, 185 const GrProcOptInfo& colorPOI,
186 const GrProcOptInfo& coveragePOI , 186 const GrProcOptInfo& coveragePOI ,
187 int* firstColorProcessorIdx, 187 int* firstColorProcessorIdx,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 221 }
222 } 222 }
223 223
224 for (int i = 0; i < a.numFragmentProcessors(); i++) { 224 for (int i = 0; i < a.numFragmentProcessors(); i++) {
225 if (!a.getFragmentProcessor(i).isEqual(b.getFragmentProcessor(i), ignore CoordTransforms)) { 225 if (!a.getFragmentProcessor(i).isEqual(b.getFragmentProcessor(i), ignore CoordTransforms)) {
226 return false; 226 return false;
227 } 227 }
228 } 228 }
229 return true; 229 return true;
230 } 230 }
231
OLDNEW
« no previous file with comments | « src/gpu/GrPathRendererChain.cpp ('k') | src/gpu/GrPipelineBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698