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

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

Issue 630063002: Make createOptDrawState return NULL if we would end up not drawing (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase and Nits Created 6 years, 2 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/GrDrawState.cpp ('k') | src/gpu/GrOptDrawState.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 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 "GrDrawState.h" 11 #include "GrColor.h"
12 #include "GrGpu.h"
13 #include "GrProcessorStage.h"
14 #include "GrStencil.h"
15 #include "GrTypesPriv.h"
16 #include "SkMatrix.h"
17 #include "SkRefCnt.h"
18
19 class GrDrawState;
12 20
13 /** 21 /**
14 * Class that holds an optimized version of a GrDrawState. It is meant to be an immutable class, 22 * Class that holds an optimized version of a GrDrawState. It is meant to be an immutable class,
15 * and contains all data needed to set the state for a gpu draw. 23 * and contains all data needed to set the state for a gpu draw.
16 */ 24 */
17 class GrOptDrawState : public SkRefCnt { 25 class GrOptDrawState : public SkRefCnt {
18 public: 26 public:
27 /**
28 * Returns a snapshot of the current optimized state. If the current drawSta te has a valid
29 * cached optimiezed state it will simply return a pointer to it otherwise i t will create a new
30 * GrOptDrawState. In all cases the GrOptDrawState is reffed and ownership i s given to the
31 * caller.
32 */
33 static GrOptDrawState* Create(const GrDrawState& drawState, const GrDrawTarg etCaps& caps,
34 GrGpu::DrawType drawType);
35
19 bool operator== (const GrOptDrawState& that) const; 36 bool operator== (const GrOptDrawState& that) const;
20 37
21 /////////////////////////////////////////////////////////////////////////// 38 ///////////////////////////////////////////////////////////////////////////
22 /// @name Vertex Attributes 39 /// @name Vertex Attributes
23 //// 40 ////
24 41
25 enum { 42 enum {
26 kMaxVertexAttribCnt = kLast_GrVertexAttribBinding + 4, 43 kMaxVertexAttribCnt = kLast_GrVertexAttribBinding + 4,
27 }; 44 };
28 45
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 bool fRequiresLocalCoordAttrib; 453 bool fRequiresLocalCoordAttrib;
437 454
438 SkAutoSTArray<4, GrVertexAttrib> fOptVA; 455 SkAutoSTArray<4, GrVertexAttrib> fOptVA;
439 456
440 BlendOptFlags fBlendOptFlags; 457 BlendOptFlags fBlendOptFlags;
441 458
442 // Fragment shader color outputs 459 // Fragment shader color outputs
443 PrimaryOutputType fPrimaryOutputType : 8; 460 PrimaryOutputType fPrimaryOutputType : 8;
444 SecondaryOutputType fSecondaryOutputType : 8; 461 SecondaryOutputType fSecondaryOutputType : 8;
445 462
446 friend GrOptDrawState* GrDrawState::createOptState(const GrDrawTargetCaps&) const;
447 typedef SkRefCnt INHERITED; 463 typedef SkRefCnt INHERITED;
448 }; 464 };
449 465
450 GR_MAKE_BITFIELD_OPS(GrOptDrawState::BlendOptFlags); 466 GR_MAKE_BITFIELD_OPS(GrOptDrawState::BlendOptFlags);
451 467
452 #endif 468 #endif
453 469
OLDNEW
« no previous file with comments | « src/gpu/GrDrawState.cpp ('k') | src/gpu/GrOptDrawState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698