mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 18:29:23 +00:00
[inspector] Extract storage-buffer information
BUG=tint:257 Change-Id: Ib85d76a3b972226b401e57ba2a632d6252e95f8f Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31080 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
57694c8dab
commit
fcbc6efa8f
@@ -137,14 +137,8 @@ std::map<uint32_t, Scalar> Inspector::GetConstantIDs() {
|
||||
|
||||
std::vector<ResourceBinding> Inspector::GetUniformBufferResourceBindings(
|
||||
const std::string& entry_point) {
|
||||
auto* func = module_.FindFunctionByName(entry_point);
|
||||
auto* func = FindEntryPointByName(entry_point);
|
||||
if (!func) {
|
||||
error_ += entry_point + " was not found!";
|
||||
return {};
|
||||
}
|
||||
|
||||
if (!func->IsEntryPoint()) {
|
||||
error_ += entry_point + " is not an entry point!";
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -173,5 +167,53 @@ std::vector<ResourceBinding> Inspector::GetUniformBufferResourceBindings(
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<ResourceBinding> Inspector::GetStorageBufferResourceBindings(
|
||||
const std::string& entry_point) {
|
||||
auto* func = FindEntryPointByName(entry_point);
|
||||
if (!func) {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<ResourceBinding> result;
|
||||
for (auto& ruv : func->referenced_storagebuffer_variables()) {
|
||||
ResourceBinding entry;
|
||||
ast::Variable* var = nullptr;
|
||||
ast::Function::BindingInfo binding_info;
|
||||
std::tie(var, binding_info) = ruv;
|
||||
if (!var->type()->IsStruct()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entry.bind_group = binding_info.set->value();
|
||||
entry.binding = binding_info.binding->value();
|
||||
entry.min_buffer_binding_size = var->type()->MinBufferBindingSize();
|
||||
|
||||
result.push_back(std::move(entry));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<ResourceBinding>
|
||||
Inspector::GetReadOnlyStorageBufferResourceBindings(const std::string&) {
|
||||
error_ += "GetReadOnlyStorageBufferResourceBindings is not implemented!";
|
||||
return {};
|
||||
}
|
||||
|
||||
ast::Function* Inspector::FindEntryPointByName(const std::string& name) {
|
||||
auto* func = module_.FindFunctionByName(name);
|
||||
if (!func) {
|
||||
error_ += name + " was not found!";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!func->IsEntryPoint()) {
|
||||
error_ += name + " is not an entry point!";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return func;
|
||||
}
|
||||
|
||||
} // namespace inspector
|
||||
} // namespace tint
|
||||
|
||||
Reference in New Issue
Block a user