mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-28 02:30:35 +00:00
Simplify menu_shader_manager_set_preset
This commit is contained in:
parent
d02dbcfedd
commit
732fe2e996
@ -168,24 +168,12 @@ bool menu_shader_manager_set_preset(struct video_shader *shader,
|
||||
bool ret = false;
|
||||
|
||||
if (apply && !retroarch_apply_shader(type, preset_path, true))
|
||||
{
|
||||
/* We don't want to disable shaders entirely here,
|
||||
* just reset number of passes
|
||||
* > Note: Disabling shaders at this point would in
|
||||
* fact be dangerous, since it changes the number of
|
||||
* entries in the shader options menu which can in
|
||||
* turn lead to the menu selection pointer going out
|
||||
* of bounds. This causes undefined behaviour/segfaults */
|
||||
menu_shader_manager_clear_num_passes(shader);
|
||||
command_event(CMD_EVENT_SHADER_PRESET_LOADED, NULL);
|
||||
return false;
|
||||
}
|
||||
goto clear;
|
||||
|
||||
if (string_is_empty(preset_path))
|
||||
{
|
||||
menu_shader_manager_clear_num_passes(shader);
|
||||
command_event(CMD_EVENT_SHADER_PRESET_LOADED, NULL);
|
||||
return true;
|
||||
ret = true;
|
||||
goto clear;
|
||||
}
|
||||
|
||||
if (!shader)
|
||||
@ -220,6 +208,18 @@ end:
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
#endif
|
||||
return ret;
|
||||
|
||||
clear:
|
||||
/* We don't want to disable shaders entirely here,
|
||||
* just reset number of passes
|
||||
* > Note: Disabling shaders at this point would in
|
||||
* fact be dangerous, since it changes the number of
|
||||
* entries in the shader options menu which can in
|
||||
* turn lead to the menu selection pointer going out
|
||||
* of bounds. This causes undefined behaviour/segfaults */
|
||||
menu_shader_manager_clear_num_passes(shader);
|
||||
command_event(CMD_EVENT_SHADER_PRESET_LOADED, NULL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool menu_shader_manager_save_preset_internal(
|
||||
|
Loading…
Reference in New Issue
Block a user