Switched highp float to highfloat and mediump float to half.
The ultimate goal is to end up with "float" and "half", but this
intermediate step uses "highfloat" so that it is clear if I missed a
"float" somewhere. Once this lands, a subsequent CL will switch all
"highfloats" back to "floats".
Bug: skia:
Change-Id: Ia13225c7a0a0a2901e07665891c473d2500ddcca
Reviewed-on: https://skia-review.googlesource.com/31000
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/include/private/GrTypesPriv.h b/include/private/GrTypesPriv.h
index d2df9b2..b83a733 100644
--- a/include/private/GrTypesPriv.h
+++ b/include/private/GrTypesPriv.h
@@ -78,18 +78,27 @@
enum GrSLType {
kVoid_GrSLType,
kBool_GrSLType,
- kInt_GrSLType,
kUint_GrSLType,
- kFloat_GrSLType,
- kVec2f_GrSLType,
- kVec3f_GrSLType,
- kVec4f_GrSLType,
- kVec2i_GrSLType,
- kVec3i_GrSLType,
- kVec4i_GrSLType,
- kMat22f_GrSLType,
- kMat33f_GrSLType,
- kMat44f_GrSLType,
+ kShort_GrSLType,
+ kUShort_GrSLType,
+ kHighFloat_GrSLType,
+ kHighFloat2_GrSLType,
+ kHighFloat3_GrSLType,
+ kHighFloat4_GrSLType,
+ kHighFloat2x2_GrSLType,
+ kHighFloat3x3_GrSLType,
+ kHighFloat4x4_GrSLType,
+ kHalf_GrSLType,
+ kHalf2_GrSLType,
+ kHalf3_GrSLType,
+ kHalf4_GrSLType,
+ kHalf2x2_GrSLType,
+ kHalf3x3_GrSLType,
+ kHalf4x4_GrSLType,
+ kInt_GrSLType,
+ kInt2_GrSLType,
+ kInt3_GrSLType,
+ kInt4_GrSLType,
kTexture2DSampler_GrSLType,
kITexture2DSampler_GrSLType,
kTextureExternalSampler_GrSLType,
@@ -143,13 +152,20 @@
/** Is the shading language type float (including vectors/matrices)? */
static inline bool GrSLTypeIsFloatType(GrSLType type) {
switch (type) {
- case kFloat_GrSLType:
- case kVec2f_GrSLType:
- case kVec3f_GrSLType:
- case kVec4f_GrSLType:
- case kMat22f_GrSLType:
- case kMat33f_GrSLType:
- case kMat44f_GrSLType:
+ case kHighFloat_GrSLType:
+ case kHighFloat2_GrSLType:
+ case kHighFloat3_GrSLType:
+ case kHighFloat4_GrSLType:
+ case kHighFloat2x2_GrSLType:
+ case kHighFloat3x3_GrSLType:
+ case kHighFloat4x4_GrSLType:
+ case kHalf_GrSLType:
+ case kHalf2_GrSLType:
+ case kHalf3_GrSLType:
+ case kHalf4_GrSLType:
+ case kHalf2x2_GrSLType:
+ case kHalf3x3_GrSLType:
+ case kHalf4x4_GrSLType:
return true;
case kVoid_GrSLType:
@@ -159,11 +175,13 @@
case kTexture2DRectSampler_GrSLType:
case kBufferSampler_GrSLType:
case kBool_GrSLType:
- case kInt_GrSLType:
case kUint_GrSLType:
- case kVec2i_GrSLType:
- case kVec3i_GrSLType:
- case kVec4i_GrSLType:
+ case kShort_GrSLType:
+ case kUShort_GrSLType:
+ case kInt_GrSLType:
+ case kInt2_GrSLType:
+ case kInt3_GrSLType:
+ case kInt4_GrSLType:
case kTexture2D_GrSLType:
case kSampler_GrSLType:
case kImageStorage2D_GrSLType:
@@ -183,20 +201,29 @@
return true;
case kVoid_GrSLType:
- case kFloat_GrSLType:
- case kVec2f_GrSLType:
- case kVec3f_GrSLType:
- case kVec4f_GrSLType:
- case kVec2i_GrSLType:
- case kVec3i_GrSLType:
- case kVec4i_GrSLType:
- case kMat22f_GrSLType:
- case kMat33f_GrSLType:
- case kMat44f_GrSLType:
- case kBufferSampler_GrSLType:
+ case kHighFloat_GrSLType:
+ case kHighFloat2_GrSLType:
+ case kHighFloat3_GrSLType:
+ case kHighFloat4_GrSLType:
+ case kHighFloat2x2_GrSLType:
+ case kHighFloat3x3_GrSLType:
+ case kHighFloat4x4_GrSLType:
+ case kHalf_GrSLType:
+ case kHalf2_GrSLType:
+ case kHalf3_GrSLType:
+ case kHalf4_GrSLType:
+ case kHalf2x2_GrSLType:
+ case kHalf3x3_GrSLType:
+ case kHalf4x4_GrSLType:
case kInt_GrSLType:
+ case kInt2_GrSLType:
+ case kInt3_GrSLType:
+ case kInt4_GrSLType:
+ case kBufferSampler_GrSLType:
case kUint_GrSLType:
case kBool_GrSLType:
+ case kShort_GrSLType:
+ case kUShort_GrSLType:
case kTexture2D_GrSLType:
case kSampler_GrSLType:
case kImageStorage2D_GrSLType:
@@ -217,19 +244,28 @@
return true;
case kVoid_GrSLType:
- case kFloat_GrSLType:
- case kVec2f_GrSLType:
- case kVec3f_GrSLType:
- case kVec4f_GrSLType:
- case kVec2i_GrSLType:
- case kVec3i_GrSLType:
- case kVec4i_GrSLType:
- case kMat22f_GrSLType:
- case kMat33f_GrSLType:
- case kMat44f_GrSLType:
+ case kHighFloat_GrSLType:
+ case kHighFloat2_GrSLType:
+ case kHighFloat3_GrSLType:
+ case kHighFloat4_GrSLType:
+ case kHighFloat2x2_GrSLType:
+ case kHighFloat3x3_GrSLType:
+ case kHighFloat4x4_GrSLType:
+ case kHalf_GrSLType:
+ case kHalf2_GrSLType:
+ case kHalf3_GrSLType:
+ case kHalf4_GrSLType:
+ case kHalf2x2_GrSLType:
+ case kHalf3x3_GrSLType:
+ case kHalf4x4_GrSLType:
case kInt_GrSLType:
+ case kInt2_GrSLType:
+ case kInt3_GrSLType:
+ case kInt4_GrSLType:
case kUint_GrSLType:
case kBool_GrSLType:
+ case kShort_GrSLType:
+ case kUShort_GrSLType:
case kTexture2D_GrSLType:
case kSampler_GrSLType:
case kImageStorage2D_GrSLType:
@@ -247,19 +283,28 @@
return true;
case kVoid_GrSLType:
- case kFloat_GrSLType:
- case kVec2f_GrSLType:
- case kVec3f_GrSLType:
- case kVec4f_GrSLType:
- case kVec2i_GrSLType:
- case kVec3i_GrSLType:
- case kVec4i_GrSLType:
- case kMat22f_GrSLType:
- case kMat33f_GrSLType:
- case kMat44f_GrSLType:
+ case kHighFloat_GrSLType:
+ case kHighFloat2_GrSLType:
+ case kHighFloat3_GrSLType:
+ case kHighFloat4_GrSLType:
+ case kHighFloat2x2_GrSLType:
+ case kHighFloat3x3_GrSLType:
+ case kHighFloat4x4_GrSLType:
+ case kHalf_GrSLType:
+ case kHalf2_GrSLType:
+ case kHalf3_GrSLType:
+ case kHalf4_GrSLType:
+ case kHalf2x2_GrSLType:
+ case kHalf3x3_GrSLType:
+ case kHalf4x4_GrSLType:
+ case kInt2_GrSLType:
+ case kInt3_GrSLType:
+ case kInt4_GrSLType:
case kInt_GrSLType:
case kUint_GrSLType:
case kBool_GrSLType:
+ case kShort_GrSLType:
+ case kUShort_GrSLType:
case kTexture2D_GrSLType:
case kSampler_GrSLType:
case kTexture2DSampler_GrSLType:
@@ -275,18 +320,71 @@
static inline bool GrSLTypeAcceptsPrecision(GrSLType type) {
switch (type) {
- case kInt_GrSLType:
+ case kTexture2DSampler_GrSLType:
+ case kITexture2DSampler_GrSLType:
+ case kTextureExternalSampler_GrSLType:
+ case kTexture2DRectSampler_GrSLType:
+ case kBufferSampler_GrSLType:
+ case kTexture2D_GrSLType:
+ case kSampler_GrSLType:
+ case kImageStorage2D_GrSLType:
+ case kIImageStorage2D_GrSLType:
+ return true;
+
+ case kVoid_GrSLType:
+ case kBool_GrSLType:
case kUint_GrSLType:
- case kFloat_GrSLType:
- case kVec2f_GrSLType:
- case kVec3f_GrSLType:
- case kVec4f_GrSLType:
- case kVec2i_GrSLType:
- case kVec3i_GrSLType:
- case kVec4i_GrSLType:
- case kMat22f_GrSLType:
- case kMat33f_GrSLType:
- case kMat44f_GrSLType:
+ case kShort_GrSLType:
+ case kUShort_GrSLType:
+ case kHighFloat_GrSLType:
+ case kHighFloat2_GrSLType:
+ case kHighFloat3_GrSLType:
+ case kHighFloat4_GrSLType:
+ case kHighFloat2x2_GrSLType:
+ case kHighFloat3x3_GrSLType:
+ case kHighFloat4x4_GrSLType:
+ case kHalf_GrSLType:
+ case kHalf2_GrSLType:
+ case kHalf3_GrSLType:
+ case kHalf4_GrSLType:
+ case kHalf2x2_GrSLType:
+ case kHalf3x3_GrSLType:
+ case kHalf4x4_GrSLType:
+ case kInt_GrSLType:
+ case kInt2_GrSLType:
+ case kInt3_GrSLType:
+ case kInt4_GrSLType:
+ return false;
+ }
+ SkFAIL("Unexpected type");
+ return false;
+}
+
+// temporarily accepting (but ignoring) precision modifiers on the new types; this will be killed
+// in a future CL
+static inline bool GrSLTypeTemporarilyAcceptsPrecision(GrSLType type) {
+ switch (type) {
+ case kUint_GrSLType:
+ case kShort_GrSLType:
+ case kUShort_GrSLType:
+ case kHighFloat_GrSLType:
+ case kHighFloat2_GrSLType:
+ case kHighFloat3_GrSLType:
+ case kHighFloat4_GrSLType:
+ case kHighFloat2x2_GrSLType:
+ case kHighFloat3x3_GrSLType:
+ case kHighFloat4x4_GrSLType:
+ case kHalf_GrSLType:
+ case kHalf2_GrSLType:
+ case kHalf3_GrSLType:
+ case kHalf4_GrSLType:
+ case kHalf2x2_GrSLType:
+ case kHalf3x3_GrSLType:
+ case kHalf4x4_GrSLType:
+ case kInt_GrSLType:
+ case kInt2_GrSLType:
+ case kInt3_GrSLType:
+ case kInt4_GrSLType:
case kTexture2DSampler_GrSLType:
case kITexture2DSampler_GrSLType:
case kTextureExternalSampler_GrSLType:
@@ -408,21 +506,21 @@
switch (type) {
case kUByte_GrVertexAttribType:
case kFloat_GrVertexAttribType:
- return kFloat_GrSLType;
+ return kHighFloat_GrSLType;
case kVec2us_GrVertexAttribType:
case kVec2f_GrVertexAttribType:
- return kVec2f_GrSLType;
+ return kHighFloat2_GrSLType;
case kVec3f_GrVertexAttribType:
- return kVec3f_GrSLType;
+ return kHighFloat3_GrSLType;
case kVec4ub_GrVertexAttribType:
case kVec4f_GrVertexAttribType:
- return kVec4f_GrSLType;
+ return kHighFloat4_GrSLType;
case kVec2i_GrVertexAttribType:
- return kVec2i_GrSLType;
+ return kInt2_GrSLType;
case kVec3i_GrVertexAttribType:
- return kVec3i_GrSLType;
+ return kInt3_GrSLType;
case kVec4i_GrVertexAttribType:
- return kVec4i_GrSLType;
+ return kInt4_GrSLType;
case kInt_GrVertexAttribType:
return kInt_GrSLType;
case kUint_GrVertexAttribType: