diff options
| author | Petr Kraus <petr_kraus@email.cz> | 2017-12-17 17:37:33 +0100 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2017-12-19 10:04:42 -0700 |
| commit | 6721474e9a8cb4a16a08c9622dee091ed3b05228 (patch) | |
| tree | 1c47d5bb3d6fcd6662d19a09fe7bc2c842a2eebb /layers/object_tracker_utils.cpp | |
| parent | 0ce85c82dd42fbe55f1b62eed75f7b9bcd2043fe (diff) | |
| download | usermoji-6721474e9a8cb4a16a08c9622dee091ed3b05228.tar.xz | |
layers: Ignore pImmutableSamplers on non-samplers
Diffstat (limited to 'layers/object_tracker_utils.cpp')
| -rw-r--r-- | layers/object_tracker_utils.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
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<std::mutex> 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<std::mutex> lock(global_lock); + CreateObject(device, *pSetLayout, kVulkanObjectTypeDescriptorSetLayout, pAllocator); + } + return result; +} + VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties *pQueueFamilyProperties) { |
