From b02ef398e9f306992cb86b4735f2454d90f24bf2 Mon Sep 17 00:00:00 2001 From: Tobin Ehlis Date: Fri, 16 Mar 2018 07:54:24 -0600 Subject: [PATCH] layers:Check for descriptor with invalid sampler Fixes #2485 Verify that a descriptor's sampler is still valid at draw time. We had a validation hole here where we missed this case if the sampler was destroyed before the related descriptor was bound to a cmd buffer. This plugs that hole by making sure all sampler descriptors used at draw time still have a valid sampler. --- layers/descriptor_sets.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp index 66a8a48..26796a0 100644 --- a/layers/descriptor_sets.cpp +++ b/layers/descriptor_sets.cpp @@ -620,6 +620,22 @@ bool cvdescriptorset::DescriptorSet::ValidateDrawState(const std::map(descriptors_[i].get())->GetSampler(); + } else { + sampler = static_cast(descriptors_[i].get())->GetSampler(); + } + if (!ValidateSampler(sampler, device_data_)) { + std::stringstream error_str; + error_str << "Descriptor in binding #" << binding << " at global descriptor index " << i + << " is using sampler " << sampler << " that has been destroyed."; + *error = error_str.str(); + return false; + } + } } } } -- 2.7.4