Move all Source constructor params to be the first

This consistency can be utilized by the ast::Builder to inject the source parameter if it isn't provided.

Bug: tint:396
Bug: tint:390
Change-Id: I2f19002131e79daae799b8cbe918eb192d6bfc75
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35503
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2020-12-14 21:10:07 +00:00
committed by Commit Bot service account
parent 7b2f8d010f
commit 5aad70a069
72 changed files with 554 additions and 554 deletions

View File

@@ -66,7 +66,7 @@ Transform::Output EmitVertexPointSize::Run(ast::Module* in) {
ast::VariableDecorationList{
// decorations
mod->create<ast::BuiltinDecoration>(
ast::Builtin::kPointSize, Source{}),
Source{}, ast::Builtin::kPointSize),
});
mod->AddGlobalVariable(pointsize_var);

View File

@@ -71,8 +71,8 @@ TEST_F(EmitVertexPointSizeTest, VertexStageBasic) {
auto* entry = create<ast::Function>(
Source{}, entry_sym, "entry", ast::VariableList{}, ty.void_, block,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex,
Source{}),
create<ast::StageDecoration>(Source{},
ast::PipelineStage::kVertex),
});
mod->AddFunction(entry);
@@ -141,8 +141,8 @@ TEST_F(EmitVertexPointSizeTest, VertexStageEmpty) {
Source{}, entry_sym, "entry", ast::VariableList{}, ty.void_,
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex,
Source{}),
create<ast::StageDecoration>(Source{},
ast::PipelineStage::kVertex),
}));
auto b_sym = mod->RegisterSymbol("non_entry_b");
@@ -197,8 +197,8 @@ TEST_F(EmitVertexPointSizeTest, NonVertexStage) {
Source{}, frag_sym, "fragment_entry", ast::VariableList{}, ty.void_,
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment,
Source{}),
create<ast::StageDecoration>(Source{},
ast::PipelineStage::kFragment),
});
mod->AddFunction(fragment_entry);
@@ -207,8 +207,8 @@ TEST_F(EmitVertexPointSizeTest, NonVertexStage) {
Source{}, comp_sym, "compute_entry", ast::VariableList{}, ty.void_,
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute,
Source{}),
create<ast::StageDecoration>(Source{},
ast::PipelineStage::kCompute),
});
mod->AddFunction(compute_entry);
}

View File

@@ -197,7 +197,7 @@ ast::Variable* FirstIndexOffset::AddUniformBuffer(ast::Module* mod) {
if (has_vertex_index_) {
ast::StructMemberDecorationList member_dec;
member_dec.push_back(
mod->create<ast::StructMemberOffsetDecoration>(offset, Source{}));
mod->create<ast::StructMemberOffsetDecoration>(Source{}, offset));
members.push_back(mod->create<ast::StructMember>(
Source{}, kFirstVertexName, u32_type, std::move(member_dec)));
vertex_index_offset_ = offset;
@@ -207,7 +207,7 @@ ast::Variable* FirstIndexOffset::AddUniformBuffer(ast::Module* mod) {
if (has_instance_index_) {
ast::StructMemberDecorationList member_dec;
member_dec.push_back(
mod->create<ast::StructMemberOffsetDecoration>(offset, Source{}));
mod->create<ast::StructMemberOffsetDecoration>(Source{}, offset));
members.push_back(mod->create<ast::StructMember>(
Source{}, kFirstInstanceName, u32_type, std::move(member_dec)));
instance_index_offset_ = offset;
@@ -229,8 +229,8 @@ ast::Variable* FirstIndexOffset::AddUniformBuffer(ast::Module* mod) {
false, // is_const
nullptr, // constructor
ast::VariableDecorationList{
mod->create<ast::BindingDecoration>(binding_, Source{}),
mod->create<ast::SetDecoration>(set_, Source{}),
mod->create<ast::BindingDecoration>(Source{}, binding_),
mod->create<ast::SetDecoration>(Source{}, set_),
}); // decorations
mod->AddGlobalVariable(idx_var);

View File

@@ -54,7 +54,7 @@ struct ModuleBuilder : public ast::BuilderWithModule {
void AddBuiltinInput(const std::string& name, ast::Builtin builtin) {
mod->AddGlobalVariable(
Var(name, ast::StorageClass::kInput, ty.u32, nullptr,
{create<ast::BuiltinDecoration>(builtin, Source{})}));
{create<ast::BuiltinDecoration>(Source{}, builtin)}));
}
ast::Function* AddFunction(const std::string& name,

View File

@@ -173,7 +173,7 @@ void VertexPulling::State::FindOrInsertVertexIndexIfUsed() {
ast::VariableDecorationList{
// decorations
out->create<ast::BuiltinDecoration>(
ast::Builtin::kVertexIdx, Source{}),
Source{}, ast::Builtin::kVertexIdx),
});
out->AddGlobalVariable(var);
@@ -220,7 +220,7 @@ void VertexPulling::State::FindOrInsertInstanceIndexIfUsed() {
ast::VariableDecorationList{
// decorations
out->create<ast::BuiltinDecoration>(
ast::Builtin::kInstanceIdx, Source{}),
Source{}, ast::Builtin::kInstanceIdx),
});
out->AddGlobalVariable(var);
}
@@ -258,14 +258,14 @@ void VertexPulling::State::AddVertexStorageBuffers() {
auto* internal_array_type = out->create<ast::type::Array>(
GetU32Type(), 0,
ast::ArrayDecorationList{
out->create<ast::StrideDecoration>(4u, Source{}),
out->create<ast::StrideDecoration>(Source{}, 4u),
});
// Creating the struct type
ast::StructMemberList members;
ast::StructMemberDecorationList member_dec;
member_dec.push_back(
out->create<ast::StructMemberOffsetDecoration>(0u, Source{}));
out->create<ast::StructMemberOffsetDecoration>(Source{}, 0u));
members.push_back(out->create<ast::StructMember>(
Source{}, kStructBufferName, internal_array_type, std::move(member_dec)));
@@ -288,8 +288,8 @@ void VertexPulling::State::AddVertexStorageBuffers() {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
out->create<ast::BindingDecoration>(i, Source{}),
out->create<ast::SetDecoration>(cfg.pulling_set, Source{}),
out->create<ast::BindingDecoration>(Source{}, i),
out->create<ast::SetDecoration>(Source{}, cfg.pulling_set),
});
out->AddGlobalVariable(var);
}

View File

@@ -51,7 +51,7 @@ class VertexPullingHelper {
mod_->create<ast::type::Void>(),
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{create<ast::StageDecoration>(
ast::PipelineStage::kVertex, Source{})});
Source{}, ast::PipelineStage::kVertex)});
mod()->AddFunction(func);
}
@@ -79,7 +79,7 @@ class VertexPullingHelper {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(location, Source{}),
create<ast::LocationDecoration>(Source{}, location),
});
mod_->AddGlobalVariable(var);
@@ -139,7 +139,7 @@ TEST_F(VertexPullingTest, Error_EntryPointWrongStage) {
mod()->create<ast::type::Void>(),
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod()->AddFunction(func);
@@ -437,7 +437,7 @@ TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex) {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BuiltinDecoration>(ast::Builtin::kVertexIdx, Source{}),
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kVertexIdx),
}));
mod()->AddGlobalVariable(create<ast::Variable>(
@@ -449,7 +449,7 @@ TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex) {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BuiltinDecoration>(ast::Builtin::kInstanceIdx, Source{}),
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kInstanceIdx),
}));
InitTransform(