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>
This commit is contained in:
Ethan Nicholas 2021-05-04 11:39:30 -04:00 committed by Skia Commit-Bot
parent 4b6b1dd218
commit 722c83e8ac
11 changed files with 9 additions and 95 deletions

View File

@ -113,14 +113,6 @@ BuiltinTypes::BuiltinTypes()
, 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 @@ BuiltinTypes::BuiltinTypes()
{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))

View File

@ -51,16 +51,6 @@ public:
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;

View File

@ -143,11 +143,9 @@ Compiler::Compiler(const ShaderCapsClass* caps)
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),

View File

@ -43,14 +43,6 @@ bool type_to_grsltype(const Context& context, const Type& type, GrSLType* outTyp
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; }

View File

@ -217,8 +217,7 @@ String CPPCodeGenerator::formatRuntimeValue(const Type& type,
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 @@ static const char* glsltype_string(const Context& context, const Type& type) {
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"; }

View File

@ -206,8 +206,7 @@ String DSLCPPCodeGenerator::formatRuntimeValue(const Type& type,
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()");

View File

@ -144,12 +144,6 @@ String GLSLCodeGenerator::getTypeName(const Type& type) {
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 @@ void GLSLCodeGenerator::writeIntLiteral(const IntLiteral& i) {
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 @@ const char* GLSLCodeGenerator::getTypePrecision(const Type& type) {
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 ";

View File

@ -53,18 +53,15 @@ Layout::CType HCodeGenerator::ParameterCType(const Context& context, const Type&
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;

View File

@ -143,10 +143,6 @@ String MetalCodeGenerator::typeName(const Type& type) {
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 @@ void MetalCodeGenerator::writeIntLiteral(const IntLiteral& i) {
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()));
}

View File

@ -483,12 +483,10 @@ const Type& SPIRVCodeGenerator::getActualType(const Type& type) {
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());
}
}

View File

@ -148,18 +148,6 @@ const Type& Type::toCompound(const Context& context, int columns, int rows) cons
}
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 @@ const Type& Type::toCompound(const Context& context, int columns, int rows) cons
}
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: