Access struct member name through sem.

This CL changes the uses of Declaration()->symbol for struct members in
the sem to access the `Name` directly.

Bug: tint:1718
Change-Id: I3050147b97bea66d6c283e176a7152f36eb2b25f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112444
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
dan sinclair
2022-12-01 14:52:33 +00:00
committed by Dawn LUCI CQ
parent d5d207ba9f
commit c5b1b5c77a
9 changed files with 18 additions and 21 deletions

View File

@@ -359,10 +359,10 @@ struct CanonicalizeEntryPointIO::State {
continue;
}
auto* member_ast = member->Declaration();
auto name = ctx.src->Symbols().NameFor(member_ast->symbol);
auto name = ctx.src->Symbols().NameFor(member->Name());
auto attributes = CloneShaderIOAttributes(member_ast->attributes, do_interpolate);
auto attributes =
CloneShaderIOAttributes(member->Declaration()->attributes, do_interpolate);
auto* input_expr =
AddInput(name, member->Type(), member->Location(), std::move(attributes));
inner_struct_values.Push(input_expr);
@@ -388,9 +388,9 @@ struct CanonicalizeEntryPointIO::State {
continue;
}
auto* member_ast = member->Declaration();
auto name = ctx.src->Symbols().NameFor(member_ast->symbol);
auto attributes = CloneShaderIOAttributes(member_ast->attributes, do_interpolate);
auto name = ctx.src->Symbols().NameFor(member->Name());
auto attributes =
CloneShaderIOAttributes(member->Declaration()->attributes, do_interpolate);
// Extract the original structure member.
AddOutput(name, member->Type(), member->Location(), std::move(attributes),

View File

@@ -645,8 +645,8 @@ struct DecomposeMemoryAccess::State {
utils::Vector<const ast::Statement*, 8> stmts;
for (auto* member : str->Members()) {
auto* offset = b.Add("offset", u32(member->Offset()));
auto* element = b.MemberAccessor(
"value", ctx.Clone(member->Declaration()->symbol));
auto* element =
b.MemberAccessor("value", ctx.Clone(member->Name()));
Symbol store =
StoreFunc(buf_ty, member->Type()->UnwrapRef(), var_user);
auto* call = b.Call(store, "buffer", offset, element);

View File

@@ -107,7 +107,7 @@ Transform::ApplyResult NumWorkgroupsFromUniform::Apply(const Program* src,
// Capture the symbols that would be used to access this member, which
// we will replace later. We currently have no way to get from the
// parameter directly to the member accessor expressions that use it.
to_replace.insert({param->Declaration()->symbol, member->Declaration()->symbol});
to_replace.insert({param->Declaration()->symbol, member->Name()});
// Remove the struct member.
// The CanonicalizeEntryPointIO transform will have generated this

View File

@@ -57,7 +57,7 @@ struct PackedVec3::State {
// Apply the PackedVec3::Attribute to the member
auto* member_decl = member->Declaration();
auto name = ctx.Clone(member_decl->symbol);
auto name = ctx.Clone(member->Name());
auto* type = ctx.Clone(member_decl->type);
utils::Vector<const ast::Attribute*, 4> attrs{
b.ASTNodes().Create<Attribute>(b.ID(), b.AllocateNodeID()),

View File

@@ -131,8 +131,7 @@ Transform::ApplyResult TruncateInterstageVariables::Apply(const Program* src,
}
truncated_members.Push(ctx.Clone(member->Declaration()));
initializer_exprs.Push(
b.MemberAccessor("io", ctx.Clone(member->Declaration()->symbol)));
initializer_exprs.Push(b.MemberAccessor("io", ctx.Clone(member->Name())));
}
// Create the new shader io struct.