Skip to content

Commit

Permalink
layers: add warning if allocated descriptors exceeds pool max
Browse files Browse the repository at this point in the history
  • Loading branch information
HildarTheDorf committed Jan 15, 2025
1 parent 06a6118 commit 9bed1f2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions layers/best_practices/bp_descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ bool BestPractices::PreCallValidateAllocateDescriptorSets(VkDevice device, const
". This pool only has %" PRIu32 " descriptorSets remaining.",
pAllocateInfo->descriptorSetCount, FormatHandle(*pool_state).c_str(), pool_state->GetAvailableSets());
}
auto ads_pool_state = Get<vvl::DescriptorPool>(pAllocateInfo->descriptorPool);
for (auto it = ads_state_data.required_descriptors_by_type.begin(); it != ads_state_data.required_descriptors_by_type.end(); ++it) {
auto available_count = ads_pool_state->GetAvailableCount(it->first);

if (ads_state_data.required_descriptors_by_type.at(it->first) > available_count) {
skip |= LogWarning("BestPractices-VkDescriptorSetAllocateInfo-EmptyDescriptorPoolType", ads_pool_state->Handle(), error_obj.location,
"Unable to allocate %" PRIu32
" descriptors of type %s from %s"
". This pool only has %" PRIu32 " descriptors of this type remaining.",
ads_state_data.required_descriptors_by_type.at(it->first),
string_VkDescriptorType(VkDescriptorType(it->first)), FormatHandle(*ads_pool_state).c_str(),
available_count);
}
}
}

return skip;
Expand Down

0 comments on commit 9bed1f2

Please sign in to comment.