mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 08:27:05 +00:00
Post migration to castable cleanup
Change-Id: I5c47b1736bd850548cb1c9c7a6f69242d8626173 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34460 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
782f6a5e3e
commit
1b6a8ce165
@@ -213,20 +213,20 @@ bool BoundArrayAccessorsTransform::ProcessAccessExpression(
|
||||
// Scalar constructor we can re-write the value to be within bounds.
|
||||
if (auto* c = expr->idx_expr()->As<ast::ScalarConstructorExpression>()) {
|
||||
auto* lit = c->literal();
|
||||
if (lit->Is<ast::SintLiteral>()) {
|
||||
int32_t val = lit->As<ast::SintLiteral>()->value();
|
||||
if (auto* sint = lit->As<ast::SintLiteral>()) {
|
||||
int32_t val = sint->value();
|
||||
if (val < 0) {
|
||||
val = 0;
|
||||
} else if (val >= int32_t(size)) {
|
||||
val = int32_t(size) - 1;
|
||||
}
|
||||
lit->As<ast::SintLiteral>()->set_value(val);
|
||||
} else if (lit->Is<ast::UintLiteral>()) {
|
||||
uint32_t val = lit->As<ast::UintLiteral>()->value();
|
||||
sint->set_value(val);
|
||||
} else if (auto* uint = lit->As<ast::UintLiteral>()) {
|
||||
uint32_t val = uint->value();
|
||||
if (val >= size - 1) {
|
||||
val = size - 1;
|
||||
}
|
||||
lit->As<ast::UintLiteral>()->set_value(val);
|
||||
uint->set_value(val);
|
||||
} else {
|
||||
error_ = "unknown scalar constructor type for accessor";
|
||||
return false;
|
||||
|
||||
@@ -128,11 +128,11 @@ void VertexPullingTransform::FindOrInsertVertexIndexIfUsed() {
|
||||
}
|
||||
|
||||
for (auto* d : v->As<ast::DecoratedVariable>()->decorations()) {
|
||||
if (d->Is<ast::BuiltinDecoration>() &&
|
||||
d->As<ast::BuiltinDecoration>()->value() ==
|
||||
ast::Builtin::kVertexIdx) {
|
||||
vertex_index_name_ = v->name();
|
||||
return;
|
||||
if (auto* builtin = d->As<ast::BuiltinDecoration>()) {
|
||||
if (builtin->value() == ast::Builtin::kVertexIdx) {
|
||||
vertex_index_name_ = v->name();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,11 +172,11 @@ void VertexPullingTransform::FindOrInsertInstanceIndexIfUsed() {
|
||||
}
|
||||
|
||||
for (auto* d : v->As<ast::DecoratedVariable>()->decorations()) {
|
||||
if (d->Is<ast::BuiltinDecoration>() &&
|
||||
d->As<ast::BuiltinDecoration>()->value() ==
|
||||
ast::Builtin::kInstanceIdx) {
|
||||
instance_index_name_ = v->name();
|
||||
return;
|
||||
if (auto* builtin = d->As<ast::BuiltinDecoration>()) {
|
||||
if (builtin->value() == ast::Builtin::kInstanceIdx) {
|
||||
instance_index_name_ = v->name();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user