mirror of
https://github.com/libretro/RetroArch
synced 2025-02-24 18:39:59 +00:00
Add better fallback in case current_video_context_api is none
This commit is contained in:
parent
c8028f3150
commit
128dff15ab
@ -586,25 +586,6 @@ static void video_context_driver_reset(void)
|
||||
if (current_video_context.has_focus)
|
||||
video_driver_cb_has_focus = video_context_has_focus;
|
||||
|
||||
if (current_video_context_api == GFX_CTX_NONE)
|
||||
{
|
||||
const char *video_driver = video_driver_get_ident();
|
||||
|
||||
if (string_is_equal(video_driver, "d3d9"))
|
||||
current_video_context_api = GFX_CTX_DIRECT3D9_API;
|
||||
else if (string_is_equal(video_driver, "d3d10"))
|
||||
current_video_context_api = GFX_CTX_DIRECT3D10_API;
|
||||
else if (string_is_equal(video_driver, "d3d11"))
|
||||
current_video_context_api = GFX_CTX_DIRECT3D11_API;
|
||||
else if (string_is_equal(video_driver, "d3d12"))
|
||||
current_video_context_api = GFX_CTX_DIRECT3D12_API;
|
||||
else if (string_is_equal(video_driver, "gx2"))
|
||||
current_video_context_api = GFX_CTX_GX2_API;
|
||||
else if (string_is_equal(video_driver, "gl"))
|
||||
current_video_context_api = GFX_CTX_OPENGL_API;
|
||||
else if (string_is_equal(video_driver, "vulkan"))
|
||||
current_video_context_api = GFX_CTX_VULKAN_API;
|
||||
}
|
||||
}
|
||||
|
||||
bool video_context_driver_set(const gfx_ctx_driver_t *data)
|
||||
@ -2915,7 +2896,8 @@ static const gfx_ctx_driver_t *video_context_driver_init(
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
RARCH_WARN("Failed to bind API (#%u, version %u.%u) on context driver \"%s\".\n",
|
||||
RARCH_WARN("Failed to bind API (#%u, version %u.%u)"
|
||||
" on context driver \"%s\".\n",
|
||||
(unsigned)api, major, minor, ctx->ident);
|
||||
#endif
|
||||
|
||||
@ -3220,6 +3202,26 @@ bool video_context_driver_set_flags(gfx_ctx_flags_t *flags)
|
||||
|
||||
enum gfx_ctx_api video_context_driver_get_api(void)
|
||||
{
|
||||
if (current_video_context_api == GFX_CTX_NONE)
|
||||
{
|
||||
const char *video_driver = video_driver_get_ident();
|
||||
|
||||
if (string_is_equal(video_driver, "d3d9"))
|
||||
current_video_context_api = GFX_CTX_DIRECT3D9_API;
|
||||
else if (string_is_equal(video_driver, "d3d10"))
|
||||
current_video_context_api = GFX_CTX_DIRECT3D10_API;
|
||||
else if (string_is_equal(video_driver, "d3d11"))
|
||||
current_video_context_api = GFX_CTX_DIRECT3D11_API;
|
||||
else if (string_is_equal(video_driver, "d3d12"))
|
||||
current_video_context_api = GFX_CTX_DIRECT3D12_API;
|
||||
else if (string_is_equal(video_driver, "gx2"))
|
||||
current_video_context_api = GFX_CTX_GX2_API;
|
||||
else if (string_is_equal(video_driver, "gl"))
|
||||
current_video_context_api = GFX_CTX_OPENGL_API;
|
||||
else if (string_is_equal(video_driver, "vulkan"))
|
||||
current_video_context_api = GFX_CTX_VULKAN_API;
|
||||
}
|
||||
|
||||
return current_video_context_api;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user