Removed byte/ubyte types from SkSL
These types had no tests, have never been used, and GLSL doesn't support
byte types.
Change-Id: Id423e3e4790be7f443acc88bce5497470c7d3fd4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404219
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
diff --git a/src/sksl/SkSLBuiltinTypes.cpp b/src/sksl/SkSLBuiltinTypes.cpp
index e179b62..b434d5b 100644
--- a/src/sksl/SkSLBuiltinTypes.cpp
+++ b/src/sksl/SkSLBuiltinTypes.cpp
@@ -113,14 +113,6 @@
, fUShort2(MakeVectorType("ushort2", "S2", *fUShort, /*columns=*/2))
, fUShort3(MakeVectorType("ushort3", "S3", *fUShort, /*columns=*/3))
, fUShort4(MakeVectorType("ushort4", "S4", *fUShort, /*columns=*/4))
- , fByte(MakeScalarType("byte", "c", Type::NumberKind::kSigned, /*priority=*/2))
- , fByte2(MakeVectorType("byte2", "c2", *fByte, /*columns=*/2))
- , fByte3(MakeVectorType("byte3", "c3", *fByte, /*columns=*/3))
- , fByte4(MakeVectorType("byte4", "c4", *fByte, /*columns=*/4))
- , fUByte(MakeScalarType("ubyte", "C", Type::NumberKind::kUnsigned, /*priority=*/1))
- , fUByte2(MakeVectorType("ubyte2", "C2", *fUByte, /*columns=*/2))
- , fUByte3(MakeVectorType("ubyte3", "C3", *fUByte, /*columns=*/3))
- , fUByte4(MakeVectorType("ubyte4", "C4", *fUByte, /*columns=*/4))
, fBool(MakeScalarType("bool", "b", Type::NumberKind::kBoolean, /*priority=*/0))
, fBool2(MakeVectorType("bool2", "b2", *fBool, /*columns=*/2))
, fBool3(MakeVectorType("bool3", "b3", *fBool, /*columns=*/3))
@@ -245,10 +237,6 @@
{fInvalid.get(), fShort2.get(), fShort3.get(), fShort4.get()}))
, fUSVec(MakeGenericType("$usvec",
{fInvalid.get(), fUShort2.get(), fUShort3.get(), fUShort4.get()}))
- , fByteVec(MakeGenericType("$bytevec",
- {fInvalid.get(), fByte2.get(), fByte3.get(), fByte4.get()}))
- , fUByteVec(MakeGenericType("$ubytevec",
- {fInvalid.get(), fUByte2.get(), fUByte3.get(), fUByte4.get()}))
, fBVec(MakeGenericType("$bvec",
{fInvalid.get(), fBool2.get(), fBool3.get(), fBool4.get()}))
, fSkCaps(MakeSpecialType("$sk_Caps", "O", Type::TypeKind::kOther))
diff --git a/src/sksl/SkSLBuiltinTypes.h b/src/sksl/SkSLBuiltinTypes.h
index 45bac12..f6d6f43 100644
--- a/src/sksl/SkSLBuiltinTypes.h
+++ b/src/sksl/SkSLBuiltinTypes.h
@@ -51,16 +51,6 @@
const std::unique_ptr<Type> fUShort3;
const std::unique_ptr<Type> fUShort4;
- const std::unique_ptr<Type> fByte;
- const std::unique_ptr<Type> fByte2;
- const std::unique_ptr<Type> fByte3;
- const std::unique_ptr<Type> fByte4;
-
- const std::unique_ptr<Type> fUByte;
- const std::unique_ptr<Type> fUByte2;
- const std::unique_ptr<Type> fUByte3;
- const std::unique_ptr<Type> fUByte4;
-
const std::unique_ptr<Type> fBool;
const std::unique_ptr<Type> fBool2;
const std::unique_ptr<Type> fBool3;
diff --git a/src/sksl/SkSLCompiler.cpp b/src/sksl/SkSLCompiler.cpp
index a61b416..8915821 100644
--- a/src/sksl/SkSLCompiler.cpp
+++ b/src/sksl/SkSLCompiler.cpp
@@ -143,11 +143,9 @@
TYPE( UInt), TYPE( UInt2), TYPE( UInt3), TYPE( UInt4),
TYPE( Short), TYPE( Short2), TYPE( Short3), TYPE( Short4),
TYPE(UShort), TYPE(UShort2), TYPE(UShort3), TYPE(UShort4),
- TYPE( Byte), TYPE( Byte2), TYPE( Byte3), TYPE( Byte4),
- TYPE( UByte), TYPE( UByte2), TYPE( UByte3), TYPE( UByte4),
TYPE(GenUType), TYPE(UVec),
- TYPE(SVec), TYPE(USVec), TYPE(ByteVec), TYPE(UByteVec),
+ TYPE(SVec), TYPE(USVec),
TYPE(Float2x3), TYPE(Float2x4),
TYPE(Float3x2), TYPE(Float3x4),
diff --git a/src/sksl/SkSLUtil.cpp b/src/sksl/SkSLUtil.cpp
index 1006129..099487f 100644
--- a/src/sksl/SkSLUtil.cpp
+++ b/src/sksl/SkSLUtil.cpp
@@ -43,14 +43,6 @@
if (type == *context.fTypes.fBool2 ) { *outType = kBool2_GrSLType; return true; }
if (type == *context.fTypes.fBool3 ) { *outType = kBool3_GrSLType; return true; }
if (type == *context.fTypes.fBool4 ) { *outType = kBool4_GrSLType; return true; }
- if (type == *context.fTypes.fByte ) { *outType = kByte_GrSLType; return true; }
- if (type == *context.fTypes.fByte2 ) { *outType = kByte2_GrSLType; return true; }
- if (type == *context.fTypes.fByte3 ) { *outType = kByte3_GrSLType; return true; }
- if (type == *context.fTypes.fByte4 ) { *outType = kByte4_GrSLType; return true; }
- if (type == *context.fTypes.fUByte ) { *outType = kUByte_GrSLType; return true; }
- if (type == *context.fTypes.fUByte2 ) { *outType = kUByte2_GrSLType; return true; }
- if (type == *context.fTypes.fUByte3 ) { *outType = kUByte3_GrSLType; return true; }
- if (type == *context.fTypes.fUByte4 ) { *outType = kUByte4_GrSLType; return true; }
if (type == *context.fTypes.fShort ) { *outType = kShort_GrSLType; return true; }
if (type == *context.fTypes.fShort2 ) { *outType = kShort2_GrSLType; return true; }
if (type == *context.fTypes.fShort3 ) { *outType = kShort3_GrSLType; return true; }
diff --git a/src/sksl/codegen/SkSLCPPCodeGenerator.cpp b/src/sksl/codegen/SkSLCPPCodeGenerator.cpp
index 832466b..792d02a 100644
--- a/src/sksl/codegen/SkSLCPPCodeGenerator.cpp
+++ b/src/sksl/codegen/SkSLCPPCodeGenerator.cpp
@@ -217,8 +217,7 @@
return "%d";
}
if (type == *fContext.fTypes.fInt4 ||
- type == *fContext.fTypes.fShort4 ||
- type == *fContext.fTypes.fByte4) {
+ type == *fContext.fTypes.fShort4) {
formatArgs->push_back(cppCode + ".left()");
formatArgs->push_back(cppCode + ".top()");
formatArgs->push_back(cppCode + ".right()");
@@ -454,14 +453,6 @@
if (type == *context.fTypes.fBool2 ) { return "kBool2_GrSLType"; }
if (type == *context.fTypes.fBool3 ) { return "kBool3_GrSLType"; }
if (type == *context.fTypes.fBool4 ) { return "kBool4_GrSLType"; }
- if (type == *context.fTypes.fByte ) { return "kByte_GrSLType"; }
- if (type == *context.fTypes.fByte2 ) { return "kByte2_GrSLType"; }
- if (type == *context.fTypes.fByte3 ) { return "kByte3_GrSLType"; }
- if (type == *context.fTypes.fByte4 ) { return "kByte4_GrSLType"; }
- if (type == *context.fTypes.fUByte ) { return "kUByte_GrSLType"; }
- if (type == *context.fTypes.fUByte2 ) { return "kUByte2_GrSLType"; }
- if (type == *context.fTypes.fUByte3 ) { return "kUByte3_GrSLType"; }
- if (type == *context.fTypes.fUByte4 ) { return "kUByte4_GrSLType"; }
if (type == *context.fTypes.fShort ) { return "kShort_GrSLType"; }
if (type == *context.fTypes.fShort2 ) { return "kShort2_GrSLType"; }
if (type == *context.fTypes.fShort3 ) { return "kShort3_GrSLType"; }
diff --git a/src/sksl/codegen/SkSLDSLCPPCodeGenerator.cpp b/src/sksl/codegen/SkSLDSLCPPCodeGenerator.cpp
index f94734c..1208a31 100644
--- a/src/sksl/codegen/SkSLDSLCPPCodeGenerator.cpp
+++ b/src/sksl/codegen/SkSLDSLCPPCodeGenerator.cpp
@@ -206,8 +206,7 @@
return "%d";
}
if (type == *fContext.fTypes.fInt4 ||
- type == *fContext.fTypes.fShort4 ||
- type == *fContext.fTypes.fByte4) {
+ type == *fContext.fTypes.fShort4) {
formatArgs->push_back(cppCode + ".left()");
formatArgs->push_back(cppCode + ".top()");
formatArgs->push_back(cppCode + ".right()");
diff --git a/src/sksl/codegen/SkSLGLSLCodeGenerator.cpp b/src/sksl/codegen/SkSLGLSLCodeGenerator.cpp
index ae5e909..7ee0d44 100644
--- a/src/sksl/codegen/SkSLGLSLCodeGenerator.cpp
+++ b/src/sksl/codegen/SkSLGLSLCodeGenerator.cpp
@@ -144,12 +144,6 @@
else if (type == *fContext.fTypes.fUShort) {
return "uint";
}
- else if (type == *fContext.fTypes.fByte) {
- return "int";
- }
- else if (type == *fContext.fTypes.fUByte) {
- return "uint";
- }
else {
return type.name();
}
@@ -986,8 +980,6 @@
this->write(to_string(i.value() & 0xffffffff) + "u");
} else if (type == *fContext.fTypes.fUShort) {
this->write(to_string(i.value() & 0xffff) + "u");
- } else if (type == *fContext.fTypes.fUByte) {
- this->write(to_string(i.value() & 0xff) + "u");
} else {
this->write(to_string(i.value()));
}
@@ -1148,8 +1140,7 @@
if (usesPrecisionModifiers()) {
switch (type.typeKind()) {
case Type::TypeKind::kScalar:
- if (type == *fContext.fTypes.fShort || type == *fContext.fTypes.fUShort ||
- type == *fContext.fTypes.fByte || type == *fContext.fTypes.fUByte) {
+ if (type == *fContext.fTypes.fShort || type == *fContext.fTypes.fUShort) {
if (fProgram.fConfig->fSettings.fForceHighPrecision ||
this->caps().incompleteShortIntPrecision()) {
return "highp ";
diff --git a/src/sksl/codegen/SkSLHCodeGenerator.cpp b/src/sksl/codegen/SkSLHCodeGenerator.cpp
index c236c70..e9d8499 100644
--- a/src/sksl/codegen/SkSLHCodeGenerator.cpp
+++ b/src/sksl/codegen/SkSLHCodeGenerator.cpp
@@ -53,18 +53,15 @@
if (type == *context.fTypes.fFloat || type == *context.fTypes.fHalf) {
return Layout::CType::kFloat;
} else if (type == *context.fTypes.fInt ||
- type == *context.fTypes.fShort ||
- type == *context.fTypes.fByte) {
+ type == *context.fTypes.fShort) {
return Layout::CType::kInt32;
} else if (type == *context.fTypes.fFloat2 || type == *context.fTypes.fHalf2) {
return Layout::CType::kSkPoint;
} else if (type == *context.fTypes.fInt2 ||
- type == *context.fTypes.fShort2 ||
- type == *context.fTypes.fByte2) {
+ type == *context.fTypes.fShort2) {
return Layout::CType::kSkIPoint;
} else if (type == *context.fTypes.fInt4 ||
- type == *context.fTypes.fShort4 ||
- type == *context.fTypes.fByte4) {
+ type == *context.fTypes.fShort4) {
return Layout::CType::kSkIRect;
} else if (type == *context.fTypes.fFloat4 || type == *context.fTypes.fHalf4) {
return Layout::CType::kSkRect;
diff --git a/src/sksl/codegen/SkSLMetalCodeGenerator.cpp b/src/sksl/codegen/SkSLMetalCodeGenerator.cpp
index 31e55d3..fe85ce7 100644
--- a/src/sksl/codegen/SkSLMetalCodeGenerator.cpp
+++ b/src/sksl/codegen/SkSLMetalCodeGenerator.cpp
@@ -143,10 +143,6 @@
if (type == *fContext.fTypes.fHalf) {
// FIXME - Currently only supporting floats in MSL to avoid type coercion issues.
return fContext.fTypes.fFloat->name();
- } else if (type == *fContext.fTypes.fByte) {
- return "char";
- } else if (type == *fContext.fTypes.fUByte) {
- return "uchar";
} else {
return type.name();
}
@@ -1482,8 +1478,6 @@
this->write(to_string(i.value() & 0xffffffff) + "u");
} else if (type == *fContext.fTypes.fUShort) {
this->write(to_string(i.value() & 0xffff) + "u");
- } else if (type == *fContext.fTypes.fUByte) {
- this->write(to_string(i.value() & 0xff) + "u");
} else {
this->write(to_string(i.value()));
}
diff --git a/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp b/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp
index 8ff7279..6a32768 100644
--- a/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp
+++ b/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp
@@ -483,12 +483,10 @@
if (type.componentType() == *fContext.fTypes.fHalf) {
return fContext.fTypes.fFloat->toCompound(fContext, type.columns(), type.rows());
}
- if (type.componentType() == *fContext.fTypes.fShort ||
- type.componentType() == *fContext.fTypes.fByte) {
+ if (type.componentType() == *fContext.fTypes.fShort) {
return fContext.fTypes.fInt->toCompound(fContext, type.columns(), type.rows());
}
- if (type.componentType() == *fContext.fTypes.fUShort ||
- type.componentType() == *fContext.fTypes.fUByte) {
+ if (type.componentType() == *fContext.fTypes.fUShort) {
return fContext.fTypes.fUInt->toCompound(fContext, type.columns(), type.rows());
}
}
diff --git a/src/sksl/ir/SkSLType.cpp b/src/sksl/ir/SkSLType.cpp
index a94c68c..f0d3896 100644
--- a/src/sksl/ir/SkSLType.cpp
+++ b/src/sksl/ir/SkSLType.cpp
@@ -148,18 +148,6 @@
}
default: SK_ABORT("unsupported row count (%d)", rows);
}
- } else if (*this == *context.fTypes.fByte) {
- switch (rows) {
- case 1:
- switch (columns) {
- case 1: return *context.fTypes.fByte;
- case 2: return *context.fTypes.fByte2;
- case 3: return *context.fTypes.fByte3;
- case 4: return *context.fTypes.fByte4;
- default: SK_ABORT("unsupported vector column count (%d)", columns);
- }
- default: SK_ABORT("unsupported row count (%d)", rows);
- }
} else if (*this == *context.fTypes.fUInt) {
switch (rows) {
case 1:
@@ -184,18 +172,6 @@
}
default: SK_ABORT("unsupported row count (%d)", rows);
}
- } else if (*this == *context.fTypes.fUByte) {
- switch (rows) {
- case 1:
- switch (columns) {
- case 1: return *context.fTypes.fUByte;
- case 2: return *context.fTypes.fUByte2;
- case 3: return *context.fTypes.fUByte3;
- case 4: return *context.fTypes.fUByte4;
- default: SK_ABORT("unsupported vector column count (%d)", columns);
- }
- default: SK_ABORT("unsupported row count (%d)", rows);
- }
} else if (*this == *context.fTypes.fBool) {
switch (rows) {
case 1: