Simplify gfx_display_init_first_driver

This commit is contained in:
libretroadmin 2023-06-19 07:46:16 +02:00
parent e8242253a7
commit a296160151

View File

@ -123,41 +123,6 @@ static gfx_display_ctx_driver_t *gfx_display_ctx_drivers[] = {
NULL,
};
/* Check if the current menu driver is compatible
* with your video driver. */
static bool gfx_display_check_compatibility(
const char *video_driver,
enum gfx_display_driver_type type,
const char *ident,
bool video_is_threaded)
{
switch (type)
{
case GFX_VIDEO_DRIVER_OPENGL:
case GFX_VIDEO_DRIVER_OPENGL1:
case GFX_VIDEO_DRIVER_OPENGL_CORE:
case GFX_VIDEO_DRIVER_VULKAN:
case GFX_VIDEO_DRIVER_METAL:
case GFX_VIDEO_DRIVER_DIRECT3D8:
case GFX_VIDEO_DRIVER_DIRECT3D9_HLSL:
case GFX_VIDEO_DRIVER_DIRECT3D9_CG:
case GFX_VIDEO_DRIVER_DIRECT3D10:
case GFX_VIDEO_DRIVER_DIRECT3D11:
case GFX_VIDEO_DRIVER_DIRECT3D12:
case GFX_VIDEO_DRIVER_VITA2D:
case GFX_VIDEO_DRIVER_CTR:
case GFX_VIDEO_DRIVER_WIIU:
case GFX_VIDEO_DRIVER_GDI:
case GFX_VIDEO_DRIVER_SWITCH:
case GFX_VIDEO_DRIVER_RSX:
return string_is_equal(video_driver, ident);
case GFX_VIDEO_DRIVER_GENERIC:
return true;
}
return false;
}
static float gfx_display_get_dpi_scale_internal(
unsigned width, unsigned height)
{
@ -1241,16 +1206,14 @@ bool gfx_display_init_first_driver(gfx_display_t *p_disp,
for (i = 0; gfx_display_ctx_drivers[i]; i++)
{
if (!gfx_display_check_compatibility(video_driver,
gfx_display_ctx_drivers[i]->type,
gfx_display_ctx_drivers[i]->ident,
video_is_threaded))
gfx_display_ctx_driver_t *dispctx = gfx_display_ctx_drivers[i];
enum gfx_display_driver_type type = dispctx->type;
const char *ident = dispctx->ident;
if ( (type != GFX_VIDEO_DRIVER_GENERIC)
&& (!string_is_equal(video_driver, ident)))
continue;
if (video_driver)
RARCH_LOG("[Display]: Found display driver: \"%s\".\n",
gfx_display_ctx_drivers[i]->ident);
p_disp->dispctx = gfx_display_ctx_drivers[i];
RARCH_LOG("[Display]: Found display driver: \"%s\".\n", ident);
p_disp->dispctx = dispctx;
return true;
}
return false;