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 |
11 #include "GrTypes.h" | 11 #include "GrTypes.h" |
12 #include "SkTArray.h" | 12 #include "SkTArray.h" |
13 #include "SkRect.h" | 13 #include "SkRect.h" |
14 | 14 |
15 /** | 15 /** |
16 * Types of shader-language-specific boxed variables we can create. (Currently
only GrGLShaderVars, | 16 * Types of shader-language-specific boxed variables we can create. (Currently
only GrGLShaderVars, |
17 * but should be applicable to other shader languages.) | 17 * but should be applicable to other shader languages.) |
18 */ | 18 */ |
19 enum GrSLType { | 19 enum GrSLType { |
20 kVoid_GrSLType, | 20 kVoid_GrSLType, |
21 kFloat_GrSLType, | 21 kFloat_GrSLType, |
22 kVec2f_GrSLType, | 22 kVec2f_GrSLType, |
23 kVec3f_GrSLType, | 23 kVec3f_GrSLType, |
24 kVec4f_GrSLType, | 24 kVec4f_GrSLType, |
25 kMat33f_GrSLType, | 25 kMat33f_GrSLType, |
26 kMat44f_GrSLType, | 26 kMat44f_GrSLType, |
27 kSampler2D_GrSLType, | 27 kSampler2D_GrSLType, |
28 kSamplerExternal_GrSLType, | 28 kSamplerExternal_GrSLType, |
29 kSampler2DRect_GrSLType, | 29 kSampler2DRect_GrSLType, |
| 30 kBool_GrSLType, |
| 31 kInt_GrSLType, |
30 | 32 |
31 kLast_GrSLType = kSampler2DRect_GrSLType | 33 kLast_GrSLType = kInt_GrSLType |
32 }; | 34 }; |
33 static const int kGrSLTypeCount = kLast_GrSLType + 1; | 35 static const int kGrSLTypeCount = kLast_GrSLType + 1; |
34 | 36 |
35 enum GrShaderType { | 37 enum GrShaderType { |
36 kVertex_GrShaderType, | 38 kVertex_GrShaderType, |
37 kGeometry_GrShaderType, | 39 kGeometry_GrShaderType, |
38 kFragment_GrShaderType, | 40 kFragment_GrShaderType, |
39 | 41 |
40 kLastkFragment_GrShaderType = kFragment_GrShaderType | 42 kLastkFragment_GrShaderType = kFragment_GrShaderType |
41 }; | 43 }; |
(...skipping 16 matching lines...) Expand all Loading... |
58 kLast_GrSLPrecision = kHigh_GrSLPrecision | 60 kLast_GrSLPrecision = kHigh_GrSLPrecision |
59 }; | 61 }; |
60 | 62 |
61 static const int kGrSLPrecisionCount = kLast_GrSLPrecision + 1; | 63 static const int kGrSLPrecisionCount = kLast_GrSLPrecision + 1; |
62 | 64 |
63 /** | 65 /** |
64 * Gets the vector size of the SLType. Returns -1 for void, matrices, and sample
rs. | 66 * Gets the vector size of the SLType. Returns -1 for void, matrices, and sample
rs. |
65 */ | 67 */ |
66 static inline int GrSLTypeVectorCount(GrSLType type) { | 68 static inline int GrSLTypeVectorCount(GrSLType type) { |
67 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount)); | 69 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount)); |
68 static const int kCounts[] = { -1, 1, 2, 3, 4, -1, -1, -1, -1, -1 }; | 70 static const int kCounts[] = { -1, 1, 2, 3, 4, -1, -1, -1, -1, -1, -1, -1 }; |
69 return kCounts[type]; | 71 return kCounts[type]; |
70 | 72 |
71 GR_STATIC_ASSERT(0 == kVoid_GrSLType); | 73 GR_STATIC_ASSERT(0 == kVoid_GrSLType); |
72 GR_STATIC_ASSERT(1 == kFloat_GrSLType); | 74 GR_STATIC_ASSERT(1 == kFloat_GrSLType); |
73 GR_STATIC_ASSERT(2 == kVec2f_GrSLType); | 75 GR_STATIC_ASSERT(2 == kVec2f_GrSLType); |
74 GR_STATIC_ASSERT(3 == kVec3f_GrSLType); | 76 GR_STATIC_ASSERT(3 == kVec3f_GrSLType); |
75 GR_STATIC_ASSERT(4 == kVec4f_GrSLType); | 77 GR_STATIC_ASSERT(4 == kVec4f_GrSLType); |
76 GR_STATIC_ASSERT(5 == kMat33f_GrSLType); | 78 GR_STATIC_ASSERT(5 == kMat33f_GrSLType); |
77 GR_STATIC_ASSERT(6 == kMat44f_GrSLType); | 79 GR_STATIC_ASSERT(6 == kMat44f_GrSLType); |
78 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType); | 80 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType); |
79 GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType); | 81 GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType); |
80 GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType); | 82 GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType); |
| 83 GR_STATIC_ASSERT(10 == kBool_GrSLType); |
| 84 GR_STATIC_ASSERT(11 == kInt_GrSLType); |
81 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrSLTypeCount); | 85 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrSLTypeCount); |
82 } | 86 } |
83 | 87 |
84 /** Return the type enum for a vector of floats of length n (1..4), | 88 /** Return the type enum for a vector of floats of length n (1..4), |
85 e.g. 1 -> kFloat_GrSLType, 2 -> kVec2_GrSLType, ... */ | 89 e.g. 1 -> kFloat_GrSLType, 2 -> kVec2_GrSLType, ... */ |
86 static inline GrSLType GrSLFloatVectorType(int count) { | 90 static inline GrSLType GrSLFloatVectorType(int count) { |
87 SkASSERT(count > 0 && count <= 4); | 91 SkASSERT(count > 0 && count <= 4); |
88 return (GrSLType)(count); | 92 return (GrSLType)(count); |
89 | 93 |
90 GR_STATIC_ASSERT(kFloat_GrSLType == 1); | 94 GR_STATIC_ASSERT(kFloat_GrSLType == 1); |
91 GR_STATIC_ASSERT(kVec2f_GrSLType == 2); | 95 GR_STATIC_ASSERT(kVec2f_GrSLType == 2); |
92 GR_STATIC_ASSERT(kVec3f_GrSLType == 3); | 96 GR_STATIC_ASSERT(kVec3f_GrSLType == 3); |
93 GR_STATIC_ASSERT(kVec4f_GrSLType == 4); | 97 GR_STATIC_ASSERT(kVec4f_GrSLType == 4); |
94 } | 98 } |
95 | 99 |
96 /** Is the shading language type floating point (or vector/matrix of fp)? */ | 100 /** Is the shading language type float (including vectors/matrices)? */ |
97 static inline bool GrSLTypeIsFloatType(GrSLType type) { | 101 static inline bool GrSLTypeIsFloatType(GrSLType type) { |
98 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount)); | 102 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount)); |
99 return type >= 1 && type <= 6; | 103 return (type >= 1 && type <= 6); |
100 | 104 |
101 GR_STATIC_ASSERT(0 == kVoid_GrSLType); | 105 GR_STATIC_ASSERT(0 == kVoid_GrSLType); |
102 GR_STATIC_ASSERT(1 == kFloat_GrSLType); | 106 GR_STATIC_ASSERT(1 == kFloat_GrSLType); |
103 GR_STATIC_ASSERT(2 == kVec2f_GrSLType); | 107 GR_STATIC_ASSERT(2 == kVec2f_GrSLType); |
104 GR_STATIC_ASSERT(3 == kVec3f_GrSLType); | 108 GR_STATIC_ASSERT(3 == kVec3f_GrSLType); |
105 GR_STATIC_ASSERT(4 == kVec4f_GrSLType); | 109 GR_STATIC_ASSERT(4 == kVec4f_GrSLType); |
106 GR_STATIC_ASSERT(5 == kMat33f_GrSLType); | 110 GR_STATIC_ASSERT(5 == kMat33f_GrSLType); |
107 GR_STATIC_ASSERT(6 == kMat44f_GrSLType); | 111 GR_STATIC_ASSERT(6 == kMat44f_GrSLType); |
108 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType); | 112 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType); |
109 GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType); | 113 GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType); |
110 GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType); | 114 GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType); |
111 GR_STATIC_ASSERT(10 == kGrSLTypeCount); | 115 GR_STATIC_ASSERT(10 == kBool_GrSLType); |
| 116 GR_STATIC_ASSERT(11 == kInt_GrSLType); |
| 117 GR_STATIC_ASSERT(12 == kGrSLTypeCount); |
| 118 } |
| 119 |
| 120 /** Is the shading language type integral (including vectors/matrices)? */ |
| 121 static inline bool GrSLTypeIsIntType(GrSLType type) { |
| 122 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount)); |
| 123 return type == kInt_GrSLType; |
| 124 |
| 125 GR_STATIC_ASSERT(0 == kVoid_GrSLType); |
| 126 GR_STATIC_ASSERT(1 == kFloat_GrSLType); |
| 127 GR_STATIC_ASSERT(2 == kVec2f_GrSLType); |
| 128 GR_STATIC_ASSERT(3 == kVec3f_GrSLType); |
| 129 GR_STATIC_ASSERT(4 == kVec4f_GrSLType); |
| 130 GR_STATIC_ASSERT(5 == kMat33f_GrSLType); |
| 131 GR_STATIC_ASSERT(6 == kMat44f_GrSLType); |
| 132 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType); |
| 133 GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType); |
| 134 GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType); |
| 135 GR_STATIC_ASSERT(10 == kBool_GrSLType); |
| 136 GR_STATIC_ASSERT(11 == kInt_GrSLType); |
| 137 GR_STATIC_ASSERT(12 == kGrSLTypeCount); |
| 138 } |
| 139 |
| 140 /** Is the shading language type numeric (including vectors/matrices)? */ |
| 141 static inline bool GrSLTypeIsNumeric(GrSLType type) { |
| 142 return GrSLTypeIsFloatType(type) || GrSLTypeIsIntType(type); |
112 } | 143 } |
113 | 144 |
114 /** Returns the size in bytes for floating point GrSLTypes. For non floating poi
nt type returns 0 */ | 145 /** Returns the size in bytes for floating point GrSLTypes. For non floating poi
nt type returns 0 */ |
115 static inline size_t GrSLTypeSize(GrSLType type) { | 146 static inline size_t GrSLTypeSize(GrSLType type) { |
116 SkASSERT(GrSLTypeIsFloatType(type)); | 147 SkASSERT(GrSLTypeIsFloatType(type)); |
117 static const size_t kSizes[] = { | 148 static const size_t kSizes[] = { |
118 0, // kVoid_GrSLType | 149 0, // kVoid_GrSLType |
119 sizeof(float), // kFloat_GrSLType | 150 sizeof(float), // kFloat_GrSLType |
120 2 * sizeof(float), // kVec2f_GrSLType | 151 2 * sizeof(float), // kVec2f_GrSLType |
121 3 * sizeof(float), // kVec3f_GrSLType | 152 3 * sizeof(float), // kVec3f_GrSLType |
122 4 * sizeof(float), // kVec4f_GrSLType | 153 4 * sizeof(float), // kVec4f_GrSLType |
123 9 * sizeof(float), // kMat33f_GrSLType | 154 9 * sizeof(float), // kMat33f_GrSLType |
124 16 * sizeof(float), // kMat44f_GrSLType | 155 16 * sizeof(float), // kMat44f_GrSLType |
125 0, // kSampler2D_GrSLType | 156 0, // kSampler2D_GrSLType |
126 0, // kSamplerExternal_GrSLType | 157 0, // kSamplerExternal_GrSLType |
127 0 // kSampler2DRect_GrSLType | 158 0, // kSampler2DRect_GrSLType |
| 159 0, // kBool_GrSLType |
| 160 0, // kInt_GrSLType |
128 }; | 161 }; |
129 return kSizes[type]; | 162 return kSizes[type]; |
130 | 163 |
131 GR_STATIC_ASSERT(0 == kVoid_GrSLType); | 164 GR_STATIC_ASSERT(0 == kVoid_GrSLType); |
132 GR_STATIC_ASSERT(1 == kFloat_GrSLType); | 165 GR_STATIC_ASSERT(1 == kFloat_GrSLType); |
133 GR_STATIC_ASSERT(2 == kVec2f_GrSLType); | 166 GR_STATIC_ASSERT(2 == kVec2f_GrSLType); |
134 GR_STATIC_ASSERT(3 == kVec3f_GrSLType); | 167 GR_STATIC_ASSERT(3 == kVec3f_GrSLType); |
135 GR_STATIC_ASSERT(4 == kVec4f_GrSLType); | 168 GR_STATIC_ASSERT(4 == kVec4f_GrSLType); |
136 GR_STATIC_ASSERT(5 == kMat33f_GrSLType); | 169 GR_STATIC_ASSERT(5 == kMat33f_GrSLType); |
137 GR_STATIC_ASSERT(6 == kMat44f_GrSLType); | 170 GR_STATIC_ASSERT(6 == kMat44f_GrSLType); |
138 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType); | 171 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType); |
139 GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType); | 172 GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType); |
140 GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType); | 173 GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType); |
141 GR_STATIC_ASSERT(10 == kGrSLTypeCount); | 174 GR_STATIC_ASSERT(10 == kBool_GrSLType); |
| 175 GR_STATIC_ASSERT(11 == kInt_GrSLType); |
| 176 GR_STATIC_ASSERT(12 == kGrSLTypeCount); |
142 } | 177 } |
143 | 178 |
144 static inline bool GrSLTypeIsSamplerType(GrSLType type) { | 179 static inline bool GrSLTypeIsSamplerType(GrSLType type) { |
145 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount)); | 180 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount)); |
146 return type >= 7 && type <= 9; | 181 return type >= 7 && type <= 9; |
147 | 182 |
148 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType); | 183 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType); |
149 GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType); | 184 GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType); |
150 GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType); | 185 GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType); |
151 } | 186 } |
152 | 187 |
153 ////////////////////////////////////////////////////////////////////////////// | 188 ////////////////////////////////////////////////////////////////////////////// |
154 | 189 |
155 /** | 190 /** |
156 * Types used to describe format of vertices in arrays. | 191 * Types used to describe format of vertices in arrays. |
157 */ | 192 */ |
158 enum GrVertexAttribType { | 193 enum GrVertexAttribType { |
159 kFloat_GrVertexAttribType = 0, | 194 kFloat_GrVertexAttribType = 0, |
160 kVec2f_GrVertexAttribType, | 195 kVec2f_GrVertexAttribType, |
161 kVec3f_GrVertexAttribType, | 196 kVec3f_GrVertexAttribType, |
162 kVec4f_GrVertexAttribType, | 197 kVec4f_GrVertexAttribType, |
163 | 198 |
164 kUByte_GrVertexAttribType, // unsigned byte, e.g. coverage | 199 kUByte_GrVertexAttribType, // unsigned byte, e.g. coverage |
165 kVec4ub_GrVertexAttribType, // vector of 4 unsigned bytes, e.g. colors | 200 kVec4ub_GrVertexAttribType, // vector of 4 unsigned bytes, e.g. colors |
166 | 201 |
167 kVec2s_GrVertexAttribType, // vector of 2 shorts, e.g. texture coordinates | 202 kVec2s_GrVertexAttribType, // vector of 2 shorts, e.g. texture coordinates |
| 203 |
| 204 kInt_GrVertexAttribType, |
168 | 205 |
169 kLast_GrVertexAttribType = kVec2s_GrVertexAttribType | 206 kLast_GrVertexAttribType = kInt_GrVertexAttribType |
170 }; | 207 }; |
171 static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1; | 208 static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1; |
172 | 209 |
173 /** | 210 /** |
174 * Returns the vector size of the type. | 211 * Returns the vector size of the type. |
175 */ | 212 */ |
176 static inline int GrVertexAttribTypeVectorCount(GrVertexAttribType type) { | 213 static inline int GrVertexAttribTypeVectorCount(GrVertexAttribType type) { |
177 SkASSERT(type >= 0 && type < kGrVertexAttribTypeCount); | 214 static const int kCounts[] = { 1, 2, 3, 4, 1, 4, 2, 1 }; |
178 static const int kCounts[] = { 1, 2, 3, 4, 1, 4, 2 }; | |
179 return kCounts[type]; | 215 return kCounts[type]; |
180 | 216 |
181 GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType); | 217 GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType); |
182 GR_STATIC_ASSERT(1 == kVec2f_GrVertexAttribType); | 218 GR_STATIC_ASSERT(1 == kVec2f_GrVertexAttribType); |
183 GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType); | 219 GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType); |
184 GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType); | 220 GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType); |
185 GR_STATIC_ASSERT(4 == kUByte_GrVertexAttribType); | 221 GR_STATIC_ASSERT(4 == kUByte_GrVertexAttribType); |
186 GR_STATIC_ASSERT(5 == kVec4ub_GrVertexAttribType); | 222 GR_STATIC_ASSERT(5 == kVec4ub_GrVertexAttribType); |
187 GR_STATIC_ASSERT(6 == kVec2s_GrVertexAttribType); | 223 GR_STATIC_ASSERT(6 == kVec2s_GrVertexAttribType); |
| 224 GR_STATIC_ASSERT(7 == kInt_GrVertexAttribType); |
188 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrVertexAttribTypeCount); | 225 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrVertexAttribTypeCount); |
189 } | 226 } |
190 | 227 |
191 /** | 228 /** |
192 * Returns the size of the attrib type in bytes. | 229 * Returns the size of the attrib type in bytes. |
193 */ | 230 */ |
194 static inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) { | 231 static inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) { |
195 SkASSERT(type >= 0 && type < kGrVertexAttribTypeCount); | |
196 static const size_t kSizes[] = { | 232 static const size_t kSizes[] = { |
197 sizeof(float), // kFloat_GrVertexAttribType | 233 sizeof(float), // kFloat_GrVertexAttribType |
198 2*sizeof(float), // kVec2f_GrVertexAttribType | 234 2*sizeof(float), // kVec2f_GrVertexAttribType |
199 3*sizeof(float), // kVec3f_GrVertexAttribType | 235 3*sizeof(float), // kVec3f_GrVertexAttribType |
200 4*sizeof(float), // kVec4f_GrVertexAttribType | 236 4*sizeof(float), // kVec4f_GrVertexAttribType |
201 1*sizeof(char), // kUByte_GrVertexAttribType | 237 1*sizeof(char), // kUByte_GrVertexAttribType |
202 4*sizeof(char), // kVec4ub_GrVertexAttribType | 238 4*sizeof(char), // kVec4ub_GrVertexAttribType |
203 2*sizeof(int16_t) // kVec2s_GrVertexAttribType | 239 2*sizeof(int16_t), // kVec2s_GrVertexAttribType |
| 240 sizeof(int32_t) // kInt_GrVertexAttribType |
204 }; | 241 }; |
205 return kSizes[type]; | 242 return kSizes[type]; |
206 | 243 |
207 GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType); | 244 GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType); |
208 GR_STATIC_ASSERT(1 == kVec2f_GrVertexAttribType); | 245 GR_STATIC_ASSERT(1 == kVec2f_GrVertexAttribType); |
209 GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType); | 246 GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType); |
210 GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType); | 247 GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType); |
211 GR_STATIC_ASSERT(4 == kUByte_GrVertexAttribType); | 248 GR_STATIC_ASSERT(4 == kUByte_GrVertexAttribType); |
212 GR_STATIC_ASSERT(5 == kVec4ub_GrVertexAttribType); | 249 GR_STATIC_ASSERT(5 == kVec4ub_GrVertexAttribType); |
213 GR_STATIC_ASSERT(6 == kVec2s_GrVertexAttribType); | 250 GR_STATIC_ASSERT(6 == kVec2s_GrVertexAttribType); |
| 251 GR_STATIC_ASSERT(7 == kInt_GrVertexAttribType); |
214 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kSizes) == kGrVertexAttribTypeCount); | 252 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kSizes) == kGrVertexAttribTypeCount); |
215 } | 253 } |
216 | 254 |
217 /** | 255 /** |
218 * converts a GrVertexAttribType to a GrSLType | 256 * converts a GrVertexAttribType to a GrSLType |
219 */ | 257 */ |
220 static inline GrSLType GrVertexAttribTypeToSLType(GrVertexAttribType type) { | 258 static inline GrSLType GrVertexAttribTypeToSLType(GrVertexAttribType type) { |
221 switch (type) { | 259 switch (type) { |
222 default: | 260 default: |
223 SkFAIL("Unsupported type conversion"); | 261 SkFAIL("Unsupported type conversion"); |
224 return kVoid_GrSLType; | 262 return kVoid_GrSLType; |
225 case kUByte_GrVertexAttribType: | 263 case kUByte_GrVertexAttribType: |
226 case kFloat_GrVertexAttribType: | 264 case kFloat_GrVertexAttribType: |
227 return kFloat_GrSLType; | 265 return kFloat_GrSLType; |
228 case kVec2s_GrVertexAttribType: | 266 case kVec2s_GrVertexAttribType: |
229 case kVec2f_GrVertexAttribType: | 267 case kVec2f_GrVertexAttribType: |
230 return kVec2f_GrSLType; | 268 return kVec2f_GrSLType; |
231 case kVec3f_GrVertexAttribType: | 269 case kVec3f_GrVertexAttribType: |
232 return kVec3f_GrSLType; | 270 return kVec3f_GrSLType; |
233 case kVec4ub_GrVertexAttribType: | 271 case kVec4ub_GrVertexAttribType: |
234 case kVec4f_GrVertexAttribType: | 272 case kVec4f_GrVertexAttribType: |
235 return kVec4f_GrSLType; | 273 return kVec4f_GrSLType; |
| 274 case kInt_GrVertexAttribType: |
| 275 return kInt_GrSLType; |
236 } | 276 } |
237 } | 277 } |
238 | 278 |
239 ////////////////////////////////////////////////////////////////////////////// | 279 ////////////////////////////////////////////////////////////////////////////// |
240 | 280 |
241 /** | 281 /** |
242 * We have coverage effects that clip rendering to the edge of some geometric pri
mitive. | 282 * We have coverage effects that clip rendering to the edge of some geometric pri
mitive. |
243 * This enum specifies how that clipping is performed. Not all factories that tak
e a | 283 * This enum specifies how that clipping is performed. Not all factories that tak
e a |
244 * GrProcessorEdgeType will succeed with all values and it is up to the caller to
check for | 284 * GrProcessorEdgeType will succeed with all values and it is up to the caller to
check for |
245 * a NULL return. | 285 * a NULL return. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 // Takes a pointer to a GrCaps, and will suppress prints if required | 366 // Takes a pointer to a GrCaps, and will suppress prints if required |
327 #define GrCapsDebugf(caps, ...) \ | 367 #define GrCapsDebugf(caps, ...) \ |
328 if (!caps->suppressPrints()) { \ | 368 if (!caps->suppressPrints()) { \ |
329 SkDebugf(__VA_ARGS__); \ | 369 SkDebugf(__VA_ARGS__); \ |
330 } | 370 } |
331 #else | 371 #else |
332 #define GrCapsDebugf(caps, ...) | 372 #define GrCapsDebugf(caps, ...) |
333 #endif | 373 #endif |
334 | 374 |
335 #endif | 375 #endif |
OLD | NEW |