mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +00:00
Automatically clone all symbols in CloneContext()
Almost all transforms should clone all symbols before doing any work, to avoid any newly created symbols clashing with existing symbols the source program and causing them to be renamed. The Renamer is the exception to this, and so an optional flag is used to prevent automatic cloning of symbols for this transform. Bug: dawn:758 Change-Id: I84527a352825b2eaa43eabe225beb9e0999bf048 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/48000 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Ben Clayton <bclayton@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
ed8332a0d1
commit
8cb5a23afb
@@ -29,11 +29,6 @@ BoundArrayAccessors::~BoundArrayAccessors() = default;
|
||||
Output BoundArrayAccessors::Run(const Program* in, const DataMap&) {
|
||||
ProgramBuilder out;
|
||||
CloneContext ctx(&out, in);
|
||||
|
||||
// Start by cloning all the symbols. This ensures that the authored symbols
|
||||
// won't get renamed if they collide with new symbols below.
|
||||
ctx.CloneSymbols();
|
||||
|
||||
ctx.ReplaceAll([&](ast::ArrayAccessorExpression* expr) {
|
||||
return Transform(expr, &ctx);
|
||||
});
|
||||
|
||||
@@ -62,10 +62,6 @@ Output CanonicalizeEntryPointIO::Run(const Program* in, const DataMap&) {
|
||||
ProgramBuilder out;
|
||||
CloneContext ctx(&out, in);
|
||||
|
||||
// Start by cloning all the symbols. This ensures that the authored symbols
|
||||
// won't get renamed if they collide with new symbols below.
|
||||
ctx.CloneSymbols();
|
||||
|
||||
// Strip entry point IO decorations from struct declarations.
|
||||
// TODO(jrprice): This code is duplicated with the SPIR-V transform.
|
||||
for (auto* ty : ctx.src->AST().ConstructedTypes()) {
|
||||
|
||||
@@ -613,10 +613,6 @@ Output DecomposeStorageAccess::Run(const Program* in, const DataMap&) {
|
||||
ProgramBuilder out;
|
||||
CloneContext ctx(&out, in);
|
||||
|
||||
// Start by cloning all the symbols. This ensures that the authored symbols
|
||||
// won't get renamed if they collide with new symbols below.
|
||||
ctx.CloneSymbols();
|
||||
|
||||
auto& sem = ctx.src->Sem();
|
||||
|
||||
State state;
|
||||
|
||||
@@ -35,10 +35,6 @@ Output EmitVertexPointSize::Run(const Program* in, const DataMap&) {
|
||||
|
||||
CloneContext ctx(&out, in);
|
||||
|
||||
// Start by cloning all the symbols. This ensures that the authored symbols
|
||||
// won't get renamed if they collide with new symbols below.
|
||||
ctx.CloneSymbols();
|
||||
|
||||
Symbol pointsize = out.Symbols().New("tint_pointsize");
|
||||
|
||||
// Declare the pointsize builtin output variable.
|
||||
|
||||
@@ -848,7 +848,8 @@ Renamer::~Renamer() = default;
|
||||
|
||||
Output Renamer::Run(const Program* in, const DataMap&) {
|
||||
ProgramBuilder out;
|
||||
CloneContext ctx(&out, in);
|
||||
// Disable auto-cloning of symbols, since we want to rename them.
|
||||
CloneContext ctx(&out, in, false);
|
||||
|
||||
// Swizzles and intrinsic calls need to keep their symbols preserved.
|
||||
std::unordered_set<ast::IdentifierExpression*> preserve;
|
||||
|
||||
@@ -414,10 +414,6 @@ Output VertexPulling::Run(const Program* in, const DataMap& data) {
|
||||
|
||||
CloneContext ctx(&out, in);
|
||||
|
||||
// Start by cloning all the symbols. This ensures that the authored symbols
|
||||
// won't get renamed if they collide with new symbols below.
|
||||
ctx.CloneSymbols();
|
||||
|
||||
State state{ctx, cfg};
|
||||
state.FindOrInsertVertexIndexIfUsed();
|
||||
state.FindOrInsertInstanceIndexIfUsed();
|
||||
|
||||
Reference in New Issue
Block a user