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:
Ben Clayton
2020-12-04 09:06:09 +00:00
committed by Commit Bot service account
parent 0f37afb74e
commit 00b77a80ab
25 changed files with 1210 additions and 1317 deletions

View File

@@ -71,7 +71,7 @@ const char kUsage[] = R"(Usage: tint [options] <input-file>
-ep <compute|fragment|vertex> <name> -- Output single entry point
--output-file <name> -- Output file name. Use "-" for standard output
-o <name> -- Output file name. Use "-" for standard output
--transform <name list> -- Runs transformers, name list is comma separated
--transform <name list> -- Runs transforms, name list is comma separated
Available transforms:
bound_array_accessors
emit_vertex_point_size
@@ -515,22 +515,24 @@ int main(int argc, const char** argv) {
if (name == "bound_array_accessors") {
transform_manager.append(
std::make_unique<tint::transform::BoundArrayAccessorsTransform>(
&mod));
std::make_unique<tint::transform::BoundArrayAccessors>());
} else if (name == "emit_vertex_point_size") {
transform_manager.append(
std::make_unique<tint::transform::EmitVertexPointSizeTransform>(
&mod));
std::make_unique<tint::transform::EmitVertexPointSize>());
} else {
std::cerr << "Unknown transform name: " << name << std::endl;
return 1;
}
}
if (!transform_manager.Run(&mod)) {
std::cerr << "Transformer: " << transform_manager.error() << std::endl;
auto out = transform_manager.Run(&mod);
if (out.diagnostics.contains_errors()) {
diag_formatter.format(out.diagnostics, diag_printer.get());
return 1;
}
mod = std::move(out.module);
std::unique_ptr<tint::writer::Writer> writer;
#if TINT_BUILD_SPV_WRITER