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

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

Issue 1988923002: Remove GrRenderTarget from GrPipelineBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 4 years, 6 months 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/GrPipeline.h ('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 "GrDrawContext.h"
11 #include "GrDrawTarget.h" 12 #include "GrDrawTarget.h"
12 #include "GrGpu.h" 13 #include "GrGpu.h"
13 #include "GrPipelineBuilder.h" 14 #include "GrPipelineBuilder.h"
14 #include "GrProcOptInfo.h" 15 #include "GrProcOptInfo.h"
15 #include "GrRenderTargetPriv.h" 16 #include "GrRenderTargetPriv.h"
16 #include "GrXferProcessor.h" 17 #include "GrXferProcessor.h"
17 18
18 #include "batches/GrBatch.h" 19 #include "batches/GrBatch.h"
19 20
20 GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args, 21 GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
21 GrXPOverridesForBatch* overrides) { 22 GrXPOverridesForBatch* overrides) {
22 const GrPipelineBuilder& builder = *args.fPipelineBuilder; 23 const GrPipelineBuilder& builder = *args.fPipelineBuilder;
23 24
24 GrPipeline* pipeline = new (memory) GrPipeline; 25 GrPipeline* pipeline = new (memory) GrPipeline;
25 pipeline->fRenderTarget.reset(builder.fRenderTarget.get()); 26 GrRenderTarget* rt = args.fDrawContext->accessRenderTarget();
27 pipeline->fRenderTarget.reset(rt);
26 SkASSERT(pipeline->fRenderTarget); 28 SkASSERT(pipeline->fRenderTarget);
27 pipeline->fScissorState = *args.fScissor; 29 pipeline->fScissorState = *args.fScissor;
28 if (builder.hasUserStencilSettings() || args.fHasStencilClip) { 30 if (builder.hasUserStencilSettings() || args.fHasStencilClip) {
29 const GrRenderTargetPriv& rtPriv = builder.getRenderTarget()->renderTarg etPriv(); 31 const GrRenderTargetPriv& rtPriv = rt->renderTargetPriv();
30 pipeline->fStencilSettings.reset(*builder.getUserStencil(), args.fHasSte ncilClip, 32 pipeline->fStencilSettings.reset(*builder.getUserStencil(), args.fHasSte ncilClip,
31 rtPriv.numStencilBits()); 33 rtPriv.numStencilBits());
32 SkASSERT(!pipeline->fStencilSettings.usesWrapOp() || args.fCaps->stencil WrapOpsSupport()); 34 SkASSERT(!pipeline->fStencilSettings.usesWrapOp() || args.fCaps->stencil WrapOpsSupport());
33 } 35 }
34 pipeline->fDrawFace = builder.getDrawFace(); 36 pipeline->fDrawFace = builder.getDrawFace();
35 37
36 pipeline->fFlags = 0; 38 pipeline->fFlags = 0;
37 if (builder.isHWAntialias()) { 39 if (builder.isHWAntialias()) {
38 pipeline->fFlags |= kHWAA_Flag; 40 pipeline->fFlags |= kHWAA_Flag;
39 } 41 }
40 if (builder.snapVerticesToPixelCenters()) { 42 if (builder.snapVerticesToPixelCenters()) {
41 pipeline->fFlags |= kSnapVertices_Flag; 43 pipeline->fFlags |= kSnapVertices_Flag;
42 } 44 }
43 if (builder.getDisableOutputConversionToSRGB()) { 45 if (builder.getDisableOutputConversionToSRGB()) {
44 pipeline->fFlags |= kDisableOutputConversionToSRGB_Flag; 46 pipeline->fFlags |= kDisableOutputConversionToSRGB_Flag;
45 } 47 }
46 if (builder.getAllowSRGBInputs()) { 48 if (builder.getAllowSRGBInputs()) {
47 pipeline->fFlags |= kAllowSRGBInputs_Flag; 49 pipeline->fFlags |= kAllowSRGBInputs_Flag;
48 } 50 }
49 if (args.fHasStencilClip) { 51 if (args.fHasStencilClip) {
50 pipeline->fFlags |= kHasStencilClip_Flag; 52 pipeline->fFlags |= kHasStencilClip_Flag;
51 } 53 }
52 54
53 // Create XferProcessor from DS's XPFactory 55 // Create XferProcessor from DS's XPFactory
54 bool hasMixedSamples = builder.getRenderTarget()->hasMixedSamples() && 56 bool hasMixedSamples = args.fDrawContext->hasMixedSamples() &&
55 (builder.isHWAntialias() || !pipeline->fStencilSettin gs.isDisabled()); 57 (builder.isHWAntialias() || !pipeline->fStencilSettin gs.isDisabled());
56 const GrXPFactory* xpFactory = builder.getXPFactory(); 58 const GrXPFactory* xpFactory = builder.getXPFactory();
57 SkAutoTUnref<GrXferProcessor> xferProcessor; 59 SkAutoTUnref<GrXferProcessor> xferProcessor;
58 if (xpFactory) { 60 if (xpFactory) {
59 xferProcessor.reset(xpFactory->createXferProcessor(args.fOpts, 61 xferProcessor.reset(xpFactory->createXferProcessor(args.fOpts,
60 hasMixedSamples, 62 hasMixedSamples,
61 &args.fDstTexture, 63 &args.fDstTexture,
62 *args.fCaps)); 64 *args.fCaps));
63 if (!xferProcessor) { 65 if (!xferProcessor) {
64 pipeline->~GrPipeline(); 66 pipeline->~GrPipeline();
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 239 }
238 } 240 }
239 241
240 for (int i = 0; i < a.numFragmentProcessors(); i++) { 242 for (int i = 0; i < a.numFragmentProcessors(); i++) {
241 if (!a.getFragmentProcessor(i).isEqual(b.getFragmentProcessor(i), ignore CoordTransforms)) { 243 if (!a.getFragmentProcessor(i).isEqual(b.getFragmentProcessor(i), ignore CoordTransforms)) {
242 return false; 244 return false;
243 } 245 }
244 } 246 }
245 return true; 247 return true;
246 } 248 }
OLDNEW
« no previous file with comments | « src/gpu/GrPipeline.h ('k') | src/gpu/GrPipelineBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698