Simplify MultiplanarExternalTexture::ShouldRun.
Currently the multiplanar `ShouldRun` function is scanning all objects
looking for an external texture. This CL switches to using the type
manager and attempts to find an `ExternalTexture` type in the system. If
found, then the transform should run.
Change-Id: I28b8fa1835a83f2bff5d804e95bcbaa73d3d2124
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126922
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
diff --git a/src/tint/transform/multiplanar_external_texture.cc b/src/tint/transform/multiplanar_external_texture.cc
index 310bc46..dcf1e1c 100644
--- a/src/tint/transform/multiplanar_external_texture.cc
+++ b/src/tint/transform/multiplanar_external_texture.cc
@@ -33,14 +33,8 @@
namespace {
bool ShouldRun(const Program* program) {
- for (auto* node : program->ASTNodes().Objects()) {
- if (auto* expr = node->As<ast::Expression>()) {
- if (Is<type::ExternalTexture>(program->TypeOf(expr))) {
- return true;
- }
- }
- }
- return false;
+ auto ext = program->Types().Find<type::ExternalTexture>();
+ return ext != nullptr;
}
/// This struct stores symbols for new bindings created as a result of transforming a