mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-10 05:57:51 +00:00
Replace Variable::(Is|As)* with Castable
Change-Id: I7a49287af079d53cee095fa2243dd21757546b56 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34318 Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
@@ -122,11 +122,12 @@ void VertexPullingTransform::FindOrInsertVertexIndexIfUsed() {
|
||||
|
||||
// Look for an existing vertex index builtin
|
||||
for (auto* v : mod_->global_variables()) {
|
||||
if (!v->IsDecorated() || v->storage_class() != ast::StorageClass::kInput) {
|
||||
if (!v->Is<ast::DecoratedVariable>() ||
|
||||
v->storage_class() != ast::StorageClass::kInput) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (auto* d : v->AsDecorated()->decorations()) {
|
||||
for (auto* d : v->As<ast::DecoratedVariable>()->decorations()) {
|
||||
if (d->Is<ast::BuiltinDecoration>() &&
|
||||
d->As<ast::BuiltinDecoration>()->value() ==
|
||||
ast::Builtin::kVertexIdx) {
|
||||
@@ -165,11 +166,12 @@ void VertexPullingTransform::FindOrInsertInstanceIndexIfUsed() {
|
||||
|
||||
// Look for an existing instance index builtin
|
||||
for (auto* v : mod_->global_variables()) {
|
||||
if (!v->IsDecorated() || v->storage_class() != ast::StorageClass::kInput) {
|
||||
if (!v->Is<ast::DecoratedVariable>() ||
|
||||
v->storage_class() != ast::StorageClass::kInput) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (auto* d : v->AsDecorated()->decorations()) {
|
||||
for (auto* d : v->As<ast::DecoratedVariable>()->decorations()) {
|
||||
if (d->Is<ast::BuiltinDecoration>() &&
|
||||
d->As<ast::BuiltinDecoration>()->value() ==
|
||||
ast::Builtin::kInstanceIdx) {
|
||||
@@ -195,11 +197,12 @@ void VertexPullingTransform::FindOrInsertInstanceIndexIfUsed() {
|
||||
|
||||
void VertexPullingTransform::ConvertVertexInputVariablesToPrivate() {
|
||||
for (auto*& v : mod_->global_variables()) {
|
||||
if (!v->IsDecorated() || v->storage_class() != ast::StorageClass::kInput) {
|
||||
if (!v->Is<ast::DecoratedVariable>() ||
|
||||
v->storage_class() != ast::StorageClass::kInput) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (auto* d : v->AsDecorated()->decorations()) {
|
||||
for (auto* d : v->As<ast::DecoratedVariable>()->decorations()) {
|
||||
if (auto* l = d->As<ast::LocationDecoration>()) {
|
||||
uint32_t location = l->value();
|
||||
// This is where the replacement happens. Expressions use identifier
|
||||
|
||||
Reference in New Issue
Block a user