(video_driver.c) Move some code over

This commit is contained in:
twinaphex 2021-09-27 20:31:31 +02:00
parent 0448afab96
commit 4574a58683
3 changed files with 44 additions and 43 deletions

View File

@ -18,6 +18,19 @@
#include "video_driver.h"
typedef struct
{
struct string_list *list;
enum gfx_ctx_api api;
} gfx_api_gpu_map;
static gfx_api_gpu_map gpu_map[] = {
{ NULL, GFX_CTX_VULKAN_API },
{ NULL, GFX_CTX_DIRECT3D10_API },
{ NULL, GFX_CTX_DIRECT3D11_API },
{ NULL, GFX_CTX_DIRECT3D12_API }
};
video_driver_t *hw_render_context_driver(
enum retro_hw_context_type type, int major, int minor)
{
@ -121,6 +134,37 @@ enum retro_hw_context_type hw_render_context_type(const char *s)
return RETRO_HW_CONTEXT_NONE;
}
/* string list stays owned by the caller and must be available at
* all times after the video driver is inited */
void video_driver_set_gpu_api_devices(
enum gfx_ctx_api api, struct string_list *list)
{
int i;
for (i = 0; i < ARRAY_SIZE(gpu_map); i++)
{
if (api == gpu_map[i].api)
{
gpu_map[i].list = list;
break;
}
}
}
struct string_list* video_driver_get_gpu_api_devices(enum gfx_ctx_api api)
{
int i;
for (i = 0; i < ARRAY_SIZE(gpu_map); i++)
{
if (api == gpu_map[i].api)
return gpu_map[i].list;
}
return NULL;
}
/**
* video_driver_translate_coord_viewport:
* @mouse_x : Pointer X coordinate.

View File

@ -23442,36 +23442,6 @@ const char* video_driver_get_gpu_api_version_string(void)
return p_rarch->video_driver_gpu_api_version_string;
}
/* string list stays owned by the caller and must be available at
* all times after the video driver is inited */
void video_driver_set_gpu_api_devices(
enum gfx_ctx_api api, struct string_list *list)
{
int i;
for (i = 0; i < ARRAY_SIZE(gpu_map); i++)
{
if (api == gpu_map[i].api)
{
gpu_map[i].list = list;
break;
}
}
}
struct string_list* video_driver_get_gpu_api_devices(enum gfx_ctx_api api)
{
int i;
for (i = 0; i < ARRAY_SIZE(gpu_map); i++)
{
if (api == gpu_map[i].api)
return gpu_map[i].list;
}
return NULL;
}
/* CAMERA */
/**

View File

@ -936,12 +936,6 @@ typedef struct video_pixel_scaler
void *scaler_out;
} video_pixel_scaler_t;
typedef struct
{
struct string_list *list;
enum gfx_ctx_api api;
} gfx_api_gpu_map;
typedef void *(*constructor_t)(void);
typedef void (*destructor_t )(void*);
@ -1606,13 +1600,6 @@ struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END] = {
{ 1.3333f, "Full" }
};
static gfx_api_gpu_map gpu_map[] = {
{ NULL, GFX_CTX_VULKAN_API },
{ NULL, GFX_CTX_DIRECT3D10_API },
{ NULL, GFX_CTX_DIRECT3D11_API },
{ NULL, GFX_CTX_DIRECT3D12_API }
};
/* TODO/FIXME - turn these into static global variable */
#ifdef HAVE_DISCORD
bool discord_is_inited = false;