mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-12 14:46:08 +00:00
ast: Remove statement constructors that don't take a Source
Parsers need fixing up. Bug: tint:396 Bug: tint:390 Change-Id: I137f1017ca56125cf3d52ecbef2ff46d0574338b Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35161 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
1ff59cd0e2
commit
bbefff63a3
@@ -91,7 +91,7 @@ class BoundArrayAccessorsTest : public testing::Test {
|
||||
};
|
||||
|
||||
struct ModuleBuilder : public ast::BuilderWithModule {
|
||||
ModuleBuilder() : body_(create<ast::BlockStatement>()) {
|
||||
ModuleBuilder() : body_(create<ast::BlockStatement>(Source{})) {
|
||||
mod->AddFunction(create<ast::Function>(
|
||||
Source{}, mod->RegisterSymbol("func"), "func", ast::VariableList{},
|
||||
ty.void_, body_, ast::FunctionDecorationList{}));
|
||||
@@ -106,7 +106,7 @@ struct ModuleBuilder : public ast::BuilderWithModule {
|
||||
virtual void Build() = 0;
|
||||
void OnVariableBuilt(ast::Variable* var) override {
|
||||
ASSERT_NE(body_, nullptr);
|
||||
body_->append(create<ast::VariableDeclStatement>(var));
|
||||
body_->append(create<ast::VariableDeclStatement>(Source{}, var));
|
||||
}
|
||||
ast::BlockStatement* body_ = nullptr;
|
||||
};
|
||||
|
||||
@@ -65,12 +65,12 @@ Transform::Output EmitVertexPointSize::Run(ast::Module* in) {
|
||||
mod->AddGlobalVariable(pointsize_var);
|
||||
|
||||
// Build the AST expression & statement for assigning pointsize one.
|
||||
auto* one = mod->create<ast::ScalarConstructorExpression>(Source{},
|
||||
mod->create<ast::FloatLiteral>(Source{}, f32, 1.0f));
|
||||
auto* one = mod->create<ast::ScalarConstructorExpression>(
|
||||
Source{}, mod->create<ast::FloatLiteral>(Source{}, f32, 1.0f));
|
||||
auto* pointsize_ident = mod->create<ast::IdentifierExpression>(
|
||||
Source{}, mod->RegisterSymbol(kPointSizeVar), kPointSizeVar);
|
||||
auto* pointsize_assign =
|
||||
mod->create<ast::AssignmentStatement>(pointsize_ident, one);
|
||||
mod->create<ast::AssignmentStatement>(Source{}, pointsize_ident, one);
|
||||
|
||||
// Add the pointsize assignment statement to the front of all vertex stages.
|
||||
for (auto* func : mod->functions()) {
|
||||
|
||||
@@ -56,8 +56,8 @@ TEST_F(EmitVertexPointSizeTest, VertexStageBasic) {
|
||||
auto* block = create<ast::BlockStatement>(Source{});
|
||||
|
||||
block->append(create<ast::VariableDeclStatement>(
|
||||
Var("builtin_assignments_should_happen_before_this",
|
||||
tint::ast::StorageClass::kFunction, ty.f32)));
|
||||
Source{}, Var("builtin_assignments_should_happen_before_this",
|
||||
tint::ast::StorageClass::kFunction, ty.f32)));
|
||||
|
||||
auto a_sym = mod->RegisterSymbol("non_entry_a");
|
||||
mod->AddFunction(create<ast::Function>(
|
||||
|
||||
@@ -270,7 +270,7 @@ ast::VariableDeclStatement* FirstIndexOffset::CreateFirstIndexOffset(
|
||||
true, // is_const
|
||||
constructor, // constructor
|
||||
ast::VariableDecorationList{}); // decorations
|
||||
return mod->create<ast::VariableDeclStatement>(var);
|
||||
return mod->create<ast::VariableDeclStatement>(Source{}, var);
|
||||
}
|
||||
|
||||
} // namespace transform
|
||||
|
||||
@@ -61,7 +61,7 @@ struct ModuleBuilder : public ast::BuilderWithModule {
|
||||
ast::VariableList params = {}) {
|
||||
auto* func = create<ast::Function>(
|
||||
Source{}, mod->RegisterSymbol(name), name, std::move(params), ty.u32,
|
||||
create<ast::BlockStatement>(), ast::FunctionDecorationList());
|
||||
create<ast::BlockStatement>(Source{}), ast::FunctionDecorationList());
|
||||
mod->AddFunction(func);
|
||||
return func;
|
||||
}
|
||||
|
||||
@@ -292,18 +292,18 @@ void VertexPulling::State::AddVertexPullingPreamble(
|
||||
// location.
|
||||
|
||||
// A block statement allowing us to use append instead of insert
|
||||
auto* block = mod->create<ast::BlockStatement>();
|
||||
auto* block = mod->create<ast::BlockStatement>(Source{});
|
||||
|
||||
// Declare the |kPullingPosVarName| variable in the shader
|
||||
auto* pos_declaration =
|
||||
mod->create<ast::VariableDeclStatement>(mod->create<ast::Variable>(
|
||||
Source{}, // source
|
||||
kPullingPosVarName, // name
|
||||
ast::StorageClass::kFunction, // storage_class
|
||||
GetI32Type(), // type
|
||||
false, // is_const
|
||||
nullptr, // constructor
|
||||
ast::VariableDecorationList{})); // decorations
|
||||
auto* pos_declaration = mod->create<ast::VariableDeclStatement>(
|
||||
Source{}, mod->create<ast::Variable>(
|
||||
Source{}, // source
|
||||
kPullingPosVarName, // name
|
||||
ast::StorageClass::kFunction, // storage_class
|
||||
GetI32Type(), // type
|
||||
false, // is_const
|
||||
nullptr, // constructor
|
||||
ast::VariableDecorationList{})); // decorations
|
||||
|
||||
// |kPullingPosVarName| refers to the byte location of the current read. We
|
||||
// declare a variable in the shader to avoid having to reuse Expression
|
||||
@@ -338,10 +338,11 @@ void VertexPulling::State::AddVertexPullingPreamble(
|
||||
|
||||
// Update position of the read
|
||||
auto* set_pos_expr = mod->create<ast::AssignmentStatement>(
|
||||
CreatePullingPositionIdent(), pos_value);
|
||||
Source{}, CreatePullingPositionIdent(), pos_value);
|
||||
block->append(set_pos_expr);
|
||||
|
||||
block->append(mod->create<ast::AssignmentStatement>(
|
||||
Source{},
|
||||
mod->create<ast::IdentifierExpression>(
|
||||
Source{}, mod->RegisterSymbol(v->name()), v->name()),
|
||||
AccessByFormat(i, attribute_desc.format)));
|
||||
|
||||
@@ -48,7 +48,7 @@ class VertexPullingHelper {
|
||||
void InitBasicModule() {
|
||||
auto* func = create<ast::Function>(
|
||||
Source{}, mod_->RegisterSymbol("main"), "main", ast::VariableList{},
|
||||
mod_->create<ast::type::Void>(), create<ast::BlockStatement>(),
|
||||
mod_->create<ast::type::Void>(), create<ast::BlockStatement>(Source{}),
|
||||
ast::FunctionDecorationList{create<ast::StageDecoration>(
|
||||
ast::PipelineStage::kVertex, Source{})});
|
||||
mod()->AddFunction(func);
|
||||
@@ -135,7 +135,7 @@ TEST_F(VertexPullingTest, Error_InvalidEntryPoint) {
|
||||
TEST_F(VertexPullingTest, Error_EntryPointWrongStage) {
|
||||
auto* func = create<ast::Function>(
|
||||
Source{}, mod()->RegisterSymbol("main"), "main", ast::VariableList{},
|
||||
mod()->create<ast::type::Void>(), create<ast::BlockStatement>(),
|
||||
mod()->create<ast::type::Void>(), create<ast::BlockStatement>(Source{}),
|
||||
ast::FunctionDecorationList{
|
||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user