mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 08:27:05 +00:00
Rework all transforms to transform-on-copy
instead of transform-in-place. This is a public API breaking change, so I've added the `DAWN_USE_NEW_TINT_TRANSFORM_API` define which is used by Dawn to know which API to use. As we're going to have to go through the effort of an API breaking change, use this as an opportunity to rename Transformer to Transform, and remove 'Transform' from each of the transforms themselves (they're already in the transform namespace). Bug: tint:390 Bug: tint:389 Change-Id: I1017507524b76bb4ffd26b95e550ef53ddc891c9 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34800 Reviewed-by: dan sinclair <dsinclair@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
0f37afb74e
commit
00b77a80ab
@@ -31,19 +31,21 @@ Module::~Module() = default;
|
||||
|
||||
Module Module::Clone() {
|
||||
Module out;
|
||||
|
||||
CloneContext ctx(&out);
|
||||
Clone(&ctx);
|
||||
return out;
|
||||
}
|
||||
|
||||
void Module::Clone(CloneContext* ctx) {
|
||||
for (auto* ty : constructed_types_) {
|
||||
out.constructed_types_.emplace_back(ctx.Clone(ty));
|
||||
ctx->mod->constructed_types_.emplace_back(ctx->Clone(ty));
|
||||
}
|
||||
for (auto* var : global_variables_) {
|
||||
out.global_variables_.emplace_back(ctx.Clone(var));
|
||||
ctx->mod->global_variables_.emplace_back(ctx->Clone(var));
|
||||
}
|
||||
for (auto* func : functions_) {
|
||||
out.functions_.emplace_back(ctx.Clone(func));
|
||||
ctx->mod->functions_.emplace_back(ctx->Clone(func));
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
Function* Module::FindFunctionByName(const std::string& name) const {
|
||||
|
||||
@@ -54,6 +54,10 @@ class Module {
|
||||
/// @return a deep copy of this module
|
||||
Module Clone();
|
||||
|
||||
/// Clone this module into `ctx->mod` using the provided CloneContext
|
||||
/// @param ctx the clone context
|
||||
void Clone(CloneContext* ctx);
|
||||
|
||||
/// Add a global variable to the module
|
||||
/// @param var the variable to add
|
||||
void AddGlobalVariable(Variable* var) { global_variables_.push_back(var); }
|
||||
|
||||
Reference in New Issue
Block a user