Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(710)

Side by Side Diff: src/gpu/GrPipeline.cpp

Issue 1480353002: APIs which took colorPOI / coveragePOI pairs updated to take a GrPipelineOptimizations struct (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrPipelineBuilder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 const GrXPFactory* xpFactory = builder.getXPFactory(); 24 const GrXPFactory* xpFactory = builder.getXPFactory();
25 SkAutoTUnref<GrXferProcessor> xferProcessor; 25 SkAutoTUnref<GrXferProcessor> xferProcessor;
26 if (xpFactory) { 26 if (xpFactory) {
27 xferProcessor.reset(xpFactory->createXferProcessor(args.fOpts.fColorPOI, 27 xferProcessor.reset(xpFactory->createXferProcessor(args.fOpts,
28 args.fOpts.fCoverageP OI,
29 builder.hasMixedSampl es(), 28 builder.hasMixedSampl es(),
30 &args.fDstTexture, 29 &args.fDstTexture,
31 *args.fCaps)); 30 *args.fCaps));
32 } else { 31 } else {
33 xferProcessor.reset(GrPorterDuffXPFactory::CreateSrcOverXferProcessor( 32 xferProcessor.reset(GrPorterDuffXPFactory::CreateSrcOverXferProcessor(
34 *args.fC aps, 33 *args.fC aps,
35 args.fOp ts.fColorPOI, 34 args.fOp ts,
36 args.fOp ts.fCoveragePOI,
37 builder. hasMixedSamples(), 35 builder. hasMixedSamples(),
38 &args.fD stTexture)); 36 &args.fD stTexture));
39 } 37 }
40 38
41 if (!xferProcessor) { 39 if (!xferProcessor) {
42 return nullptr; 40 return nullptr;
43 } 41 }
44 42
45 GrColor overrideColor = GrColor_ILLEGAL; 43 GrColor overrideColor = GrColor_ILLEGAL;
46 if (args.fOpts.fColorPOI.firstEffectiveProcessorIndex() != 0) { 44 if (args.fOpts.fColorPOI.firstEffectiveProcessorIndex() != 0) {
47 overrideColor = args.fOpts.fColorPOI.inputColorToFirstEffectiveProccesor (); 45 overrideColor = args.fOpts.fColorPOI.inputColorToFirstEffectiveProccesor ();
48 } 46 }
49 47
50 GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_OptFlags; 48 GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_OptFlags;
51 49
52 optFlags = xferProcessor->getOptimizations(args.fOpts.fColorPOI, 50 optFlags = xferProcessor->getOptimizations(args.fOpts,
53 args.fOpts.fCoveragePOI,
54 builder.getStencil().doesWrite(), 51 builder.getStencil().doesWrite(),
55 &overrideColor, 52 &overrideColor,
56 *args.fCaps); 53 *args.fCaps);
57 54
58 // When path rendering the stencil settings are not always set on the GrPipe lineBuilder 55 // When path rendering the stencil settings are not always set on the GrPipe lineBuilder
59 // so we must check the draw type. In cases where we will skip drawing we si mply return a 56 // so we must check the draw type. In cases where we will skip drawing we si mply return a
60 // null GrPipeline. 57 // null GrPipeline.
61 if (GrXferProcessor::kSkipDraw_OptFlag & optFlags) { 58 if (GrXferProcessor::kSkipDraw_OptFlag & optFlags) {
62 return nullptr; 59 return nullptr;
63 } 60 }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } 225 }
229 226
230 for (int i = 0; i < a.numFragmentProcessors(); i++) { 227 for (int i = 0; i < a.numFragmentProcessors(); i++) {
231 if (!a.getFragmentProcessor(i).isEqual(b.getFragmentProcessor(i), ignore CoordTransforms)) { 228 if (!a.getFragmentProcessor(i).isEqual(b.getFragmentProcessor(i), ignore CoordTransforms)) {
232 return false; 229 return false;
233 } 230 }
234 } 231 }
235 return true; 232 return true;
236 } 233 }
237 234
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrPipelineBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698