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 <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
dan sinclair 2021-01-11 16:24:32 +00:00 committed by dan sinclair
parent 8d6e625ef4
commit f3e3586835
2 changed files with 10 additions and 11 deletions

View File

@ -43,7 +43,8 @@
namespace tint { namespace tint {
namespace inspector { namespace inspector {
Inspector::Inspector(const ast::Module& module) : module_(module) {} Inspector::Inspector(ast::Module& module)
: module_(module), namer_(std::make_unique<UnsafeNamer>(&module)) {}
Inspector::~Inspector() = default; Inspector::~Inspector() = default;
@ -77,15 +78,11 @@ std::vector<EntryPoint> Inspector::GetEntryPoints() {
std::string Inspector::GetRemappedNameForEntryPoint( std::string Inspector::GetRemappedNameForEntryPoint(
const std::string& entry_point) { const std::string& entry_point) {
// TODO(rharrison): Reenable once all of the backends are using the renamed auto* func = FindEntryPointByName(entry_point);
// entry points. if (!func) {
return {};
// auto* func = FindEntryPointByName(entry_point); }
// if (!func) { return namer_->NameFor(func->symbol());
// return {};
// }
// return func->name();
return entry_point;
} }
std::map<uint32_t, Scalar> Inspector::GetConstantIDs() { std::map<uint32_t, Scalar> Inspector::GetConstantIDs() {

View File

@ -25,6 +25,7 @@
#include "src/ast/pipeline_stage.h" #include "src/ast/pipeline_stage.h"
#include "src/inspector/entry_point.h" #include "src/inspector/entry_point.h"
#include "src/inspector/scalar.h" #include "src/inspector/scalar.h"
#include "src/namer.h"
namespace tint { namespace tint {
namespace inspector { namespace inspector {
@ -72,7 +73,7 @@ class Inspector {
public: public:
/// Constructor /// Constructor
/// @param module Shader module to extract information from. /// @param module Shader module to extract information from.
explicit Inspector(const ast::Module& module); explicit Inspector(ast::Module& module);
~Inspector(); ~Inspector();
/// @returns error messages from the Inspector /// @returns error messages from the Inspector
@ -128,6 +129,7 @@ class Inspector {
private: private:
const ast::Module& module_; const ast::Module& module_;
std::unique_ptr<Namer> namer_;
std::string error_; std::string error_;
/// @param name name of the entry point to find /// @param name name of the entry point to find