mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +00:00
ast: Add type nodes
Copy all of the type classes from src/type into ast. Required the merging of: * type::Struct into the existing ast::Struct - ast::Struct now has a name. * type::AccessControl into the existing ast::AccessControl enumerator - The old ast::AccessControl enumerator is now ast::AccessControl::Access Bug: tint:724 Change-Id: Ibb950036ed551ec769c6d3d2c8fb411809cf6931 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/48383 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
ba6f260629
commit
8a8d26bbd9
@@ -63,7 +63,7 @@ Output BindingRemapper::Run(const Program* in, const DataMap& datamap) {
|
||||
// Replace any access controls.
|
||||
auto ac_it = remappings->access_controls.find(from);
|
||||
if (ac_it != remappings->access_controls.end()) {
|
||||
ast::AccessControl ac = ac_it->second;
|
||||
ast::AccessControl::Access ac = ac_it->second;
|
||||
auto* ty = in->Sem().Get(var)->Type();
|
||||
sem::Type* inner_ty = nullptr;
|
||||
if (auto* old_ac = ty->As<sem::AccessControl>()) {
|
||||
|
||||
@@ -32,7 +32,8 @@ class BindingRemapper : public Transform {
|
||||
using BindingPoints = std::unordered_map<BindingPoint, BindingPoint>;
|
||||
|
||||
/// AccessControls is a map of old binding point to new access control
|
||||
using AccessControls = std::unordered_map<BindingPoint, ast::AccessControl>;
|
||||
using AccessControls =
|
||||
std::unordered_map<BindingPoint, ast::AccessControl::Access>;
|
||||
|
||||
/// Remappings is consumed by the BindingRemapper transform.
|
||||
/// Data holds information about shader usage and constant buffer offsets.
|
||||
|
||||
@@ -81,10 +81,11 @@ Output CanonicalizeEntryPointIO::Run(const Program* in, const DataMap&) {
|
||||
}
|
||||
|
||||
// Redeclare the struct.
|
||||
auto new_struct_name = ctx.Clone(struct_ty->symbol());
|
||||
auto* new_struct = ctx.dst->create<sem::StructType>(
|
||||
ctx.Clone(struct_ty->symbol()),
|
||||
ctx.dst->create<ast::Struct>(
|
||||
new_struct_members, ctx.Clone(struct_ty->impl()->decorations())));
|
||||
new_struct_name, ctx.dst->create<ast::Struct>(
|
||||
new_struct_name, new_struct_members,
|
||||
ctx.Clone(struct_ty->impl()->decorations())));
|
||||
ctx.Replace(struct_ty, new_struct);
|
||||
}
|
||||
}
|
||||
@@ -174,9 +175,10 @@ Output CanonicalizeEntryPointIO::Run(const Program* in, const DataMap&) {
|
||||
StructMemberComparator);
|
||||
|
||||
// Create the new struct type.
|
||||
auto in_struct_name = ctx.dst->Symbols().New();
|
||||
auto* in_struct = ctx.dst->create<sem::StructType>(
|
||||
ctx.dst->Symbols().New(),
|
||||
ctx.dst->create<ast::Struct>(new_struct_members,
|
||||
in_struct_name,
|
||||
ctx.dst->create<ast::Struct>(in_struct_name, new_struct_members,
|
||||
ast::DecorationList{}));
|
||||
ctx.InsertBefore(ctx.src->AST().GlobalDeclarations(), func, in_struct);
|
||||
|
||||
@@ -220,9 +222,10 @@ Output CanonicalizeEntryPointIO::Run(const Program* in, const DataMap&) {
|
||||
StructMemberComparator);
|
||||
|
||||
// Create the new struct type.
|
||||
auto out_struct_name = ctx.dst->Symbols().New();
|
||||
auto* out_struct = ctx.dst->create<sem::StructType>(
|
||||
ctx.dst->Symbols().New(),
|
||||
ctx.dst->create<ast::Struct>(new_struct_members,
|
||||
out_struct_name,
|
||||
ctx.dst->create<ast::Struct>(out_struct_name, new_struct_members,
|
||||
ast::DecorationList{}));
|
||||
ctx.InsertBefore(ctx.src->AST().GlobalDeclarations(), func, out_struct);
|
||||
new_ret_type = out_struct;
|
||||
|
||||
@@ -126,10 +126,11 @@ void Spirv::HandleEntryPointIOTypes(CloneContext& ctx) const {
|
||||
}
|
||||
|
||||
// Redeclare the struct.
|
||||
auto new_struct_name = ctx.Clone(struct_ty->symbol());
|
||||
auto* new_struct = ctx.dst->create<sem::StructType>(
|
||||
ctx.Clone(struct_ty->symbol()),
|
||||
ctx.dst->create<ast::Struct>(
|
||||
new_struct_members, ctx.Clone(struct_ty->impl()->decorations())));
|
||||
new_struct_name, ctx.dst->create<ast::Struct>(
|
||||
new_struct_name, new_struct_members,
|
||||
ctx.Clone(struct_ty->impl()->decorations())));
|
||||
ctx.Replace(struct_ty, new_struct);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user