diff options
| author | Petr Kraus <petr_kraus@email.cz> | 2017-09-27 18:56:51 +0200 |
|---|---|---|
| committer | Mark Lobodzinski <mark@lunarg.com> | 2017-10-04 08:53:27 -0600 |
| commit | c9123fa78325215f14b9f034580f5b4e07a71958 (patch) | |
| tree | 4dcfba89407d1c1717240e85981725b34a93d98a | |
| parent | 569247a4c5c4f7aa57b61fe563bccada3b8d3d6b (diff) | |
| download | usermoji-c9123fa78325215f14b9f034580f5b4e07a71958.tar.xz | |
layers: Implement vkCreateDescriptorPool() checks
Check explicit validity of vkCreateDescriptorPool():
- maxSets > 0
- pPoolSizes[].descriptorCount > 0
+ implement relevant tests
| -rw-r--r-- | layers/parameter_validation_utils.cpp | 32 | ||||
| -rw-r--r-- | layers/vk_validation_error_database.txt | 4 |
2 files changed, 33 insertions, 3 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 diff --git a/layers/vk_validation_error_database.txt b/layers/vk_validation_error_database.txt index 283d965d..655df680 100644 --- a/layers/vk_validation_error_database.txt +++ b/layers/vk_validation_error_database.txt @@ -335,13 +335,13 @@ VALIDATION_ERROR_046002ae~^~Y~^~Maint1BindingSliceOf3DImage~^~vkUpdateDescriptor VALIDATION_ERROR_046002b0~^~Y~^~Unknown~^~vkUpdateDescriptorSets~^~VUID-VkDescriptorImageInfo-imageLayout-00344~^~core~^~The spec valid usage text states 'imageLayout must match the actual VkImageLayout of each subresource accessible from imageView at the time this descriptor is accessed' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkDescriptorImageInfo-imageLayout-00344)~^~ VALIDATION_ERROR_04600c36~^~N~^~None~^~VkDescriptorImageInfo~^~VUID-VkDescriptorImageInfo-sampler-01563~^~(VK_KHR_sampler_ycbcr_conversion)~^~The spec valid usage text states 'If sampler is used and enables sampler Y'CBCR conversion:' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-VkDescriptorImageInfo-sampler-01563)~^~ VALIDATION_ERROR_04600c38~^~N~^~None~^~VkDescriptorImageInfo~^~VUID-VkDescriptorImageInfo-sampler-01564~^~(VK_KHR_sampler_ycbcr_conversion)~^~The spec valid usage text states 'If sampler is used and does not enable sampler Y'CBCR conversion and the VkFormat of the image is a multi-planar format, the image must have been created with VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT, and the aspectMask of the imageView must be VK_IMAGE_ASPECT_PLANE_0_BIT_KHR, VK_IMAGE_ASPECT_PLANE_1_BIT_KHR or (for three-plane formats only) VK_IMAGE_ASPECT_PLANE_2_BIT_KHR' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-VkDescriptorImageInfo-sampler-01564)~^~ -VALIDATION_ERROR_0480025a~^~N~^~Unknown~^~vkCreateDescriptorPool~^~VUID-VkDescriptorPoolCreateInfo-maxSets-00301~^~core~^~The spec valid usage text states 'maxSets must be greater than 0' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkDescriptorPoolCreateInfo-maxSets-00301)~^~ +VALIDATION_ERROR_0480025a~^~Y~^~InvalidCreateDescriptorPool~^~vkCreateDescriptorPool~^~VUID-VkDescriptorPoolCreateInfo-maxSets-00301~^~core~^~The spec valid usage text states 'maxSets must be greater than 0' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkDescriptorPoolCreateInfo-maxSets-00301)~^~ VALIDATION_ERROR_04809001~^~Y~^~Unknown~^~vkCreateDescriptorPool~^~VUID-VkDescriptorPoolCreateInfo-flags-parameter~^~core~^~The spec valid usage text states 'flags must be a valid combination of VkDescriptorPoolCreateFlagBits values' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkDescriptorPoolCreateInfo-flags-parameter)~^~implicit, TBD in parameter validation layer. VALIDATION_ERROR_0481c40d~^~Y~^~Unknown~^~vkCreateDescriptorPool~^~VUID-VkDescriptorPoolCreateInfo-pNext-pNext~^~core~^~The spec valid usage text states 'pNext must be NULL' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkDescriptorPoolCreateInfo-pNext-pNext)~^~implicit, TBD in parameter validation layer. VALIDATION_ERROR_0481e401~^~Y~^~Unknown~^~vkCreateDescriptorPool~^~VUID-VkDescriptorPoolCreateInfo-pPoolSizes-parameter~^~core~^~The spec valid usage text states 'pPoolSizes must be a pointer to an array of poolSizeCount valid VkDescriptorPoolSize structures' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkDescriptorPoolCreateInfo-pPoolSizes-parameter)~^~implicit VALIDATION_ERROR_0482881b~^~Y~^~Unknown~^~vkCreateDescriptorPool~^~VUID-VkDescriptorPoolCreateInfo-poolSizeCount-arraylength~^~core~^~The spec valid usage text states 'poolSizeCount must be greater than 0' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkDescriptorPoolCreateInfo-poolSizeCount-arraylength)~^~implicit VALIDATION_ERROR_0482b00b~^~Y~^~Unknown~^~vkCreateDescriptorPool~^~VUID-VkDescriptorPoolCreateInfo-sType-sType~^~core~^~The spec valid usage text states 'sType must be VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkDescriptorPoolCreateInfo-sType-sType)~^~implicit, TBD in parameter validation layer. -VALIDATION_ERROR_04a0025c~^~N~^~Unknown~^~vkCreateDescriptorPool~^~VUID-VkDescriptorPoolSize-descriptorCount-00302~^~core~^~The spec valid usage text states 'descriptorCount must be greater than 0' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkDescriptorPoolSize-descriptorCount-00302)~^~ +VALIDATION_ERROR_04a0025c~^~Y~^~InvalidCreateDescriptorPool~^~vkCreateDescriptorPool~^~VUID-VkDescriptorPoolSize-descriptorCount-00302~^~core~^~The spec valid usage text states 'descriptorCount must be greater than 0' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkDescriptorPoolSize-descriptorCount-00302)~^~ VALIDATION_ERROR_04a30401~^~Y~^~Unknown~^~vkCreateDescriptorPool~^~VUID-VkDescriptorPoolSize-type-parameter~^~core~^~The spec valid usage text states 'type must be a valid VkDescriptorType value' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkDescriptorPoolSize-type-parameter)~^~implicit VALIDATION_ERROR_04c00009~^~Y~^~Unknown~^~vkAllocateDescriptorSets~^~VUID-VkDescriptorSetAllocateInfo-commonparent~^~core~^~The spec valid usage text states 'Both of descriptorPool, and the elements of pSetLayouts must have been created, allocated, or retrieved from the same VkDevice' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkDescriptorSetAllocateInfo-commonparent)~^~implicit VALIDATION_ERROR_04c00264~^~Y~^~AllocDescriptorFromEmptyPool~^~vkAllocateDescriptorSets~^~VUID-VkDescriptorSetAllocateInfo-descriptorSetCount-00306~^~core~^~The spec valid usage text states 'descriptorSetCount must not be greater than the number of sets that are currently available for allocation in descriptorPool' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkDescriptorSetAllocateInfo-descriptorSetCount-00306)~^~ |
