aboutsummaryrefslogtreecommitdiff
path: root/layers/descriptor_sets.cpp
diff options
context:
space:
mode:
authorTobin Ehlis <tobine@google.com>2017-07-14 11:25:21 -0600
committerTobin Ehlis <tobine@google.com>2017-07-17 10:52:57 -0600
commit4487010f1e803e8417198c5f2e44b908329926e1 (patch)
tree0db94d3a28acc05e0de56254f5e158345ab99f79 /layers/descriptor_sets.cpp
parentb25a8ac0588042daee94f911578047113a9f3b14 (diff)
downloadusermoji-4487010f1e803e8417198c5f2e44b908329926e1.tar.xz
layers:Handle deleted image view in descriptor
When an image descriptor with a destroyed image view was used we hit an assert. This is not caught upstream and can occur if a descriptor is re-used following image view deletion. Add code to catch this case and report the destroyed image view.
Diffstat (limited to 'layers/descriptor_sets.cpp')
-rw-r--r--layers/descriptor_sets.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp
index c6162ebd..e3caff60 100644
--- a/layers/descriptor_sets.cpp
+++ b/layers/descriptor_sets.cpp
@@ -486,7 +486,15 @@ bool cvdescriptorset::DescriptorSet::ValidateDrawState(const std::map<uint32_t,
auto reqs = binding_pair.second;
auto image_view_state = GetImageViewState(device_data_, image_view);
- assert(image_view_state);
+ if (nullptr == image_view_state) {
+ // Image view must have been destroyed since initial update. Could potentially flag the descriptor
+ // as "invalid" (updated = false) at DestroyImageView() time and detect this error at bind time
+ std::stringstream error_str;
+ error_str << "Descriptor in binding #" << binding << " at global descriptor index " << i
+ << " is using imageView " << image_view << " that has been destroyed.";
+ *error = error_str.str();
+ return false;
+ }
auto image_view_ci = image_view_state->create_info;
if ((reqs & DESCRIPTOR_REQ_ALL_VIEW_TYPE_BITS) && (~reqs & (1 << image_view_ci.viewType))) {