[inspector] Extract ComparisonSampler resource binding information

Adds in method to get resource binding information for comparison
samplers along with tests.

BUG=tint:257

Change-Id: I60f675347d2b9596308b1599d0a9b846615d547e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31980
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
Ryan Harrison
2020-11-06 17:53:45 +00:00
committed by Commit Bot service account
parent 34f90a0097
commit 110af53089
3 changed files with 230 additions and 0 deletions

View File

@@ -211,6 +211,30 @@ std::vector<ResourceBinding> Inspector::GetSamplerResourceBindings(
return result;
}
std::vector<ResourceBinding> Inspector::GetComparisonSamplerResourceBindings(
const std::string& entry_point) {
auto* func = FindEntryPointByName(entry_point);
if (!func) {
return {};
}
std::vector<ResourceBinding> result;
for (auto& rcs : func->referenced_comparison_sampler_variables()) {
ResourceBinding entry;
ast::Variable* var = nullptr;
ast::Function::BindingInfo binding_info;
std::tie(var, binding_info) = rcs;
entry.bind_group = binding_info.set->value();
entry.binding = binding_info.binding->value();
result.push_back(std::move(entry));
}
return result;
}
ast::Function* Inspector::FindEntryPointByName(const std::string& name) {
auto* func = module_.FindFunctionByName(name);
if (!func) {