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 "GrBatch.h" |
10 #include "GrDrawTargetCaps.h" | 11 #include "GrDrawTargetCaps.h" |
11 #include "GrGpu.h" | 12 #include "GrGpu.h" |
12 #include "GrPipelineBuilder.h" | 13 #include "GrPipelineBuilder.h" |
13 #include "GrProcOptInfo.h" | 14 #include "GrProcOptInfo.h" |
14 #include "GrXferProcessor.h" | 15 #include "GrXferProcessor.h" |
15 | 16 |
16 GrPipeline::GrPipeline(const GrPipelineBuilder& pipelineBuilder, | 17 GrPipeline::GrPipeline(const GrPipelineBuilder& pipelineBuilder, |
17 const GrPrimitiveProcessor* primProc, | 18 const GrPrimitiveProcessor* primProc, |
18 const GrDrawTargetCaps& caps, | 19 const GrDrawTargetCaps& caps, |
19 const GrScissorState& scissorState, | 20 const GrScissorState& scissorState, |
20 const GrDeviceCoordTexture* dstCopy) { | 21 const GrDeviceCoordTexture* dstCopy) { |
21 const GrProcOptInfo& colorPOI = pipelineBuilder.colorProcInfo(primProc); | 22 const GrProcOptInfo& colorPOI = pipelineBuilder.colorProcInfo(primProc); |
22 const GrProcOptInfo& coveragePOI = pipelineBuilder.coverageProcInfo(primProc
); | 23 const GrProcOptInfo& coveragePOI = pipelineBuilder.coverageProcInfo(primProc
); |
23 | 24 |
| 25 this->internalConstructor(pipelineBuilder, colorPOI, coveragePOI, caps, scis
sorState, dstCopy); |
| 26 } |
| 27 |
| 28 GrPipeline::GrPipeline(GrBatch* batch, |
| 29 const GrPipelineBuilder& pipelineBuilder, |
| 30 const GrDrawTargetCaps& caps, |
| 31 const GrScissorState& scissorState, |
| 32 const GrDeviceCoordTexture* dstCopy) { |
| 33 GrBatchOpt batchOpt; |
| 34 batchOpt.fCanTweakAlphaForCoverage = pipelineBuilder.canTweakAlphaForCoverag
e(); |
| 35 batch->initBatchOpt(batchOpt); |
| 36 |
| 37 const GrProcOptInfo& colorPOI = pipelineBuilder.colorProcInfo(batch); |
| 38 const GrProcOptInfo& coveragePOI = pipelineBuilder.coverageProcInfo(batch); |
| 39 |
| 40 this->internalConstructor(pipelineBuilder, colorPOI, coveragePOI, caps, scis
sorState, dstCopy); |
| 41 } |
| 42 |
| 43 void GrPipeline::internalConstructor(const GrPipelineBuilder& pipelineBuilder, |
| 44 const GrProcOptInfo& colorPOI, |
| 45 const GrProcOptInfo& coveragePOI, |
| 46 const GrDrawTargetCaps& caps, |
| 47 const GrScissorState& scissorState, |
| 48 const GrDeviceCoordTexture* dstCopy) { |
24 // Create XferProcessor from DS's XPFactory | 49 // Create XferProcessor from DS's XPFactory |
25 SkAutoTUnref<GrXferProcessor> xferProcessor( | 50 SkAutoTUnref<GrXferProcessor> xferProcessor( |
26 pipelineBuilder.getXPFactory()->createXferProcessor(colorPOI, coveragePO
I)); | 51 pipelineBuilder.getXPFactory()->createXferProcessor(colorPOI, coveragePO
I)); |
27 | 52 |
28 GrColor overrideColor = GrColor_ILLEGAL; | 53 GrColor overrideColor = GrColor_ILLEGAL; |
29 if (colorPOI.firstEffectiveStageIndex() != 0) { | 54 if (colorPOI.firstEffectiveStageIndex() != 0) { |
30 overrideColor = colorPOI.inputColorToEffectiveStage(); | 55 overrideColor = colorPOI.inputColorToEffectiveStage(); |
31 } | 56 } |
32 | 57 |
33 GrXferProcessor::OptFlags optFlags; | 58 GrXferProcessor::OptFlags optFlags; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); | 182 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); |
158 for (int i = 0; i < this->numFragmentStages(); i++) { | 183 for (int i = 0; i < this->numFragmentStages(); i++) { |
159 | 184 |
160 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { | 185 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { |
161 return false; | 186 return false; |
162 } | 187 } |
163 } | 188 } |
164 return true; | 189 return true; |
165 } | 190 } |
166 | 191 |
OLD | NEW |