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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 const uint32_t* bKey = b.asKey(); | 63 const uint32_t* bKey = b.asKey(); |
64 for (int i = 0; i < l; ++i) { | 64 for (int i = 0; i < l; ++i) { |
65 if (aKey[i] != bKey[i]) { | 65 if (aKey[i] != bKey[i]) { |
66 return aKey[i] < bKey[i] ? true : false; | 66 return aKey[i] < bKey[i] ? true : false; |
67 } | 67 } |
68 } | 68 } |
69 return false; | 69 return false; |
70 } | 70 } |
71 | 71 |
72 struct KeyHeader { | 72 struct KeyHeader { |
73 uint8_t fFragPosKey; // set by GrGLShaderBuilder i
f there are | 73 // Set by GrGLShaderBuilder if there are effects that read the fragment
position. |
74 // effects that read the frag
ment position. | 74 // Otherwise, 0. |
75 // Otherwise, 0. | 75 uint8_t fFragPosKey; |
| 76 // Set to uniquely idenitify any swizzling of the shader's output color(
s). |
| 77 uint8_t fOutputSwizzle; |
76 uint8_t fSnapVerticesToPixelCenters; | 78 uint8_t fSnapVerticesToPixelCenters; |
77 int8_t fColorEffectCnt; | 79 int8_t fColorEffectCnt; |
78 int8_t fCoverageEffectCnt; | 80 int8_t fCoverageEffectCnt; |
79 uint8_t fIgnoresCoverage; | 81 uint8_t fIgnoresCoverage; |
80 }; | 82 }; |
81 GR_STATIC_ASSERT(sizeof(KeyHeader) == 5); | |
82 | 83 |
83 int numColorEffects() const { | 84 int numColorEffects() const { |
84 return this->header().fColorEffectCnt; | 85 return this->header().fColorEffectCnt; |
85 } | 86 } |
86 | 87 |
87 int numCoverageEffects() const { | 88 int numCoverageEffects() const { |
88 return this->header().fCoverageEffectCnt; | 89 return this->header().fCoverageEffectCnt; |
89 } | 90 } |
90 | 91 |
91 int numTotalEffects() const { return this->numColorEffects() + this->numCove
rageEffects(); } | 92 int numTotalEffects() const { return this->numColorEffects() + this->numCove
rageEffects(); } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 }; | 136 }; |
136 | 137 |
137 SkSTArray<kPreAllocSize, uint8_t, true>& key() { return fKey; } | 138 SkSTArray<kPreAllocSize, uint8_t, true>& key() { return fKey; } |
138 const SkSTArray<kPreAllocSize, uint8_t, true>& key() const { return fKey; } | 139 const SkSTArray<kPreAllocSize, uint8_t, true>& key() const { return fKey; } |
139 | 140 |
140 private: | 141 private: |
141 SkSTArray<kPreAllocSize, uint8_t, true> fKey; | 142 SkSTArray<kPreAllocSize, uint8_t, true> fKey; |
142 }; | 143 }; |
143 | 144 |
144 #endif | 145 #endif |
OLD | NEW |