| Index: include/gpu/GrTypesPriv.h
|
| diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h
|
| index 491b23b37baf93148f692f6853a41c3e18445aba..6a9c44ff9fb9d2c38bc63f069b312a9869cf5a91 100644
|
| --- a/include/gpu/GrTypesPriv.h
|
| +++ b/include/gpu/GrTypesPriv.h
|
| @@ -107,6 +107,35 @@ static inline bool GrSLTypeIsFloatType(GrSLType type) {
|
| GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType);
|
| GR_STATIC_ASSERT(9 == kGrSLTypeCount);
|
| }
|
| +
|
| +/** Returns the size in bytes for floating point GrSLTypes. For non floating point type returns 0 */
|
| +static inline size_t GrSLTypeSize(GrSLType type) {
|
| + SkASSERT(GrSLTypeIsFloatType(type));
|
| + static const size_t kSizes[] = {
|
| + 0, // kVoid_GrSLType
|
| + sizeof(float), // kFloat_GrSLType
|
| + 2 * sizeof(float), // kVec2f_GrSLType
|
| + 3 * sizeof(float), // kVec3f_GrSLType
|
| + 4 * sizeof(float), // kVec4f_GrSLType
|
| + 9 * sizeof(float), // kMat33f_GrSLType
|
| + 16 * sizeof(float), // kMat44f_GrSLType
|
| + 0, // kSampler2D_GrSLType
|
| + 0 // kSamplerExternal_GrSLType
|
| + };
|
| + return kSizes[type];
|
| +
|
| + GR_STATIC_ASSERT(0 == kVoid_GrSLType);
|
| + GR_STATIC_ASSERT(1 == kFloat_GrSLType);
|
| + GR_STATIC_ASSERT(2 == kVec2f_GrSLType);
|
| + GR_STATIC_ASSERT(3 == kVec3f_GrSLType);
|
| + GR_STATIC_ASSERT(4 == kVec4f_GrSLType);
|
| + GR_STATIC_ASSERT(5 == kMat33f_GrSLType);
|
| + GR_STATIC_ASSERT(6 == kMat44f_GrSLType);
|
| + GR_STATIC_ASSERT(7 == kSampler2D_GrSLType);
|
| + GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType);
|
| + GR_STATIC_ASSERT(9 == kGrSLTypeCount);
|
| +}
|
| +
|
| //////////////////////////////////////////////////////////////////////////////
|
|
|
| /**
|
|
|