layers: Implement vkCreateDescriptorPool() checks
Check explicit validity of vkCreateDescriptorPool():
- maxSets > 0
- pPoolSizes[].descriptorCount > 0
+ implement relevant tests
diff --git a/layers/parameter_validation_utils.cpp b/layers/parameter_validation_utils.cpp
index 4f6f5b8..d40c7ea 100644
--- a/layers/parameter_validation_utils.cpp
+++ b/layers/parameter_validation_utils.cpp
@@ -2344,6 +2344,35 @@
return false;
}
+bool pv_vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo,
+ const VkAllocationCallbacks *pAllocator, VkDescriptorPool *pDescriptorPool) {
+ auto device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map);
+ bool skip = false;
+
+ if (pCreateInfo) {
+ if (pCreateInfo->maxSets <= 0) {
+ skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT, VK_NULL_HANDLE, __LINE__, VALIDATION_ERROR_0480025a,
+ LayerName, "vkCreateDescriptorPool(): pCreateInfo->maxSets is not greater than 0. %s",
+ validation_error_map[VALIDATION_ERROR_0480025a]);
+ }
+
+ if (pCreateInfo->pPoolSizes) {
+ for (uint32_t i = 0; i < pCreateInfo->poolSizeCount; ++i) {
+ if (pCreateInfo->pPoolSizes[i].descriptorCount <= 0) {
+ skip |= log_msg(
+ device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT,
+ VK_NULL_HANDLE, __LINE__, VALIDATION_ERROR_04a0025c, LayerName,
+ "vkCreateDescriptorPool(): pCreateInfo->pPoolSizes[%" PRIu32 "].descriptorCount is not greater than 0. %s",
+ i, validation_error_map[VALIDATION_ERROR_04a0025c]);
+ }
+ }
+ }
+ }
+
+ return skip;
+}
+
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char *funcName) {
const auto item = name_to_funcptr_map.find(funcName);
if (item != name_to_funcptr_map.end()) {
@@ -2378,7 +2407,7 @@
// If additional validation is needed outside of the generated checks, a manual routine can be added to this file
// and the address filled in here. The autogenerated source will call these routines if the pointers are not NULL.
-void InitializeManualParameterValidationFunctionPointers(void) {
+void InitializeManualParameterValidationFunctionPointers() {
custom_functions["vkGetDeviceQueue"] = (void*)pv_vkGetDeviceQueue;
custom_functions["vkCreateBuffer"] = (void*)pv_vkCreateBuffer;
custom_functions["vkCreateImage"] = (void*)pv_vkCreateImage;
@@ -2404,6 +2433,7 @@
custom_functions["vkCmdFillBuffer"] = (void*)pv_vkCmdFillBuffer;
custom_functions["vkCreateSwapchainKHR"] = (void*)pv_vkCreateSwapchainKHR;
custom_functions["vkQueuePresentKHR"] = (void*)pv_vkQueuePresentKHR;
+ custom_functions["vkCreateDescriptorPool"] = (void*)pv_vkCreateDescriptorPool;
}
} // namespace parameter_validation