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" |
(...skipping 11 matching lines...) Expand all Loading... | |
22 const GrDeviceCoordTexture* dstCopy) { | 22 const GrDeviceCoordTexture* dstCopy) { |
23 // Create XferProcessor from DS's XPFactory | 23 // Create XferProcessor from DS's XPFactory |
24 SkAutoTUnref<GrXferProcessor> xferProcessor( | 24 SkAutoTUnref<GrXferProcessor> xferProcessor( |
25 pipelineBuilder.getXPFactory()->createXferProcessor(colorPOI, coveragePO I, dstCopy, caps)); | 25 pipelineBuilder.getXPFactory()->createXferProcessor(colorPOI, coveragePO I, dstCopy, caps)); |
26 | 26 |
27 GrColor overrideColor = GrColor_ILLEGAL; | 27 GrColor overrideColor = GrColor_ILLEGAL; |
28 if (colorPOI.firstEffectiveStageIndex() != 0) { | 28 if (colorPOI.firstEffectiveStageIndex() != 0) { |
29 overrideColor = colorPOI.inputColorToEffectiveStage(); | 29 overrideColor = colorPOI.inputColorToEffectiveStage(); |
30 } | 30 } |
31 | 31 |
32 fRenderTarget.reset(pipelineBuilder.fRenderTarget.get()); | |
33 SkASSERT(fRenderTarget); | |
34 | |
32 GrXferProcessor::OptFlags optFlags; | 35 GrXferProcessor::OptFlags optFlags; |
33 if (xferProcessor) { | 36 if (xferProcessor) { |
34 fXferProcessor.reset(xferProcessor.get()); | 37 fXferProcessor.reset(xferProcessor.get()); |
35 | 38 |
36 optFlags = xferProcessor->getOptimizations(colorPOI, | 39 GrProcOptInfo localColorPOI = colorPOI; |
40 // Optimizations will try to turn off blending which is required by mixe d | |
41 // sampled modes. | |
42 bool isMixedSampledTarget = | |
43 (this->getRenderTarget()->sampleConfig() == kStencil_GrSampleConfig) ; | |
44 localColorPOI.setNeedsCoverageModulation(isMixedSampledTarget); | |
Chris Dalton
2015/03/14 02:51:30
No need to force blending unless we're actually us
| |
45 | |
46 optFlags = xferProcessor->getOptimizations(localColorPOI, | |
37 coveragePOI, | 47 coveragePOI, |
38 pipelineBuilder.getStencil(). doesWrite(), | 48 pipelineBuilder.getStencil(). doesWrite(), |
39 &overrideColor, | 49 &overrideColor, |
40 caps); | 50 caps); |
41 } | 51 } |
42 | 52 |
43 // When path rendering the stencil settings are not always set on the GrPipe lineBuilder | 53 // When path rendering the stencil settings are not always set on the GrPipe lineBuilder |
44 // so we must check the draw type. In cases where we will skip drawing we si mply return a | 54 // so we must check the draw type. In cases where we will skip drawing we si mply return a |
45 // null GrPipeline. | 55 // null GrPipeline. |
46 if (!xferProcessor || (GrXferProcessor::kSkipDraw_OptFlag & optFlags)) { | 56 if (!xferProcessor || (GrXferProcessor::kSkipDraw_OptFlag & optFlags)) { |
47 // Set the fields that don't default init and return. The lack of a rend er target will | 57 // Set the fields that don't default init and return. The lack of a rend er target will |
48 // indicate that this can be skipped. | 58 // indicate that this can be skipped. |
49 fFlags = 0; | 59 fFlags = 0; |
50 fDrawFace = GrPipelineBuilder::kInvalid_DrawFace; | 60 fDrawFace = GrPipelineBuilder::kInvalid_DrawFace; |
51 return; | 61 return; |
52 } | 62 } |
53 | 63 |
54 fRenderTarget.reset(pipelineBuilder.fRenderTarget.get()); | |
55 SkASSERT(fRenderTarget); | |
56 fScissorState = scissorState; | 64 fScissorState = scissorState; |
57 fStencilSettings = pipelineBuilder.getStencil(); | 65 fStencilSettings = pipelineBuilder.getStencil(); |
58 fDrawFace = pipelineBuilder.getDrawFace(); | 66 fDrawFace = pipelineBuilder.getDrawFace(); |
59 | 67 |
60 fFlags = 0; | 68 fFlags = 0; |
61 if (pipelineBuilder.isHWAntialias()) { | 69 if (pipelineBuilder.isHWAntialias()) { |
62 fFlags |= kHWAA_Flag; | 70 fFlags |= kHWAA_Flag; |
63 } | 71 } |
64 if (pipelineBuilder.isDither()) { | 72 if (pipelineBuilder.isDither()) { |
65 fFlags |= kDither_Flag; | 73 fFlags |= kDither_Flag; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); | 159 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); |
152 for (int i = 0; i < this->numFragmentStages(); i++) { | 160 for (int i = 0; i < this->numFragmentStages(); i++) { |
153 | 161 |
154 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { | 162 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { |
155 return false; | 163 return false; |
156 } | 164 } |
157 } | 165 } |
158 return true; | 166 return true; |
159 } | 167 } |
160 | 168 |
OLD | NEW |