aboutsummaryrefslogtreecommitdiff
path: root/layers/parameter_validation_utils.cpp
diff options
context:
space:
mode:
authorPetr Kraus <petr_kraus@email.cz>2017-09-27 18:56:51 +0200
committerMark Lobodzinski <mark@lunarg.com>2017-10-04 08:53:27 -0600
commitc9123fa78325215f14b9f034580f5b4e07a71958 (patch)
tree4dcfba89407d1c1717240e85981725b34a93d98a /layers/parameter_validation_utils.cpp
parent569247a4c5c4f7aa57b61fe563bccada3b8d3d6b (diff)
downloadusermoji-c9123fa78325215f14b9f034580f5b4e07a71958.tar.xz
layers: Implement vkCreateDescriptorPool() checks
Check explicit validity of vkCreateDescriptorPool(): - maxSets > 0 - pPoolSizes[].descriptorCount > 0 + implement relevant tests
Diffstat (limited to 'layers/parameter_validation_utils.cpp')
-rw-r--r--layers/parameter_validation_utils.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/layers/parameter_validation_utils.cpp b/layers/parameter_validation_utils.cpp
index 4f6f5b8c..d40c7eaf 100644
--- a/layers/parameter_validation_utils.cpp
+++ b/layers/parameter_validation_utils.cpp
@@ -2344,6 +2344,35 @@ bool pv_vkDebugMarkerSetObjectNameEXT(VkDevice device, const VkDebugMarkerObject
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 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetPhysicalDeviceProcAddr(VkInstance
// 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 @@ void InitializeManualParameterValidationFunctionPointers(void) {
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