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(); |
216 switch (t) { | 217 switch (t) { |
217 case kNone_TypeModifier: | 218 case kNone_TypeModifier: |
218 return ""; | 219 return ""; |
219 case kAttribute_TypeModifier: // fall through | |
220 case kVaryingIn_TypeModifier: // fall through | |
221 case kIn_TypeModifier: | 220 case kIn_TypeModifier: |
222 return "in"; | 221 return "in"; |
223 case kInOut_TypeModifier: | 222 case kInOut_TypeModifier: |
224 return "inout"; | 223 return "inout"; |
225 case kVaryingOut_TypeModifier: // fall through | |
226 case kOut_TypeModifier: | 224 case kOut_TypeModifier: |
227 return "out"; | 225 return "out"; |
228 case kUniform_TypeModifier: | 226 case kUniform_TypeModifier: |
229 return "uniform"; | 227 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"; |
230 default: | 234 default: |
231 SkFAIL("Unknown shader variable type modifier."); | 235 SkFAIL("Unknown shader variable type modifier."); |
232 return ""; // suppress warning | 236 return ""; // suppress warning |
233 } | 237 } |
234 } | 238 } |
235 | 239 |
236 /// Work around driver bugs on some hardware that don't correctly | 240 /// Work around driver bugs on some hardware that don't correctly |
237 /// support uniform float [] | 241 /// support uniform float [] |
238 bool fUseUniformFloatArrays; | 242 bool fUseUniformFloatArrays; |
239 | 243 |
240 SkString fLayoutQualifier; | 244 SkString fLayoutQualifier; |
241 SkString fExtraModifiers; | 245 SkString fExtraModifiers; |
242 | 246 |
243 typedef GrShaderVar INHERITED; | 247 typedef GrShaderVar INHERITED; |
244 }; | 248 }; |
245 | 249 |
246 #endif | 250 #endif |
OLD | NEW |