layers:Check all memory bindings
There are a few places in the code where we assume that an image or
buffer doesn't have a sparse binding. These cases break with sparse
bindings.
To fix I added a function to BINDING class to retrieve all memory
bindings and then updated a few spots with bad assumption to make use
of this new GetBoundMemory() function.
diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp
index d231543..4d06845 100644
--- a/layers/descriptor_sets.cpp
+++ b/layers/descriptor_sets.cpp
@@ -406,14 +406,15 @@
*error = error_str.str();
return false;
} else {
- auto mem_entry = getMemObjInfo(device_data_, buffer_node->binding.mem);
- if (!mem_entry) {
- std::stringstream error_str;
- error_str << "Descriptor in binding #" << binding << " at global descriptor index " << i
- << " uses buffer " << buffer << " that references invalid memory "
- << buffer_node->binding.mem << ".";
- *error = error_str.str();
- return false;
+ for (auto mem_binding : buffer_node->GetBoundMemory()) {
+ if (!getMemObjInfo(device_data_, mem_binding)) {
+ std::stringstream error_str;
+ error_str << "Descriptor in binding #" << binding << " at global descriptor index " << i
+ << " uses buffer " << buffer << " that references invalid memory " << mem_binding
+ << ".";
+ *error = error_str.str();
+ return false;
+ }
}
}
if (descriptors_[i]->IsDynamic()) {