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

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

Issue 742853002: Don't use NULL GrOptDrawState to indicate that draw should be skipped. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: save other file Created 6 years, 1 month 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
(...skipping 12 matching lines...) Expand all
23 /** 23 /**
24 * Class that holds an optimized version of a GrDrawState. It is meant to be an immutable class, 24 * Class that holds an optimized version of a GrDrawState. It is meant to be an immutable class,
25 * and contains all data needed to set the state for a gpu draw. 25 * and contains all data needed to set the state for a gpu draw.
26 */ 26 */
27 class GrOptDrawState : public SkRefCnt { 27 class GrOptDrawState : public SkRefCnt {
28 public: 28 public:
29 SK_DECLARE_INST_COUNT(GrOptDrawState) 29 SK_DECLARE_INST_COUNT(GrOptDrawState)
30 30
31 typedef GrClipMaskManager::ScissorState ScissorState; 31 typedef GrClipMaskManager::ScissorState ScissorState;
32 32
33 /** 33 GrOptDrawState(const GrDrawState& drawState, GrGpu*, const ScissorState&,
34 * Returns a snapshot of the current optimized state. The GrOptDrawState is reffed and ownership 34 const GrDeviceCoordTexture* dstCopy, GrGpu::DrawType);
35 * is given to the caller.
36 */
37 static GrOptDrawState* Create(const GrDrawState& drawState,
38 GrGpu*,
39 const ScissorState&,
40 const GrDeviceCoordTexture* dstCopy,
41 GrGpu::DrawType drawType);
42 35
43 bool operator== (const GrOptDrawState& that) const; 36 bool operator== (const GrOptDrawState& that) const;
44 bool operator!= (const GrOptDrawState& that) const { return !(*this == that) ; } 37 bool operator!= (const GrOptDrawState& that) const { return !(*this == that) ; }
45 38
46 /////////////////////////////////////////////////////////////////////////// 39 ///////////////////////////////////////////////////////////////////////////
47 /// @name Vertex Attributes 40 /// @name Vertex Attributes
48 //// 41 ////
49 42
50 enum { 43 enum {
51 kMaxVertexAttribCnt = kLast_GrVertexAttribBinding + 4, 44 kMaxVertexAttribCnt = kLast_GrVertexAttribBinding + 4,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 /// @} 168 /// @}
176 169
177 170
178 /////////////////////////////////////////////////////////////////////////// 171 ///////////////////////////////////////////////////////////////////////////
179 /// @name Boolean Queries 172 /// @name Boolean Queries
180 //// 173 ////
181 174
182 bool isDitherState() const { return SkToBool(fFlags & kDither_Flag); } 175 bool isDitherState() const { return SkToBool(fFlags & kDither_Flag); }
183 bool isHWAntialiasState() const { return SkToBool(fFlags & kHWAA_Flag); } 176 bool isHWAntialiasState() const { return SkToBool(fFlags & kHWAA_Flag); }
184 bool isColorWriteDisabled() const { return SkToBool(fFlags & kDisableColorWr ite_Flag); } 177 bool isColorWriteDisabled() const { return SkToBool(fFlags & kDisableColorWr ite_Flag); }
178 bool mustSkip() const { return NULL == this->getRenderTarget(); }
185 179
186 /// @} 180 /// @}
187 181
188 /** 182 /**
189 * Gets whether the target is drawing clockwise, counterclockwise, 183 * Gets whether the target is drawing clockwise, counterclockwise,
190 * or both faces. 184 * or both faces.
191 * @return the current draw face(s). 185 * @return the current draw face(s).
192 */ 186 */
193 GrDrawState::DrawFace getDrawFace() const { return fDrawFace; } 187 GrDrawState::DrawFace getDrawFace() const { return fDrawFace; }
194 188
195 /// @} 189 /// @}
196 190
197 /////////////////////////////////////////////////////////////////////////// 191 ///////////////////////////////////////////////////////////////////////////
198 192
199 193
200 const GrProgramDesc& programDesc() const { return fDesc; } 194 const GrProgramDesc& programDesc() const { return fDesc; }
201 195
202 private: 196 private:
203 /** 197 /**
204 * Constructs and optimized drawState out of a GrRODrawState.
205 */
206 GrOptDrawState(const GrDrawState& drawState, GrDrawState::BlendOpt,
207 GrBlendCoeff optSrcCoeff, GrBlendCoeff optDstCoeff,
208 GrGpu*, const ScissorState&, const GrDeviceCoordTexture* dstC opy,
209 GrGpu::DrawType);
210
211 /**
212 * Loops through all the color stage effects to check if the stage will igno re color input or 198 * Loops through all the color stage effects to check if the stage will igno re color input or
213 * always output a constant color. In the ignore color input case we can ign ore all previous 199 * always output a constant color. In the ignore color input case we can ign ore all previous
214 * stages. In the constant color case, we can ignore all previous stages and 200 * stages. In the constant color case, we can ignore all previous stages and
215 * the current one and set the state color to the constant color. 201 * the current one and set the state color to the constant color.
216 */ 202 */
217 void computeEffectiveColorStages(const GrDrawState& ds, GrProgramDesc::DescI nfo*, 203 void computeEffectiveColorStages(const GrDrawState& ds, GrProgramDesc::DescI nfo*,
218 int* firstColorStageIdx, uint8_t* fixFuncti onVAToRemove); 204 int* firstColorStageIdx, uint8_t* fixFuncti onVAToRemove);
219 205
220 /** 206 /**
221 * Loops through all the coverage stage effects to check if the stage will i gnore color input. 207 * Loops through all the coverage stage effects to check if the stage will i gnore color input.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 int fNumColorStages; 271 int fNumColorStages;
286 272
287 SkAutoSTArray<4, GrVertexAttrib> fOptVA; 273 SkAutoSTArray<4, GrVertexAttrib> fOptVA;
288 274
289 GrProgramDesc fDesc; 275 GrProgramDesc fDesc;
290 276
291 typedef SkRefCnt INHERITED; 277 typedef SkRefCnt INHERITED;
292 }; 278 };
293 279
294 #endif 280 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698