| 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 SkASSERT(!(args.fAdditionalFlags & args.fBlockedFlags)); |
| 22 |
| 21 const GrPipelineBuilder& builder = *args.fPipelineBuilder; | 23 const GrPipelineBuilder& builder = *args.fPipelineBuilder; |
| 22 | 24 |
| 23 // Create XferProcessor from DS's XPFactory | 25 // Create XferProcessor from DS's XPFactory |
| 24 SkAutoTUnref<GrXferProcessor> xferProcessor( | 26 SkAutoTUnref<GrXferProcessor> xferProcessor( |
| 25 builder.getXPFactory()->createXferProcessor(args.fColorPOI, args.fCovera
gePOI, | 27 builder.getXPFactory()->createXferProcessor(args.fColorPOI, args.fCovera
gePOI, |
| 26 builder.hasMixedSamples(), &
args.fDstTexture, | 28 builder.hasMixedSamples(), &
args.fDstTexture, |
| 27 *args.fCaps)); | 29 *args.fCaps)); |
| 28 if (!xferProcessor) { | 30 if (!xferProcessor) { |
| 29 return nullptr; | 31 return nullptr; |
| 30 } | 32 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 56 | 58 |
| 57 GrPipeline* pipeline = new (memory) GrPipeline; | 59 GrPipeline* pipeline = new (memory) GrPipeline; |
| 58 pipeline->fXferProcessor.reset(xferProcessor.get()); | 60 pipeline->fXferProcessor.reset(xferProcessor.get()); |
| 59 | 61 |
| 60 pipeline->fRenderTarget.reset(builder.fRenderTarget.get()); | 62 pipeline->fRenderTarget.reset(builder.fRenderTarget.get()); |
| 61 SkASSERT(pipeline->fRenderTarget); | 63 SkASSERT(pipeline->fRenderTarget); |
| 62 pipeline->fScissorState = *args.fScissor; | 64 pipeline->fScissorState = *args.fScissor; |
| 63 pipeline->fStencilSettings = builder.getStencil(); | 65 pipeline->fStencilSettings = builder.getStencil(); |
| 64 pipeline->fDrawFace = builder.getDrawFace(); | 66 pipeline->fDrawFace = builder.getDrawFace(); |
| 65 | 67 |
| 66 pipeline->fFlags = 0; | 68 pipeline->fFlags = args.fAdditionalFlags; |
| 67 if (builder.isHWAntialias()) { | 69 if (builder.isHWAntialias()) { |
| 68 pipeline->fFlags |= kHWAA_Flag; | 70 pipeline->fFlags |= kHWAA_Flag; |
| 69 } | 71 } |
| 70 if (builder.snapVerticesToPixelCenters()) { | 72 if (builder.snapVerticesToPixelCenters()) { |
| 71 pipeline->fFlags |= kSnapVertices_Flag; | 73 pipeline->fFlags |= kSnapVertices_Flag; |
| 72 } | 74 } |
| 75 pipeline->fFlags &= ~args.fBlockedFlags; |
| 73 | 76 |
| 74 int firstColorProcessorIdx = args.fColorPOI.firstEffectiveProcessorIndex(); | 77 int firstColorProcessorIdx = args.fColorPOI.firstEffectiveProcessorIndex(); |
| 75 | 78 |
| 76 // TODO: Once we can handle single or four channel input into coverage GrFra
gmentProcessors | 79 // TODO: Once we can handle single or four channel input into coverage GrFra
gmentProcessors |
| 77 // then we can use GrPipelineBuilder's coverageProcInfo (like color above) t
o set this initial | 80 // then we can use GrPipelineBuilder's coverageProcInfo (like color above) t
o set this initial |
| 78 // information. | 81 // information. |
| 79 int firstCoverageProcessorIdx = 0; | 82 int firstCoverageProcessorIdx = 0; |
| 80 | 83 |
| 81 pipeline->adjustProgramFromOptimizations(builder, optFlags, args.fColorPOI,
args.fCoveragePOI, | 84 pipeline->adjustProgramFromOptimizations(builder, optFlags, args.fColorPOI,
args.fCoveragePOI, |
| 82 &firstColorProcessorIdx, &firstCove
rageProcessorIdx); | 85 &firstColorProcessorIdx, &firstCove
rageProcessorIdx); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 } | 210 } |
| 208 | 211 |
| 209 for (int i = 0; i < a.numFragmentProcessors(); i++) { | 212 for (int i = 0; i < a.numFragmentProcessors(); i++) { |
| 210 if (!a.getFragmentProcessor(i).isEqual(b.getFragmentProcessor(i), ignore
CoordTransforms)) { | 213 if (!a.getFragmentProcessor(i).isEqual(b.getFragmentProcessor(i), ignore
CoordTransforms)) { |
| 211 return false; | 214 return false; |
| 212 } | 215 } |
| 213 } | 216 } |
| 214 return true; | 217 return true; |
| 215 } | 218 } |
| 216 | 219 |
| OLD | NEW |