| 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 GrPipelineOptimizations* opts) { | 20 GrPipelineOptimizations* opts) { |
| 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 SkAutoTUnref<GrXferProcessor> xferProcessor( | 24 SkAutoTUnref<GrXferProcessor> xferProcessor( |
| 25 builder.getXPFactory()->createXferProcessor(args.fColorPOI, args.fCovera
gePOI, | 25 builder.getXPFactory()->createXferProcessor(args.fColorPOI, args.fCovera
gePOI, |
| 26 builder.hasMixedSamples(), &
args.fDstTexture, | 26 builder.hasMixedSamples(), &
args.fDstTexture, |
| 27 *args.fCaps)); | 27 *args.fCaps, builder.getRend
erTarget())); |
| 28 if (!xferProcessor) { | 28 if (!xferProcessor) { |
| 29 return nullptr; | 29 return nullptr; |
| 30 } | 30 } |
| 31 | 31 |
| 32 GrColor overrideColor = GrColor_ILLEGAL; | 32 GrColor overrideColor = GrColor_ILLEGAL; |
| 33 if (args.fColorPOI.firstEffectiveProcessorIndex() != 0) { | 33 if (args.fColorPOI.firstEffectiveProcessorIndex() != 0) { |
| 34 overrideColor = args.fColorPOI.inputColorToFirstEffectiveProccesor(); | 34 overrideColor = args.fColorPOI.inputColorToFirstEffectiveProccesor(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_OptFlags; | 37 GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_OptFlags; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 50 } | 50 } |
| 51 | 51 |
| 52 // No need to have an override color if it isn't even going to be used. | 52 // No need to have an override color if it isn't even going to be used. |
| 53 if (SkToBool(GrXferProcessor::kIgnoreColor_OptFlag & optFlags)) { | 53 if (SkToBool(GrXferProcessor::kIgnoreColor_OptFlag & optFlags)) { |
| 54 overrideColor = GrColor_ILLEGAL; | 54 overrideColor = GrColor_ILLEGAL; |
| 55 } | 55 } |
| 56 | 56 |
| 57 GrPipeline* pipeline = new (memory) GrPipeline; | 57 GrPipeline* pipeline = new (memory) GrPipeline; |
| 58 pipeline->fXferProcessor.reset(xferProcessor.get()); | 58 pipeline->fXferProcessor.reset(xferProcessor.get()); |
| 59 | 59 |
| 60 pipeline->fRenderTarget.reset(builder.fRenderTarget.get()); | 60 pipeline->fRenderTarget.reset(builder.fRenderTarget.get(), NULL); |
| 61 SkASSERT(pipeline->fRenderTarget); | 61 SkASSERT(pipeline->fRenderTarget); |
| 62 pipeline->fScissorState = *args.fScissor; | 62 pipeline->fScissorState = *args.fScissor; |
| 63 pipeline->fStencilSettings = builder.getStencil(); | 63 pipeline->fStencilSettings = builder.getStencil(); |
| 64 pipeline->fDrawFace = builder.getDrawFace(); | 64 pipeline->fDrawFace = builder.getDrawFace(); |
| 65 | 65 |
| 66 pipeline->fFlags = 0; | 66 pipeline->fFlags = 0; |
| 67 if (builder.isHWAntialias()) { | 67 if (builder.isHWAntialias()) { |
| 68 pipeline->fFlags |= kHWAA_Flag; | 68 pipeline->fFlags |= kHWAA_Flag; |
| 69 } | 69 } |
| 70 if (builder.snapVerticesToPixelCenters()) { | 70 if (builder.snapVerticesToPixelCenters()) { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 } | 207 } |
| 208 | 208 |
| 209 for (int i = 0; i < a.numFragmentProcessors(); i++) { | 209 for (int i = 0; i < a.numFragmentProcessors(); i++) { |
| 210 if (!a.getFragmentProcessor(i).isEqual(b.getFragmentProcessor(i), ignore
CoordTransforms)) { | 210 if (!a.getFragmentProcessor(i).isEqual(b.getFragmentProcessor(i), ignore
CoordTransforms)) { |
| 211 return false; | 211 return false; |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 return true; | 214 return true; |
| 215 } | 215 } |
| 216 | 216 |
| OLD | NEW |