diff options
| author | Mark Lobodzinski <mark@lunarg.com> | 2016-11-14 10:00:41 -0700 |
|---|---|---|
| committer | Mark Lobodzinski <mark@lunarg.com> | 2016-12-13 10:08:15 -0700 |
| commit | 32884cb56cfb9f7c22ba27144fc6a1b06854e6f3 (patch) | |
| tree | 72db39c3f91040837e827af064f4ba290c7c57c1 | |
| parent | ee3524a1ad54d5682f1abb8fbb46a95ca950ea38 (diff) | |
| download | usermoji-32884cb56cfb9f7c22ba27144fc6a1b06854e6f3.tar.xz | |
layers: GH897, Add VK_KHR_display stubs to OT
Added extension enable and function stubs for VK_KHR_display
extension functions to object_tracker.
Change-Id: Iaee862efaadf4657271b74d75a289dbaf13af26c
| -rw-r--r-- | layers/object_tracker.cpp | 101 | ||||
| -rw-r--r-- | layers/object_tracker.h | 7 |
2 files changed, 105 insertions, 3 deletions
diff --git a/layers/object_tracker.cpp b/layers/object_tracker.cpp index e4b8694a..8ccaa279 100644 --- a/layers/object_tracker.cpp +++ b/layers/object_tracker.cpp @@ -3163,6 +3163,7 @@ static void CheckDeviceRegisterExtensions(const VkDeviceCreateInfo *pCreateInfo, layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); device_data->wsi_enabled = false; device_data->wsi_display_swapchain_enabled = false; + device_data->wsi_display_extension_enabled = false; device_data->objtrack_extensions_enabled = false; for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { @@ -3172,6 +3173,9 @@ static void CheckDeviceRegisterExtensions(const VkDeviceCreateInfo *pCreateInfo, if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME) == 0) { device_data->wsi_display_swapchain_enabled = true; } + if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_DISPLAY_EXTENSION_NAME) == 0) { + device_data->wsi_display_extension_enabled = true; + } if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], "OBJTRACK_EXTENSIONS") == 0) { device_data->objtrack_extensions_enabled = true; } @@ -3811,6 +3815,86 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceExternalImageFormatPropertiesNV( return result; } +// VK_KHR_display Extension +VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, + VkDisplayPropertiesKHR *pProperties) { + VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; + bool skip = false; + layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); + assert(my_data != NULL); + + result = get_dispatch_table(ot_instance_table_map, physicalDevice) + ->GetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, pPropertyCount, pProperties); + + return result; +} + +VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, + VkDisplayPlanePropertiesKHR *pProperties) { + VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; + bool skip = false; + layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); + assert(my_data != NULL); + + result = get_dispatch_table(ot_instance_table_map, physicalDevice) + ->GetPhysicalDeviceDisplayPlanePropertiesKHR(physicalDevice, pPropertyCount, pProperties); + + return result; +} + +VKAPI_ATTR VkResult VKAPI_CALL GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex, + uint32_t *pDisplayCount, VkDisplayKHR *pDisplays) { + VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; + bool skip = false; + layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); + assert(my_data != NULL); + + result = get_dispatch_table(ot_instance_table_map, physicalDevice) + ->GetDisplayPlaneSupportedDisplaysKHR(physicalDevice, planeIndex, pDisplayCount, pDisplays); + + return result; +} + +VKAPI_ATTR VkResult VKAPI_CALL GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, + uint32_t *pPropertyCount, VkDisplayModePropertiesKHR *pProperties) { + VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; + bool skip = false; + layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); + assert(my_data != NULL); + + result = get_dispatch_table(ot_instance_table_map, physicalDevice) + ->GetDisplayModePropertiesKHR(physicalDevice, display, pPropertyCount, pProperties); + + return result; +} + +VKAPI_ATTR VkResult VKAPI_CALL CreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, + const VkDisplayModeCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode) { + VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; + bool skip = false; + layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); + assert(my_data != NULL); + + result = get_dispatch_table(ot_instance_table_map, physicalDevice) + ->CreateDisplayModeKHR(physicalDevice, display, pCreateInfo, pAllocator, pMode); + + return result; +} + +VKAPI_ATTR VkResult VKAPI_CALL GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, + uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR *pCapabilities) { + VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; + bool skip = false; + layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); + assert(my_data != NULL); + + result = get_dispatch_table(ot_instance_table_map, physicalDevice) + ->GetDisplayPlaneCapabilitiesKHR(physicalDevice, mode, planeIndex, pCapabilities); + + return result; +} + #ifdef VK_USE_PLATFORM_WIN32_KHR // VK_NV_external_memory_win32 Extension VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandleNV(VkDevice device, VkDeviceMemory memory, @@ -4191,6 +4275,23 @@ static inline PFN_vkVoidFunction InterceptWsiEnabledCommand(const char *name, Vk return reinterpret_cast<PFN_vkVoidFunction>(CreateSharedSwapchainsKHR); } } + + if (device_data->wsi_display_extension_enabled) { + if (!strcmp("vkGetPhysicalDeviceDisplayPropertiesKHR", name)) + return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceDisplayPropertiesKHR); + if (!strcmp("vkGetPhysicalDeviceDisplayPlanePropertiesKHR", name)) + return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceDisplayPlanePropertiesKHR); + if (!strcmp("vkGetDisplayPlaneSupportedDisplaysKHR", name)) + return reinterpret_cast<PFN_vkVoidFunction>(GetDisplayPlaneSupportedDisplaysKHR); + if (!strcmp("vkGetDisplayModePropertiesKHR", name)) + return reinterpret_cast<PFN_vkVoidFunction>(GetDisplayModePropertiesKHR); + if (!strcmp("vkCreateDisplayModeKHR", name)) + return reinterpret_cast<PFN_vkVoidFunction>(CreateDisplayModeKHR); + if (!strcmp("vkGetDisplayPlaneCapabilitiesKHR", name)) + return reinterpret_cast<PFN_vkVoidFunction>(GetDisplayPlaneCapabilitiesKHR); + if (!strcmp("vkCreateDisplayPlaneSurfaceKHR", name)) + return reinterpret_cast<PFN_vkVoidFunction>(CreateDisplayPlaneSurfaceKHR); + } } return nullptr; diff --git a/layers/object_tracker.h b/layers/object_tracker.h index 8f852f80..078e7f09 100644 --- a/layers/object_tracker.h +++ b/layers/object_tracker.h @@ -96,6 +96,7 @@ struct layer_data { std::vector<VkDebugReportCallbackEXT> logging_callback; bool wsi_enabled; bool wsi_display_swapchain_enabled; + bool wsi_display_extension_enabled; bool objtrack_extensions_enabled; // The following are for keeping track of the temporary callbacks that can @@ -117,13 +118,13 @@ struct layer_data { // Default constructor layer_data() : instance(nullptr), physical_device(nullptr), num_objects{}, num_total_objects(0), report_data(nullptr), - wsi_enabled(false), wsi_display_swapchain_enabled(false), objtrack_extensions_enabled(false), num_tmp_callbacks(0), - tmp_dbg_create_infos(nullptr), tmp_callbacks(nullptr), object_map{}, dispatch_table{} { + wsi_enabled(false), wsi_display_swapchain_enabled(false), wsi_display_extension_enabled(false), + objtrack_extensions_enabled(false), num_tmp_callbacks(0), tmp_dbg_create_infos(nullptr), tmp_callbacks(nullptr), + object_map{}, dispatch_table{} { object_map.resize(VK_DEBUG_REPORT_OBJECT_TYPE_RANGE_SIZE_EXT + 1); } }; - static std::unordered_map<void *, struct instance_extension_enables> instanceExtMap; static std::unordered_map<void *, layer_data *> layer_data_map; static device_table_map ot_device_table_map; |
