mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-10 22:17:51 +00:00
Program: Remove deprecated global variable methods
Fixup all usages Bug: tint:390 Change-Id: I2e239dfc77872acb9f0b2ee5494350605dd780a1 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38545 Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
@@ -62,7 +62,7 @@ Transform::Output EmitVertexPointSize::Run(const Program* in) {
|
||||
out.program.create<ast::BuiltinDecoration>(Source{},
|
||||
ast::Builtin::kPointSize),
|
||||
});
|
||||
out.program.AddGlobalVariable(pointsize_var);
|
||||
out.program.AST().AddGlobalVariable(pointsize_var);
|
||||
|
||||
// Build the AST expression & statement for assigning pointsize one.
|
||||
auto* one = out.program.create<ast::ScalarConstructorExpression>(
|
||||
|
||||
@@ -83,7 +83,7 @@ FirstIndexOffset::~FirstIndexOffset() = default;
|
||||
|
||||
Transform::Output FirstIndexOffset::Run(const Program* in) {
|
||||
// First do a quick check to see if the transform has already been applied.
|
||||
for (ast::Variable* var : in->global_variables()) {
|
||||
for (ast::Variable* var : in->AST().GlobalVariables()) {
|
||||
if (auto* dec_var = var->As<ast::Variable>()) {
|
||||
if (dec_var->symbol() == in->GetSymbol(kBufferName)) {
|
||||
diag::Diagnostic err;
|
||||
@@ -240,7 +240,7 @@ ast::Variable* FirstIndexOffset::AddUniformBuffer(Program* dst) {
|
||||
dst->create<ast::GroupDecoration>(Source{}, group_),
|
||||
}); // decorations
|
||||
|
||||
dst->AddGlobalVariable(idx_var);
|
||||
dst->AST().AddGlobalVariable(idx_var);
|
||||
|
||||
dst->AddConstructedType(struct_type);
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ void VertexPulling::State::FindOrInsertVertexIndexIfUsed() {
|
||||
}
|
||||
|
||||
// Look for an existing vertex index builtin
|
||||
for (auto* v : in->global_variables()) {
|
||||
for (auto* v : in->AST().GlobalVariables()) {
|
||||
if (v->storage_class() != ast::StorageClass::kInput) {
|
||||
continue;
|
||||
}
|
||||
@@ -181,7 +181,7 @@ void VertexPulling::State::FindOrInsertVertexIndexIfUsed() {
|
||||
ast::Builtin::kVertexIndex),
|
||||
});
|
||||
|
||||
out->AddGlobalVariable(var);
|
||||
out->AST().AddGlobalVariable(var);
|
||||
}
|
||||
|
||||
void VertexPulling::State::FindOrInsertInstanceIndexIfUsed() {
|
||||
@@ -197,7 +197,7 @@ void VertexPulling::State::FindOrInsertInstanceIndexIfUsed() {
|
||||
}
|
||||
|
||||
// Look for an existing instance index builtin
|
||||
for (auto* v : in->global_variables()) {
|
||||
for (auto* v : in->AST().GlobalVariables()) {
|
||||
if (v->storage_class() != ast::StorageClass::kInput) {
|
||||
continue;
|
||||
}
|
||||
@@ -227,12 +227,12 @@ void VertexPulling::State::FindOrInsertInstanceIndexIfUsed() {
|
||||
out->create<ast::BuiltinDecoration>(Source{},
|
||||
ast::Builtin::kInstanceIndex),
|
||||
});
|
||||
out->AddGlobalVariable(var);
|
||||
out->AST().AddGlobalVariable(var);
|
||||
}
|
||||
|
||||
void VertexPulling::State::ConvertVertexInputVariablesToPrivate() {
|
||||
// TODO(https://crbug.com/tint/390): Remove this const_cast hack!
|
||||
for (auto*& v : const_cast<Program*>(in)->global_variables()) {
|
||||
for (auto*& v : const_cast<Program*>(in)->AST().GlobalVariables()) {
|
||||
if (v->storage_class() != ast::StorageClass::kInput) {
|
||||
continue;
|
||||
}
|
||||
@@ -299,7 +299,7 @@ void VertexPulling::State::AddVertexStorageBuffers() {
|
||||
out->create<ast::BindingDecoration>(Source{}, i),
|
||||
out->create<ast::GroupDecoration>(Source{}, cfg.pulling_group),
|
||||
});
|
||||
out->AddGlobalVariable(var);
|
||||
out->AST().AddGlobalVariable(var);
|
||||
}
|
||||
out->AddConstructedType(struct_type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user