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