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

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

Issue 1287973003: Check for xfer barriers in GrBatch, auto-issue barriers in GrGpu (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment Created 5 years, 4 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/GrPathRendering.h ('k') | src/gpu/GrPipeline.cpp » ('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 #ifndef GrPipeline_DEFINED 8 #ifndef GrPipeline_DEFINED
9 #define GrPipeline_DEFINED 9 #define GrPipeline_DEFINED
10 10
(...skipping 11 matching lines...) Expand all
22 class GrBatch; 22 class GrBatch;
23 class GrDeviceCoordTexture; 23 class GrDeviceCoordTexture;
24 class GrPipelineBuilder; 24 class GrPipelineBuilder;
25 25
26 /** 26 /**
27 * Class that holds an optimized version of a GrPipelineBuilder. It is meant to be an immutable 27 * Class that holds an optimized version of a GrPipelineBuilder. It is meant to be an immutable
28 * class, and contains all data needed to set the state for a gpu draw. 28 * class, and contains all data needed to set the state for a gpu draw.
29 */ 29 */
30 class GrPipeline : public GrNonAtomicRef { 30 class GrPipeline : public GrNonAtomicRef {
31 public: 31 public:
32 ///////////////////////////////////////////////////////////////////////////
33 /// @name Creation
34
32 struct CreateArgs { 35 struct CreateArgs {
33 const GrPipelineBuilder* fPipelineBuilder; 36 const GrPipelineBuilder* fPipelineBuilder;
34 const GrCaps* fCaps; 37 const GrCaps* fCaps;
35 GrProcOptInfo fColorPOI; 38 GrProcOptInfo fColorPOI;
36 GrProcOptInfo fCoveragePOI; 39 GrProcOptInfo fCoveragePOI;
37 const GrScissorState* fScissor; 40 const GrScissorState* fScissor;
38 GrXferProcessor::DstTexture fDstTexture; 41 GrXferProcessor::DstTexture fDstTexture;
39 }; 42 };
40 43
41 /** Creates a pipeline into a pre-allocated buffer */ 44 /** Creates a pipeline into a pre-allocated buffer */
42 static GrPipeline* CreateAt(void* memory, const CreateArgs&, GrPipelineOptim izations*); 45 static GrPipeline* CreateAt(void* memory, const CreateArgs&, GrPipelineOptim izations*);
43 46
44 /* 47 /// @}
48
49 ///////////////////////////////////////////////////////////////////////////
50 /// @name Comparisons
51
52 /**
45 * Returns true if these pipelines are equivalent. Coord transforms may be applied either on 53 * Returns true if these pipelines are equivalent. Coord transforms may be applied either on
46 * the GPU or the CPU. When we apply them on the CPU then the matrices need not agree in order 54 * the GPU or the CPU. When we apply them on the CPU then the matrices need not agree in order
47 * to combine draws. Therefore we take a param that indicates whether coord transforms should be 55 * to combine draws. Therefore we take a param that indicates whether coord transforms should be
48 * compared." 56 * compared."
49 */ 57 */
50 bool isEqual(const GrPipeline& that, bool ignoreCoordTransforms = false) con st; 58 static bool AreEqual(const GrPipeline& a, const GrPipeline& b, bool ignoreCo ordTransforms);
59
60 /**
61 * Allows a GrBatch subclass to determine whether two GrBatches can combine. This is a stricter
62 * test than isEqual because it also considers blend barriers when the two b atches' bounds
63 * overlap
64 */
65 static bool CanCombine(const GrPipeline& a, const SkRect& aBounds,
66 const GrPipeline& b, const SkRect& bBounds,
67 const GrCaps& caps,
68 bool ignoreCoordTransforms = false) {
69 if (!AreEqual(a, b, ignoreCoordTransforms)) {
70 return false;
71 }
72 if (a.xferBarrierType(caps)) {
73 return aBounds.fRight <= bBounds.fLeft ||
74 aBounds.fBottom <= bBounds.fTop ||
75 bBounds.fRight <= aBounds.fLeft ||
76 bBounds.fBottom <= aBounds.fTop;
77 }
78 return true;
79 }
51 80
52 /// @} 81 /// @}
53 82
54 /////////////////////////////////////////////////////////////////////////// 83 ///////////////////////////////////////////////////////////////////////////
55 /// @name GrFragmentProcessors 84 /// @name GrFragmentProcessors
56 85
57 86
58 int numColorFragmentStages() const { return fNumColorStages; } 87 int numColorFragmentStages() const { return fNumColorStages; }
59 int numCoverageFragmentStages() const { return fFragmentStages.count() - fNu mColorStages; } 88 int numCoverageFragmentStages() const { return fFragmentStages.count() - fNu mColorStages; }
60 int numFragmentStages() const { return fFragmentStages.count(); } 89 int numFragmentStages() const { return fFragmentStages.count(); }
(...skipping 22 matching lines...) Expand all
83 GrRenderTarget* getRenderTarget() const { return fRenderTarget.get(); } 112 GrRenderTarget* getRenderTarget() const { return fRenderTarget.get(); }
84 113
85 const GrStencilSettings& getStencil() const { return fStencilSettings; } 114 const GrStencilSettings& getStencil() const { return fStencilSettings; }
86 115
87 const GrScissorState& getScissorState() const { return fScissorState; } 116 const GrScissorState& getScissorState() const { return fScissorState; }
88 117
89 bool isDitherState() const { return SkToBool(fFlags & kDither_Flag); } 118 bool isDitherState() const { return SkToBool(fFlags & kDither_Flag); }
90 bool isHWAntialiasState() const { return SkToBool(fFlags & kHWAA_Flag); } 119 bool isHWAntialiasState() const { return SkToBool(fFlags & kHWAA_Flag); }
91 bool snapVerticesToPixelCenters() const { return SkToBool(fFlags & kSnapVert ices_Flag); } 120 bool snapVerticesToPixelCenters() const { return SkToBool(fFlags & kSnapVert ices_Flag); }
92 121
122 GrXferBarrierType xferBarrierType(const GrCaps& caps) const {
123 return fXferProcessor->xferBarrierType(fRenderTarget.get(), caps);
124 }
125
93 /** 126 /**
94 * Gets whether the target is drawing clockwise, counterclockwise, 127 * Gets whether the target is drawing clockwise, counterclockwise,
95 * or both faces. 128 * or both faces.
96 * @return the current draw face(s). 129 * @return the current draw face(s).
97 */ 130 */
98 GrPipelineBuilder::DrawFace getDrawFace() const { return fDrawFace; } 131 GrPipelineBuilder::DrawFace getDrawFace() const { return fDrawFace; }
99 132
100 133
101 /////////////////////////////////////////////////////////////////////////// 134 ///////////////////////////////////////////////////////////////////////////
102 135
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // This function is equivalent to the offset into fFragmentStages where cove rage stages begin. 181 // This function is equivalent to the offset into fFragmentStages where cove rage stages begin.
149 int fNumColorStages; 182 int fNumColorStages;
150 183
151 SkSTArray<8, const GrCoordTransform*, true> fCoordTransforms; 184 SkSTArray<8, const GrCoordTransform*, true> fCoordTransforms;
152 GrProgramDesc fDesc; 185 GrProgramDesc fDesc;
153 186
154 typedef SkRefCnt INHERITED; 187 typedef SkRefCnt INHERITED;
155 }; 188 };
156 189
157 #endif 190 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrPathRendering.h ('k') | src/gpu/GrPipeline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698