Video context driver cleanups - less functions to go through with

public scope
This commit is contained in:
twinaphex 2020-07-26 08:00:49 +02:00
parent f94b5864b2
commit cd1d760a38
4 changed files with 35 additions and 38 deletions

View File

@ -1285,8 +1285,8 @@ bool core_info_hw_api_supported(core_info_t *info)
#ifdef RARCH_INTERNAL
unsigned i;
enum gfx_ctx_api sys_api;
gfx_ctx_flags_t sys_flags = {0};
const char *sys_api_version_str = video_driver_get_gpu_api_version_string();
gfx_ctx_flags_t sys_flags = video_driver_get_flags_wrapper();
int sys_api_version_major = 0;
int sys_api_version_minor = 0;
@ -1297,11 +1297,13 @@ bool core_info_hw_api_supported(core_info_t *info)
STATE_API_VERSION
};
if (!info || !info->required_hw_api_list || info->required_hw_api_list->size == 0)
if (
!info
|| !info->required_hw_api_list
|| info->required_hw_api_list->size == 0)
return true;
sys_api = video_context_driver_get_api();
video_context_driver_get_flags(&sys_flags);
for (i = 0; i < info->required_hw_api_list->size; i++)
{
@ -1418,6 +1420,7 @@ bool core_info_hw_api_supported(core_info_t *info)
fflush(stdout);
#endif
if ((string_is_equal_noncase(api_str, "opengl") && sys_api == GFX_CTX_OPENGL_API) ||
(string_is_equal_noncase(api_str, "openglcompat") && sys_api == GFX_CTX_OPENGL_API) ||
(string_is_equal_noncase(api_str, "openglcompatibility") && sys_api == GFX_CTX_OPENGL_API))

View File

@ -1168,32 +1168,24 @@ const char *video_shader_to_str(enum rarch_shader_type type)
**/
bool video_shader_is_supported(enum rarch_shader_type type)
{
gfx_ctx_flags_t flags;
enum display_flags testflag = GFX_CTX_FLAGS_NONE;
flags.flags = 0;
gfx_ctx_flags_t flags = video_driver_get_flags_wrapper();
switch (type)
{
case RARCH_SHADER_SLANG:
testflag = GFX_CTX_FLAGS_SHADERS_SLANG;
break;
return BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_SLANG);
case RARCH_SHADER_GLSL:
testflag = GFX_CTX_FLAGS_SHADERS_GLSL;
break;
return BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_GLSL);
case RARCH_SHADER_CG:
testflag = GFX_CTX_FLAGS_SHADERS_CG;
break;
return BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_CG);
case RARCH_SHADER_HLSL:
testflag = GFX_CTX_FLAGS_SHADERS_HLSL;
break;
return BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_HLSL);
case RARCH_SHADER_NONE:
default:
return false;
break;
}
video_context_driver_get_flags(&flags);
return BIT32_GET(flags.flags, testflag);
return false;
}
const char *video_shader_get_preset_extension(enum rarch_shader_type type)
@ -1216,10 +1208,7 @@ const char *video_shader_get_preset_extension(enum rarch_shader_type type)
bool video_shader_any_supported(void)
{
gfx_ctx_flags_t flags;
flags.flags = 0;
video_context_driver_get_flags(&flags);
gfx_ctx_flags_t flags = video_driver_get_flags_wrapper();
return
BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_SLANG) ||
BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_GLSL) ||

View File

@ -33473,9 +33473,10 @@ bool video_context_driver_get_video_size(gfx_ctx_mode_t *mode_info)
return true;
}
bool video_context_driver_get_flags(gfx_ctx_flags_t *flags)
static bool video_context_driver_get_flags(
struct rarch_state *p_rarch,
gfx_ctx_flags_t *flags)
{
struct rarch_state *p_rarch = &rarch_st;
if (!p_rarch->current_video_context.get_flags)
return false;
@ -33492,15 +33493,28 @@ bool video_context_driver_get_flags(gfx_ctx_flags_t *flags)
return true;
}
static bool video_driver_get_flags(gfx_ctx_flags_t *flags)
static bool video_driver_get_flags(
struct rarch_state *p_rarch,
gfx_ctx_flags_t *flags)
{
struct rarch_state *p_rarch = &rarch_st;
if (!p_rarch->video_driver_poke || !p_rarch->video_driver_poke->get_flags)
return false;
flags->flags = p_rarch->video_driver_poke->get_flags(p_rarch->video_driver_data);
return true;
}
gfx_ctx_flags_t video_driver_get_flags_wrapper(void)
{
gfx_ctx_flags_t flags;
struct rarch_state *p_rarch = &rarch_st;
flags.flags = 0;
if (!video_driver_get_flags(p_rarch, &flags))
video_context_driver_get_flags(p_rarch, &flags);
return flags;
}
/**
* video_driver_test_all_flags:
* @testflag : flag to test
@ -33510,17 +33524,8 @@ static bool video_driver_get_flags(gfx_ctx_flags_t *flags)
**/
bool video_driver_test_all_flags(enum display_flags testflag)
{
gfx_ctx_flags_t flags;
if (video_driver_get_flags(&flags))
if (BIT32_GET(flags.flags, testflag))
return true;
if (video_context_driver_get_flags(&flags))
if (BIT32_GET(flags.flags, testflag))
return true;
return false;
gfx_ctx_flags_t flags = video_driver_get_flags_wrapper();
return BIT32_GET(flags.flags, testflag);
}
bool video_context_driver_set_flags(gfx_ctx_flags_t *flags)

View File

@ -1808,7 +1808,7 @@ bool video_driver_started_fullscreen(void);
bool video_driver_is_threaded(void);
bool video_context_driver_get_flags(gfx_ctx_flags_t *flags);
gfx_ctx_flags_t video_driver_get_flags_wrapper(void);
bool video_driver_test_all_flags(enum display_flags testflag);