layer_data_map.erase(key);
}
-static void createDeviceRegisterExtensions(const VkDeviceCreateInfo *pCreateInfo, VkDevice device) {
+static void checkDeviceRegisterExtensions(const VkDeviceCreateInfo *pCreateInfo, VkDevice device) {
uint32_t i;
// TBD: Need any locking, in case this function is called at the same time
// by more than one thread?
layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
dev_data->device_extensions.wsi_enabled = false;
- VkLayerDispatchTable *pDisp = dev_data->device_dispatch_table;
- PFN_vkGetDeviceProcAddr gpa = pDisp->GetDeviceProcAddr;
- pDisp->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR)gpa(device, "vkCreateSwapchainKHR");
- pDisp->DestroySwapchainKHR = (PFN_vkDestroySwapchainKHR)gpa(device, "vkDestroySwapchainKHR");
- pDisp->GetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR)gpa(device, "vkGetSwapchainImagesKHR");
- pDisp->AcquireNextImageKHR = (PFN_vkAcquireNextImageKHR)gpa(device, "vkAcquireNextImageKHR");
- pDisp->QueuePresentKHR = (PFN_vkQueuePresentKHR)gpa(device, "vkQueuePresentKHR");
-
for (i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SWAPCHAIN_EXTENSION_NAME) == 0)
dev_data->device_extensions.wsi_enabled = true;
my_device_data->device = *pDevice;
my_device_data->report_data = layer_debug_report_create_device(my_instance_data->report_data, *pDevice);
- createDeviceRegisterExtensions(pCreateInfo, *pDevice);
+ checkDeviceRegisterExtensions(pCreateInfo, *pDevice);
// Get physical device limits for this device
my_instance_data->instance_dispatch_table->GetPhysicalDeviceProperties(gpu, &(my_device_data->phys_dev_properties.properties));
uint32_t count;
static void createDeviceRegisterExtensions(const VkDeviceCreateInfo *pCreateInfo, VkDevice device) {
layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
- VkLayerDispatchTable *pDisp = get_dispatch_table(object_tracker_device_table_map, device);
- PFN_vkGetDeviceProcAddr gpa = pDisp->GetDeviceProcAddr;
- pDisp->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR)gpa(device, "vkCreateSwapchainKHR");
- pDisp->DestroySwapchainKHR = (PFN_vkDestroySwapchainKHR)gpa(device, "vkDestroySwapchainKHR");
- pDisp->GetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR)gpa(device, "vkGetSwapchainImagesKHR");
- pDisp->AcquireNextImageKHR = (PFN_vkAcquireNextImageKHR)gpa(device, "vkAcquireNextImageKHR");
- pDisp->QueuePresentKHR = (PFN_vkQueuePresentKHR)gpa(device, "vkQueuePresentKHR");
+
my_device_data->wsi_enabled = false;
for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SWAPCHAIN_EXTENSION_NAME) == 0)
static void createInstanceRegisterExtensions(const VkInstanceCreateInfo *pCreateInfo, VkInstance instance) {
VkLayerInstanceDispatchTable *pDisp = get_dispatch_table(object_tracker_instance_table_map, instance);
- PFN_vkGetInstanceProcAddr gpa = pDisp->GetInstanceProcAddr;
-
- pDisp->DestroySurfaceKHR = (PFN_vkDestroySurfaceKHR)gpa(instance, "vkDestroySurfaceKHR");
- pDisp->GetPhysicalDeviceSurfaceSupportKHR =
- (PFN_vkGetPhysicalDeviceSurfaceSupportKHR)gpa(instance, "vkGetPhysicalDeviceSurfaceSupportKHR");
- pDisp->GetPhysicalDeviceSurfaceCapabilitiesKHR =
- (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)gpa(instance, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR");
- pDisp->GetPhysicalDeviceSurfaceFormatsKHR =
- (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)gpa(instance, "vkGetPhysicalDeviceSurfaceFormatsKHR");
- pDisp->GetPhysicalDeviceSurfacePresentModesKHR =
- (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)gpa(instance, "vkGetPhysicalDeviceSurfacePresentModesKHR");
-#ifndef __ANDROID__
- pDisp->GetPhysicalDeviceDisplayPropertiesKHR =
- (PFN_vkGetPhysicalDeviceDisplayPropertiesKHR)gpa(instance, "vkGetPhysicalDeviceDisplayPropertiesKHR");
- pDisp->GetPhysicalDeviceDisplayPlanePropertiesKHR =
- (PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR)gpa(instance, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR");
- pDisp->GetDisplayPlaneSupportedDisplaysKHR =
- (PFN_vkGetDisplayPlaneSupportedDisplaysKHR)gpa(instance, "vkGetDisplayPlaneSupportedDisplaysKHR");
- pDisp->GetDisplayModePropertiesKHR =
- (PFN_vkGetDisplayModePropertiesKHR)gpa(instance, "vkGetDisplayModePropertiesKHR");
- pDisp->CreateDisplayModeKHR =
- (PFN_vkCreateDisplayModeKHR)gpa(instance, "vkCreateDisplayModeKHR");
- pDisp->GetDisplayPlaneCapabilitiesKHR =
- (PFN_vkGetDisplayPlaneCapabilitiesKHR)gpa(instance, "vkGetDisplayPlaneCapabilitiesKHR");
- pDisp->CreateDisplayPlaneSurfaceKHR =
- (PFN_vkCreateDisplayPlaneSurfaceKHR)gpa(instance, "vkCreateDisplayPlaneSurfaceKHR");
-#endif
-
-#if VK_USE_PLATFORM_WIN32_KHR
- pDisp->CreateWin32SurfaceKHR = (PFN_vkCreateWin32SurfaceKHR)gpa(instance, "vkCreateWin32SurfaceKHR");
- pDisp->GetPhysicalDeviceWin32PresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceWin32PresentationSupportKHR");
-#endif // VK_USE_PLATFORM_WIN32_KHR
-#ifdef VK_USE_PLATFORM_XCB_KHR
- pDisp->CreateXcbSurfaceKHR = (PFN_vkCreateXcbSurfaceKHR)gpa(instance, "vkCreateXcbSurfaceKHR");
- pDisp->GetPhysicalDeviceXcbPresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceXcbPresentationSupportKHR");
-#endif // VK_USE_PLATFORM_XCB_KHR
-#ifdef VK_USE_PLATFORM_XLIB_KHR
- pDisp->CreateXlibSurfaceKHR = (PFN_vkCreateXlibSurfaceKHR)gpa(instance, "vkCreateXlibSurfaceKHR");
- pDisp->GetPhysicalDeviceXlibPresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceXlibPresentationSupportKHR");
-#endif // VK_USE_PLATFORM_XLIB_KHR
-#ifdef VK_USE_PLATFORM_MIR_KHR
- pDisp->CreateMirSurfaceKHR = (PFN_vkCreateMirSurfaceKHR)gpa(instance, "vkCreateMirSurfaceKHR");
- pDisp->GetPhysicalDeviceMirPresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceMirPresentationSupportKHR");
-#endif // VK_USE_PLATFORM_MIR_KHR
-#ifdef VK_USE_PLATFORM_WAYLAND_KHR
- pDisp->CreateWaylandSurfaceKHR = (PFN_vkCreateWaylandSurfaceKHR)gpa(instance, "vkCreateWaylandSurfaceKHR");
- pDisp->GetPhysicalDeviceWaylandPresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceWaylandPresentationSupportKHR");
-#endif // VK_USE_PLATFORM_WAYLAND_KHR
-#ifdef VK_USE_PLATFORM_ANDROID_KHR
- pDisp->CreateAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR)gpa(instance, "vkCreateAndroidSurfaceKHR");
-#endif // VK_USE_PLATFORM_ANDROID_KHR
instanceExtMap[pDisp] = {};
"VK_LAYER_LUNARG_swapchain", VK_LAYER_API_VERSION, 1, "LunarG Validation Layer",
};
-static void createDeviceRegisterExtensions(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
- VkDevice device) {
+static void checkDeviceRegisterExtensions(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
+ VkDevice device) {
uint32_t i;
layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
layer_data *my_instance_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map);
- VkLayerDispatchTable *pDisp = my_device_data->device_dispatch_table;
- PFN_vkGetDeviceProcAddr gpa = pDisp->GetDeviceProcAddr;
-
- pDisp->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR)gpa(device, "vkCreateSwapchainKHR");
- pDisp->DestroySwapchainKHR = (PFN_vkDestroySwapchainKHR)gpa(device, "vkDestroySwapchainKHR");
- pDisp->GetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR)gpa(device, "vkGetSwapchainImagesKHR");
- pDisp->AcquireNextImageKHR = (PFN_vkAcquireNextImageKHR)gpa(device, "vkAcquireNextImageKHR");
- pDisp->QueuePresentKHR = (PFN_vkQueuePresentKHR)gpa(device, "vkQueuePresentKHR");
- pDisp->GetDeviceQueue = (PFN_vkGetDeviceQueue)gpa(device, "vkGetDeviceQueue");
-
SwpPhysicalDevice *pPhysicalDevice = NULL;
{
auto it = my_instance_data->physicalDeviceMap.find(physicalDevice);
}
}
-static void createInstanceRegisterExtensions(const VkInstanceCreateInfo *pCreateInfo, VkInstance instance) {
+static void checkInstanceRegisterExtensions(const VkInstanceCreateInfo *pCreateInfo, VkInstance instance) {
uint32_t i;
layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
- VkLayerInstanceDispatchTable *pDisp = my_data->instance_dispatch_table;
- PFN_vkGetInstanceProcAddr gpa = pDisp->GetInstanceProcAddr;
-#ifdef VK_USE_PLATFORM_ANDROID_KHR
- pDisp->CreateAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR)gpa(instance, "vkCreateAndroidSurfaceKHR");
-#endif // VK_USE_PLATFORM_ANDROID_KHR
-#ifdef VK_USE_PLATFORM_MIR_KHR
- pDisp->CreateMirSurfaceKHR = (PFN_vkCreateMirSurfaceKHR)gpa(instance, "vkCreateMirSurfaceKHR");
- pDisp->GetPhysicalDeviceMirPresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceMirPresentationSupportKHR");
-#endif // VK_USE_PLATFORM_MIR_KHR
-#ifdef VK_USE_PLATFORM_WAYLAND_KHR
- pDisp->CreateWaylandSurfaceKHR = (PFN_vkCreateWaylandSurfaceKHR)gpa(instance, "vkCreateWaylandSurfaceKHR");
- pDisp->GetPhysicalDeviceWaylandPresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceWaylandPresentationSupportKHR");
-#endif // VK_USE_PLATFORM_WAYLAND_KHR
-#ifdef VK_USE_PLATFORM_WIN32_KHR
- pDisp->CreateWin32SurfaceKHR = (PFN_vkCreateWin32SurfaceKHR)gpa(instance, "vkCreateWin32SurfaceKHR");
- pDisp->GetPhysicalDeviceWin32PresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceWin32PresentationSupportKHR");
-#endif // VK_USE_PLATFORM_WIN32_KHR
-#ifdef VK_USE_PLATFORM_XCB_KHR
- pDisp->CreateXcbSurfaceKHR = (PFN_vkCreateXcbSurfaceKHR)gpa(instance, "vkCreateXcbSurfaceKHR");
- pDisp->GetPhysicalDeviceXcbPresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceXcbPresentationSupportKHR");
-#endif // VK_USE_PLATFORM_XCB_KHR
-#ifdef VK_USE_PLATFORM_XLIB_KHR
- pDisp->CreateXlibSurfaceKHR = (PFN_vkCreateXlibSurfaceKHR)gpa(instance, "vkCreateXlibSurfaceKHR");
- pDisp->GetPhysicalDeviceXlibPresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceXlibPresentationSupportKHR");
-#endif // VK_USE_PLATFORM_XLIB_KHR
- pDisp->DestroySurfaceKHR = (PFN_vkDestroySurfaceKHR)gpa(instance, "vkDestroySurfaceKHR");
- pDisp->GetPhysicalDeviceSurfaceSupportKHR =
- (PFN_vkGetPhysicalDeviceSurfaceSupportKHR)gpa(instance, "vkGetPhysicalDeviceSurfaceSupportKHR");
- pDisp->GetPhysicalDeviceSurfaceCapabilitiesKHR =
- (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)gpa(instance, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR");
- pDisp->GetPhysicalDeviceSurfaceFormatsKHR =
- (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)gpa(instance, "vkGetPhysicalDeviceSurfaceFormatsKHR");
- pDisp->GetPhysicalDeviceSurfacePresentModesKHR =
- (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)gpa(instance, "vkGetPhysicalDeviceSurfacePresentModesKHR");
- pDisp->CreateDisplayPlaneSurfaceKHR =
- (PFN_vkCreateDisplayPlaneSurfaceKHR)gpa(instance, "vkCreateDisplayPlaneSurfaceKHR");
- pDisp->GetPhysicalDeviceDisplayPropertiesKHR =
- (PFN_vkGetPhysicalDeviceDisplayPropertiesKHR)gpa(instance, "vkGetPhysicalDeviceDisplayPropertiesKHR");
- pDisp->GetPhysicalDeviceDisplayPlanePropertiesKHR =
- (PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR)gpa(instance, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR");
- pDisp->GetDisplayPlaneSupportedDisplaysKHR =
- (PFN_vkGetDisplayPlaneSupportedDisplaysKHR)gpa(instance, "vkGetDisplayPlaneSupportedDisplaysKHR");
- pDisp->GetDisplayModePropertiesKHR =
- (PFN_vkGetDisplayModePropertiesKHR)gpa(instance, "vkGetDisplayModePropertiesKHR");
- pDisp->CreateDisplayModeKHR =
- (PFN_vkCreateDisplayModeKHR)gpa(instance, "vkCreateDisplayModeKHR");
- pDisp->GetDisplayPlaneCapabilitiesKHR =
- (PFN_vkGetDisplayPlaneCapabilitiesKHR)gpa(instance, "vkGetDisplayPlaneCapabilitiesKHR");
// Remember this instance, and whether the VK_KHR_surface extension
// was enabled for it:
pCreateInfo->enabledExtensionCount, pCreateInfo->ppEnabledExtensionNames);
// Call the following function after my_data is initialized:
- createInstanceRegisterExtensions(pCreateInfo, *pInstance);
+ checkInstanceRegisterExtensions(pCreateInfo, *pInstance);
init_swapchain(my_data, pAllocator);
return result;
layer_init_device_dispatch_table(*pDevice, my_device_data->device_dispatch_table, fpGetDeviceProcAddr);
my_device_data->report_data = layer_debug_report_create_device(my_instance_data->report_data, *pDevice);
- createDeviceRegisterExtensions(physicalDevice, pCreateInfo, *pDevice);
+ checkDeviceRegisterExtensions(physicalDevice, pCreateInfo, *pDevice);
return result;
}
}
// Handle CreateInstance
-static void createInstanceRegisterExtensions(const VkInstanceCreateInfo *pCreateInfo, VkInstance instance) {
+static void checkInstanceRegisterExtensions(const VkInstanceCreateInfo *pCreateInfo, VkInstance instance) {
uint32_t i;
VkLayerInstanceDispatchTable *pDisp = get_dispatch_table(unique_objects_instance_table_map, instance);
- PFN_vkGetInstanceProcAddr gpa = pDisp->GetInstanceProcAddr;
-
- //KHR_surface
- pDisp->DestroySurfaceKHR = (PFN_vkDestroySurfaceKHR)gpa(instance, "vkDestroySurfaceKHR");
- pDisp->GetPhysicalDeviceSurfaceSupportKHR =
- (PFN_vkGetPhysicalDeviceSurfaceSupportKHR)gpa(instance, "vkGetPhysicalDeviceSurfaceSupportKHR");
- pDisp->GetPhysicalDeviceSurfaceCapabilitiesKHR =
- (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)gpa(instance, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR");
- pDisp->GetPhysicalDeviceSurfaceFormatsKHR =
- (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)gpa(instance, "vkGetPhysicalDeviceSurfaceFormatsKHR");
- pDisp->GetPhysicalDeviceSurfacePresentModesKHR =
- (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)gpa(instance, "vkGetPhysicalDeviceSurfacePresentModesKHR");
-
- // KHR_display
-#ifndef __ANDROID__
- pDisp->GetPhysicalDeviceDisplayPropertiesKHR = (PFN_vkGetPhysicalDeviceDisplayPropertiesKHR)gpa(instance, "vkGetPhysicalDeviceDisplayPropertiesKHR");
- pDisp->GetPhysicalDeviceDisplayPlanePropertiesKHR = (PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR)gpa(instance, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR");
- pDisp->GetDisplayPlaneSupportedDisplaysKHR = (PFN_vkGetDisplayPlaneSupportedDisplaysKHR)gpa(instance, "vkGetDisplayPlaneSupportedDisplaysKHR");
- pDisp->GetDisplayModePropertiesKHR = (PFN_vkGetDisplayModePropertiesKHR)gpa(instance, "vkGetDisplayModePropertiesKHR");
- pDisp->CreateDisplayModeKHR = (PFN_vkCreateDisplayModeKHR)gpa(instance, "vkCreateDisplayModeKHR");
- pDisp->GetDisplayPlaneCapabilitiesKHR = (PFN_vkGetDisplayPlaneCapabilitiesKHR)gpa(instance, "vkGetDisplayPlaneCapabilitiesKHR");
- pDisp->CreateDisplayPlaneSurfaceKHR = (PFN_vkCreateDisplayPlaneSurfaceKHR)gpa(instance, "vkCreateDisplayPlaneSurfaceKHR");
-#endif
-
-#ifdef VK_USE_PLATFORM_WIN32_KHR
- pDisp->CreateWin32SurfaceKHR = (PFN_vkCreateWin32SurfaceKHR)gpa(instance, "vkCreateWin32SurfaceKHR");
- pDisp->GetPhysicalDeviceWin32PresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceWin32PresentationSupportKHR");
-#endif // VK_USE_PLATFORM_WIN32_KHR
-#ifdef VK_USE_PLATFORM_XCB_KHR
- pDisp->CreateXcbSurfaceKHR = (PFN_vkCreateXcbSurfaceKHR)gpa(instance, "vkCreateXcbSurfaceKHR");
- pDisp->GetPhysicalDeviceXcbPresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceXcbPresentationSupportKHR");
-#endif // VK_USE_PLATFORM_XCB_KHR
-#ifdef VK_USE_PLATFORM_XLIB_KHR
- pDisp->CreateXlibSurfaceKHR = (PFN_vkCreateXlibSurfaceKHR)gpa(instance, "vkCreateXlibSurfaceKHR");
- pDisp->GetPhysicalDeviceXlibPresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceXlibPresentationSupportKHR");
-#endif // VK_USE_PLATFORM_XLIB_KHR
-#ifdef VK_USE_PLATFORM_MIR_KHR
- pDisp->CreateMirSurfaceKHR = (PFN_vkCreateMirSurfaceKHR)gpa(instance, "vkCreateMirSurfaceKHR");
- pDisp->GetPhysicalDeviceMirPresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceMirPresentationSupportKHR");
-#endif // VK_USE_PLATFORM_MIR_KHR
-#ifdef VK_USE_PLATFORM_WAYLAND_KHR
- pDisp->CreateWaylandSurfaceKHR = (PFN_vkCreateWaylandSurfaceKHR)gpa(instance, "vkCreateWaylandSurfaceKHR");
- pDisp->GetPhysicalDeviceWaylandPresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceWaylandPresentationSupportKHR");
-#endif // VK_USE_PLATFORM_WAYLAND_KHR
-#ifdef VK_USE_PLATFORM_ANDROID_KHR
- pDisp->CreateAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR)gpa(instance, "vkCreateAndroidSurfaceKHR");
-#endif // VK_USE_PLATFORM_ANDROID_KHR
instanceExtMap[pDisp] = {};
my_data->instance = *pInstance;
initInstanceTable(*pInstance, fpGetInstanceProcAddr, unique_objects_instance_table_map);
- createInstanceRegisterExtensions(pCreateInfo, *pInstance);
+ checkInstanceRegisterExtensions(pCreateInfo, *pInstance);
return result;
}
debug_report_create_instance(VkLayerInstanceDispatchTable *table, VkInstance inst, uint32_t extension_count,
const char *const *ppEnabledExtensions) // layer or extension name to be enabled
{
- debug_report_data *debug_data;
- PFN_vkGetInstanceProcAddr gpa = table->GetInstanceProcAddr;
-
- table->CreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT)gpa(inst, "vkCreateDebugReportCallbackEXT");
- table->DestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT)gpa(inst, "vkDestroyDebugReportCallbackEXT");
- table->DebugReportMessageEXT = (PFN_vkDebugReportMessageEXT)gpa(inst, "vkDebugReportMessageEXT");
-
- debug_data = (debug_report_data *)malloc(sizeof(debug_report_data));
+ debug_report_data *debug_data = (debug_report_data *)malloc(sizeof(debug_report_data));
if (!debug_data)
return NULL;
}
layer_init_instance_dispatch_table(*pInstance, &inst->layer_disp, fpGetInstanceProcAddr);
- create_instance_register_extensions(pCreateInfo, *pInstance, inst);
-
return result;
}
}
initDeviceTable(*pDevice, fpGetDeviceProcAddr);
- create_device_register_extensions(pCreateInfo, *pDevice);
-
#if 0 // TODO add once device is wrapped
// store the loader callback for initializing created dispatchable objects
chain_info = get_chain_info(pCreateInfo, VK_LOADER_DATA_CALLBACK);
pDisp->AcquireNextImageKHR = (PFN_vkAcquireNextImageKHR)gpa(device, "vkAcquireNextImageKHR");
pDisp->QueuePresentKHR = (PFN_vkQueuePresentKHR)gpa(device, "vkQueuePresentKHR");
}
-
-static void create_instance_register_extensions(const VkInstanceCreateInfo *pCreateInfo, VkInstance instance, struct wrapped_inst_obj *inst) {
- VkLayerInstanceDispatchTable *pDisp = &inst->layer_disp;
- PFN_vkGetInstanceProcAddr gpa = pDisp->GetInstanceProcAddr;
-
- // KHR_surface
- pDisp->DestroySurfaceKHR = (PFN_vkDestroySurfaceKHR)gpa(instance, "vkDestroySurfaceKHR");
- pDisp->GetPhysicalDeviceSurfaceSupportKHR =
- (PFN_vkGetPhysicalDeviceSurfaceSupportKHR)gpa(instance, "vkGetPhysicalDeviceSurfaceSupportKHR");
- pDisp->GetPhysicalDeviceSurfaceCapabilitiesKHR =
- (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)gpa(instance, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR");
- pDisp->GetPhysicalDeviceSurfaceFormatsKHR =
- (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)gpa(instance, "vkGetPhysicalDeviceSurfaceFormatsKHR");
- pDisp->GetPhysicalDeviceSurfacePresentModesKHR =
- (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)gpa(instance, "vkGetPhysicalDeviceSurfacePresentModesKHR");
-
- // KHR_XXX_surface
-#ifdef VK_USE_PLATFORM_XCB_KHR
- pDisp->CreateXcbSurfaceKHR = (PFN_vkCreateXcbSurfaceKHR)gpa(instance, "vkCreateXcbSurfaceKHR");
- pDisp->GetPhysicalDeviceXcbPresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceXcbPresentationSupportKHR");
-#endif // VK_USE_PLATFORM_XCB_KHR
-
-#ifdef VK_USE_PLATFORM_XLIB_KHR
- pDisp->CreateXlibSurfaceKHR = (PFN_vkCreateXlibSurfaceKHR)gpa(instance, "vkCreateXlibSurfaceKHR");
- pDisp->GetPhysicalDeviceXlibPresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceXlibPresentationSupportKHR");
-#endif // VK_USE_PLATFORM_XLIB_KHR
-
-#ifdef VK_USE_PLATFORM_MIR_KHR
- pDisp->CreateMirSurfaceKHR = (PFN_vkCreateMirSurfaceKHR)gpa(instance, "vkCreateMirSurfaceKHR");
- pDisp->GetPhysicalDeviceMirPresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceMirPresentationSupportKHR");
-#endif // VK_USE_PLATFORM_MIR_KHR
-
-#ifdef VK_USE_PLATFORM_WAYLAND_KHR
- pDisp->CreateWaylandSurfaceKHR = (PFN_vkCreateWaylandSurfaceKHR)gpa(instance, "vkCreateWaylandSurfaceKHR");
- pDisp->GetPhysicalDeviceWaylandPresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceWaylandPresentationSupportKHR");
-#endif // VK_USE_PLATFORM_WAYLAND_KHR
-
-#ifdef VK_USE_PLATFORM_WIN32_KHR
- pDisp->CreateWin32SurfaceKHR = (PFN_vkCreateWin32SurfaceKHR)gpa(instance, "vkCreateWin32SurfaceKHR");
- pDisp->GetPhysicalDeviceWin32PresentationSupportKHR =
- (PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceWin32PresentationSupportKHR");
-#endif // VK_USE_PLATFORM_WIN32_KHR
-
- //EXT_debug_report
- pDisp->CreateDebugReportCallbackEXT =
- (PFN_vkCreateDebugReportCallbackEXT)gpa(instance, "vkCreateDebugReportCallbackEXT");
- pDisp->DestroyDebugReportCallbackEXT =
- (PFN_vkDestroyDebugReportCallbackEXT)gpa(instance, "vkDestroyDebugReportCallbackEXT");
- pDisp->DebugReportMessageEXT =
- (PFN_vkDebugReportMessageEXT)gpa(instance, "vkDebugReportMessageEXT");
-}
pass
class DispatchTableOpsSubcommand(Subcommand):
+ def __init__(self, argv):
+ self.argv = argv
+ self.headers = vulkan.headers_all
+ self.protos = vulkan.protos_all
+ self.outfile = None
+
def run(self):
if len(self.argv) < 1:
print("DispatchTableOpsSubcommand: <prefix> unspecified")
func = []
if type == "device":
# GPA has to be first one and uses wrapped object
- stmts.append("memset(table, 0, sizeof(*table));")
- stmts.append("table->GetDeviceProcAddr =(PFN_vkGetDeviceProcAddr) gpa(device,\"vkGetDeviceProcAddr\");")
+ stmts.append(" memset(table, 0, sizeof(*table));")
+ stmts.append(" // Core device function pointers")
+ stmts.append(" table->GetDeviceProcAddr = (PFN_vkGetDeviceProcAddr) gpa(device, \"vkGetDeviceProcAddr\");")
+
+ KHR_printed = False
+ EXT_printed = False
+ XLIB_printed = False
+ XCB_printed = False
+ MIR_printed = False
+ WAY_printed = False
for proto in self.protos:
- if proto.name == "CreateInstance" or proto.name == "EnumerateInstanceExtensionProperties" or proto.name == "EnumerateInstanceLayerProperties" or proto.params[0].ty == "VkInstance" or proto.params[0].ty == "VkPhysicalDevice":
+ if proto.name == "CreateInstance" or proto.name == "EnumerateInstanceExtensionProperties" or \
+ proto.name == "EnumerateInstanceLayerProperties" or proto.params[0].ty == "VkInstance" or \
+ proto.params[0].ty == "VkPhysicalDevice" or proto.name == "GetDeviceProcAddr":
continue
- if proto.name != "GetDeviceProcAddr" and 'KHR' not in proto.name:
- stmts.append("table->%s = (PFN_vk%s) gpa(device, \"vk%s\");" %
+ if 'KHR' in proto.name and not KHR_printed:
+ stmts.append(" // KHR device extension function pointers")
+ KHR_printed = True
+ if 'EXT' in proto.name and not EXT_printed:
+ stmts.append(" // EXT device extension function pointers")
+ EXT_printed = True
+ if XLIB_printed and 'Xlib' not in proto.name:
+ stmts.append("#endif // VK_USE_PLATFORM_XLIB_KHR")
+ XLIB_printed = False
+ if XCB_printed and 'Xcb' not in proto.name:
+ stmts.append("#endif // VK_USE_PLATFORM_XCB_KHR")
+ XCB_printed = False
+ if MIR_printed and 'Mir' not in proto.name:
+ stmts.append("#endif // VK_USE_PLATFORM_MIR_KHR")
+ MIR_printed = False
+ if WAY_printed and 'Wayland' not in proto.name:
+ stmts.append("#endif // VK_USE_PLATFORM_WAYLAND_KHR")
+ WAY_printed = False
+ if 'KHR' in proto.name and 'Xlib' in proto.name:
+ if not XLIB_printed:
+ stmts.append("#ifdef VK_USE_PLATFORM_XLIB_KHR")
+ XLIB_printed = True
+ if 'KHR' in proto.name and 'Xcb' in proto.name:
+ if not XCB_printed:
+ stmts.append("#ifdef VK_USE_PLATFORM_XCB_KHR")
+ XCB_printed = True
+ if 'KHR' in proto.name and 'Mir' in proto.name:
+ if not MIR_printed:
+ stmts.append("#ifdef VK_USE_PLATFORM_MIR_KHR")
+ MIR_printed = True
+ if 'KHR' in proto.name and 'Wayland' in proto.name:
+ if not WAY_printed:
+ stmts.append("#ifdef VK_USE_PLATFORM_WAYLAND_KHR")
+ WAY_printed = True
+ stmts.append(" table->%s = (PFN_vk%s) gpa(device, \"vk%s\");" %
(proto.name, proto.name, proto.name))
func.append("static inline void %s_init_device_dispatch_table(VkDevice device,"
% self.prefix)
func.append("%s PFN_vkGetDeviceProcAddr gpa)"
% (" " * len(self.prefix)))
else:
- stmts.append("table->GetInstanceProcAddr =(PFN_vkGetInstanceProcAddr) gpa(instance,\"vkGetInstanceProcAddr\");")
+ stmts.append(" memset(table, 0, sizeof(*table));")
+ stmts.append(" // Core instance function pointers")
+ stmts.append(" table->GetInstanceProcAddr = (PFN_vkGetInstanceProcAddr) gpa(instance, \"vkGetInstanceProcAddr\");")
+
+ KHR_printed = False
+ EXT_printed = False
+ XLIB_printed = False
+ XCB_printed = False
+ MIR_printed = False
+ WAY_printed = False
for proto in self.protos:
- if proto.params[0].ty != "VkInstance" and proto.params[0].ty != "VkPhysicalDevice":
- continue
- if proto.name == "CreateDevice":
+ if proto.params[0].ty != "VkInstance" and proto.params[0].ty != "VkPhysicalDevice" or \
+ proto.name == "CreateDevice" or proto.name == "GetInstanceProcAddr":
continue
- if proto.name != "GetInstanceProcAddr" and 'KHR' not in proto.name:
- stmts.append("table->%s = (PFN_vk%s) gpa(instance, \"vk%s\");" %
- (proto.name, proto.name, proto.name))
+ if 'KHR' in proto.name and not KHR_printed:
+ stmts.append(" // KHR instance extension function pointers")
+ KHR_printed = True
+ if 'EXT' in proto.name and not EXT_printed:
+ stmts.append(" // EXT instance extension function pointers")
+ EXT_printed = True
+ if XLIB_printed and 'Xlib' not in proto.name:
+ stmts.append("#endif // VK_USE_PLATFORM_XLIB_KHR")
+ XLIB_printed = False
+ if XCB_printed and 'Xcb' not in proto.name:
+ stmts.append("#endif // VK_USE_PLATFORM_XCB_KHR")
+ XCB_printed = False
+ if MIR_printed and 'Mir' not in proto.name:
+ stmts.append("#endif // VK_USE_PLATFORM_MIR_KHR")
+ MIR_printed = False
+ if WAY_printed and 'Wayland' not in proto.name:
+ stmts.append("#endif // VK_USE_PLATFORM_WAYLAND_KHR")
+ WAY_printed = False
+ if 'KHR' in proto.name and 'Xlib' in proto.name:
+ if not XLIB_printed:
+ stmts.append("#ifdef VK_USE_PLATFORM_XLIB_KHR")
+ XLIB_printed = True
+ if 'KHR' in proto.name and 'Xcb' in proto.name:
+ if not XCB_printed:
+ stmts.append("#ifdef VK_USE_PLATFORM_XCB_KHR")
+ XCB_printed = True
+ if 'KHR' in proto.name and 'Mir' in proto.name:
+ if not MIR_printed:
+ stmts.append("#ifdef VK_USE_PLATFORM_MIR_KHR")
+ MIR_printed = True
+ if 'KHR' in proto.name and 'Wayland' in proto.name:
+ if not WAY_printed:
+ stmts.append("#ifdef VK_USE_PLATFORM_WAYLAND_KHR")
+ WAY_printed = True
+ stmts.append(" table->%s = (PFN_vk%s) gpa(instance, \"vk%s\");" %
+ (proto.name, proto.name, proto.name))
func.append("static inline void %s_init_instance_dispatch_table(" % self.prefix)
func.append("%s VkInstance instance," % (" " * len(self.prefix)))
func.append("%s VkLayerInstanceDispatchTable *table," % (" " * len(self.prefix)))
func.append("%s PFN_vkGetInstanceProcAddr gpa)" % (" " * len(self.prefix)))
func.append("{")
- func.append(" %s" % "\n ".join(stmts))
+ func.append("%s" % "\n".join(stmts))
func.append("}")
return "\n".join(func)
proto_names = [proto.name for proto in protos]
+headers_all = []
+objects_all = []
+protos_all = []
+for ext in extensions_all:
+ headers_all.extend(ext.headers)
+ objects_all.extend(ext.objects)
+ protos_all.extend(ext.protos)
+
+proto_all_names = [proto.name for proto in protos_all]
+
def parse_vk_h(filename):
# read object and protoype typedefs
object_lines = []