From f3e35868359af6945698482fe5b31dc320b687f0 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Mon, 11 Jan 2021 16:24:32 +0000 Subject: [PATCH] Use namer in the Inspector. This CL adds the namer to the Inspector when getting the remapped name. Change-Id: Ic5ed8c50a24b7a1cc303767d049a358181d27603 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36661 Reviewed-by: Ryan Harrison Reviewed-by: Ben Clayton --- src/inspector/inspector.cc | 17 +++++++---------- src/inspector/inspector.h | 4 +++- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/inspector/inspector.cc b/src/inspector/inspector.cc index 7ef231184b..8d8c1fefaa 100644 --- a/src/inspector/inspector.cc +++ b/src/inspector/inspector.cc @@ -43,7 +43,8 @@ namespace tint { namespace inspector { -Inspector::Inspector(const ast::Module& module) : module_(module) {} +Inspector::Inspector(ast::Module& module) + : module_(module), namer_(std::make_unique(&module)) {} Inspector::~Inspector() = default; @@ -77,15 +78,11 @@ std::vector Inspector::GetEntryPoints() { std::string Inspector::GetRemappedNameForEntryPoint( const std::string& entry_point) { - // TODO(rharrison): Reenable once all of the backends are using the renamed - // entry points. - - // auto* func = FindEntryPointByName(entry_point); - // if (!func) { - // return {}; - // } - // return func->name(); - return entry_point; + auto* func = FindEntryPointByName(entry_point); + if (!func) { + return {}; + } + return namer_->NameFor(func->symbol()); } std::map Inspector::GetConstantIDs() { diff --git a/src/inspector/inspector.h b/src/inspector/inspector.h index 552dab67bb..ea82e1baa6 100644 --- a/src/inspector/inspector.h +++ b/src/inspector/inspector.h @@ -25,6 +25,7 @@ #include "src/ast/pipeline_stage.h" #include "src/inspector/entry_point.h" #include "src/inspector/scalar.h" +#include "src/namer.h" namespace tint { namespace inspector { @@ -72,7 +73,7 @@ class Inspector { public: /// Constructor /// @param module Shader module to extract information from. - explicit Inspector(const ast::Module& module); + explicit Inspector(ast::Module& module); ~Inspector(); /// @returns error messages from the Inspector @@ -128,6 +129,7 @@ class Inspector { private: const ast::Module& module_; + std::unique_ptr namer_; std::string error_; /// @param name name of the entry point to find