8 #ifndef GrShaderVar_DEFINED
9 #define GrShaderVar_DEFINED
11 #include "GrTypesPriv.h"
30 kUniform_TypeModifier,
32 kAttribute_TypeModifier,
33 kVaryingIn_TypeModifier,
34 kVaryingOut_TypeModifier
41 : fType(kFloat_GrSLType)
42 , fTypeModifier(kNone_TypeModifier)
44 , fPrecision(kDefault_GrSLPrecision) {
48 GrSLPrecision precision = kDefault_GrSLPrecision)
50 , fTypeModifier(kNone_TypeModifier)
53 , fPrecision(precision) {
54 SkASSERT(kVoid_GrSLType != type);
57 GrShaderVar(
const char* name, GrSLType type,
int arrayCount = kNonArray,
58 GrSLPrecision precision = kDefault_GrSLPrecision)
60 , fTypeModifier(kNone_TypeModifier)
63 , fPrecision(precision) {
64 SkASSERT(kVoid_GrSLType != type);
68 int arrayCount = kNonArray, GrSLPrecision precision = kDefault_GrSLPrecision)
70 , fTypeModifier(typeModifier)
73 , fPrecision(precision) {
74 SkASSERT(kVoid_GrSLType != type);
85 void set(GrSLType type,
88 GrSLPrecision precision = kDefault_GrSLPrecision,
89 int count = kNonArray) {
90 SkASSERT(kVoid_GrSLType != type);
92 fTypeModifier = typeModifier;
95 fPrecision = precision;
98 void set(GrSLType type,
101 GrSLPrecision precision = kDefault_GrSLPrecision,
102 int count = kNonArray) {
103 SkASSERT(kVoid_GrSLType != type);
105 fTypeModifier = typeModifier;
108 fPrecision = precision;
114 bool isArray()
const {
return kNonArray != fCount; }
144 void setName(
const char* n) { fName = n; }
165 TypeModifier getTypeModifier()
const {
return fTypeModifier; }
166 void setTypeModifier(
TypeModifier type) { fTypeModifier = type; }
183 GrSLPrecision fPrecision;
GrSLType getType() const
Get the type of the var.
Definition: GrShaderVar.h:159
int getArrayCount() const
Get the array length of the var.
Definition: GrShaderVar.h:122
const char * c_str() const
Shortcut for this->getName().c_str();.
Definition: GrShaderVar.h:154
Definition: GrShaderVar.h:14
void setName(const SkString &n)
Set the var name.
Definition: GrShaderVar.h:143
bool isArray() const
Is the var an array.
Definition: GrShaderVar.h:114
void setNonArray()
Set to be a non-array.
Definition: GrShaderVar.h:130
bool isUnsizedArray() const
Is this an unsized array, (i.e.
Definition: GrShaderVar.h:118
GrSLPrecision getPrecision() const
Get the precision of the var.
Definition: GrShaderVar.h:171
SkString * accessName()
Access the var name as a writable string.
Definition: GrShaderVar.h:139
TypeModifier
Early versions of GLSL have Varying and Attribute; those are later deprecated, but we still need to k...
Definition: GrShaderVar.h:25
void setUnsizedArray()
Set to be an unsized array.
Definition: GrShaderVar.h:134
void setPrecision(GrSLPrecision p)
Set the precision of the var.
Definition: GrShaderVar.h:176
void setType(GrSLType type)
Set the type of the var.
Definition: GrShaderVar.h:163
GrShaderVar()
Defaults to a float with no precision specifier.
Definition: GrShaderVar.h:40
const SkString & getName() const
Get the var name.
Definition: GrShaderVar.h:149
void setArrayCount(int count)
Set the array length of the var.
Definition: GrShaderVar.h:126
Light weight class for managing strings.
Definition: SkString.h:121