mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
Move retroarch_get_shader_preset to video_shader_parse.c
This commit is contained in:
parent
e42f8228de
commit
bf8cae10a3
@ -2500,3 +2500,59 @@ bool apply_shader(
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* get the name of the current shader preset */
|
||||
const char *retroarch_get_shader_preset(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
const char *core_name = runloop_st->system.info.library_name;
|
||||
bool video_shader_enable = settings->bools.video_shader_enable;
|
||||
unsigned video_shader_delay = settings->uints.video_shader_delay;
|
||||
bool auto_shaders_enable = settings->bools.auto_shaders_enable;
|
||||
bool cli_shader_disable = video_st->cli_shader_disable;
|
||||
|
||||
if (!video_shader_enable)
|
||||
return NULL;
|
||||
|
||||
if (video_shader_delay && !runloop_st->shader_delay_timer.timer_end)
|
||||
return NULL;
|
||||
|
||||
/* Disallow loading auto-shaders when no core is loaded */
|
||||
if (string_is_empty(core_name))
|
||||
return NULL;
|
||||
|
||||
if (!string_is_empty(runloop_st->runtime_shader_preset_path))
|
||||
return runloop_st->runtime_shader_preset_path;
|
||||
|
||||
/* load auto-shader once, --set-shader works like a global auto-shader */
|
||||
if (video_st->shader_presets_need_reload && !cli_shader_disable)
|
||||
{
|
||||
video_st->shader_presets_need_reload = false;
|
||||
|
||||
if (video_shader_is_supported(
|
||||
video_shader_parse_type(video_st->cli_shader_path)))
|
||||
strlcpy(runloop_st->runtime_shader_preset_path,
|
||||
video_st->cli_shader_path,
|
||||
sizeof(runloop_st->runtime_shader_preset_path));
|
||||
else
|
||||
{
|
||||
if (auto_shaders_enable) /* sets runtime_shader_preset_path */
|
||||
{
|
||||
if (load_shader_preset(
|
||||
settings,
|
||||
runloop_st->system.info.library_name,
|
||||
runloop_st->runtime_shader_preset_path,
|
||||
sizeof(runloop_st->runtime_shader_preset_path)))
|
||||
{
|
||||
RARCH_LOG("[Shaders]: Specific shader preset found at %s.\n",
|
||||
runloop_st->runtime_shader_preset_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
return runloop_st->runtime_shader_preset_path;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
59
retroarch.c
59
retroarch.c
@ -18091,65 +18091,6 @@ bool retroarch_ctl(enum rarch_ctl_state state, void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* get the name of the current shader preset */
|
||||
const char *retroarch_get_shader_preset(void)
|
||||
{
|
||||
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
settings_t *settings = config_get_ptr();
|
||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
const char *core_name = runloop_st->system.info.library_name;
|
||||
bool video_shader_enable = settings->bools.video_shader_enable;
|
||||
unsigned video_shader_delay = settings->uints.video_shader_delay;
|
||||
bool auto_shaders_enable = settings->bools.auto_shaders_enable;
|
||||
bool cli_shader_disable = video_st->cli_shader_disable;
|
||||
|
||||
if (!video_shader_enable)
|
||||
return NULL;
|
||||
|
||||
if (video_shader_delay && !runloop_st->shader_delay_timer.timer_end)
|
||||
return NULL;
|
||||
|
||||
/* Disallow loading auto-shaders when no core is loaded */
|
||||
if (string_is_empty(core_name))
|
||||
return NULL;
|
||||
|
||||
if (!string_is_empty(runloop_st->runtime_shader_preset_path))
|
||||
return runloop_st->runtime_shader_preset_path;
|
||||
|
||||
/* load auto-shader once, --set-shader works like a global auto-shader */
|
||||
if (video_st->shader_presets_need_reload && !cli_shader_disable)
|
||||
{
|
||||
video_st->shader_presets_need_reload = false;
|
||||
|
||||
if (video_shader_is_supported(
|
||||
video_shader_parse_type(video_st->cli_shader_path)))
|
||||
strlcpy(runloop_st->runtime_shader_preset_path,
|
||||
video_st->cli_shader_path,
|
||||
sizeof(runloop_st->runtime_shader_preset_path));
|
||||
else
|
||||
{
|
||||
if (auto_shaders_enable) /* sets runtime_shader_preset_path */
|
||||
{
|
||||
if (load_shader_preset(
|
||||
settings,
|
||||
runloop_st->system.info.library_name,
|
||||
runloop_st->runtime_shader_preset_path,
|
||||
sizeof(runloop_st->runtime_shader_preset_path)))
|
||||
{
|
||||
RARCH_LOG("[Shaders]: Specific shader preset found at %s.\n",
|
||||
runloop_st->runtime_shader_preset_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
return runloop_st->runtime_shader_preset_path;
|
||||
}
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool retroarch_override_setting_is_set(
|
||||
enum rarch_override_setting enum_idx, void *data)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user