diff --git a/gfx/common/vulkan_common.c b/gfx/common/vulkan_common.c index a736a8c134..7c92a96643 100644 --- a/gfx/common/vulkan_common.c +++ b/gfx/common/vulkan_common.c @@ -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 diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index f9fb7095c0..3d162d0118 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -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);