struct device_data {
struct instance_data *instance;
+ PFN_vkSetDeviceLoaderData set_device_loader_data;
+
struct vk_device_dispatch_table vtable;
VkPhysicalDevice physical_device;
VkDevice device;
/**/
+static void check_vk_result(VkResult err)
+{
+ if (err != VK_SUCCESS)
+ printf("ERROR!\n");
+}
+
+/**/
+
static VkLayerInstanceCreateInfo *get_instance_chain_info(const VkInstanceCreateInfo *pCreateInfo,
VkLayerFunction func)
{
data->vtable.GetDeviceQueue(data->device,
pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex,
j, &queue);
+
+ VkResult err = data->set_device_loader_data(data->device, queue);
+ check_vk_result(err);
+
data->queues[queue_index++] =
new_queue_data(queue, &family_props[pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex],
pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex, data);
ralloc_free(data);
}
-static void check_vk_result(VkResult err)
-{
- if (err != VK_SUCCESS)
- printf("ERROR!\n");
-}
-
/**/
static struct swapchain_data *new_swapchain_data(VkSwapchainKHR swapchain,
struct device_data *device_data)
cmd_bufs);
check_vk_result(err);
- for (uint32_t i = 0; i < ARRAY_SIZE(data->frame_data); i++)
- data->frame_data[i].command_buffer = cmd_bufs[i];
+ for (uint32_t i = 0; i < ARRAY_SIZE(data->frame_data); i++) {
+ err = device_data->set_device_loader_data(device_data->device,
+ cmd_bufs[i]);
+ check_vk_result(err);
+ data->frame_data[i].command_buffer = cmd_bufs[i];
+ }
/* Submission fence */
VkFenceCreateInfo fence_info = {};
err = device_data->vtable.CreateFence(device_data->device, &fence_info,
NULL, &data->fence);
check_vk_result(err);
-
}
static void shutdown_swapchain_data(struct swapchain_data *data)
instance_data->vtable.GetPhysicalDeviceProperties(device_data->physical_device,
&device_data->properties);
+ VkLayerDeviceCreateInfo *load_data_info =
+ get_device_chain_info(pCreateInfo, VK_LOADER_DATA_CALLBACK);
+ device_data->set_device_loader_data = load_data_info->u.pfnSetDeviceLoaderData;
+
device_map_queues(device_data, pCreateInfo);
return result;