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 GrProgramDesc_DEFINED | 8 #ifndef GrProgramDesc_DEFINED |
9 #define GrProgramDesc_DEFINED | 9 #define GrProgramDesc_DEFINED |
10 | 10 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 int numTotalEffects() const { return this->numColorEffects() + this->numCove
rageEffects(); } | 77 int numTotalEffects() const { return this->numColorEffects() + this->numCove
rageEffects(); } |
78 | 78 |
79 // This should really only be used internally, base classes should return th
eir own headers | 79 // This should really only be used internally, base classes should return th
eir own headers |
80 const KeyHeader& header() const { return *this->atOffset<KeyHeader, kHeaderO
ffset>(); } | 80 const KeyHeader& header() const { return *this->atOffset<KeyHeader, kHeaderO
ffset>(); } |
81 | 81 |
82 // A struct to communicate descriptor information to the program descriptor
builder | 82 // A struct to communicate descriptor information to the program descriptor
builder |
83 struct DescInfo { | 83 struct DescInfo { |
84 bool operator==(const DescInfo& that) const { | 84 bool operator==(const DescInfo& that) const { |
85 return fReadsDst == that.fReadsDst && | 85 return fReadsDst == that.fReadsDst && |
86 fReadsFragPosition == that.fReadsFragPosition && | 86 fReadsFragPosition == that.fReadsFragPosition; |
87 fRequiresLocalCoordAttrib == that.fRequiresLocalCoordAttrib; | |
88 } | 87 } |
89 bool operator!=(const DescInfo& that) const { return !(*this == that); }
; | 88 bool operator!=(const DescInfo& that) const { return !(*this == that); }
; |
90 | 89 |
91 // These flags give aggregated info on the processor stages that are use
d when building | 90 // These flags give aggregated info on the processor stages that are use
d when building |
92 // programs. | 91 // programs. |
93 bool fReadsDst; | 92 bool fReadsDst; |
94 bool fReadsFragPosition; | 93 bool fReadsFragPosition; |
95 bool fRequiresLocalCoordAttrib; | |
96 }; | 94 }; |
97 | 95 |
98 private: | 96 private: |
99 template<typename T, size_t OFFSET> T* atOffset() { | 97 template<typename T, size_t OFFSET> T* atOffset() { |
100 return reinterpret_cast<T*>(reinterpret_cast<intptr_t>(fKey.begin()) + O
FFSET); | 98 return reinterpret_cast<T*>(reinterpret_cast<intptr_t>(fKey.begin()) + O
FFSET); |
101 } | 99 } |
102 | 100 |
103 template<typename T, size_t OFFSET> const T* atOffset() const { | 101 template<typename T, size_t OFFSET> const T* atOffset() const { |
104 return reinterpret_cast<const T*>(reinterpret_cast<intptr_t>(fKey.begin(
)) + OFFSET); | 102 return reinterpret_cast<const T*>(reinterpret_cast<intptr_t>(fKey.begin(
)) + OFFSET); |
105 } | 103 } |
(...skipping 29 matching lines...) Expand all Loading... |
135 kPreAllocSize = kHeaderOffset + kHeaderSize + | 133 kPreAllocSize = kHeaderOffset + kHeaderSize + |
136 kMaxPreallocProcessors * sizeof(uint32_t) * kIntsPerProc
essor, | 134 kMaxPreallocProcessors * sizeof(uint32_t) * kIntsPerProc
essor, |
137 }; | 135 }; |
138 | 136 |
139 SkSTArray<kPreAllocSize, uint8_t, true> fKey; | 137 SkSTArray<kPreAllocSize, uint8_t, true> fKey; |
140 | 138 |
141 friend class GrGLProgramDescBuilder; | 139 friend class GrGLProgramDescBuilder; |
142 }; | 140 }; |
143 | 141 |
144 #endif | 142 #endif |
OLD | NEW |