aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobin Ehlis <tobine@google.com>2018-03-16 07:54:24 -0600
committerTobin Ehlis <tobine@google.com>2018-03-16 10:39:15 -0600
commitb02ef398e9f306992cb86b4735f2454d90f24bf2 (patch)
tree75db1aa79cc2a2052a0d3ca50ac7ed6d88b31cd1
parent7ffa65f0e77f4c14fa5c2bed9858d04ce3422269 (diff)
downloadusermoji-b02ef398e9f306992cb86b4735f2454d90f24bf2.tar.xz
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.
-rw-r--r--layers/descriptor_sets.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp
index 66a8a48e..26796a03 100644
--- a/layers/descriptor_sets.cpp
+++ b/layers/descriptor_sets.cpp
@@ -620,6 +620,22 @@ bool cvdescriptorset::DescriptorSet::ValidateDrawState(const std::map<uint32_t,
return false;
}
}
+ if (descriptor_class == ImageSampler || descriptor_class == PlainSampler) {
+ // Verify Sampler still valid
+ VkSampler sampler;
+ if (descriptor_class == ImageSampler) {
+ sampler = static_cast<ImageSamplerDescriptor *>(descriptors_[i].get())->GetSampler();
+ } else {
+ sampler = static_cast<SamplerDescriptor *>(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;
+ }
+ }
}
}
}