Remove nullable type support from SkSL

This was only used for nullable fragment processors, which are gone.

Change-Id: I1ea805c683995367a7525b787c9113ae6d2d0ae0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347051
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2020-12-23 14:30:04 -05:00 committed by Skia Commit-Bot
parent 69a9983967
commit caca7bfff9
19 changed files with 5444 additions and 5515 deletions

View File

@ -184,14 +184,12 @@ struct ASTNode {
struct TypeData {
TypeData() {}
TypeData(StringFragment name, bool isStructDeclaration, bool isNullable)
TypeData(StringFragment name, bool isStructDeclaration)
: fName(name)
, fIsStructDeclaration(isStructDeclaration)
, fIsNullable(isNullable) {}
, fIsStructDeclaration(isStructDeclaration) {}
StringFragment fName;
bool fIsStructDeclaration;
bool fIsNullable;
};
struct ParameterData {

View File

@ -377,7 +377,7 @@ int CPPCodeGenerator::getChildFPIndex(const Variable& var) const {
p->as<GlobalVarDeclaration>().declaration()->as<VarDeclaration>();
if (&decl.var() == &var) {
return index;
} else if (decl.var().type().nonnullable() == *fContext.fFragmentProcessor_Type) {
} else if (decl.var().type() == *fContext.fFragmentProcessor_Type) {
++index;
}
}
@ -761,7 +761,7 @@ void CPPCodeGenerator::writePrivateVarValues() {
}
static bool is_accessible(const Variable& var) {
const Type& type = var.type().nonnullable();
const Type& type = var.type();
return Type::TypeKind::kSampler != type.typeKind() &&
Type::TypeKind::kOther != type.typeKind();
}
@ -1136,7 +1136,7 @@ void CPPCodeGenerator::writeSetData(std::vector<const Variable*>& uniforms) {
wroteProcessor = true;
}
if (variable.type().nonnullable() != *fContext.fFragmentProcessor_Type) {
if (variable.type() != *fContext.fFragmentProcessor_Type) {
this->writef(" auto %s = _outer.%s;\n"
" (void) %s;\n",
name, name, name);
@ -1183,7 +1183,7 @@ void CPPCodeGenerator::writeClone() {
fFullName.c_str(), fFullName.c_str(), fFullName.c_str());
for (const Variable* param : fSectionAndParameterHelper.getParameters()) {
String fieldName = HCodeGenerator::FieldName(String(param->name()).c_str());
if (param->type().nonnullable() != *fContext.fFragmentProcessor_Type) {
if (param->type() != *fContext.fFragmentProcessor_Type) {
this->writef("\n, %s(src.%s)",
fieldName.c_str(),
fieldName.c_str());
@ -1227,7 +1227,7 @@ void CPPCodeGenerator::writeDumpInfo() {
for (const Variable* param : fSectionAndParameterHelper.getParameters()) {
// dumpInfo() doesn't need to log child FPs.
if (param->type().nonnullable() == *fContext.fFragmentProcessor_Type) {
if (param->type() == *fContext.fFragmentProcessor_Type) {
continue;
}
@ -1438,7 +1438,7 @@ bool CPPCodeGenerator::generateCode() {
" (void) that;\n",
fullName, fullName, fullName);
for (const auto& param : fSectionAndParameterHelper.getParameters()) {
if (param->type().nonnullable() == *fContext.fFragmentProcessor_Type) {
if (param->type() == *fContext.fFragmentProcessor_Type) {
continue;
}
String nameString(param->name());

View File

@ -189,11 +189,6 @@ void Dehydrator::write(const Symbol& s) {
this->writeId(&t);
this->write(t.name());
break;
case Type::TypeKind::kNullable:
this->writeCommand(Rehydrator::kNullableType_Command);
this->writeId(&t);
this->write(t.componentType());
break;
case Type::TypeKind::kStruct:
this->writeCommand(Rehydrator::kStructType_Command);
this->writeId(&t);

View File

@ -50,9 +50,7 @@ Layout::CType HCodeGenerator::ParameterCType(const Context& context, const Type&
if (layout.fCType != Layout::CType::kDefault) {
return layout.fCType;
}
if (type.typeKind() == Type::TypeKind::kNullable) {
return ParameterCType(context, type.componentType(), layout);
} else if (type == *context.fFloat_Type || type == *context.fHalf_Type) {
if (type == *context.fFloat_Type || type == *context.fHalf_Type) {
return Layout::CType::kFloat;
} else if (type == *context.fInt_Type ||
type == *context.fShort_Type ||
@ -200,8 +198,8 @@ void HCodeGenerator::writeMake() {
fFullName.c_str());
separator = "";
for (const auto& param : fSectionAndParameterHelper.getParameters()) {
if (param->type().nonnullable() == *fContext.fFragmentProcessor_Type ||
param->type().nonnullable().typeKind() == Type::TypeKind::kSampler) {
if (param->type() == *fContext.fFragmentProcessor_Type ||
param->type().typeKind() == Type::TypeKind::kSampler) {
this->writef("%sstd::move(%s)", separator, String(param->name()).c_str());
} else {
this->writef("%s%s", separator, String(param->name()).c_str());
@ -249,7 +247,7 @@ void HCodeGenerator::writeConstructor() {
for (const auto& param : fSectionAndParameterHelper.getParameters()) {
String nameString(param->name());
const char* name = nameString.c_str();
const Type& type = param->type().nonnullable();
const Type& type = param->type();
if (type.typeKind() == Type::TypeKind::kSampler) {
this->writef("\n , %s(std::move(%s)", FieldName(name).c_str(), name);
for (const Section* s : fSectionAndParameterHelper.getSections(
@ -277,7 +275,7 @@ void HCodeGenerator::writeConstructor() {
const Type& paramType = param->type();
if (paramType.typeKind() == Type::TypeKind::kSampler) {
++samplerCount;
} else if (paramType.nonnullable() == *fContext.fFragmentProcessor_Type) {
} else if (paramType == *fContext.fFragmentProcessor_Type) {
SampleUsage usage = Analysis::GetSampleUsage(fProgram, *param);
std::string perspExpression;
@ -307,7 +305,7 @@ void HCodeGenerator::writeFields() {
this->writeSection(kFieldsSection);
for (const auto& param : fSectionAndParameterHelper.getParameters()) {
String name = FieldName(String(param->name()).c_str());
if (param->type().nonnullable() == *fContext.fFragmentProcessor_Type) {
if (param->type() == *fContext.fFragmentProcessor_Type) {
// Don't need to write any fields, FPs are held as children
} else {
this->writef(" %s %s;\n", FieldType(fContext, param->type(),

View File

@ -301,7 +301,7 @@ StatementArray IRGenerator::convertVarDeclarations(const ASTNode& decls,
}
if (fKind == Program::kRuntimeEffect_Kind) {
if ((modifiers.fFlags & Modifiers::kIn_Flag) &&
baseType->nonnullable() != *fContext.fFragmentProcessor_Type) {
*baseType != *fContext.fFragmentProcessor_Type) {
fErrors.error(decls.fOffset, "'in' variables not permitted in runtime effects");
}
}
@ -919,7 +919,7 @@ void IRGenerator::convertFunction(const ASTNode& f) {
// Only the (builtin) declarations of 'sample' are allowed to have FP parameters.
// (You can pass other opaque types to functions safely; this restriction is
// fragment-processor specific.)
if ((type->nonnullable() == *fContext.fFragmentProcessor_Type && !fIsBuiltinCode) ||
if ((*type == *fContext.fFragmentProcessor_Type && !fIsBuiltinCode) ||
!typeIsAllowed(type)) {
fErrors.error(param.fOffset,
"parameters of type '" + type->displayName() + "' not allowed");
@ -1243,9 +1243,8 @@ void IRGenerator::convertEnum(const ASTNode& e) {
SkASSERT(e.fKind == ASTNode::Kind::kEnum);
int64_t currentValue = 0;
Layout layout;
ASTNode enumType(
e.fNodes, e.fOffset, ASTNode::Kind::kType,
ASTNode::TypeData(e.getString(), /*isStructDeclaration=*/false, /*isNullable=*/false));
ASTNode enumType(e.fNodes, e.fOffset, ASTNode::Kind::kType,
ASTNode::TypeData(e.getString(), /*isStructDeclaration=*/false));
const Type* type = this->convertType(enumType);
Modifiers modifiers(layout, Modifiers::kConst_Flag);
std::shared_ptr<SymbolTable> oldTable = fSymbolTable;
@ -1305,17 +1304,6 @@ const Type* IRGenerator::convertType(const ASTNode& type, bool allowVoid) {
}
const Type* result = &symbol->as<Type>();
const bool isArray = (type.begin() != type.end());
if (td.fIsNullable) {
if (*result == *fContext.fFragmentProcessor_Type) {
if (isArray) {
fErrors.error(type.fOffset, "type '" + td.fName + "' may not be used in an array");
}
result = fSymbolTable->takeOwnershipOfSymbol(
Type::MakeNullableType(String(result->name()) + "?", *result));
} else {
fErrors.error(type.fOffset, "type '" + td.fName + "' may not be nullable");
}
}
if (*result == *fContext.fVoid_Type) {
if (!allowVoid) {
fErrors.error(type.fOffset, "type '" + td.fName + "' not allowed in this context");
@ -1423,7 +1411,7 @@ std::unique_ptr<Expression> IRGenerator::convertIdentifier(const ASTNode& identi
!(modifiers.fFlags & Modifiers::kUniform_Flag) &&
!modifiers.fLayout.fKey &&
modifiers.fLayout.fBuiltin == -1 &&
var->type().nonnullable() != *fContext.fFragmentProcessor_Type &&
var->type() != *fContext.fFragmentProcessor_Type &&
var->type().typeKind() != Type::TypeKind::kSampler) {
bool valid = false;
for (const auto& decl : fFile->root()) {

View File

@ -588,7 +588,7 @@ ASTNode::ID Parser::structDeclaration() {
fSymbols.add(std::move(newType));
return this->createNode(name.fOffset, ASTNode::Kind::kType,
ASTNode::TypeData(this->text(name),
/*isStructDeclaration=*/true, /*isNullable=*/false));
/*isStructDeclaration=*/true));
}
/* structDeclaration ((IDENTIFIER varDeclarationEnd) | SEMICOLON) */
@ -1166,7 +1166,7 @@ ASTNode::ID Parser::type() {
return ASTNode::ID::Invalid();
}
ASTNode::ID result = this->createNode(type.fOffset, ASTNode::Kind::kType);
ASTNode::TypeData td(this->text(type), /*isStructDeclaration=*/false, /*isNullable=*/false);
ASTNode::TypeData td(this->text(type), /*isStructDeclaration=*/false);
bool isArray = false;
while (this->checkNext(Token::Kind::TK_LBRACKET)) {
if (isArray) {
@ -1187,7 +1187,6 @@ ASTNode::ID Parser::type() {
isArray = true;
this->expect(Token::Kind::TK_RBRACKET, "']'");
}
td.fIsNullable = this->checkNext(Token::Kind::TK_QUESTION);
getNode(result).setTypeData(td);
return result;
}

View File

@ -127,7 +127,7 @@ void PipelineStageCodeGenerator::writeVariableReference(const VariableReference&
// Skip over fragmentProcessors (shaders).
// These are indexed separately from other globals.
if (var.modifiers().fFlags & flag &&
var.type().nonnullable() != *fContext.fFragmentProcessor_Type) {
var.type() != *fContext.fFragmentProcessor_Type) {
++index;
}
}

View File

@ -192,14 +192,6 @@ const Symbol* Rehydrator::symbol() {
std::make_unique<Field>(/*offset=*/-1, owner, index));
return result;
}
case kNullableType_Command: {
uint16_t id = this->readU16();
const Type* base = this->type();
const Type* result = fSymbolTable->takeOwnershipOfSymbol(
Type::MakeNullableType(base->name() + "?", *base));
this->addSymbol(id, result);
return result;
}
case kStructType_Command: {
uint16_t id = this->readU16();
StringFragment name = this->readString();

View File

@ -102,8 +102,6 @@ public:
kModifiers8Bit_Command,
// Layout layout, uint32 flags
kModifiers_Command,
// uint16 id, Type baseType
kNullableType_Command,
// uint8 op, Expression operand
kPostfix_Command,
// uint8 op, Expression operand

View File

@ -29,127 +29,127 @@ static uint8_t SKSL_INCLUDE_sksl_fp[] = {76,1,
9,107,84,111,80,114,101,109,117,108,
11,107,84,111,85,110,112,114,101,109,117,108,
16,107,80,77,67,111,110,118,101,114,115,105,111,110,67,110,116,
43,36,0,
42,36,0,
15,1,0,2,0,
15,2,0,17,0,
47,3,0,
46,3,0,
30,
5,15,0,2,30,0,
44,4,0,43,0,0,
43,4,0,43,0,0,
0,5,0,
44,6,0,50,0,1,
47,7,0,
43,6,0,50,0,1,
46,7,0,
30,
5,20,0,4,54,0,
41,5,0,0,
40,5,0,0,
0,8,0,
41,4,0,1,
47,9,0,
40,4,0,1,
46,9,0,
30,
5,15,39,0,68,0,
41,8,0,0,
47,10,0,
40,8,0,0,
46,10,0,
30,
5,15,39,0,84,0,
44,11,0,101,0,0,
47,12,0,
43,11,0,101,0,0,
46,12,0,
30,
5,15,39,0,107,0,
41,11,0,0,
47,13,0,
40,11,0,0,
46,13,0,
30,
5,15,39,0,127,0,
41,11,0,0,
47,14,0,
40,11,0,0,
46,14,0,
30,
5,27,39,0,152,0,
44,15,0,161,0,0,
47,16,0,
43,15,0,161,0,0,
46,16,0,
30,
5,28,39,0,166,0,
41,15,0,0,
47,17,0,
40,15,0,0,
46,17,0,
9,176,0,
44,18,0,179,0,3,
43,18,0,179,0,3,
23,19,0,
9,197,0,1,17,0,
41,11,0,
47,20,0,
40,11,0,
46,20,0,
9,176,0,
41,18,0,3,
47,21,0,
40,18,0,3,
46,21,0,
9,204,0,
44,22,0,214,0,3,
46,23,0,2,
41,19,0,
43,22,0,214,0,3,
45,23,0,2,
40,19,0,
23,24,0,
9,197,0,2,20,0,21,0,
41,11,0,
41,24,0,
47,25,0,
40,11,0,
40,24,0,
46,25,0,
9,176,0,
41,18,0,3,
47,26,0,
40,18,0,3,
46,26,0,
9,223,0,
44,27,0,230,0,3,
46,28,0,3,
41,19,0,
41,24,0,
43,27,0,230,0,3,
45,28,0,3,
40,19,0,
40,24,0,
23,29,0,
9,197,0,2,25,0,26,0,
41,11,0,
41,29,0,
47,30,0,
40,11,0,
40,29,0,
46,30,0,
9,176,0,
41,18,0,3,
47,31,0,
40,18,0,3,
46,31,0,
9,237,0,
41,11,0,3,
46,32,0,4,
41,19,0,
41,24,0,
41,29,0,
40,11,0,3,
45,32,0,4,
40,19,0,
40,24,0,
40,29,0,
23,33,0,
9,197,0,2,30,0,31,0,
41,11,0,
41,33,0,
47,34,0,
40,11,0,
40,33,0,
46,34,0,
9,176,0,
41,18,0,3,
47,35,0,
40,18,0,3,
46,35,0,
9,237,0,
41,11,0,3,
47,36,0,
40,11,0,3,
46,36,0,
9,204,0,
41,22,0,3,
46,37,0,5,
41,19,0,
41,24,0,
41,29,0,
41,33,0,
40,22,0,3,
45,37,0,5,
40,19,0,
40,24,0,
40,29,0,
40,33,0,
23,38,0,
9,197,0,3,34,0,35,0,36,0,
41,11,0,
41,38,0,
47,39,0,
40,11,0,
40,38,0,
46,39,0,
9,176,0,
41,18,0,3,
47,40,0,
40,18,0,3,
46,40,0,
9,237,0,
41,11,0,3,
47,41,0,
40,11,0,3,
46,41,0,
9,223,0,
41,27,0,3,
46,42,0,6,
41,19,0,
41,24,0,
41,29,0,
41,33,0,
41,38,0,
40,27,0,3,
45,42,0,6,
40,19,0,
40,24,0,
40,29,0,
40,33,0,
40,38,0,
23,43,0,
9,197,0,3,39,0,40,0,41,0,
41,11,0,
41,43,0,11,0,
40,11,0,
40,43,0,11,0,
0,0,
1,0,
7,0,
@ -163,80 +163,80 @@ static uint8_t SKSL_INCLUDE_sksl_fp[] = {76,1,
10,0,
12,
14,2,0,
43,5,0,
47,44,0,
42,5,0,
46,44,0,
30,
8,1,243,0,
41,1,0,0,
47,45,0,
40,1,0,0,
46,45,0,
30,
8,1,251,0,
41,1,0,0,
47,46,0,
40,1,0,0,
46,46,0,
30,
8,1,3,1,
41,1,0,0,
47,47,0,
40,1,0,0,
46,47,0,
30,
8,1,18,1,
41,1,0,0,
47,48,0,
40,1,0,0,
46,48,0,
30,
8,1,33,1,
41,1,0,0,5,0,
40,1,0,0,5,0,
1,0,
0,0,
3,0,
2,0,
4,0,0,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,3,0,0,0,
14,17,0,
43,3,0,
47,49,0,
42,3,0,
46,49,0,
30,
8,1,39,1,
41,2,0,0,
47,50,0,
40,2,0,0,
46,50,0,
30,
8,1,49,1,
41,2,0,0,
47,51,0,
40,2,0,0,
46,51,0,
30,
8,1,61,1,
41,2,0,0,3,0,
40,2,0,0,3,0,
2,0,
0,0,
1,0,0,0,0,0,1,0,0,0,2,0,0,0,
49,
48,3,0,
41,4,0,0,
51,
49,
48,7,0,
41,6,0,1,
51,
49,
48,9,0,
41,4,0,1,
51,
49,
48,10,0,
41,11,0,0,
51,
49,
48,12,0,
41,11,0,0,
51,
49,
48,13,0,
41,11,0,0,
51,
49,
48,14,0,
41,15,0,0,
51,
49,
48,16,0,
41,15,0,0,
51,
48,
47,3,0,
40,4,0,0,
50,
48,
47,7,0,
40,6,0,1,
50,
48,
47,9,0,
40,4,0,1,
50,
48,
47,10,0,
40,11,0,0,
50,
48,
47,12,0,
40,11,0,0,
50,
48,
47,13,0,
40,11,0,0,
50,
48,
47,14,0,
40,15,0,0,
50,
48,
47,16,0,
40,15,0,0,
50,
13,};
static constexpr size_t SKSL_INCLUDE_sksl_fp_LENGTH = sizeof(SKSL_INCLUDE_sksl_fp);

View File

@ -13,41 +13,41 @@ static uint8_t SKSL_INCLUDE_sksl_frag[] = {142,0,
8,115,107,95,87,105,100,116,104,
4,104,97,108,102,
9,115,107,95,72,101,105,103,104,116,
43,9,0,
47,1,0,
42,9,0,
46,1,0,
30,
5,15,0,2,2,0,
44,2,0,15,0,0,
47,3,0,
43,2,0,15,0,0,
46,3,0,
30,
5,17,0,2,22,0,
44,4,0,35,0,0,
43,4,0,35,0,0,
0,5,0,
44,6,0,40,0,1,
47,7,0,
43,6,0,40,0,1,
46,7,0,
30,
5,20,0,4,44,0,
41,5,0,0,
47,8,0,
40,5,0,0,
46,8,0,
30,
5,15,39,4,58,0,
44,9,0,83,0,0,
47,10,0,
43,9,0,83,0,0,
46,10,0,
30,
29,0,0,0,0,0,255,255,0,255,17,39,255,255,255,255,255,89,0,89,0,0,0,4,90,0,
41,9,0,0,
47,11,0,
40,9,0,0,
46,11,0,
30,
5,24,39,0,103,0,
41,9,0,0,
47,12,0,
40,9,0,0,
46,12,0,
30,
5,27,39,0,120,0,
44,13,0,129,0,0,
47,14,0,
43,13,0,129,0,0,
46,14,0,
30,
5,28,39,0,134,0,
41,13,0,0,8,0,
40,13,0,0,8,0,
4,0,
1,0,
5,0,
@ -57,37 +57,37 @@ static uint8_t SKSL_INCLUDE_sksl_frag[] = {142,0,
3,0,
7,0,
12,
49,
48,1,0,
41,2,0,0,
51,
49,
48,3,0,
41,4,0,0,
51,
49,
48,7,0,
41,6,0,1,
51,
49,
48,8,0,
41,9,0,0,
51,
49,
48,10,0,
41,9,0,0,
51,
49,
48,11,0,
41,9,0,0,
51,
49,
48,12,0,
41,13,0,0,
51,
49,
48,14,0,
41,13,0,0,
51,
48,
47,1,0,
40,2,0,0,
50,
48,
47,3,0,
40,4,0,0,
50,
48,
47,7,0,
40,6,0,1,
50,
48,
47,8,0,
40,9,0,0,
50,
48,
47,10,0,
40,9,0,0,
50,
48,
47,11,0,
40,9,0,0,
50,
48,
47,12,0,
40,13,0,0,
50,
48,
47,14,0,
40,13,0,0,
50,
13,};
static constexpr size_t SKSL_INCLUDE_sksl_frag_LENGTH = sizeof(SKSL_INCLUDE_sksl_frag);

View File

@ -13,54 +13,54 @@ static uint8_t SKSL_INCLUDE_sksl_geom[] = {134,0,
10,69,109,105,116,86,101,114,116,101,120,
12,69,110,100,80,114,105,109,105,116,105,118,101,
0,
43,12,0,
38,1,0,2,0,2,
42,12,0,
37,1,0,2,0,2,
30,
5,0,0,0,15,0,
44,2,0,27,0,
43,2,0,27,0,
30,
5,1,0,0,34,0,
44,3,0,47,0,
47,4,0,
43,3,0,47,0,
46,4,0,
30,
5,18,39,2,53,0,
0,5,0,
41,1,0,255,0,
38,6,0,2,0,2,
40,1,0,255,0,
37,6,0,2,0,2,
30,
5,0,0,0,15,0,
41,2,0,
40,2,0,
30,
5,1,0,0,34,0,
41,3,0,
47,7,0,
40,3,0,
46,7,0,
30,
5,23,39,4,2,0,
41,6,0,0,
40,6,0,0,
17,7,0,0,
17,7,0,1,
47,8,0,
46,8,0,
9,59,0,
44,9,0,66,0,3,
43,9,0,66,0,3,
23,10,0,
31,
8,0,16,0,0,70,0,1,8,0,
44,11,0,87,0,
47,12,0,
43,11,0,87,0,
46,12,0,
9,59,0,
41,9,0,3,
40,9,0,3,
23,13,0,
31,
8,0,16,0,0,92,0,1,12,0,
41,11,0,
40,11,0,
23,14,0,
31,
8,0,16,0,0,111,0,0,
41,11,0,
40,11,0,
23,15,0,
31,
8,0,16,0,0,122,0,0,
41,11,0,7,0,
40,11,0,7,0,
7,0,
10,0,
11,0,
@ -70,8 +70,8 @@ static uint8_t SKSL_INCLUDE_sksl_geom[] = {134,0,
1,0,
12,
27,
41,4,0,2,0,53,0,255,
40,4,0,2,0,53,0,255,
27,
41,7,0,2,0,135,0,0,
40,7,0,2,0,135,0,0,
13,};
static constexpr size_t SKSL_INCLUDE_sksl_geom_LENGTH = sizeof(SKSL_INCLUDE_sksl_geom);

File diff suppressed because it is too large Load Diff

View File

@ -21,190 +21,190 @@ static uint8_t SKSL_INCLUDE_sksl_interp[] = {160,0,
16,103,114,101,97,116,101,114,84,104,97,110,69,113,117,97,108,
5,101,113,117,97,108,
8,110,111,116,69,113,117,97,108,
43,60,0,
47,1,0,
42,60,0,
46,1,0,
9,2,0,
44,2,0,4,0,3,
47,3,0,
43,2,0,4,0,3,
46,3,0,
9,14,0,
41,2,0,3,
40,2,0,3,
23,4,0,
9,16,0,2,1,0,3,0,
41,2,0,
47,5,0,
40,2,0,
46,5,0,
9,2,0,
41,2,0,3,
47,6,0,
40,2,0,3,
46,6,0,
9,14,0,
44,7,0,20,0,3,
46,8,0,2,
41,4,0,
43,7,0,20,0,3,
45,8,0,2,
40,4,0,
23,9,0,
9,16,0,2,5,0,6,0,
41,2,0,
41,9,0,
47,10,0,
40,2,0,
40,9,0,
46,10,0,
9,2,0,
41,2,0,3,
47,11,0,
40,2,0,3,
46,11,0,
9,14,0,
41,2,0,3,
40,2,0,3,
23,12,0,
9,24,0,2,10,0,11,0,
41,2,0,
47,13,0,
40,2,0,
46,13,0,
9,2,0,
41,2,0,3,
47,14,0,
40,2,0,3,
46,14,0,
9,14,0,
41,7,0,3,
46,15,0,2,
41,12,0,
40,7,0,3,
45,15,0,2,
40,12,0,
23,16,0,
9,24,0,2,13,0,14,0,
41,2,0,
41,16,0,
47,17,0,
40,2,0,
40,16,0,
46,17,0,
9,2,0,
41,2,0,3,
47,18,0,
40,2,0,3,
46,18,0,
9,28,0,
41,2,0,3,
47,19,0,
40,2,0,3,
46,19,0,
9,35,0,
41,2,0,3,
40,2,0,3,
23,20,0,
9,42,0,3,17,0,18,0,19,0,
41,2,0,
47,21,0,
40,2,0,
46,21,0,
9,2,0,
41,2,0,3,
47,22,0,
40,2,0,3,
46,22,0,
9,28,0,
41,7,0,3,
47,23,0,
40,7,0,3,
46,23,0,
9,35,0,
41,7,0,3,
46,24,0,2,
41,20,0,
40,7,0,3,
45,24,0,2,
40,20,0,
23,25,0,
9,42,0,3,21,0,22,0,23,0,
41,2,0,
41,25,0,
47,26,0,
40,2,0,
40,25,0,
46,26,0,
9,2,0,
44,27,0,48,0,3,
47,28,0,
43,27,0,48,0,3,
46,28,0,
9,14,0,
41,27,0,3,
47,29,0,
40,27,0,3,
46,29,0,
9,57,0,
44,30,0,59,0,3,
43,30,0,59,0,3,
23,31,0,
9,69,0,3,26,0,28,0,29,0,
41,27,0,
47,32,0,
40,27,0,
46,32,0,
9,2,0,
44,33,0,73,0,3,
47,34,0,
43,33,0,73,0,3,
46,34,0,
9,14,0,
41,33,0,3,
47,35,0,
40,33,0,3,
46,35,0,
9,57,0,
41,30,0,3,
46,36,0,2,
41,31,0,
40,30,0,3,
45,36,0,2,
40,31,0,
23,37,0,
9,69,0,3,32,0,34,0,35,0,
41,33,0,
41,37,0,
47,38,0,
40,33,0,
40,37,0,
46,38,0,
9,2,0,
41,2,0,3,
47,39,0,
40,2,0,3,
46,39,0,
9,14,0,
41,2,0,3,
47,40,0,
40,2,0,3,
46,40,0,
9,57,0,
41,30,0,3,
46,41,0,3,
41,31,0,
41,37,0,
40,30,0,3,
45,41,0,3,
40,31,0,
40,37,0,
23,42,0,
9,69,0,3,38,0,39,0,40,0,
41,2,0,
41,42,0,
47,43,0,
40,2,0,
40,42,0,
46,43,0,
9,2,0,
41,30,0,3,
47,44,0,
40,30,0,3,
46,44,0,
9,14,0,
41,30,0,3,
47,45,0,
40,30,0,3,
46,45,0,
9,57,0,
41,30,0,3,
46,46,0,4,
41,31,0,
41,37,0,
41,42,0,
40,30,0,3,
45,46,0,4,
40,31,0,
40,37,0,
40,42,0,
23,47,0,
9,69,0,3,43,0,44,0,45,0,
41,30,0,
41,47,0,
47,48,0,
40,30,0,
40,47,0,
46,48,0,
9,2,0,
44,49,0,83,0,3,
47,50,0,
43,49,0,83,0,3,
46,50,0,
9,14,0,
41,49,0,3,
40,49,0,3,
23,51,0,
9,89,0,2,48,0,50,0,
44,52,0,98,0,
47,53,0,
43,52,0,98,0,
46,53,0,
9,2,0,
41,49,0,3,
47,54,0,
40,49,0,3,
46,54,0,
9,14,0,
41,49,0,3,
40,49,0,3,
23,55,0,
9,104,0,2,53,0,54,0,
41,52,0,
47,56,0,
40,52,0,
46,56,0,
9,2,0,
41,49,0,3,
47,57,0,
40,49,0,3,
46,57,0,
9,14,0,
41,49,0,3,
40,49,0,3,
23,58,0,
9,118,0,2,56,0,57,0,
41,52,0,
47,59,0,
40,52,0,
46,59,0,
9,2,0,
41,49,0,3,
47,60,0,
40,49,0,3,
46,60,0,
9,14,0,
41,49,0,3,
40,49,0,3,
23,61,0,
9,130,0,2,59,0,60,0,
41,52,0,
47,62,0,
40,52,0,
46,62,0,
9,2,0,
41,49,0,3,
47,63,0,
40,49,0,3,
46,63,0,
9,14,0,
41,49,0,3,
40,49,0,3,
23,64,0,
9,147,0,2,62,0,63,0,
41,52,0,
47,65,0,
40,52,0,
46,65,0,
9,2,0,
41,49,0,3,
47,66,0,
40,49,0,3,
46,66,0,
9,14,0,
41,49,0,3,
40,49,0,3,
23,67,0,
9,153,0,2,65,0,66,0,
41,52,0,10,0,
40,52,0,10,0,
21,0,
56,0,
50,0,

File diff suppressed because it is too large Load Diff

View File

@ -9,48 +9,48 @@ static uint8_t SKSL_INCLUDE_sksl_runtime[] = {87,0,
6,102,108,111,97,116,50,
9,116,114,97,110,115,102,111,114,109,
8,102,108,111,97,116,51,120,51,
43,11,0,
47,1,0,
42,11,0,
46,1,0,
30,
5,15,0,0,2,0,
44,2,0,15,0,0,
47,3,0,
43,2,0,15,0,0,
46,3,0,
9,22,0,
44,4,0,25,0,3,
43,4,0,25,0,3,
23,5,0,
9,43,0,1,3,0,
44,6,0,50,0,
47,7,0,
43,6,0,50,0,
46,7,0,
9,22,0,
41,4,0,3,
47,8,0,
40,4,0,3,
46,8,0,
9,56,0,
44,9,0,63,0,3,
46,10,0,2,
41,5,0,
43,9,0,63,0,3,
45,10,0,2,
40,5,0,
23,11,0,
9,43,0,2,7,0,8,0,
41,6,0,
41,11,0,
47,12,0,
40,6,0,
40,11,0,
46,12,0,
9,22,0,
41,4,0,3,
47,13,0,
40,4,0,3,
46,13,0,
9,70,0,
44,14,0,80,0,3,
46,15,0,3,
41,5,0,
41,11,0,
43,14,0,80,0,3,
45,15,0,3,
40,5,0,
40,11,0,
23,16,0,
9,43,0,2,12,0,13,0,
41,6,0,
41,16,0,2,0,
40,6,0,
40,16,0,2,0,
9,0,
0,0,
12,
49,
48,1,0,
41,2,0,0,
51,
48,
47,1,0,
40,2,0,0,
50,
13,};
static constexpr size_t SKSL_INCLUDE_sksl_runtime_LENGTH = sizeof(SKSL_INCLUDE_sksl_runtime);

View File

@ -8,42 +8,42 @@ static uint8_t SKSL_INCLUDE_sksl_vert[] = {82,0,
3,105,110,116,
13,115,107,95,73,110,115,116,97,110,99,101,73,68,
0,
43,6,0,
38,1,0,2,0,2,
42,6,0,
37,1,0,2,0,2,
30,
5,0,0,0,15,0,
44,2,0,27,0,
43,2,0,27,0,
30,
5,1,0,0,34,0,
44,3,0,47,0,
47,4,0,
43,3,0,47,0,
46,4,0,
30,
8,4,2,0,
41,1,0,0,
40,1,0,0,
17,4,0,0,
17,4,0,1,
47,5,0,
46,5,0,
30,
5,42,0,2,53,0,
44,6,0,65,0,0,
47,7,0,
43,6,0,65,0,0,
46,7,0,
30,
5,43,0,2,69,0,
41,6,0,0,4,0,
40,6,0,0,4,0,
5,0,
3,0,
2,0,
4,0,
12,
27,
41,4,0,2,0,83,0,0,
49,
48,5,0,
41,6,0,0,
51,
49,
48,7,0,
41,6,0,0,
51,
40,4,0,2,0,83,0,0,
48,
47,5,0,
40,6,0,0,
50,
48,
47,7,0,
40,6,0,0,
50,
13,};
static constexpr size_t SKSL_INCLUDE_sksl_vert_LENGTH = sizeof(SKSL_INCLUDE_sksl_vert);

View File

@ -14,16 +14,6 @@ CoercionCost Type::coercionCost(const Type& other) const {
if (*this == other) {
return CoercionCost::Free();
}
if (this->typeKind() == TypeKind::kNullable && other.typeKind() != TypeKind::kNullable) {
CoercionCost result = this->componentType().coercionCost(other);
if (result.isPossible(/*allowNarrowing=*/true)) {
++result.fNormalCost;
}
return result;
}
if (this->name() == "null" && other.typeKind() == TypeKind::kNullable) {
return CoercionCost::Free();
}
if (this->typeKind() == TypeKind::kVector && other.typeKind() == TypeKind::kVector) {
if (this->columns() == other.columns()) {
return this->componentType().coercionCost(other.componentType());

View File

@ -76,7 +76,6 @@ public:
kArray,
kEnum,
kGeneric,
kNullable,
kMatrix,
kOther,
kSampler,
@ -130,11 +129,6 @@ public:
return std::unique_ptr<Type>(new Type(name, numberKind, priority, highPrecision));
}
// Create a nullable type.
static std::unique_ptr<Type> MakeNullableType(String name, const Type& componentType) {
return std::unique_ptr<Type>(new Type(std::move(name), componentType));
}
// Create a vector type.
static std::unique_ptr<Type> MakeVectorType(const char* name, const Type& componentType,
int columns) {
@ -307,16 +301,6 @@ public:
return *fTextureType;
}
/**
* For nullable types, returns the base type, otherwise returns the type itself.
*/
const Type& nonnullable() const {
if (fTypeKind == TypeKind::kNullable) {
return this->componentType();
}
return *this;
}
/**
* For matrices and vectors, returns the number of columns (e.g. both mat3 and float3 return 3).
* For scalars, returns 1. For arrays, returns either the size of the array (if known) or -1.
@ -491,19 +475,6 @@ private:
fName = StringFragment(fNameString.c_str(), fNameString.length());
}
// Constructor for MakeNullableType.
Type(String name, const Type& componentType)
: INHERITED(-1, kSymbolKind, "")
, fNameString(std::move(name))
, fTypeKind(Type::TypeKind::kNullable)
, fNumberKind(NumberKind::kNonnumeric)
, fComponentType(&componentType)
, fColumns(1)
, fRows(1)
, fDimensions(SpvDim1D) {
fName = StringFragment(fNameString.c_str(), fNameString.length());
}
// Constructor for MakeTextureType.
Type(const char* name, SpvDim_ dimensions, bool isDepth, bool isArrayedTexture,
bool isMultisampled, bool isSampled)