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 "GrBatch.h" |
11 #include "GrDrawTargetCaps.h" | 11 #include "GrDrawTargetCaps.h" |
12 #include "GrGpu.h" | 12 #include "GrGpu.h" |
13 #include "GrPipelineBuilder.h" | 13 #include "GrPipelineBuilder.h" |
14 #include "GrProcOptInfo.h" | 14 #include "GrProcOptInfo.h" |
15 #include "GrXferProcessor.h" | 15 #include "GrXferProcessor.h" |
16 | 16 |
17 GrPipeline::GrPipeline(const GrPipelineBuilder& pipelineBuilder, | 17 GrPipeline::GrPipeline(const GrPipelineBuilder& pipelineBuilder, |
18 const GrPrimitiveProcessor* primProc, | 18 const GrProcOptInfo& colorPOI, |
| 19 const GrProcOptInfo& coveragePOI, |
19 const GrDrawTargetCaps& caps, | 20 const GrDrawTargetCaps& caps, |
20 const GrScissorState& scissorState, | 21 const GrScissorState& scissorState, |
21 const GrDeviceCoordTexture* dstCopy) { | 22 const GrDeviceCoordTexture* dstCopy) { |
22 const GrProcOptInfo& colorPOI = pipelineBuilder.colorProcInfo(primProc); | |
23 const GrProcOptInfo& coveragePOI = pipelineBuilder.coverageProcInfo(primProc
); | |
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) { | |
49 // Create XferProcessor from DS's XPFactory | 23 // Create XferProcessor from DS's XPFactory |
50 SkAutoTUnref<GrXferProcessor> xferProcessor( | 24 SkAutoTUnref<GrXferProcessor> xferProcessor( |
51 pipelineBuilder.getXPFactory()->createXferProcessor(colorPOI, coveragePO
I, dstCopy, caps)); | 25 pipelineBuilder.getXPFactory()->createXferProcessor(colorPOI, coveragePO
I, dstCopy, caps)); |
52 | 26 |
53 GrColor overrideColor = GrColor_ILLEGAL; | 27 GrColor overrideColor = GrColor_ILLEGAL; |
54 if (colorPOI.firstEffectiveStageIndex() != 0) { | 28 if (colorPOI.firstEffectiveStageIndex() != 0) { |
55 overrideColor = colorPOI.inputColorToEffectiveStage(); | 29 overrideColor = colorPOI.inputColorToEffectiveStage(); |
56 } | 30 } |
57 | 31 |
58 GrXferProcessor::OptFlags optFlags; | 32 GrXferProcessor::OptFlags optFlags; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); | 149 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); |
176 for (int i = 0; i < this->numFragmentStages(); i++) { | 150 for (int i = 0; i < this->numFragmentStages(); i++) { |
177 | 151 |
178 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { | 152 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { |
179 return false; | 153 return false; |
180 } | 154 } |
181 } | 155 } |
182 return true; | 156 return true; |
183 } | 157 } |
184 | 158 |
OLD | NEW |