| Index: include/gpu/GrTypesPriv.h
|
| diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h
|
| index bc107b5cf5aa6467b391f38c4fad1caf8a5ac526..4026eb7874dcbab4de91e3a732ea6865af07cb7c 100644
|
| --- a/include/gpu/GrTypesPriv.h
|
| +++ b/include/gpu/GrTypesPriv.h
|
| @@ -29,8 +29,9 @@ enum GrSLType {
|
| kSampler2DRect_GrSLType,
|
| kBool_GrSLType,
|
| kInt_GrSLType,
|
| + kUint_GrSLType,
|
|
|
| - kLast_GrSLType = kInt_GrSLType
|
| + kLast_GrSLType = kUint_GrSLType
|
| };
|
| static const int kGrSLTypeCount = kLast_GrSLType + 1;
|
|
|
| @@ -67,7 +68,7 @@ static const int kGrSLPrecisionCount = kLast_GrSLPrecision + 1;
|
| */
|
| static inline int GrSLTypeVectorCount(GrSLType type) {
|
| SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
|
| - static const int kCounts[] = { -1, 1, 2, 3, 4, -1, -1, -1, -1, -1, -1, -1 };
|
| + static const int kCounts[] = { -1, 1, 2, 3, 4, -1, -1, -1, -1, -1, 1, 1, 1 };
|
| return kCounts[type];
|
|
|
| GR_STATIC_ASSERT(0 == kVoid_GrSLType);
|
| @@ -82,6 +83,7 @@ static inline int GrSLTypeVectorCount(GrSLType type) {
|
| GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType);
|
| GR_STATIC_ASSERT(10 == kBool_GrSLType);
|
| GR_STATIC_ASSERT(11 == kInt_GrSLType);
|
| + GR_STATIC_ASSERT(12 == kUint_GrSLType);
|
| GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrSLTypeCount);
|
| }
|
|
|
| @@ -114,13 +116,14 @@ static inline bool GrSLTypeIsFloatType(GrSLType type) {
|
| GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType);
|
| GR_STATIC_ASSERT(10 == kBool_GrSLType);
|
| GR_STATIC_ASSERT(11 == kInt_GrSLType);
|
| - GR_STATIC_ASSERT(12 == kGrSLTypeCount);
|
| + GR_STATIC_ASSERT(12 == kUint_GrSLType);
|
| + GR_STATIC_ASSERT(13 == kGrSLTypeCount);
|
| }
|
|
|
| /** Is the shading language type integral (including vectors/matrices)? */
|
| static inline bool GrSLTypeIsIntType(GrSLType type) {
|
| SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
|
| - return type == kInt_GrSLType;
|
| + return type >= kInt_GrSLType;
|
|
|
| GR_STATIC_ASSERT(0 == kVoid_GrSLType);
|
| GR_STATIC_ASSERT(1 == kFloat_GrSLType);
|
| @@ -134,7 +137,8 @@ static inline bool GrSLTypeIsIntType(GrSLType type) {
|
| GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType);
|
| GR_STATIC_ASSERT(10 == kBool_GrSLType);
|
| GR_STATIC_ASSERT(11 == kInt_GrSLType);
|
| - GR_STATIC_ASSERT(12 == kGrSLTypeCount);
|
| + GR_STATIC_ASSERT(12 == kUint_GrSLType);
|
| + GR_STATIC_ASSERT(13 == kGrSLTypeCount);
|
| }
|
|
|
| /** Is the shading language type numeric (including vectors/matrices)? */
|
| @@ -158,6 +162,7 @@ static inline size_t GrSLTypeSize(GrSLType type) {
|
| 0, // kSampler2DRect_GrSLType
|
| 0, // kBool_GrSLType
|
| 0, // kInt_GrSLType
|
| + 0, // kUint_GrSLType
|
| };
|
| return kSizes[type];
|
|
|
| @@ -173,7 +178,8 @@ static inline size_t GrSLTypeSize(GrSLType type) {
|
| GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType);
|
| GR_STATIC_ASSERT(10 == kBool_GrSLType);
|
| GR_STATIC_ASSERT(11 == kInt_GrSLType);
|
| - GR_STATIC_ASSERT(12 == kGrSLTypeCount);
|
| + GR_STATIC_ASSERT(12 == kUint_GrSLType);
|
| + GR_STATIC_ASSERT(13 == kGrSLTypeCount);
|
| }
|
|
|
| static inline bool GrSLTypeIsSamplerType(GrSLType type) {
|
| @@ -202,8 +208,9 @@ enum GrVertexAttribType {
|
| kVec2s_GrVertexAttribType, // vector of 2 shorts, e.g. texture coordinates
|
|
|
| kInt_GrVertexAttribType,
|
| + kUint_GrVertexAttribType,
|
|
|
| - kLast_GrVertexAttribType = kInt_GrVertexAttribType
|
| + kLast_GrVertexAttribType = kUint_GrVertexAttribType
|
| };
|
| static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1;
|
|
|
| @@ -211,7 +218,8 @@ static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1;
|
| * Returns the vector size of the type.
|
| */
|
| static inline int GrVertexAttribTypeVectorCount(GrVertexAttribType type) {
|
| - static const int kCounts[] = { 1, 2, 3, 4, 1, 4, 2, 1 };
|
| + SkASSERT(type >= 0 && type < kGrVertexAttribTypeCount);
|
| + static const int kCounts[] = { 1, 2, 3, 4, 1, 4, 2, 1, 1 };
|
| return kCounts[type];
|
|
|
| GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType);
|
| @@ -222,6 +230,7 @@ static inline int GrVertexAttribTypeVectorCount(GrVertexAttribType type) {
|
| GR_STATIC_ASSERT(5 == kVec4ub_GrVertexAttribType);
|
| GR_STATIC_ASSERT(6 == kVec2s_GrVertexAttribType);
|
| GR_STATIC_ASSERT(7 == kInt_GrVertexAttribType);
|
| + GR_STATIC_ASSERT(8 == kUint_GrVertexAttribType);
|
| GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrVertexAttribTypeCount);
|
| }
|
|
|
| @@ -237,7 +246,8 @@ static inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) {
|
| 1*sizeof(char), // kUByte_GrVertexAttribType
|
| 4*sizeof(char), // kVec4ub_GrVertexAttribType
|
| 2*sizeof(int16_t), // kVec2s_GrVertexAttribType
|
| - sizeof(int32_t) // kInt_GrVertexAttribType
|
| + sizeof(int32_t), // kInt_GrVertexAttribType
|
| + sizeof(uint32_t) // kUint_GrVertexAttribType
|
| };
|
| return kSizes[type];
|
|
|
| @@ -249,10 +259,30 @@ static inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) {
|
| GR_STATIC_ASSERT(5 == kVec4ub_GrVertexAttribType);
|
| GR_STATIC_ASSERT(6 == kVec2s_GrVertexAttribType);
|
| GR_STATIC_ASSERT(7 == kInt_GrVertexAttribType);
|
| + GR_STATIC_ASSERT(8 == kUint_GrVertexAttribType);
|
| GR_STATIC_ASSERT(SK_ARRAY_COUNT(kSizes) == kGrVertexAttribTypeCount);
|
| }
|
|
|
| /**
|
| + * Is the attrib type integral?
|
| + */
|
| +static inline bool GrVertexAttribTypeIsIntType(GrVertexAttribType type) {
|
| + SkASSERT(type >= 0 && type < static_cast<GrVertexAttribType>(kGrVertexAttribTypeCount));
|
| + return type >= kInt_GrVertexAttribType;
|
| +
|
| + GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType);
|
| + GR_STATIC_ASSERT(1 == kVec2f_GrVertexAttribType);
|
| + GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType);
|
| + GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType);
|
| + GR_STATIC_ASSERT(4 == kUByte_GrVertexAttribType);
|
| + GR_STATIC_ASSERT(5 == kVec4ub_GrVertexAttribType);
|
| + GR_STATIC_ASSERT(6 == kVec2s_GrVertexAttribType);
|
| + GR_STATIC_ASSERT(7 == kInt_GrVertexAttribType);
|
| + GR_STATIC_ASSERT(8 == kUint_GrVertexAttribType);
|
| + GR_STATIC_ASSERT(9 == kGrVertexAttribTypeCount);
|
| +}
|
| +
|
| +/**
|
| * converts a GrVertexAttribType to a GrSLType
|
| */
|
| static inline GrSLType GrVertexAttribTypeToSLType(GrVertexAttribType type) {
|
| @@ -273,6 +303,8 @@ static inline GrSLType GrVertexAttribTypeToSLType(GrVertexAttribType type) {
|
| return kVec4f_GrSLType;
|
| case kInt_GrVertexAttribType:
|
| return kInt_GrSLType;
|
| + case kUint_GrVertexAttribType:
|
| + return kUint_GrSLType;
|
| }
|
| }
|
|
|
|
|