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

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

Issue 845103005: GrBatchPrototype (Closed) Base URL: https://skia.googlesource.com/skia.git@lc2
Patch Set: update devrect 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, GrGpu::DrawType); 35 const GrDeviceCoordTexture* dstCopy, GrGpu::DrawType);
35 36
37 GrOptDrawState(GrBatch*,
38 const GrDrawState& drawState,
39 const GrDrawTargetCaps&, const GrScissorState&,
40 const GrDeviceCoordTexture* dstCopy, GrGpu::DrawType);
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 137
131 GrGpu::DrawType drawType() const { return fDrawType; } 138 GrGpu::DrawType drawType() const { return fDrawType; }
132 139
133 const GrDeviceCoordTexture* getDstCopy() const { return fDstCopy.texture() ? &fDstCopy : NULL; } 140 const GrDeviceCoordTexture* getDstCopy() const { return fDstCopy.texture() ? &fDstCopy : NULL; }
134 141
135 const GrProgramDesc::DescInfo& descInfo() const { return fDescInfo; } 142 const GrProgramDesc::DescInfo& descInfo() const { return fDescInfo; }
136 143
137 const GrGeometryProcessor::InitBT& getInitBatchTracker() const { return fIni tBT; } 144 const GrGeometryProcessor::InitBT& getInitBatchTracker() const { return fIni tBT; }
138 145
139 private: 146 private:
147 // TODO we can have one constructor once GrBatch is complete
148 void internalConstructor(const GrDrawState&,
149 const GrProcOptInfo& colorPOI,
150 const GrProcOptInfo& coveragePOI,
151 const GrDrawTargetCaps&,
152 const GrScissorState&,
153 const GrDeviceCoordTexture* dstCopy,
154 GrGpu::DrawType);
155
140 /** 156 /**
141 * Alter the program desc and inputs (attribs and processors) based on the b lend optimization. 157 * Alter the program desc and inputs (attribs and processors) based on the b lend optimization.
142 */ 158 */
143 void adjustProgramFromOptimizations(const GrDrawState& ds, 159 void adjustProgramFromOptimizations(const GrDrawState& ds,
144 GrXferProcessor::OptFlags, 160 GrXferProcessor::OptFlags,
145 const GrProcOptInfo& colorPOI, 161 const GrProcOptInfo& colorPOI,
146 const GrProcOptInfo& coveragePOI, 162 const GrProcOptInfo& coveragePOI,
147 int* firstColorStageIdx, 163 int* firstColorStageIdx,
148 int* firstCoverageStageIdx); 164 int* firstCoverageStageIdx);
149 165
(...skipping 27 matching lines...) Expand all
177 193
178 // This function is equivalent to the offset into fFragmentStages where cove rage stages begin. 194 // This function is equivalent to the offset into fFragmentStages where cove rage stages begin.
179 int fNumColorStages; 195 int fNumColorStages;
180 196
181 GrProgramDesc fDesc; 197 GrProgramDesc fDesc;
182 198
183 typedef SkRefCnt INHERITED; 199 typedef SkRefCnt INHERITED;
184 }; 200 };
185 201
186 #endif 202 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698