[dawn][metal] Use IR version of VertexPulling
Bug: 380044409
Change-Id: I829985f2f6381f8fe7bca1565356afa5cf7ad1a5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/222020
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
diff --git a/src/dawn/native/BUILD.gn b/src/dawn/native/BUILD.gn
index a418a8f..10c31cc 100644
--- a/src/dawn/native/BUILD.gn
+++ b/src/dawn/native/BUILD.gn
@@ -677,6 +677,8 @@
"metal/UtilsMetal.mm",
]
+ deps += [ "${dawn_root}/src/tint/lang/core/ir/transform" ]
+
# If a "build with ARC" config is present, remove it.
if (filter_include(configs, [ "//build/config/compiler:enable_arc" ]) !=
[]) {
diff --git a/src/dawn/native/metal/ShaderModuleMTL.mm b/src/dawn/native/metal/ShaderModuleMTL.mm
index d7aecb6..940e39f 100644
--- a/src/dawn/native/metal/ShaderModuleMTL.mm
+++ b/src/dawn/native/metal/ShaderModuleMTL.mm
@@ -44,6 +44,7 @@
#include "dawn/platform/DawnPlatform.h"
#include "dawn/platform/metrics/HistogramMacros.h"
#include "dawn/platform/tracing/TraceEvent.h"
+#include "src/tint/lang/core/ir/transform/vertex_pulling.h"
#include <tint/tint.h>
@@ -325,14 +326,15 @@
r.disableSymbolRenaming ? tint::ast::transform::Renamer::Target::kMslKeywords
: tint::ast::transform::Renamer::Target::kAll,
std::move(requestedNames));
- }
- if (r.vertexPullingTransformConfig) {
- tint::ast::transform::VertexPulling::Config config;
- config.pulling_group = r.vertexPullingTransformConfig->pulling_group;
- config.vertex_state = r.vertexPullingTransformConfig->vertex_state;
- transformManager.Add<tint::ast::transform::VertexPulling>();
- transformInputs.Add<tint::ast::transform::VertexPulling::Config>(std::move(config));
+ if (r.vertexPullingTransformConfig) {
+ tint::ast::transform::VertexPulling::Config config;
+ config.pulling_group = r.vertexPullingTransformConfig->pulling_group;
+ config.vertex_state = r.vertexPullingTransformConfig->vertex_state;
+ transformManager.Add<tint::ast::transform::VertexPulling>();
+ transformInputs.Add<tint::ast::transform::VertexPulling::Config>(
+ std::move(config));
+ }
}
if (r.substituteOverrideConfig) {
@@ -363,6 +365,15 @@
"An error occurred while generating Tint IR\n%s",
ir.Failure().reason.Str());
+ // TODO(380044409): Move this into the backend.
+ if (r.vertexPullingTransformConfig) {
+ auto vertex_pulling_result = tint::core::ir::transform::VertexPulling(
+ ir.Get(), *r.vertexPullingTransformConfig);
+ DAWN_INVALID_IF(vertex_pulling_result != tint::Success,
+ "An error occurred while running vertex pulling:\n%s",
+ vertex_pulling_result.Failure().reason.Str());
+ }
+
result = tint::msl::writer::Generate(ir.Get(), r.tintOptions);
// Workgroup validation has to come after `Generate` because it may require