Skia
2DGraphicsLibrary
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GrShaderVar Class Reference

Public Types

enum  TypeModifier {
  kNone_TypeModifier, kOut_TypeModifier, kIn_TypeModifier, kInOut_TypeModifier,
  kUniform_TypeModifier, kAttribute_TypeModifier, kVaryingIn_TypeModifier, kVaryingOut_TypeModifier
}
 Early versions of GLSL have Varying and Attribute; those are later deprecated, but we still need to know whether a Varying variable should be treated as In or Out. More...
 
enum  { kNonArray = 0, kUnsizedArray = -1 }
 Values for array count that have special meaning. More...
 

Public Member Functions

 GrShaderVar ()
 Defaults to a float with no precision specifier.
 
 GrShaderVar (const SkString &name, GrSLType type, int arrayCount=kNonArray, GrSLPrecision precision=kDefault_GrSLPrecision)
 
 GrShaderVar (const char *name, GrSLType type, int arrayCount=kNonArray, GrSLPrecision precision=kDefault_GrSLPrecision)
 
 GrShaderVar (const char *name, GrSLType type, TypeModifier typeModifier, int arrayCount=kNonArray, GrSLPrecision precision=kDefault_GrSLPrecision)
 
void set (GrSLType type, const SkString &name, TypeModifier typeModifier=kNone_TypeModifier, GrSLPrecision precision=kDefault_GrSLPrecision, int count=kNonArray)
 
void set (GrSLType type, const char *name, TypeModifier typeModifier=kNone_TypeModifier, GrSLPrecision precision=kDefault_GrSLPrecision, int count=kNonArray)
 
bool isArray () const
 Is the var an array.
 
bool isUnsizedArray () const
 Is this an unsized array, (i.e. More...
 
int getArrayCount () const
 Get the array length of the var.
 
void setArrayCount (int count)
 Set the array length of the var.
 
void setNonArray ()
 Set to be a non-array.
 
void setUnsizedArray ()
 Set to be an unsized array.
 
SkStringaccessName ()
 Access the var name as a writable string.
 
void setName (const SkString &n)
 Set the var name.
 
void setName (const char *n)
 
const SkStringgetName () const
 Get the var name.
 
const char * c_str () const
 Shortcut for this->getName().c_str();.
 
GrSLType getType () const
 Get the type of the var.
 
void setType (GrSLType type)
 Set the type of the var.
 
TypeModifier getTypeModifier () const
 
void setTypeModifier (TypeModifier type)
 
GrSLPrecision getPrecision () const
 Get the precision of the var.
 
void setPrecision (GrSLPrecision p)
 Set the precision of the var.
 

Protected Attributes

GrSLType fType
 
TypeModifier fTypeModifier
 
SkString fName
 
int fCount
 
GrSLPrecision fPrecision
 

Member Enumeration Documentation

anonymous enum

Values for array count that have special meaning.

We allow 1-sized arrays.

Early versions of GLSL have Varying and Attribute; those are later deprecated, but we still need to know whether a Varying variable should be treated as In or Out.

TODO This really shouldn't live here, but until we have c++11, there is really no good way to write extensible enums. In reality, only none, out, in, inout, and uniform really make sense on this base class

Member Function Documentation

bool GrShaderVar::isUnsizedArray ( ) const
inline

Is this an unsized array, (i.e.

declared with []).


The documentation for this class was generated from the following file: