Merge pull request #7122 from orbea/vulkan

Fix segfaults when starting vulkan without a working vulkan driver.
This commit is contained in:
Twinaphex 2018-08-27 18:59:00 +02:00 committed by GitHub
commit ea87bb5a1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -1827,7 +1827,10 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
VK_DEBUG_REPORT_WARNING_BIT_EXT |
VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT;
info.pfnCallback = vulkan_debug_cb;
vkCreateDebugReportCallbackEXT(vk->context.instance, &info, NULL, &vk->context.debug_callback);
if (vk->context.instance)
vkCreateDebugReportCallbackEXT(vk->context.instance, &info, NULL,
&vk->context.debug_callback);
}
RARCH_LOG("[Vulkan]: Enabling Vulkan debug layers.\n");
#endif

View File

@ -744,6 +744,9 @@ static bool vulkan_init_default_filter_chain(vk_t *vk)
memset(&info, 0, sizeof(info));
if (!vk->context)
return false;
info.device = vk->context->device;
info.gpu = vk->context->gpu;
info.memory_properties = &vk->context->memory_properties;
@ -832,7 +835,7 @@ static bool vulkan_init_filter_chain(vk_t *vk)
static void vulkan_init_resources(vk_t *vk)
{
if (!vk)
if (!vk->context)
return;
vk->num_swapchain_images = vk->context->num_swapchain_images;
@ -855,6 +858,9 @@ static void vulkan_init_static_resources(vk_t *vk)
VkPipelineCacheCreateInfo cache = {
VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO };
if (!vk->context)
return;
vkCreatePipelineCache(vk->context->device,
&cache, NULL, &vk->pipelines.cache);
@ -2357,6 +2363,9 @@ static void vulkan_viewport_info(void *data, struct video_viewport *vp)
video_driver_get_size(&width, &height);
if (!vk)
return;
/* Make sure we get the correct viewport. */
vulkan_set_viewport(vk, width, height, false, true);