layers: Add VkVertexInputBindingDescription VUs
authorJeremy Hayes <jeremy@lunarg.com>
Fri, 5 May 2017 00:08:49 +0000 (18:08 -0600)
committerJeremy Hayes <jeremy-lunarg@users.noreply.github.com>
Fri, 5 May 2017 21:43:46 +0000 (15:43 -0600)
Change-Id: Id9cb603dce7a49b21f9f8252baef692b4f6787f7

layers/parameter_validation.cpp
layers/vk_validation_error_database.txt

index c8bf83ea56df5a29b4fca30539445afbc919a00c..991e2488d42dc0a2bf704a8931b1b388d0d3d084 100644 (file)
@@ -2921,6 +2921,32 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateGraphicsPipelines(VkDevice device, VkPipeli
     if (pCreateInfos != nullptr) {
         for (uint32_t i = 0; i < createInfoCount; ++i) {
             // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml
+            if (pCreateInfos[i].pVertexInputState != nullptr) {
+                auto const &vertex_input_state = pCreateInfos[i].pVertexInputState;
+                for (uint32_t d = 0; d < vertex_input_state->vertexBindingDescriptionCount; ++d) {
+                    auto const &vertex_bind_desc = vertex_input_state->pVertexBindingDescriptions[d];
+                    if (vertex_bind_desc.binding >= device_data->device_limits.maxVertexInputBindings) {
+                        skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
+                                        __LINE__, VALIDATION_ERROR_01407, LayerName,
+                                        "vkCreateGraphicsPipelines: parameter "
+                                        "pCreateInfos[%u].pVertexInputState->pVertexBindingDescriptions[%u].binding (%u) is "
+                                        "greater than or equal to VkPhysicalDeviceLimits::maxVertexInputBindings (%u). %s",
+                                        i, d, vertex_bind_desc.binding, device_data->device_limits.maxVertexInputBindings,
+                                        validation_error_map[VALIDATION_ERROR_01407]);
+                    }
+
+                    if (vertex_bind_desc.stride >= device_data->device_limits.maxVertexInputBindingStride) {
+                        skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
+                                        __LINE__, VALIDATION_ERROR_01408, LayerName,
+                                        "vkCreateGraphicsPipelines: parameter "
+                                        "pCreateInfos[%u].pVertexInputState->pVertexBindingDescriptions[%u].stride (%u) is greater "
+                                        "than VkPhysicalDeviceLimits::maxVertexInputBindingStride (%u). %s",
+                                        i, d, vertex_bind_desc.stride, device_data->device_limits.maxVertexInputBindingStride,
+                                        validation_error_map[VALIDATION_ERROR_01408]);
+                    }
+                }
+            }
+
             if (pCreateInfos[i].pStages != nullptr) {
                 bool has_control = false;
                 bool has_eval = false;
index 52edec150820d1d1b07adbeb64ddb5c1f70d834c..5141411349e02a31ad4303df45132ce825dc5707 100644 (file)
@@ -1352,8 +1352,8 @@ VALIDATION_ERROR_01403~^~N~^~Unknown~^~vkCmdDrawIndexedIndirectCountAMD~^~For mo
 VALIDATION_ERROR_01404~^~N~^~Unknown~^~vkCmdDrawIndexedIndirectCountAMD~^~For more information refer to Vulkan Spec Section '20.2. Vertex Input Description' which states 'flags must be 0' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkPipelineVertexInputStateCreateInfo)~^~implicit, TBD in parameter validation layer.
 VALIDATION_ERROR_01405~^~N~^~Unknown~^~vkCmdDrawIndexedIndirectCountAMD~^~For more information refer to Vulkan Spec Section '20.2. Vertex Input Description' which states 'If vertexBindingDescriptionCount is not 0, pVertexBindingDescriptions must be a pointer to an array of vertexBindingDescriptionCount valid VkVertexInputBindingDescription structures' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkPipelineVertexInputStateCreateInfo)~^~implicit
 VALIDATION_ERROR_01406~^~N~^~Unknown~^~vkCmdDrawIndexedIndirectCountAMD~^~For more information refer to Vulkan Spec Section '20.2. Vertex Input Description' which states 'If vertexAttributeDescriptionCount is not 0, pVertexAttributeDescriptions must be a pointer to an array of vertexAttributeDescriptionCount valid VkVertexInputAttributeDescription structures' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkPipelineVertexInputStateCreateInfo)~^~implicit
-VALIDATION_ERROR_01407~^~N~^~Unknown~^~vkCmdDrawIndexedIndirectCountAMD~^~For more information refer to Vulkan Spec Section '20.2. Vertex Input Description' which states 'binding must be less than VkPhysicalDeviceLimits::maxVertexInputBindings' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkVertexInputRate)~^~
-VALIDATION_ERROR_01408~^~N~^~Unknown~^~vkCmdDrawIndexedIndirectCountAMD~^~For more information refer to Vulkan Spec Section '20.2. Vertex Input Description' which states 'stride must be less than or equal to VkPhysicalDeviceLimits::maxVertexInputBindingStride' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkVertexInputRate)~^~
+VALIDATION_ERROR_01407~^~Y~^~VALIDATION_ERROR_01407~^~vkCmdDrawIndexedIndirectCountAMD~^~For more information refer to Vulkan Spec Section '20.2. Vertex Input Description' which states 'binding must be less than VkPhysicalDeviceLimits::maxVertexInputBindings' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkVertexInputRate)~^~
+VALIDATION_ERROR_01408~^~Y~^~VALIDATION_ERROR_01408~^~vkCmdDrawIndexedIndirectCountAMD~^~For more information refer to Vulkan Spec Section '20.2. Vertex Input Description' which states 'stride must be less than or equal to VkPhysicalDeviceLimits::maxVertexInputBindingStride' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkVertexInputRate)~^~
 VALIDATION_ERROR_01409~^~N~^~Unknown~^~vkCmdDrawIndexedIndirectCountAMD~^~For more information refer to Vulkan Spec Section '20.2. Vertex Input Description' which states 'inputRate must be a valid VkVertexInputRate value' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkVertexInputRate)~^~implicit
 VALIDATION_ERROR_01410~^~N~^~Unknown~^~vkCmdDrawIndexedIndirectCountAMD~^~For more information refer to Vulkan Spec Section '20.2. Vertex Input Description' which states 'location must be less than VkPhysicalDeviceLimits::maxVertexInputAttributes' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkVertexInputAttributeDescription)~^~
 VALIDATION_ERROR_01411~^~N~^~Unknown~^~vkCmdDrawIndexedIndirectCountAMD~^~For more information refer to Vulkan Spec Section '20.2. Vertex Input Description' which states 'binding must be less than VkPhysicalDeviceLimits::maxVertexInputBindings' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkVertexInputAttributeDescription)~^~