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

Side by Side Diff: src/gpu/GrDrawState.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 | « 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
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 708
709 /** This function determines whether the GrDrawStates used for two draws can be combined into 709 /** This function determines whether the GrDrawStates used for two draws can be combined into
710 a single GrDrawState. This is used to avoid storing redundant GrDrawStat es and to determine 710 a single GrDrawState. This is used to avoid storing redundant GrDrawStat es and to determine
711 if draws can be batched. The return value indicates whether combining is possible and, if 711 if draws can be batched. The return value indicates whether combining is possible and, if
712 so, which of the two inputs should be used. */ 712 so, which of the two inputs should be used. */
713 static CombinedState CombineIfPossible(const GrDrawState& a, const GrDrawSta te& b, 713 static CombinedState CombineIfPossible(const GrDrawState& a, const GrDrawSta te& b,
714 const GrDrawTargetCaps& caps); 714 const GrDrawTargetCaps& caps);
715 715
716 GrDrawState& operator= (const GrDrawState& that); 716 GrDrawState& operator= (const GrDrawState& that);
717 717
718 /**
719 * Returns a snapshot of the current optimized state. If the current drawSta te has a valid
720 * cached optimiezed state it will simply return a pointer to it otherwise i t will create a new
721 * GrOptDrawState. In all cases the GrOptDrawState is reffed and ownership i s given to the
722 * caller.
723 */
724 GrOptDrawState* createOptState(const GrDrawTargetCaps&) const;
725
726 private: 718 private:
727 /** 719 /**
728 * Converts refs on GrGpuResources owned directly or indirectly by this GrDr awState into 720 * Converts refs on GrGpuResources owned directly or indirectly by this GrDr awState into
729 * pending reads and writes. This should be called when a GrDrawState is rec orded into 721 * pending reads and writes. This should be called when a GrDrawState is rec orded into
730 * a GrDrawTarget for later execution. Subclasses of GrDrawState may add set ters. However, 722 * a GrDrawTarget for later execution. Subclasses of GrDrawState may add set ters. However,
731 * once this call has been made the GrDrawState is immutable. It is also no longer copyable. 723 * once this call has been made the GrDrawState is immutable. It is also no longer copyable.
732 * In the future this conversion will automatically happen when converting a GrDrawState into 724 * In the future this conversion will automatically happen when converting a GrDrawState into
733 * an optimized draw state. 725 * an optimized draw state.
734 */ 726 */
735 void convertToPendingExec(); 727 void convertToPendingExec();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 814
823 uint32_t fHints; 815 uint32_t fHints;
824 816
825 // This is simply a different representation of info in fVertexAttribs and t hus does 817 // This is simply a different representation of info in fVertexAttribs and t hus does
826 // not need to be compared in op==. 818 // not need to be compared in op==.
827 int fFixedFunctionVertexAttribIndices[kGrFixedFunctionVertexAttribBindingCnt ]; 819 int fFixedFunctionVertexAttribIndices[kGrFixedFunctionVertexAttribBindingCnt ];
828 820
829 mutable GrOptDrawState* fCachedOptState; 821 mutable GrOptDrawState* fCachedOptState;
830 mutable uint32_t fCachedCapsID; 822 mutable uint32_t fCachedCapsID;
831 823
824 friend class GrOptDrawState;
825
832 typedef SkRefCnt INHERITED; 826 typedef SkRefCnt INHERITED;
833 }; 827 };
834 828
835 //GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); 829 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags);
836 830
837 #endif 831 #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