From 1fdbcf2c5e4415e586a4baecbdacf315090eb137 Mon Sep 17 00:00:00 2001 From: John Zulauf Date: Wed, 24 Jan 2018 11:54:05 -0700 Subject: layers: Add check for push descriptor allocation Add validation check for attempting to use vkAllocateDescriptorSets with a descriptor set layout create with the push descriptor flag VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR set. Checks added: VALIDATION_ERROR_04c00268 VUID-VkDescriptorSetAllocateInfo-pSetLayouts-00308 Change-Id: I81bed8e7eb5396f7a716b6a14b648b5051127259 --- layers/descriptor_sets.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'layers/descriptor_sets.cpp') diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp index 1adc81d5..95f81c76 100644 --- a/layers/descriptor_sets.cpp +++ b/layers/descriptor_sets.cpp @@ -1824,12 +1824,16 @@ bool cvdescriptorset::ValidateAllocateDescriptorSets(const core_validation::laye for (uint32_t i = 0; i < p_alloc_info->descriptorSetCount; i++) { auto layout = GetDescriptorSetLayout(dev_data, p_alloc_info->pSetLayouts[i]); - if (!layout) { - skip |= - log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT, - HandleToUint64(p_alloc_info->pSetLayouts[i]), __LINE__, DRAWSTATE_INVALID_LAYOUT, "DS", - "Unable to find set layout node for layout 0x%" PRIxLEAST64 " specified in vkAllocateDescriptorSets() call", - HandleToUint64(p_alloc_info->pSetLayouts[i])); + if (layout) { // nullptr layout indicates no valid layout handle for this device, validated/logged in object_tracker + if (layout->GetCreateFlags() & VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR) { + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT, + HandleToUint64(p_alloc_info->pSetLayouts[i]), __LINE__, VALIDATION_ERROR_04c00268, "DS", + "Layout 0x%" PRIxLEAST64 " specified at pSetLayouts[%" PRIu32 + "] in vkAllocateDescriptorSets() was created with invalid flag %s set. %s", + HandleToUint64(p_alloc_info->pSetLayouts[i]), i, + "VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR", + validation_error_map[VALIDATION_ERROR_04c00268]); + } } } if (!GetDeviceExtensions(dev_data)->vk_khr_maintenance1) { -- cgit v1.2.3