From 6a2fe40c31c278bd23f40d6ec872172afa311f1e Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Mon, 15 May 2017 13:17:18 -0600 Subject: [PATCH] layers: Update ObjectTracker for new extensions vkGetPhysicalDeviceSurfaceFormats2KHR, vkGetSwapchainStatusKHR, and vkGetPhysicalDeviceSurfaceCapabilities2KHR. Change-Id: I726880924300e06209013ae39a8c4e019d4c2266 --- layers/object_tracker.cpp | 55 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/layers/object_tracker.cpp b/layers/object_tracker.cpp index 21ba1511..c7424c23 100644 --- a/layers/object_tracker.cpp +++ b/layers/object_tracker.cpp @@ -5041,6 +5041,61 @@ VKAPI_ATTR void VKAPI_CALL SetHdrMetadataEXT(VkDevice device, uint32_t swapchain } } +VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainStatusKHR(VkDevice device, VkSwapchainKHR swapchain) { + bool skip = false; + { + std::lock_guard lock(global_lock); + skip |= + ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); + skip |= ValidateObject(device, swapchain, kVulkanObjectTypeSwapchainKHR, false, VALIDATION_ERROR_UNDEFINED, + VALIDATION_ERROR_UNDEFINED); + } + if (skip) { + return VK_ERROR_VALIDATION_FAILED_EXT; + } + VkResult result = get_dispatch_table(ot_device_table_map, device)->GetSwapchainStatusKHR(device, swapchain); + return result; +} + +VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, + VkSurfaceCapabilities2KHR *pSurfaceCapabilities) { + bool skip = false; + { + std::lock_guard lock(global_lock); + skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_UNDEFINED, + VALIDATION_ERROR_UNDEFINED); + skip |= ValidateObject(physicalDevice, pSurfaceInfo->surface, kVulkanObjectTypeSurfaceKHR, false, + VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); + } + if (skip) { + return VK_ERROR_VALIDATION_FAILED_EXT; + } + VkResult result = get_dispatch_table(ot_instance_table_map, physicalDevice) + ->GetPhysicalDeviceSurfaceCapabilities2KHR(physicalDevice, pSurfaceInfo, pSurfaceCapabilities); + return result; +} + +VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, + uint32_t *pSurfaceFormatCount, + VkSurfaceFormat2KHR *pSurfaceFormats) { + bool skip = false; + { + std::lock_guard lock(global_lock); + skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_UNDEFINED, + VALIDATION_ERROR_UNDEFINED); + skip |= ValidateObject(physicalDevice, pSurfaceInfo->surface, kVulkanObjectTypeSurfaceKHR, false, + VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); + } + if (skip) { + return VK_ERROR_VALIDATION_FAILED_EXT; + } + VkResult result = get_dispatch_table(ot_instance_table_map, physicalDevice) + ->GetPhysicalDeviceSurfaceFormats2KHR(physicalDevice, pSurfaceInfo, pSurfaceFormatCount, pSurfaceFormats); + return result; +} + static inline PFN_vkVoidFunction InterceptCoreDeviceCommand(const char *name) { if (!name || name[0] != 'v' || name[1] != 'k') return NULL; -- 2.34.1