diff options
author | jvanverth <jvanverth@google.com> | 2015-02-17 08:39:56 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-17 08:39:56 -0800 |
commit | 059034d252007d0dd86fff5ffdbb53cbcb10d34b (patch) | |
tree | d34e49d607bd8dfb2a5ed6a44c694ba8cc0b410b /include/gpu | |
parent | 523cda39435256bcb3e5665f47612d661d3c6bf9 (diff) |
Use uint16s for texture coordinates when rendering text.
Allows us to push more vertices into a given vertex buffer, with
a slight performance improvement.
Review URL: https://codereview.chromium.org/917373002
Diffstat (limited to 'include/gpu')
-rw-r--r-- | include/gpu/GrTypesPriv.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h index 1f86197295..412de897c6 100644 --- a/include/gpu/GrTypesPriv.h +++ b/include/gpu/GrTypesPriv.h @@ -116,9 +116,11 @@ enum GrVertexAttribType { kVec4f_GrVertexAttribType, kUByte_GrVertexAttribType, // unsigned byte, e.g. coverage - kVec4ub_GrVertexAttribType, // vector of 4 unsigned bytes, e.g. colors + kVec4ub_GrVertexAttribType, // vector of 4 unsigned bytes, e.g. colors - kLast_GrVertexAttribType = kVec4ub_GrVertexAttribType + kVec2s_GrVertexAttribType, // vector of 2 shorts, e.g. texture coordinates + + kLast_GrVertexAttribType = kVec2s_GrVertexAttribType }; static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1; @@ -127,7 +129,7 @@ static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1; */ static inline int GrVertexAttribTypeVectorCount(GrVertexAttribType type) { SkASSERT(type >= 0 && type < kGrVertexAttribTypeCount); - static const int kCounts[] = { 1, 2, 3, 4, 1, 4 }; + static const int kCounts[] = { 1, 2, 3, 4, 1, 4, 2 }; return kCounts[type]; GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType); @@ -136,6 +138,7 @@ static inline int GrVertexAttribTypeVectorCount(GrVertexAttribType type) { 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(SK_ARRAY_COUNT(kCounts) == kGrVertexAttribTypeCount); } @@ -150,7 +153,8 @@ static inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) { 3*sizeof(float), // kVec3f_GrVertexAttribType 4*sizeof(float), // kVec4f_GrVertexAttribType 1*sizeof(char), // kUByte_GrVertexAttribType - 4*sizeof(char) // kVec4ub_GrVertexAttribType + 4*sizeof(char), // kVec4ub_GrVertexAttribType + 2*sizeof(int16_t) // kVec2s_GrVertexAttribType }; return kSizes[type]; @@ -160,6 +164,7 @@ static inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) { 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(SK_ARRAY_COUNT(kSizes) == kGrVertexAttribTypeCount); } @@ -173,6 +178,7 @@ static inline GrSLType GrVertexAttribTypeToSLType(GrVertexAttribType type) { case kUByte_GrVertexAttribType: case kFloat_GrVertexAttribType: return kFloat_GrSLType; + case kVec2s_GrVertexAttribType: case kVec2f_GrVertexAttribType: return kVec2f_GrSLType; case kVec3f_GrVertexAttribType: |