aboutsummaryrefslogtreecommitdiff
path: root/layers/descriptor_sets.cpp
diff options
context:
space:
mode:
authorTobin Ehlis <tobine@google.com>2017-10-11 08:48:00 -0600
committerTobin Ehlis <tobine@google.com>2017-10-12 10:51:41 -0600
commita92a2ef006274c08585058a1edbe5e911aea801e (patch)
treed5ce1c885d6ca37a4cca2cb7b18ddfc188a2651c /layers/descriptor_sets.cpp
parent61d5a562ba4e4a70142658b13a99e40d3c833b78 (diff)
downloadusermoji-a92a2ef006274c08585058a1edbe5e911aea801e.tar.xz
layers:Verify valid buffer for tex buff ds update
Fixes #2104 Make sure that buffer underlying the bufferView of texel buffer for a uniform or storage texel buffer update has a valid buffer behind it. Object tracker only checks to make sure that the view itself hasn't been destroyed, so need this extra level of checking at this level to avoid crash.
Diffstat (limited to 'layers/descriptor_sets.cpp')
-rw-r--r--layers/descriptor_sets.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp
index 6577fbb5..5c8981e5 100644
--- a/layers/descriptor_sets.cpp
+++ b/layers/descriptor_sets.cpp
@@ -1510,7 +1510,16 @@ bool cvdescriptorset::DescriptorSet::VerifyWriteUpdateContents(const VkWriteDesc
return false;
}
auto buffer = bv_state->create_info.buffer;
- if (!ValidateBufferUsage(GetBufferState(device_data_, buffer), update->descriptorType, error_code, error_msg)) {
+ auto buffer_state = GetBufferState(device_data_, buffer);
+ // Verify that buffer underlying the view hasn't been destroyed prematurely
+ if (!buffer_state) {
+ *error_code = VALIDATION_ERROR_15c00286;
+ std::stringstream error_str;
+ error_str << "Attempted write update to texel buffer descriptor failed because underlying buffer (" << buffer
+ << ") has been destroyed: " << error_msg->c_str();
+ *error_msg = error_str.str();
+ return false;
+ } else if (!ValidateBufferUsage(buffer_state, update->descriptorType, error_code, error_msg)) {
std::stringstream error_str;
error_str << "Attempted write update to texel buffer descriptor failed due to: " << error_msg->c_str();
*error_msg = error_str.str();