OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 GrTypesPriv_DEFINED | 8 #ifndef GrTypesPriv_DEFINED |
9 #define GrTypesPriv_DEFINED | 9 #define GrTypesPriv_DEFINED |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 GR_STATIC_ASSERT(1 == kFloat_GrSLType); | 41 GR_STATIC_ASSERT(1 == kFloat_GrSLType); |
42 GR_STATIC_ASSERT(2 == kVec2f_GrSLType); | 42 GR_STATIC_ASSERT(2 == kVec2f_GrSLType); |
43 GR_STATIC_ASSERT(3 == kVec3f_GrSLType); | 43 GR_STATIC_ASSERT(3 == kVec3f_GrSLType); |
44 GR_STATIC_ASSERT(4 == kVec4f_GrSLType); | 44 GR_STATIC_ASSERT(4 == kVec4f_GrSLType); |
45 GR_STATIC_ASSERT(5 == kMat33f_GrSLType); | 45 GR_STATIC_ASSERT(5 == kMat33f_GrSLType); |
46 GR_STATIC_ASSERT(6 == kMat44f_GrSLType); | 46 GR_STATIC_ASSERT(6 == kMat44f_GrSLType); |
47 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType); | 47 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType); |
48 GR_STATIC_ASSERT(GR_ARRAY_COUNT(kCounts) == kGrSLTypeCount); | 48 GR_STATIC_ASSERT(GR_ARRAY_COUNT(kCounts) == kGrSLTypeCount); |
49 } | 49 } |
50 | 50 |
| 51 /** Return the type enum for a vector of floats of length n (1..4), |
| 52 e.g. 1 -> kFloat_GrSLType, 2 -> kVec2_GrSLType, ... */ |
51 static inline GrSLType GrSLFloatVectorType(int count) { | 53 static inline GrSLType GrSLFloatVectorType(int count) { |
52 GrAssert(count > 0 && count <= 4); | 54 GrAssert(count > 0 && count <= 4); |
53 return (GrSLType)(count); | 55 return (GrSLType)(count); |
54 | 56 |
55 GR_STATIC_ASSERT(kFloat_GrSLType == 1); | 57 GR_STATIC_ASSERT(kFloat_GrSLType == 1); |
56 GR_STATIC_ASSERT(kVec2f_GrSLType == 2); | 58 GR_STATIC_ASSERT(kVec2f_GrSLType == 2); |
57 GR_STATIC_ASSERT(kVec3f_GrSLType == 3); | 59 GR_STATIC_ASSERT(kVec3f_GrSLType == 3); |
58 GR_STATIC_ASSERT(kVec4f_GrSLType == 4); | 60 GR_STATIC_ASSERT(kVec4f_GrSLType == 4); |
59 } | 61 } |
60 | 62 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 bool operator!=(const GrVertexAttrib& other) const { return !(*this == other
); } | 160 bool operator!=(const GrVertexAttrib& other) const { return !(*this == other
); } |
159 | 161 |
160 GrVertexAttribType fType; | 162 GrVertexAttribType fType; |
161 size_t fOffset; | 163 size_t fOffset; |
162 GrVertexAttribBinding fBinding; | 164 GrVertexAttribBinding fBinding; |
163 }; | 165 }; |
164 | 166 |
165 template <int N> class GrVertexAttribArray : public SkSTArray<N, GrVertexAttrib,
true> {}; | 167 template <int N> class GrVertexAttribArray : public SkSTArray<N, GrVertexAttrib,
true> {}; |
166 | 168 |
167 #endif | 169 #endif |
OLD | NEW |