OLD | NEW |
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 fNumColorStages = fFragmentStages.count(); | 92 fNumColorStages = fFragmentStages.count(); |
93 for (int i = firstCoverageStageIdx; i < pipelineBuilder.numCoverageFragmentS
tages(); ++i) { | 93 for (int i = firstCoverageStageIdx; i < pipelineBuilder.numCoverageFragmentS
tages(); ++i) { |
94 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, | 94 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, |
95 GrPendingFragmentStage, | 95 GrPendingFragmentStage, |
96 (pipelineBuilder.fCoverageStages[i])); | 96 (pipelineBuilder.fCoverageStages[i])); |
97 usesLocalCoords = usesLocalCoords || | 97 usesLocalCoords = usesLocalCoords || |
98 pipelineBuilder.fCoverageStages[i].processor()->usesLo
calCoords(); | 98 pipelineBuilder.fCoverageStages[i].processor()->usesLo
calCoords(); |
99 } | 99 } |
100 | 100 |
101 // let the GP init the batch tracker | 101 // Setup info we need to pass to GrPrimitiveProcessors that are used with th
is GrPipeline. |
102 fInitBT.fColorIgnored = SkToBool(optFlags & GrXferProcessor::kIgnoreColor_Op
tFlag); | 102 fInfoForPrimitiveProcessor.fFlags = 0; |
103 fInitBT.fOverrideColor = fInitBT.fColorIgnored ? GrColor_ILLEGAL : overrideC
olor; | 103 if (!SkToBool(optFlags & GrXferProcessor::kIgnoreColor_OptFlag)) { |
104 fInitBT.fCoverageIgnored = SkToBool(optFlags & GrXferProcessor::kIgnoreCover
age_OptFlag); | 104 fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kReadsColor_GrPipel
ineInfoFlag; |
105 fInitBT.fUsesLocalCoords = usesLocalCoords; | 105 } |
106 fInitBT.fCanTweakAlphaForCoverage = | 106 if (GrColor_ILLEGAL != overrideColor) { |
107 SkToBool(optFlags & GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag); | 107 fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kUseOverrideColor_G
rPipelineInfoFlag; |
| 108 fInfoForPrimitiveProcessor.fOverrideColor = overrideColor; |
| 109 } |
| 110 if (!SkToBool(optFlags & GrXferProcessor::kIgnoreCoverage_OptFlag)) { |
| 111 fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kReadsCoverage_GrPi
pelineInfoFlag; |
| 112 } |
| 113 if (usesLocalCoords) { |
| 114 fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kReadsLocalCoords_G
rPipelineInfoFlag; |
| 115 } |
| 116 if (SkToBool(optFlags & GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag))
{ |
| 117 fInfoForPrimitiveProcessor.fFlags |= |
| 118 GrPipelineInfo::kCanTweakAlphaForCoverage_GrPipelineInfoFlag; |
| 119 } |
108 } | 120 } |
109 | 121 |
110 void GrPipeline::adjustProgramFromOptimizations(const GrPipelineBuilder& pipelin
eBuilder, | 122 void GrPipeline::adjustProgramFromOptimizations(const GrPipelineBuilder& pipelin
eBuilder, |
111 GrXferProcessor::OptFlags flags, | 123 GrXferProcessor::OptFlags flags, |
112 const GrProcOptInfo& colorPOI, | 124 const GrProcOptInfo& colorPOI, |
113 const GrProcOptInfo& coveragePOI
, | 125 const GrProcOptInfo& coveragePOI
, |
114 int* firstColorStageIdx, | 126 int* firstColorStageIdx, |
115 int* firstCoverageStageIdx) { | 127 int* firstCoverageStageIdx) { |
116 fReadsFragPosition = fXferProcessor->willReadFragmentPosition(); | 128 fReadsFragPosition = fXferProcessor->willReadFragmentPosition(); |
117 | 129 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); | 166 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); |
155 for (int i = 0; i < this->numFragmentStages(); i++) { | 167 for (int i = 0; i < this->numFragmentStages(); i++) { |
156 | 168 |
157 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { | 169 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { |
158 return false; | 170 return false; |
159 } | 171 } |
160 } | 172 } |
161 return true; | 173 return true; |
162 } | 174 } |
163 | 175 |
OLD | NEW |