OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrGLSLShaderVar_DEFINED | 8 #ifndef GrGLSLShaderVar_DEFINED |
9 #define GrGLSLShaderVar_DEFINED | 9 #define GrGLSLShaderVar_DEFINED |
10 | 10 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 206 |
207 void appendArrayAccess(const char* indexName, SkString* out) const { | 207 void appendArrayAccess(const char* indexName, SkString* out) const { |
208 out->appendf("%s[%s]%s", | 208 out->appendf("%s[%s]%s", |
209 this->getName().c_str(), | 209 this->getName().c_str(), |
210 indexName, | 210 indexName, |
211 fUseUniformFloatArrays ? "" : ".x"); | 211 fUseUniformFloatArrays ? "" : ".x"); |
212 } | 212 } |
213 | 213 |
214 private: | 214 private: |
215 static const char* TypeModifierString(const GrGLSLCaps* glslCaps, TypeModifi
er t) { | 215 static const char* TypeModifierString(const GrGLSLCaps* glslCaps, TypeModifi
er t) { |
216 GrGLSLGeneration gen = glslCaps->generation(); | |
217 switch (t) { | 216 switch (t) { |
218 case kNone_TypeModifier: | 217 case kNone_TypeModifier: |
219 return ""; | 218 return ""; |
| 219 case kAttribute_TypeModifier: // fall through |
| 220 case kVaryingIn_TypeModifier: // fall through |
220 case kIn_TypeModifier: | 221 case kIn_TypeModifier: |
221 return "in"; | 222 return "in"; |
222 case kInOut_TypeModifier: | 223 case kInOut_TypeModifier: |
223 return "inout"; | 224 return "inout"; |
| 225 case kVaryingOut_TypeModifier: // fall through |
224 case kOut_TypeModifier: | 226 case kOut_TypeModifier: |
225 return "out"; | 227 return "out"; |
226 case kUniform_TypeModifier: | 228 case kUniform_TypeModifier: |
227 return "uniform"; | 229 return "uniform"; |
228 case kAttribute_TypeModifier: | |
229 return k110_GrGLSLGeneration == gen ? "attribute" : "in"; | |
230 case kVaryingIn_TypeModifier: | |
231 return k110_GrGLSLGeneration == gen ? "varying" : "in"; | |
232 case kVaryingOut_TypeModifier: | |
233 return k110_GrGLSLGeneration == gen ? "varying" : "out"; | |
234 default: | 230 default: |
235 SkFAIL("Unknown shader variable type modifier."); | 231 SkFAIL("Unknown shader variable type modifier."); |
236 return ""; // suppress warning | 232 return ""; // suppress warning |
237 } | 233 } |
238 } | 234 } |
239 | 235 |
240 /// Work around driver bugs on some hardware that don't correctly | 236 /// Work around driver bugs on some hardware that don't correctly |
241 /// support uniform float [] | 237 /// support uniform float [] |
242 bool fUseUniformFloatArrays; | 238 bool fUseUniformFloatArrays; |
243 | 239 |
244 SkString fLayoutQualifier; | 240 SkString fLayoutQualifier; |
245 SkString fExtraModifiers; | 241 SkString fExtraModifiers; |
246 | 242 |
247 typedef GrShaderVar INHERITED; | 243 typedef GrShaderVar INHERITED; |
248 }; | 244 }; |
249 | 245 |
250 #endif | 246 #endif |
OLD | NEW |