aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/private
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-09-25 09:52:04 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-27 14:04:17 +0000
commitfa7ee2447e6227e7f441d32e570489130c0932bb (patch)
tree16bba14539e43cf1b729a2d5a575f34c9c1d1dfc /include/private
parenta78f1bc1d4055b82c8d31861f80cafdcc17f3d1f (diff)
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 <csmartdalton@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'include/private')
-rw-r--r--include/private/GrTypesPriv.h81
1 files changed, 51 insertions, 30 deletions
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;