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

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

Issue 560443004: Revert of Attach GrOptDrawState into shader building pipeline (Closed) Base URL: https://skia.googlesource.com/skia.git@opt2
Patch Set: Created 6 years, 3 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 | « no previous file | src/gpu/GrDrawState.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 2011 Google Inc. 2 * Copyright 2011 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 GrDrawState_DEFINED 8 #ifndef GrDrawState_DEFINED
9 #define GrDrawState_DEFINED 9 #define GrDrawState_DEFINED
10 10
11 #include "GrBlend.h" 11 #include "GrBlend.h"
12 #include "GrOptDrawState.h"
12 #include "GrProgramResource.h" 13 #include "GrProgramResource.h"
13 #include "GrRODrawState.h" 14 #include "GrRODrawState.h"
14 #include "effects/GrSimpleTextureEffect.h" 15 #include "effects/GrSimpleTextureEffect.h"
15 16
16 class GrOptDrawState;
17
18 /** 17 /**
19 * Modifiable subclass derived from GrRODrawState. The majority of the data that represents a draw 18 * Modifiable subclass derived from GrRODrawState. The majority of the data that represents a draw
20 * state is stored in the parent class. GrDrawState contains methods for setting , adding to, etc. 19 * state is stored in the parent class. GrDrawState contains methods for setting , adding to, etc.
21 * various data members of the draw state. This class is used to configure the s tate used when 20 * various data members of the draw state. This class is used to configure the s tate used when
22 * issuing draws via GrDrawTarget. 21 * issuing draws via GrDrawTarget.
23 */ 22 */
24 class GrDrawState : public GrRODrawState { 23 class GrDrawState : public GrRODrawState {
25 public: 24 public:
26 SK_DECLARE_INST_COUNT(GrDrawState) 25 SK_DECLARE_INST_COUNT(GrDrawState)
27 26
(...skipping 13 matching lines...) Expand all
41 GrDrawState(const GrDrawState& state) : INHERITED(), fCachedOptState(NULL) { 40 GrDrawState(const GrDrawState& state) : INHERITED(), fCachedOptState(NULL) {
42 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) 41 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;)
43 *this = state; 42 *this = state;
44 } 43 }
45 44
46 /** 45 /**
47 * Copies another draw state with a preconcat to the view matrix. 46 * Copies another draw state with a preconcat to the view matrix.
48 **/ 47 **/
49 GrDrawState(const GrDrawState& state, const SkMatrix& preConcatMatrix); 48 GrDrawState(const GrDrawState& state, const SkMatrix& preConcatMatrix);
50 49
51 virtual ~GrDrawState(); 50 virtual ~GrDrawState() {
51 SkSafeUnref(fCachedOptState);
52 SkASSERT(0 == fBlockEffectRemovalCnt);
53 }
52 54
53 /** 55 /**
54 * Resets to the default state. GrEffects will be removed from all stages. 56 * Resets to the default state. GrEffects will be removed from all stages.
55 */ 57 */
56 void reset() { this->onReset(NULL); } 58 void reset() { this->onReset(NULL); }
57 59
58 void reset(const SkMatrix& initialViewMatrix) { this->onReset(&initialViewMa trix); } 60 void reset(const SkMatrix& initialViewMatrix) { this->onReset(&initialViewMa trix); }
59 61
60 /** 62 /**
61 * Initializes the GrDrawState based on a GrPaint, view matrix and render ta rget. Note that 63 * Initializes the GrDrawState based on a GrPaint, view matrix and render ta rget. Note that
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 545
544 /** 546 /**
545 * Returns a snapshot of the current optimized state. If the current drawSta te has a valid 547 * Returns a snapshot of the current optimized state. If the current drawSta te has a valid
546 * cached optimiezed state it will simply return a pointer to it otherwise i t will create a new 548 * cached optimiezed state it will simply return a pointer to it otherwise i t will create a new
547 * GrOptDrawState. In all cases the GrOptDrawState is reffed and ownership i s given to the 549 * GrOptDrawState. In all cases the GrOptDrawState is reffed and ownership i s given to the
548 * caller. 550 * caller.
549 */ 551 */
550 GrOptDrawState* createOptState() const; 552 GrOptDrawState* createOptState() const;
551 553
552 private: 554 private:
553 void invalidateOptState() const; 555 void invalidateOptState() const {
556 SkSafeSetNull(fCachedOptState);
557 fBlendOptFlags = kInvalid_BlendOptFlag;
558 }
554 559
555 void onReset(const SkMatrix* initialViewMatrix); 560 void onReset(const SkMatrix* initialViewMatrix);
556 561
562 void invalidateBlendOptFlags() {
563 fBlendOptFlags = kInvalid_BlendOptFlag;
564 }
565
557 // Some of the auto restore objects assume that no effects are removed durin g their lifetime. 566 // Some of the auto restore objects assume that no effects are removed durin g their lifetime.
558 // This is used to assert that this condition holds. 567 // This is used to assert that this condition holds.
559 SkDEBUGCODE(int fBlockEffectRemovalCnt;) 568 SkDEBUGCODE(int fBlockEffectRemovalCnt;)
560 569
561 void internalSetVertexAttribs(const GrVertexAttrib attribs[], int count, siz e_t stride); 570 void internalSetVertexAttribs(const GrVertexAttrib attribs[], int count, siz e_t stride);
562 571
563 mutable GrOptDrawState* fCachedOptState; 572 mutable GrOptDrawState* fCachedOptState;
564 573
565 typedef GrRODrawState INHERITED; 574 typedef GrRODrawState INHERITED;
566 }; 575 };
567 576
568 #endif 577 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrDrawState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698