Replace VariableDecoration::(Is|As)Location with Castable

Change-Id: I3096045fc093f3782401ce8623a18e0bca49b22c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34309
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2020-11-30 23:30:58 +00:00
parent 0482b54782
commit 2c1d7d5be7
18 changed files with 39 additions and 66 deletions

View File

@@ -200,18 +200,16 @@ void VertexPullingTransform::ConvertVertexInputVariablesToPrivate() {
}
for (auto* d : v->AsDecorated()->decorations()) {
if (!d->IsLocation()) {
continue;
if (auto* l = d->As<ast::LocationDecoration>()) {
uint32_t location = l->value();
// This is where the replacement happens. Expressions use identifier
// strings instead of pointers, so we don't need to update any other
// place in the AST.
v = create<ast::Variable>(v->name(), ast::StorageClass::kPrivate,
v->type());
location_to_var_[location] = v;
break;
}
uint32_t location = d->AsLocation()->value();
// This is where the replacement happens. Expressions use identifier
// strings instead of pointers, so we don't need to update any other place
// in the AST.
v = create<ast::Variable>(v->name(), ast::StorageClass::kPrivate,
v->type());
location_to_var_[location] = v;
break;
}
}
}