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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 const GrFragmentStage& fps = pipelineBuilder.fCoverageStages[i]; | 100 const GrFragmentStage& fps = pipelineBuilder.fCoverageStages[i]; |
101 const GrFragmentProcessor* fp = fps.processor(); | 101 const GrFragmentProcessor* fp = fps.processor(); |
102 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, GrPendingFragmentStage, (fps)); | 102 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, GrPendingFragmentStage, (fps)); |
103 usesLocalCoords = usesLocalCoords || fp->usesLocalCoords(); | 103 usesLocalCoords = usesLocalCoords || fp->usesLocalCoords(); |
104 fp->gatherCoordTransforms(&fCoordTransforms); | 104 fp->gatherCoordTransforms(&fCoordTransforms); |
105 } | 105 } |
106 | 106 |
107 // Setup info we need to pass to GrPrimitiveProcessors that are used with th
is GrPipeline. | 107 // Setup info we need to pass to GrPrimitiveProcessors that are used with th
is GrPipeline. |
108 fInfoForPrimitiveProcessor.fFlags = 0; | 108 fInfoForPrimitiveProcessor.fFlags = 0; |
109 if (!SkToBool(optFlags & GrXferProcessor::kIgnoreColor_OptFlag)) { | 109 if (!SkToBool(optFlags & GrXferProcessor::kIgnoreColor_OptFlag)) { |
110 fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kReadsColor_GrPipel
ineInfoFlag; | 110 fInfoForPrimitiveProcessor.fFlags |= |
| 111 GrPipelineOptimizations::kReadsColor_GrPipelineOptimizationsFlag; |
111 } | 112 } |
112 if (GrColor_ILLEGAL != overrideColor) { | 113 if (GrColor_ILLEGAL != overrideColor) { |
113 fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kUseOverrideColor_G
rPipelineInfoFlag; | 114 fInfoForPrimitiveProcessor.fFlags |= |
| 115 GrPipelineOptimizations::kUseOverrideColor_GrPipelineOptimizationsFl
ag; |
114 fInfoForPrimitiveProcessor.fOverrideColor = overrideColor; | 116 fInfoForPrimitiveProcessor.fOverrideColor = overrideColor; |
115 } | 117 } |
116 if (!SkToBool(optFlags & GrXferProcessor::kIgnoreCoverage_OptFlag)) { | 118 if (!SkToBool(optFlags & GrXferProcessor::kIgnoreCoverage_OptFlag)) { |
117 fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kReadsCoverage_GrPi
pelineInfoFlag; | 119 fInfoForPrimitiveProcessor.fFlags |= |
| 120 GrPipelineOptimizations::kReadsCoverage_GrPipelineOptimizationsFlag; |
118 } | 121 } |
119 if (usesLocalCoords) { | 122 if (usesLocalCoords) { |
120 fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kReadsLocalCoords_G
rPipelineInfoFlag; | 123 fInfoForPrimitiveProcessor.fFlags |= |
| 124 GrPipelineOptimizations::kReadsLocalCoords_GrPipelineOptimizationsFl
ag; |
121 } | 125 } |
122 if (SkToBool(optFlags & GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag))
{ | 126 if (SkToBool(optFlags & GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag))
{ |
123 fInfoForPrimitiveProcessor.fFlags |= | 127 fInfoForPrimitiveProcessor.fFlags |= |
124 GrPipelineInfo::kCanTweakAlphaForCoverage_GrPipelineInfoFlag; | 128 GrPipelineOptimizations::kCanTweakAlphaForCoverage_GrPipelineOptimiza
tionsFlag; |
125 } | 129 } |
126 } | 130 } |
127 | 131 |
128 void GrPipeline::adjustProgramFromOptimizations(const GrPipelineBuilder& pipelin
eBuilder, | 132 void GrPipeline::adjustProgramFromOptimizations(const GrPipelineBuilder& pipelin
eBuilder, |
129 GrXferProcessor::OptFlags flags, | 133 GrXferProcessor::OptFlags flags, |
130 const GrProcOptInfo& colorPOI, | 134 const GrProcOptInfo& colorPOI, |
131 const GrProcOptInfo& coveragePOI
, | 135 const GrProcOptInfo& coveragePOI
, |
132 int* firstColorStageIdx, | 136 int* firstColorStageIdx, |
133 int* firstCoverageStageIdx) { | 137 int* firstCoverageStageIdx) { |
134 fReadsFragPosition = fXferProcessor->willReadFragmentPosition(); | 138 fReadsFragPosition = fXferProcessor->willReadFragmentPosition(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 179 |
176 for (int i = 0; i < this->numFragmentStages(); i++) { | 180 for (int i = 0; i < this->numFragmentStages(); i++) { |
177 if (!this->getFragmentStage(i).processor()->isEqual(*that.getFragmentSta
ge(i).processor(), | 181 if (!this->getFragmentStage(i).processor()->isEqual(*that.getFragmentSta
ge(i).processor(), |
178 ignoreCoordTransform
s)) { | 182 ignoreCoordTransform
s)) { |
179 return false; | 183 return false; |
180 } | 184 } |
181 } | 185 } |
182 return true; | 186 return true; |
183 } | 187 } |
184 | 188 |
OLD | NEW |