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

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

Issue 845103005: GrBatchPrototype (Closed) Base URL: https://skia.googlesource.com/skia.git@lc2
Patch Set: a bit more tweaking Created 5 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 GrOptDrawState_DEFINED 8 #ifndef GrOptDrawState_DEFINED
9 #define GrOptDrawState_DEFINED 9 #define GrOptDrawState_DEFINED
10 10
11 #include "GrColor.h" 11 #include "GrColor.h"
12 #include "GrGpu.h" 12 #include "GrGpu.h"
13 #include "GrPendingFragmentStage.h" 13 #include "GrPendingFragmentStage.h"
14 #include "GrProgramDesc.h" 14 #include "GrProgramDesc.h"
15 #include "GrStencil.h" 15 #include "GrStencil.h"
16 #include "GrTypesPriv.h" 16 #include "GrTypesPriv.h"
17 #include "SkMatrix.h" 17 #include "SkMatrix.h"
18 #include "SkRefCnt.h" 18 #include "SkRefCnt.h"
19 19
20 class GrBatch;
20 class GrDeviceCoordTexture; 21 class GrDeviceCoordTexture;
21 class GrDrawState; 22 class GrDrawState;
22 class GrPathProcessor;
23 23
24 /** 24 /**
25 * Class that holds an optimized version of a GrDrawState. It is meant to be an immutable class, 25 * Class that holds an optimized version of a GrDrawState. It is meant to be an immutable class,
26 * and contains all data needed to set the state for a gpu draw. 26 * and contains all data needed to set the state for a gpu draw.
27 */ 27 */
28 class GrOptDrawState { 28 class GrOptDrawState {
29 public: 29 public:
30 SK_DECLARE_INST_COUNT(GrOptDrawState) 30 SK_DECLARE_INST_COUNT(GrOptDrawState)
31 31
32 // TODO get rid of this version of the constructor when we use batch everywh ere
32 GrOptDrawState(const GrDrawState& drawState, const GrPrimitiveProcessor*, 33 GrOptDrawState(const GrDrawState& drawState, const GrPrimitiveProcessor*,
33 const GrDrawTargetCaps&, const GrScissorState&, 34 const GrDrawTargetCaps&, const GrScissorState&,
34 const GrDeviceCoordTexture* dstCopy); 35 const GrDeviceCoordTexture* dstCopy);
35 36
37 GrOptDrawState(GrBatch*,
38 const GrDrawState& drawState,
39 const GrDrawTargetCaps&, const GrScissorState&,
40 const GrDeviceCoordTexture* dstCopy);
41
42
36 /* 43 /*
37 * Returns true if it is possible to combine the two GrOptDrawStates and it will update 'this' 44 * Returns true if it is possible to combine the two GrOptDrawStates and it will update 'this'
38 * to subsume 'that''s draw. 45 * to subsume 'that''s draw.
39 */ 46 */
40 bool isEqual(const GrOptDrawState& that) const; 47 bool isEqual(const GrOptDrawState& that) const;
41 48
42 /// @} 49 /// @}
43 50
44 /////////////////////////////////////////////////////////////////////////// 51 ///////////////////////////////////////////////////////////////////////////
45 /// @name Effect Stages 52 /// @name Effect Stages
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 135
129 /////////////////////////////////////////////////////////////////////////// 136 ///////////////////////////////////////////////////////////////////////////
130 137
131 const GrDeviceCoordTexture* getDstCopy() const { return fDstCopy.texture() ? &fDstCopy : NULL; } 138 const GrDeviceCoordTexture* getDstCopy() const { return fDstCopy.texture() ? &fDstCopy : NULL; }
132 139
133 const GrProgramDesc::DescInfo& descInfo() const { return fDescInfo; } 140 const GrProgramDesc::DescInfo& descInfo() const { return fDescInfo; }
134 141
135 const GrGeometryProcessor::InitBT& getInitBatchTracker() const { return fIni tBT; } 142 const GrGeometryProcessor::InitBT& getInitBatchTracker() const { return fIni tBT; }
136 143
137 private: 144 private:
145 // TODO we can have one constructor once GrBatch is complete
146 void internalConstructor(const GrDrawState&,
147 const GrProcOptInfo& colorPOI,
148 const GrProcOptInfo& coveragePOI,
149 const GrDrawTargetCaps&,
150 const GrScissorState&,
151 const GrDeviceCoordTexture* dstCopy);
152
138 /** 153 /**
139 * Alter the program desc and inputs (attribs and processors) based on the b lend optimization. 154 * Alter the program desc and inputs (attribs and processors) based on the b lend optimization.
140 */ 155 */
141 void adjustProgramFromOptimizations(const GrDrawState& ds, 156 void adjustProgramFromOptimizations(const GrDrawState& ds,
142 GrXferProcessor::OptFlags, 157 GrXferProcessor::OptFlags,
143 const GrProcOptInfo& colorPOI, 158 const GrProcOptInfo& colorPOI,
144 const GrProcOptInfo& coveragePOI, 159 const GrProcOptInfo& coveragePOI,
145 int* firstColorStageIdx, 160 int* firstColorStageIdx,
146 int* firstCoverageStageIdx); 161 int* firstCoverageStageIdx);
147 162
(...skipping 26 matching lines...) Expand all
174 189
175 // This function is equivalent to the offset into fFragmentStages where cove rage stages begin. 190 // This function is equivalent to the offset into fFragmentStages where cove rage stages begin.
176 int fNumColorStages; 191 int fNumColorStages;
177 192
178 GrProgramDesc fDesc; 193 GrProgramDesc fDesc;
179 194
180 typedef SkRefCnt INHERITED; 195 typedef SkRefCnt INHERITED;
181 }; 196 };
182 197
183 #endif 198 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698