| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // GrPipelineBuilder's coverageProcInfo (like color above) to set this initi
al information. | 80 // GrPipelineBuilder's coverageProcInfo (like color above) to set this initi
al information. |
| 81 int firstCoverageStageIdx = 0; | 81 int firstCoverageStageIdx = 0; |
| 82 | 82 |
| 83 this->adjustProgramFromOptimizations(pipelineBuilder, optFlags, colorPOI, co
veragePOI, | 83 this->adjustProgramFromOptimizations(pipelineBuilder, optFlags, colorPOI, co
veragePOI, |
| 84 &firstColorStageIdx, &firstCoverageStag
eIdx); | 84 &firstColorStageIdx, &firstCoverageStag
eIdx); |
| 85 | 85 |
| 86 bool usesLocalCoords = false; | 86 bool usesLocalCoords = false; |
| 87 | 87 |
| 88 // Copy Stages from PipelineBuilder to Pipeline | 88 // Copy Stages from PipelineBuilder to Pipeline |
| 89 for (int i = firstColorStageIdx; i < pipelineBuilder.numColorFragmentStages(
); ++i) { | 89 for (int i = firstColorStageIdx; i < pipelineBuilder.numColorFragmentStages(
); ++i) { |
| 90 const GrFragmentProcessor* fp = pipelineBuilder.fColorStages[i].processo
r(); | 90 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, |
| 91 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, GrPendingFragmentStage, (fp)); | 91 GrPendingFragmentStage, |
| 92 usesLocalCoords = usesLocalCoords || fp->usesLocalCoords(); | 92 (pipelineBuilder.fColorStages[i])); |
| 93 usesLocalCoords = usesLocalCoords || |
| 94 pipelineBuilder.fColorStages[i].processor()->usesLocal
Coords(); |
| 93 } | 95 } |
| 94 | 96 |
| 95 fNumColorStages = fFragmentStages.count(); | 97 fNumColorStages = fFragmentStages.count(); |
| 96 for (int i = firstCoverageStageIdx; i < pipelineBuilder.numCoverageFragmentS
tages(); ++i) { | 98 for (int i = firstCoverageStageIdx; i < pipelineBuilder.numCoverageFragmentS
tages(); ++i) { |
| 97 const GrFragmentProcessor* fp = pipelineBuilder.fCoverageStages[i].proce
ssor(); | 99 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, |
| 98 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, GrPendingFragmentStage, (fp)); | 100 GrPendingFragmentStage, |
| 99 usesLocalCoords = usesLocalCoords || fp->usesLocalCoords(); | 101 (pipelineBuilder.fCoverageStages[i])); |
| 102 usesLocalCoords = usesLocalCoords || |
| 103 pipelineBuilder.fCoverageStages[i].processor()->usesLo
calCoords(); |
| 100 } | 104 } |
| 101 | 105 |
| 102 // Setup info we need to pass to GrPrimitiveProcessors that are used with th
is GrPipeline. | 106 // Setup info we need to pass to GrPrimitiveProcessors that are used with th
is GrPipeline. |
| 103 fInfoForPrimitiveProcessor.fFlags = 0; | 107 fInfoForPrimitiveProcessor.fFlags = 0; |
| 104 if (!SkToBool(optFlags & GrXferProcessor::kIgnoreColor_OptFlag)) { | 108 if (!SkToBool(optFlags & GrXferProcessor::kIgnoreColor_OptFlag)) { |
| 105 fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kReadsColor_GrPipel
ineInfoFlag; | 109 fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kReadsColor_GrPipel
ineInfoFlag; |
| 106 } | 110 } |
| 107 if (GrColor_ILLEGAL != overrideColor) { | 111 if (GrColor_ILLEGAL != overrideColor) { |
| 108 fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kUseOverrideColor_G
rPipelineInfoFlag; | 112 fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kUseOverrideColor_G
rPipelineInfoFlag; |
| 109 fInfoForPrimitiveProcessor.fOverrideColor = overrideColor; | 113 fInfoForPrimitiveProcessor.fOverrideColor = overrideColor; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); | 171 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); |
| 168 for (int i = 0; i < this->numFragmentStages(); i++) { | 172 for (int i = 0; i < this->numFragmentStages(); i++) { |
| 169 | 173 |
| 170 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { | 174 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { |
| 171 return false; | 175 return false; |
| 172 } | 176 } |
| 173 } | 177 } |
| 174 return true; | 178 return true; |
| 175 } | 179 } |
| 176 | 180 |
| OLD | NEW |