| OLD | NEW |
| 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 GrProgramElement_DEFINED | 8 #ifndef GrProgramElement_DEFINED |
| 9 #define GrProgramElement_DEFINED | 9 #define GrProgramElement_DEFINED |
| 10 | 10 |
| 11 #include "SkRefCnt.h" | 11 #include "SkRefCnt.h" |
| 12 #include "SkTArray.h" | 12 #include "SkTArray.h" |
| 13 | 13 |
| 14 class GrGpuResourceRef; | 14 class GrGpuResourceRef; |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * Base class for GrProcessor. GrDrawState uses this to manage | 17 * Base class for GrProcessor. GrDrawState uses this to manage |
| 18 * transitioning a GrProcessor from being owned by a client to being scheduled f
or execution. It | 18 * transitioning a GrProcessor from being owned by a client to being scheduled f
or execution. It |
| 19 * converts resources owned by the effect from being ref'ed to having pending re
ads/writes. | 19 * converts resources owned by the effect from being ref'ed to having pending re
ads/writes. |
| 20 * | 20 * |
| 21 * All GrGpuResource objects owned by a GrProgramElement or derived classes (eit
her directly or | 21 * All GrGpuResource objects owned by a GrProgramElement or derived classes (eit
her directly or |
| 22 * indirectly) must be wrapped in a GrGpuResourceRef and registered with the GrP
rogramElement using | 22 * indirectly) must be wrapped in a GrGpuResourceRef and registered with the GrP
rogramElement using |
| 23 * addGpuResource(). This allows the regular refs to be converted to pending IO
events | 23 * addGpuResource(). This allows the regular refs to be converted to pending IO
events |
| 24 * when the program element is scheduled for deferred execution. | 24 * when the program element is scheduled for deferred execution. |
| 25 */ | 25 */ |
| 26 class GrProgramElement : public SkNoncopyable { | 26 class GrProgramElement : public SkNoncopyable { |
| 27 public: | 27 public: |
| 28 SK_DECLARE_INST_COUNT_ROOT(GrProgramElement) | 28 SK_DECLARE_INST_COUNT(GrProgramElement) |
| 29 | 29 |
| 30 virtual ~GrProgramElement() { | 30 virtual ~GrProgramElement() { |
| 31 // fRefCnt can be one when an effect is created statically using GR_CREA
TE_STATIC_EFFECT | 31 // fRefCnt can be one when an effect is created statically using GR_CREA
TE_STATIC_EFFECT |
| 32 SkASSERT((0 == fRefCnt || 1 == fRefCnt) && 0 == fPendingExecutions); | 32 SkASSERT((0 == fRefCnt || 1 == fRefCnt) && 0 == fPendingExecutions); |
| 33 // Set to invalid values. | 33 // Set to invalid values. |
| 34 SkDEBUGCODE(fRefCnt = fPendingExecutions = -10;) | 34 SkDEBUGCODE(fRefCnt = fPendingExecutions = -10;) |
| 35 } | 35 } |
| 36 | 36 |
| 37 void ref() const { | 37 void ref() const { |
| 38 this->validate(); | 38 this->validate(); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 SkSTArray<4, const GrGpuResourceRef*, true> fGpuResources; | 119 SkSTArray<4, const GrGpuResourceRef*, true> fGpuResources; |
| 120 | 120 |
| 121 // Only this class can access addPendingExecution() and completedExecution()
. | 121 // Only this class can access addPendingExecution() and completedExecution()
. |
| 122 template <typename T> friend class GrPendingProgramElement; | 122 template <typename T> friend class GrPendingProgramElement; |
| 123 | 123 |
| 124 typedef SkNoncopyable INHERITED; | 124 typedef SkNoncopyable INHERITED; |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 #endif | 127 #endif |
| OLD | NEW |