From 6721474e9a8cb4a16a08c9622dee091ed3b05228 Mon Sep 17 00:00:00 2001 From: Petr Kraus Date: Sun, 17 Dec 2017 17:37:33 +0100 Subject: layers: Ignore pImmutableSamplers on non-samplers --- layers/object_tracker_utils.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'layers/object_tracker_utils.cpp') diff --git a/layers/object_tracker_utils.cpp b/layers/object_tracker_utils.cpp index f4f148db..501083b2 100644 --- a/layers/object_tracker_utils.cpp +++ b/layers/object_tracker_utils.cpp @@ -695,6 +695,41 @@ VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainImagesKHR(VkDevice device, VkSwapchai return result; } +VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkDescriptorSetLayout *pSetLayout) { + bool skip = false; + { + std::lock_guard lock(global_lock); + skip |= + ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_1f805601, VALIDATION_ERROR_UNDEFINED); + if (pCreateInfo) { + if (pCreateInfo->pBindings) { + for (uint32_t binding_index = 0; binding_index < pCreateInfo->bindingCount; ++binding_index) { + const VkDescriptorSetLayoutBinding &binding = pCreateInfo->pBindings[binding_index]; + const bool is_sampler_type = binding.descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER || + binding.descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; + if (binding.pImmutableSamplers && is_sampler_type) { + for (uint32_t index2 = 0; index2 < binding.descriptorCount; ++index2) { + const VkSampler sampler = binding.pImmutableSamplers[index2]; + skip |= ValidateObject(device, sampler, kVulkanObjectTypeSampler, false, VALIDATION_ERROR_04e00234, + VALIDATION_ERROR_UNDEFINED); + } + } + } + } + } + } + if (skip) return VK_ERROR_VALIDATION_FAILED_EXT; + VkResult result = + get_dispatch_table(ot_device_table_map, device)->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout); + if (VK_SUCCESS == result) { + std::lock_guard lock(global_lock); + CreateObject(device, *pSetLayout, kVulkanObjectTypeDescriptorSetLayout, pAllocator); + } + return result; +} + VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties *pQueueFamilyProperties) { -- cgit v1.2.3