| 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 GrShaderVar_DEFINED | 8 #ifndef GrShaderVar_DEFINED |
| 9 #define GrShaderVar_DEFINED | 9 #define GrShaderVar_DEFINED |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 , fPrecision(kDefault_GrSLPrecision) { | 44 , fPrecision(kDefault_GrSLPrecision) { |
| 45 } | 45 } |
| 46 | 46 |
| 47 GrShaderVar(const SkString& name, GrSLType type, int arrayCount = kNonArray, | 47 GrShaderVar(const SkString& name, GrSLType type, int arrayCount = kNonArray, |
| 48 GrSLPrecision precision = kDefault_GrSLPrecision) | 48 GrSLPrecision precision = kDefault_GrSLPrecision) |
| 49 : fType(type) | 49 : fType(type) |
| 50 , fTypeModifier(kNone_TypeModifier) | 50 , fTypeModifier(kNone_TypeModifier) |
| 51 , fName(name) | 51 , fName(name) |
| 52 , fCount(arrayCount) | 52 , fCount(arrayCount) |
| 53 , fPrecision(precision) { | 53 , fPrecision(precision) { |
| 54 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsNumeric(type))
; | |
| 55 SkASSERT(kVoid_GrSLType != type); | 54 SkASSERT(kVoid_GrSLType != type); |
| 56 } | 55 } |
| 57 | 56 |
| 58 GrShaderVar(const char* name, GrSLType type, int arrayCount = kNonArray, | 57 GrShaderVar(const char* name, GrSLType type, int arrayCount = kNonArray, |
| 59 GrSLPrecision precision = kDefault_GrSLPrecision) | 58 GrSLPrecision precision = kDefault_GrSLPrecision) |
| 60 : fType(type) | 59 : fType(type) |
| 61 , fTypeModifier(kNone_TypeModifier) | 60 , fTypeModifier(kNone_TypeModifier) |
| 62 , fName(name) | 61 , fName(name) |
| 63 , fCount(arrayCount) | 62 , fCount(arrayCount) |
| 64 , fPrecision(precision) { | 63 , fPrecision(precision) { |
| 65 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsNumeric(type))
; | |
| 66 SkASSERT(kVoid_GrSLType != type); | 64 SkASSERT(kVoid_GrSLType != type); |
| 67 } | 65 } |
| 68 | 66 |
| 69 GrShaderVar(const char* name, GrSLType type, TypeModifier typeModifier, | 67 GrShaderVar(const char* name, GrSLType type, TypeModifier typeModifier, |
| 70 int arrayCount = kNonArray, GrSLPrecision precision = kDefault_G
rSLPrecision) | 68 int arrayCount = kNonArray, GrSLPrecision precision = kDefault_G
rSLPrecision) |
| 71 : fType(type) | 69 : fType(type) |
| 72 , fTypeModifier(typeModifier) | 70 , fTypeModifier(typeModifier) |
| 73 , fName(name) | 71 , fName(name) |
| 74 , fCount(arrayCount) | 72 , fCount(arrayCount) |
| 75 , fPrecision(precision) { | 73 , fPrecision(precision) { |
| 76 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsNumeric(type))
; | |
| 77 SkASSERT(kVoid_GrSLType != type); | 74 SkASSERT(kVoid_GrSLType != type); |
| 78 } | 75 } |
| 79 | 76 |
| 80 /** | 77 /** |
| 81 * Values for array count that have special meaning. We allow 1-sized arrays
. | 78 * Values for array count that have special meaning. We allow 1-sized arrays
. |
| 82 */ | 79 */ |
| 83 enum { | 80 enum { |
| 84 kNonArray = 0, // not an array | 81 kNonArray = 0, // not an array |
| 85 kUnsizedArray = -1, // an unsized array (declared with []) | 82 kUnsizedArray = -1, // an unsized array (declared with []) |
| 86 }; | 83 }; |
| 87 | 84 |
| 88 void set(GrSLType type, | 85 void set(GrSLType type, |
| 89 const SkString& name, | 86 const SkString& name, |
| 90 TypeModifier typeModifier = kNone_TypeModifier, | 87 TypeModifier typeModifier = kNone_TypeModifier, |
| 91 GrSLPrecision precision = kDefault_GrSLPrecision, | 88 GrSLPrecision precision = kDefault_GrSLPrecision, |
| 92 int count = kNonArray) { | 89 int count = kNonArray) { |
| 93 SkASSERT(kVoid_GrSLType != type); | 90 SkASSERT(kVoid_GrSLType != type); |
| 94 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsNumeric(type))
; | |
| 95 fType = type; | 91 fType = type; |
| 96 fTypeModifier = typeModifier; | 92 fTypeModifier = typeModifier; |
| 97 fName = name; | 93 fName = name; |
| 98 fCount = count; | 94 fCount = count; |
| 99 fPrecision = precision; | 95 fPrecision = precision; |
| 100 } | 96 } |
| 101 | 97 |
| 102 void set(GrSLType type, | 98 void set(GrSLType type, |
| 103 const char* name, | 99 const char* name, |
| 104 TypeModifier typeModifier = kNone_TypeModifier, | 100 TypeModifier typeModifier = kNone_TypeModifier, |
| 105 GrSLPrecision precision = kDefault_GrSLPrecision, | 101 GrSLPrecision precision = kDefault_GrSLPrecision, |
| 106 int count = kNonArray) { | 102 int count = kNonArray) { |
| 107 SkASSERT(kVoid_GrSLType != type); | 103 SkASSERT(kVoid_GrSLType != type); |
| 108 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsNumeric(type))
; | |
| 109 fType = type; | 104 fType = type; |
| 110 fTypeModifier = typeModifier; | 105 fTypeModifier = typeModifier; |
| 111 fName = name; | 106 fName = name; |
| 112 fCount = count; | 107 fCount = count; |
| 113 fPrecision = precision; | 108 fPrecision = precision; |
| 114 } | 109 } |
| 115 | 110 |
| 116 /** | 111 /** |
| 117 * Is the var an array. | 112 * Is the var an array. |
| 118 */ | 113 */ |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 177 |
| 183 protected: | 178 protected: |
| 184 GrSLType fType; | 179 GrSLType fType; |
| 185 TypeModifier fTypeModifier; | 180 TypeModifier fTypeModifier; |
| 186 SkString fName; | 181 SkString fName; |
| 187 int fCount; | 182 int fCount; |
| 188 GrSLPrecision fPrecision; | 183 GrSLPrecision fPrecision; |
| 189 }; | 184 }; |
| 190 | 185 |
| 191 #endif | 186 #endif |
| OLD | NEW |