Vulkan: Add more error logging.

This commit is contained in:
Hans-Kristian Arntzen 2016-03-29 17:36:13 +02:00
parent 02736963bc
commit c7b96b75b8
2 changed files with 41 additions and 1 deletions

View File

@ -1255,7 +1255,10 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
#endif
if (!vulkan_library)
{
RARCH_ERR("[Vulkan]: Failed to open Vulkan loader.\n");
return false;
}
RARCH_LOG("Vulkan dynamic library loaded.\n");
@ -1300,19 +1303,31 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
}
if (!vulkan_load_instance_symbols(vk))
{
RARCH_ERR("[Vulkan]: Failed to load instance symbols.\n");
return false;
}
if (VKFUNC(vkEnumeratePhysicalDevices)(vk->context.instance,
&gpu_count, NULL) != VK_SUCCESS)
{
RARCH_ERR("[Vulkan]: Failed to enumerate physical devices.\n");
return false;
}
gpus = (VkPhysicalDevice*)calloc(gpu_count, sizeof(*gpus));
if (!gpus)
{
RARCH_ERR("[Vulkan]: Failed to enumerate physical devices.\n");
return false;
}
if (VKFUNC(vkEnumeratePhysicalDevices)(vk->context.instance,
&gpu_count, gpus) != VK_SUCCESS)
{
RARCH_ERR("[Vulkan]: Failed to enumerate physical devices.\n");
return false;
}
if (gpu_count < 1)
{
@ -1332,7 +1347,10 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
&queue_count, NULL);
if (queue_count < 1 || queue_count > 32)
{
RARCH_ERR("[Vulkan]: Invalid number of queues detected.\n");
return false;
}
VKFUNC(vkGetPhysicalDeviceQueueFamilyProperties)(vk->context.gpu,
&queue_count, queue_properties);
@ -1376,10 +1394,16 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
}
else if (VKFUNC(vkCreateDevice)(vk->context.gpu, &device_info,
NULL, &vk->context.device) != VK_SUCCESS)
{
RARCH_ERR("[Vulkan]: Failed to create device.\n");
return false;
}
if (!vulkan_load_device_symbols(vk))
{
RARCH_ERR("[Vulkan]: Failed to load device symbols.\n");
return false;
}
VKFUNC(vkGetDeviceQueue)(vk->context.device,
vk->context.graphics_queue_index, 0, &vk->context.queue);
@ -1423,7 +1447,10 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
vk->context.queue_lock = slock_new();
if (!vk->context.queue_lock)
{
RARCH_ERR("[Vulkan]: Failed to create queue lock.\n");
return false;
}
return true;
}
@ -1764,7 +1791,11 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk,
info.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
| VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
VKFUNC(vkCreateSwapchainKHR)(vk->context.device, &info, NULL, &vk->swapchain);
if (VKFUNC(vkCreateSwapchainKHR)(vk->context.device, &info, NULL, &vk->swapchain) != VK_SUCCESS)
{
RARCH_ERR("[Vulkan]: Failed to create swapchain.\n");
return false;
}
if (old_swapchain != VK_NULL_HANDLE)
VKFUNC(vkDestroySwapchainKHR)(vk->context.device, old_swapchain, NULL);

View File

@ -927,7 +927,10 @@ static void *vulkan_init(const video_info_t *video,
ctx_driver = vulkan_get_context(vk);
if (!ctx_driver)
{
RARCH_ERR("[Vulkan]: Failed to get Vulkan context.\n");
goto error;
}
gfx_ctx_ctl(GFX_CTL_SET, (void*)ctx_driver);
@ -954,7 +957,10 @@ static void *vulkan_init(const video_info_t *video,
mode.height = win_height;
mode.fullscreen = video->fullscreen;
if (!gfx_ctx_ctl(GFX_CTL_SET_VIDEO_MODE, &mode))
{
RARCH_ERR("[Vulkan]: Failed to set video mode.\n");
goto error;
}
gfx_ctx_ctl(GFX_CTL_GET_VIDEO_SIZE, &mode);
temp_width = mode.width;
@ -986,7 +992,10 @@ static void *vulkan_init(const video_info_t *video,
vulkan_init_resources(vk);
if (!vulkan_init_filter_chain(vk))
{
RARCH_ERR("[Vulkan]: Failed to init filter chain.\n");
goto error;
}
inp.input = input;
inp.input_data = input_data;