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" |
11 #include "GrDrawTarget.h" | 11 #include "GrDrawTarget.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 #include "batches/GrBatch.h" | 17 #include "batches/GrBatch.h" |
18 | 18 |
19 GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args, | 19 GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args, |
20 GrXPOverridesForBatch* overrides) { | 20 GrXPOverridesForBatch* overrides) { |
21 const GrPipelineBuilder& builder = *args.fPipelineBuilder; | 21 const GrPipelineBuilder& builder = *args.fPipelineBuilder; |
22 | 22 |
23 // Create XferProcessor from DS's XPFactory | 23 // Create XferProcessor from DS's XPFactory |
| 24 bool hasMixedSamples = builder.getRenderTarget()->hasMixedSamples() && |
| 25 (builder.isHWAntialias() || !builder.getStencil().isD
isabled()); |
24 const GrXPFactory* xpFactory = builder.getXPFactory(); | 26 const GrXPFactory* xpFactory = builder.getXPFactory(); |
25 SkAutoTUnref<GrXferProcessor> xferProcessor; | 27 SkAutoTUnref<GrXferProcessor> xferProcessor; |
26 if (xpFactory) { | 28 if (xpFactory) { |
27 xferProcessor.reset(xpFactory->createXferProcessor(args.fOpts, | 29 xferProcessor.reset(xpFactory->createXferProcessor(args.fOpts, |
28 builder.hasMixedSampl
es(), | 30 hasMixedSamples, |
29 &args.fDstTexture, | 31 &args.fDstTexture, |
30 *args.fCaps)); | 32 *args.fCaps)); |
31 if (!xferProcessor) { | 33 if (!xferProcessor) { |
32 return nullptr; | 34 return nullptr; |
33 } | 35 } |
34 } else { | 36 } else { |
35 // This may return nullptr in the common case of src-over implemented us
ing hw blending. | 37 // This may return nullptr in the common case of src-over implemented us
ing hw blending. |
36 xferProcessor.reset(GrPorterDuffXPFactory::CreateSrcOverXferProcessor( | 38 xferProcessor.reset(GrPorterDuffXPFactory::CreateSrcOverXferProcessor( |
37 *args.fC
aps, | 39 *args.fC
aps, |
38 args.fOp
ts, | 40 args.fOp
ts, |
39 builder.
hasMixedSamples(), | 41 hasMixed
Samples, |
40 &args.fD
stTexture)); | 42 &args.fD
stTexture)); |
41 } | 43 } |
42 GrColor overrideColor = GrColor_ILLEGAL; | 44 GrColor overrideColor = GrColor_ILLEGAL; |
43 if (args.fOpts.fColorPOI.firstEffectiveProcessorIndex() != 0) { | 45 if (args.fOpts.fColorPOI.firstEffectiveProcessorIndex() != 0) { |
44 overrideColor = args.fOpts.fColorPOI.inputColorToFirstEffectiveProccesor
(); | 46 overrideColor = args.fOpts.fColorPOI.inputColorToFirstEffectiveProccesor
(); |
45 } | 47 } |
46 | 48 |
47 GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_OptFlags; | 49 GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_OptFlags; |
48 | 50 |
49 const GrXferProcessor* xpForOpts = xferProcessor ? xferProcessor.get() : | 51 const GrXferProcessor* xpForOpts = xferProcessor ? xferProcessor.get() : |
50 &GrPorterDuffXPFactory::S
impleSrcOverXP(); | 52 &GrPorterDuffXPFactory::S
impleSrcOverXP(); |
51 optFlags = xpForOpts->getOptimizations(args.fOpts, | 53 optFlags = xpForOpts->getOptimizations(args.fOpts, |
52 builder.getStencil().doesWrite(), | 54 builder.getStencil().doesWrite(), |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 } | 226 } |
225 } | 227 } |
226 | 228 |
227 for (int i = 0; i < a.numFragmentProcessors(); i++) { | 229 for (int i = 0; i < a.numFragmentProcessors(); i++) { |
228 if (!a.getFragmentProcessor(i).isEqual(b.getFragmentProcessor(i), ignore
CoordTransforms)) { | 230 if (!a.getFragmentProcessor(i).isEqual(b.getFragmentProcessor(i), ignore
CoordTransforms)) { |
229 return false; | 231 return false; |
230 } | 232 } |
231 } | 233 } |
232 return true; | 234 return true; |
233 } | 235 } |
OLD | NEW |