From 4f6526f13869127a2c4d329f2f8231d3843d4c69 Mon Sep 17 00:00:00 2001 From: John Zulauf Date: Tue, 23 Jan 2018 11:27:35 -0700 Subject: layers: Add push descriptor set layout create VUID Add VUID checks to vkCreateDescriptorSetLayout for push descriptor sets. Additional checks include: VALIDATION_ERROR_05000230 VkDescriptorSetLayoutCreateInfo-flags-00280 VALIDATION_ERROR_05000232 VkDescriptorSetLayoutCreateInfo-flags-00281 Also added check for use of VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR when the required extension VK_KHR_push_descriptor is not enabled. Updated CreateDescriptorSetBindingWithIgnoredSamplers test, which violated the above check. Change-Id: Ie009019bbb7859553df92473796a1a929a9464f7 --- layers/core_validation.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'layers/core_validation.cpp') diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index b747add6..c36d6477 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -166,6 +166,11 @@ struct layer_data { PHYS_DEV_PROPERTIES_NODE phys_dev_properties = {}; VkPhysicalDeviceMemoryProperties phys_dev_mem_props = {}; VkPhysicalDeviceProperties phys_dev_props = {}; + // Device extension properties -- storing properties gathered from VkPhysicalDeviceProperties2KHR::pNext chain + struct DeviceExtensionProperties { + uint32_t max_push_descriptors; // from VkPhysicalDevicePushDescriptorPropertiesKHR::maxPushDescriptors + }; + DeviceExtensionProperties phys_dev_ext_props = {}; bool external_sync_warning = false; }; @@ -2173,6 +2178,15 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice gpu, const VkDevice // Store physical device properties and physical device mem limits into device layer_data structs instance_data->dispatch_table.GetPhysicalDeviceMemoryProperties(gpu, &device_data->phys_dev_mem_props); instance_data->dispatch_table.GetPhysicalDeviceProperties(gpu, &device_data->phys_dev_props); + + if (device_data->extensions.vk_khr_push_descriptor) { + // Get the needed push_descriptor limits + auto push_descriptor_prop = lvl_init_struct(); + auto prop2 = lvl_init_struct(&push_descriptor_prop); + instance_data->dispatch_table.GetPhysicalDeviceProperties2KHR(gpu, &prop2); + device_data->phys_dev_ext_props.max_push_descriptors = push_descriptor_prop.maxPushDescriptors; + } + lock.unlock(); ValidateLayerOrdering(*pCreateInfo); @@ -4704,7 +4718,9 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateSampler(VkDevice device, const VkSamplerCre static bool PreCallValidateCreateDescriptorSetLayout(layer_data *dev_data, const VkDescriptorSetLayoutCreateInfo *create_info) { if (dev_data->instance_data->disabled.create_descriptor_set_layout) return false; - return cvdescriptorset::DescriptorSetLayout::ValidateCreateInfo(dev_data->report_data, create_info); + return cvdescriptorset::DescriptorSetLayout::ValidateCreateInfo(dev_data->report_data, create_info, + dev_data->extensions.vk_khr_push_descriptor, + dev_data->phys_dev_ext_props.max_push_descriptors); } static void PostCallRecordCreateDescriptorSetLayout(layer_data *dev_data, const VkDescriptorSetLayoutCreateInfo *create_info, -- cgit v1.2.3