From fa7ee2447e6227e7f441d32e570489130c0932bb Mon Sep 17 00:00:00 2001 From: Ethan Nicholas Date: Mon, 25 Sep 2017 09:52:04 -0400 Subject: changed vertex attribute precisions to be actual types Bug: skia: Change-Id: Ic5555d9f1be7f24655bdea9f2a3677bfb128ef70 Reviewed-on: https://skia-review.googlesource.com/50221 Reviewed-by: Chris Dalton Commit-Queue: Ethan Nicholas --- include/private/GrTypesPriv.h | 81 +++++++++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 30 deletions(-) (limited to 'include/private') diff --git a/include/private/GrTypesPriv.h b/include/private/GrTypesPriv.h index 0b4703f7a7..04a0111744 100644 --- a/include/private/GrTypesPriv.h +++ b/include/private/GrTypesPriv.h @@ -449,19 +449,24 @@ static inline bool GrSLTypeTemporarilyAcceptsPrecision(GrSLType type) { */ enum GrVertexAttribType { kFloat_GrVertexAttribType = 0, - kVec2f_GrVertexAttribType, - kVec3f_GrVertexAttribType, - kVec4f_GrVertexAttribType, + kFloat2_GrVertexAttribType, + kFloat3_GrVertexAttribType, + kFloat4_GrVertexAttribType, + kHalf_GrVertexAttribType, + kHalf2_GrVertexAttribType, + kHalf3_GrVertexAttribType, + kHalf4_GrVertexAttribType, - kVec2i_GrVertexAttribType, // vector of 2 32-bit ints - kVec3i_GrVertexAttribType, // vector of 3 32-bit ints - kVec4i_GrVertexAttribType, // vector of 4 32-bit ints + kInt2_GrVertexAttribType, // vector of 2 32-bit ints + kInt3_GrVertexAttribType, // vector of 3 32-bit ints + kInt4_GrVertexAttribType, // vector of 4 32-bit ints - kUByte_GrVertexAttribType, // unsigned byte, e.g. coverage - kVec4ub_GrVertexAttribType, // vector of 4 unsigned bytes, e.g. colors + kUByte_norm_GrVertexAttribType, // unsigned byte, e.g. coverage, 0 -> 0.0f, 255 -> 1.0f. + kUByte4_norm_GrVertexAttribType, // vector of 4 unsigned bytes, e.g. colors, 0 -> 0.0f, + // 255 -> 1.0f. - kVec2us_norm_GrVertexAttribType, // vector of 2 shorts. 0 -> 0.0f, 65535 -> 1.0f. - kVec2us_uint_GrVertexAttribType, // vector of 2 shorts. 0 -> 0, 65535 -> 65535. + kUShort2_GrVertexAttribType, // vector of 2 shorts. 0 -> 0, 65535 -> 65535. + kUShort2_norm_GrVertexAttribType, // vector of 2 shorts. 0 -> 0.0f, 65535 -> 1.0f. kInt_GrVertexAttribType, kUint_GrVertexAttribType, @@ -477,24 +482,32 @@ static inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) { switch (type) { case kFloat_GrVertexAttribType: return sizeof(float); - case kVec2f_GrVertexAttribType: + case kFloat2_GrVertexAttribType: return 2 * sizeof(float); - case kVec3f_GrVertexAttribType: + case kFloat3_GrVertexAttribType: return 3 * sizeof(float); - case kVec4f_GrVertexAttribType: + case kFloat4_GrVertexAttribType: return 4 * sizeof(float); - case kVec2i_GrVertexAttribType: + case kHalf_GrVertexAttribType: + return sizeof(float); + case kHalf2_GrVertexAttribType: + return 2 * sizeof(float); + case kHalf3_GrVertexAttribType: + return 3 * sizeof(float); + case kHalf4_GrVertexAttribType: + return 4 * sizeof(float); + case kInt2_GrVertexAttribType: return 2 * sizeof(int32_t); - case kVec3i_GrVertexAttribType: + case kInt3_GrVertexAttribType: return 3 * sizeof(int32_t); - case kVec4i_GrVertexAttribType: + case kInt4_GrVertexAttribType: return 4 * sizeof(int32_t); - case kUByte_GrVertexAttribType: + case kUByte_norm_GrVertexAttribType: return 1 * sizeof(char); - case kVec4ub_GrVertexAttribType: + case kUByte4_norm_GrVertexAttribType: return 4 * sizeof(char); - case kVec2us_norm_GrVertexAttribType: // fall through - case kVec2us_uint_GrVertexAttribType: + case kUShort2_norm_GrVertexAttribType: // fall through + case kUShort2_GrVertexAttribType: return 2 * sizeof(int16_t); case kInt_GrVertexAttribType: return sizeof(int32_t); @@ -510,25 +523,33 @@ static inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) { */ static inline GrSLType GrVertexAttribTypeToSLType(GrVertexAttribType type) { switch (type) { - case kVec2us_norm_GrVertexAttribType: // fall through + case kUShort2_norm_GrVertexAttribType: // fall through return kFloat2_GrSLType; - case kVec2us_uint_GrVertexAttribType: + case kUShort2_GrVertexAttribType: return kUint2_GrSLType; - case kUByte_GrVertexAttribType: // fall through + case kUByte_norm_GrVertexAttribType: // fall through case kFloat_GrVertexAttribType: return kFloat_GrSLType; - case kVec2f_GrVertexAttribType: + case kFloat2_GrVertexAttribType: return kFloat2_GrSLType; - case kVec3f_GrVertexAttribType: + case kFloat3_GrVertexAttribType: return kFloat3_GrSLType; - case kVec4ub_GrVertexAttribType: - case kVec4f_GrVertexAttribType: + case kFloat4_GrVertexAttribType: return kFloat4_GrSLType; - case kVec2i_GrVertexAttribType: + case kHalf_GrVertexAttribType: + return kHalf_GrSLType; + case kHalf2_GrVertexAttribType: + return kHalf2_GrSLType; + case kHalf3_GrVertexAttribType: + return kHalf3_GrSLType; + case kHalf4_GrVertexAttribType: + case kUByte4_norm_GrVertexAttribType: + return kHalf4_GrSLType; + case kInt2_GrVertexAttribType: return kInt2_GrSLType; - case kVec3i_GrVertexAttribType: + case kInt3_GrVertexAttribType: return kInt3_GrSLType; - case kVec4i_GrVertexAttribType: + case kInt4_GrVertexAttribType: return kInt4_GrSLType; case kInt_GrVertexAttribType: return kInt_GrSLType; -- cgit v1.2.3