Add location data to input/output variable reflection

Adds this data to the Inspector API, as well as needed internal
utility methods.
Updates and expands tests to cover changes.

BUG=tint:452

Change-Id: I598f8149cb6abd13abf606416ae61e615b99e1e1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38200
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
Ryan Harrison
2021-01-20 18:58:17 +00:00
committed by Commit Bot service account
parent ed14524b1e
commit afb8cfb254
6 changed files with 135 additions and 38 deletions

View File

@@ -64,10 +64,20 @@ std::vector<EntryPoint> Inspector::GetEntryPoints() {
for (auto* var : func->referenced_module_variables()) {
auto name = module_.SymbolToName(var->symbol());
if (var->storage_class() == ast::StorageClass::kInput) {
entry_point.input_variables.push_back(name);
StageVariable stage_variable;
stage_variable.name = name;
auto* location_decoration = var->GetLocationDecoration();
if (location_decoration) {
stage_variable.has_location_decoration = true;
stage_variable.location_decoration = location_decoration->value();
} else {
entry_point.output_variables.push_back(name);
stage_variable.has_location_decoration = false;
}
if (var->storage_class() == ast::StorageClass::kInput) {
entry_point.input_variables.push_back(stage_variable);
} else if (var->storage_class() == ast::StorageClass::kOutput) {
entry_point.output_variables.push_back(stage_variable);
}
}
result.push_back(std::move(entry_point));