mirror of
https://github.com/yquake2/ref_vk.git
synced 2024-11-12 23:54:28 +00:00
Instance handling fallback.
When the validation layers fails (or not present) then we "surprisingly" fallback to a GL renderer losing all settings too. Here we try to create the instance but without the validation part then.
This commit is contained in:
parent
bfd5659abc
commit
fe554ca0cc
1 changed files with 16 additions and 1 deletions
|
@ -1822,14 +1822,29 @@ qboolean QVk_Init(void)
|
|||
}
|
||||
|
||||
VkResult res = vkCreateInstance(&createInfo, NULL, &vk_instance);
|
||||
free(wantedExtensions);
|
||||
|
||||
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
if (res == VK_ERROR_LAYER_NOT_PRESENT && vk_validation->value) {
|
||||
// we give a "last try" if the validation layer fails
|
||||
// before falling back to a GL renderer
|
||||
createInfo.enabledLayerCount = 0;
|
||||
createInfo.ppEnabledLayerNames = 0;
|
||||
createInfo.pNext = NULL;
|
||||
memset(vk_config.layers, 0, sizeof(vk_config.layers));
|
||||
ri.Cvar_Set("vk_validation", "0");
|
||||
R_Printf(PRINT_ALL, "%s(): Could not create Vulkan instance, disabling vk_validation\n", __func__);
|
||||
if (vkCreateInstance(&createInfo, NULL, &vk_instance) == VK_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
R_Printf(PRINT_ALL, "%s(): Could not create Vulkan instance: %s\n", __func__, QVk_GetError(res));
|
||||
free(wantedExtensions);
|
||||
return false;
|
||||
}
|
||||
done:
|
||||
free(wantedExtensions);
|
||||
volkLoadInstance(vk_instance);
|
||||
R_Printf(PRINT_ALL, "...created Vulkan instance\n");
|
||||
|
||||
|
|
Loading…
Reference in a new issue