(Menu) Refactor video_shader_preset
This commit is contained in:
parent
b117a09697
commit
609ccb80d2
|
@ -88,35 +88,6 @@ static int menu_info_screen_iterate(unsigned action)
|
|||
{
|
||||
switch (info_type)
|
||||
{
|
||||
case MENU_SETTINGS_SHADER_PRESET:
|
||||
snprintf(msg, sizeof(msg),
|
||||
" -- Load Shader Preset. \n"
|
||||
" \n"
|
||||
" Load a "
|
||||
#ifdef HAVE_CG
|
||||
"Cg"
|
||||
#endif
|
||||
#ifdef HAVE_GLSL
|
||||
#ifdef HAVE_CG
|
||||
"/"
|
||||
#endif
|
||||
"GLSL"
|
||||
#endif
|
||||
#ifdef HAVE_HLSL
|
||||
#if defined(HAVE_CG) || defined(HAVE_HLSL)
|
||||
"/"
|
||||
#endif
|
||||
"HLSL"
|
||||
#endif
|
||||
" preset directly. \n"
|
||||
"The menu shader menu is updated accordingly. \n"
|
||||
" \n"
|
||||
"If the CGP uses scaling methods which are not \n"
|
||||
"simple, (i.e. source scaling, same scaling \n"
|
||||
"factor for X/Y), the scaling factor displayed \n"
|
||||
"in the menu might not be correct."
|
||||
);
|
||||
break;
|
||||
case MENU_SETTINGS_SHADER_PASSES:
|
||||
snprintf(msg, sizeof(msg),
|
||||
" -- Shader Passes. \n"
|
||||
|
@ -1352,8 +1323,9 @@ static int menu_setting_toggle(unsigned type,
|
|||
{
|
||||
struct retro_perf_counter **counters = NULL;
|
||||
|
||||
if ((type >= MENU_SETTINGS_SHADER_FILTER) &&
|
||||
(type <= MENU_SETTINGS_SHADER_LAST))
|
||||
if ((!strcmp(label, "video_shader_preset")) ||
|
||||
((type >= MENU_SETTINGS_SHADER_FILTER) &&
|
||||
(type <= MENU_SETTINGS_SHADER_LAST)))
|
||||
{
|
||||
if (driver.menu_ctx && driver.menu_ctx->backend
|
||||
&& driver.menu_ctx->backend->shader_manager_setting_toggle)
|
||||
|
@ -2332,7 +2304,6 @@ static void menu_common_setting_set_label(char *type_str,
|
|||
break;
|
||||
#endif
|
||||
case MENU_SETTINGS_CUSTOM_VIEWPORT:
|
||||
case MENU_SETTINGS_SHADER_PRESET:
|
||||
case MENU_SETTINGS_CUSTOM_BIND_ALL:
|
||||
case MENU_SETTINGS_CUSTOM_BIND_DEFAULT_ALL:
|
||||
strlcpy(type_str, "...", type_str_size);
|
||||
|
|
|
@ -324,6 +324,8 @@ static int menu_common_shader_manager_setting_toggle(
|
|||
unsigned dist_filter = id - MENU_SETTINGS_SHADER_0_FILTER;
|
||||
unsigned dist_scale = id - MENU_SETTINGS_SHADER_0_SCALE;
|
||||
|
||||
RARCH_LOG("shader label: %s\n", label);
|
||||
|
||||
if (id == MENU_SETTINGS_SHADER_FILTER)
|
||||
{
|
||||
if ((current_setting = setting_data_find_setting(
|
||||
|
@ -370,13 +372,13 @@ static int menu_common_shader_manager_setting_toggle(
|
|||
else if (!strcmp(label, "shader_apply_changes") ||
|
||||
id == MENU_SETTINGS_SHADER_PASSES)
|
||||
menu_setting_set(id, action);
|
||||
else if (((dist_shader % 3) == 0 || id == MENU_SETTINGS_SHADER_PRESET))
|
||||
else if (!strcmp(label, "video_shader_preset"))
|
||||
{
|
||||
struct gfx_shader *shader = (struct gfx_shader*)driver.menu->shader;
|
||||
struct gfx_shader_pass *pass = NULL;
|
||||
|
||||
dist_shader /= 3;
|
||||
if (shader && id == MENU_SETTINGS_SHADER_PRESET)
|
||||
if (shader)
|
||||
pass = &shader->pass[dist_shader];
|
||||
|
||||
switch (action)
|
||||
|
@ -384,8 +386,7 @@ static int menu_common_shader_manager_setting_toggle(
|
|||
case MENU_ACTION_OK:
|
||||
menu_entries_push(driver.menu->menu_stack,
|
||||
g_settings.video.shader_dir,
|
||||
(id == MENU_SETTINGS_SHADER_PRESET) ?
|
||||
"video_shader_preset" : "video_shader_pass",
|
||||
"video_shader_preset",
|
||||
id, driver.menu->selection_ptr);
|
||||
break;
|
||||
|
||||
|
@ -398,6 +399,28 @@ static int menu_common_shader_manager_setting_toggle(
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if ((dist_shader % 3) == 0)
|
||||
{
|
||||
struct gfx_shader *shader = (struct gfx_shader*)driver.menu->shader;
|
||||
|
||||
dist_shader /= 3;
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case MENU_ACTION_OK:
|
||||
menu_entries_push(driver.menu->menu_stack,
|
||||
g_settings.video.shader_dir,
|
||||
"video_shader_pass",
|
||||
id, driver.menu->selection_ptr);
|
||||
break;
|
||||
|
||||
case MENU_ACTION_START:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ((dist_filter % 3) == 0)
|
||||
{
|
||||
dist_filter /= 3;
|
||||
|
|
|
@ -363,7 +363,6 @@ static void rgui_render(void)
|
|||
type <= MENU_SETTINGS_SHADER_LAST)
|
||||
{
|
||||
if (
|
||||
type == MENU_SETTINGS_SHADER_PRESET ||
|
||||
type == MENU_SETTINGS_SHADER_PARAMETERS ||
|
||||
type == MENU_SETTINGS_SHADER_PRESET_PARAMETERS)
|
||||
strlcpy(type_str, "...", sizeof(type_str));
|
||||
|
|
|
@ -232,7 +232,6 @@ static void rmenu_render(void)
|
|||
type <= MENU_SETTINGS_SHADER_LAST)
|
||||
{
|
||||
if (
|
||||
type == MENU_SETTINGS_SHADER_PRESET ||
|
||||
type == MENU_SETTINGS_SHADER_PARAMETERS ||
|
||||
type == MENU_SETTINGS_SHADER_PRESET_PARAMETERS)
|
||||
strlcpy(type_str, "...", sizeof(type_str));
|
||||
|
|
|
@ -442,9 +442,7 @@ static void rmenu_xui_render(void)
|
|||
if (type >= MENU_SETTINGS_SHADER_FILTER &&
|
||||
type <= MENU_SETTINGS_SHADER_LAST)
|
||||
{
|
||||
if (type == MENU_SETTINGS_SHADER_PRESET)
|
||||
strlcpy(type_str, "...", sizeof(type_str));
|
||||
else if (type == MENU_SETTINGS_SHADER_FILTER)
|
||||
if (type == MENU_SETTINGS_SHADER_FILTER)
|
||||
snprintf(type_str, sizeof(type_str), "%s",
|
||||
g_settings.video.smooth ? "Linear" : "Nearest");
|
||||
else if (driver.menu_ctx && driver.menu_ctx->backend
|
||||
|
|
|
@ -664,7 +664,7 @@ unsigned menu_common_type_is(const char *label, unsigned type)
|
|||
type >= MENU_SETTINGS_SHADER_0 &&
|
||||
type <= MENU_SETTINGS_SHADER_LAST &&
|
||||
(((type - MENU_SETTINGS_SHADER_0) % 3) == 0)) ||
|
||||
type == MENU_SETTINGS_SHADER_PRESET)
|
||||
!strcmp(label, "video_shader_preset"))
|
||||
return MENU_SETTINGS_SHADER_OPTIONS;
|
||||
|
||||
if (
|
||||
|
|
|
@ -91,7 +91,6 @@ typedef enum
|
|||
MENU_SETTINGS_CUSTOM_VIEWPORT,
|
||||
MENU_SETTINGS_SHADER_OPTIONS,
|
||||
MENU_SETTINGS_SHADER_FILTER,
|
||||
MENU_SETTINGS_SHADER_PRESET,
|
||||
MENU_SETTINGS_SHADER_PARAMETERS, // Modifies current shader directly. Will not get saved to CGP.
|
||||
MENU_SETTINGS_SHADER_PRESET_PARAMETERS, // Modifies shader preset currently in menu.
|
||||
MENU_SETTINGS_SHADER_PASSES,
|
||||
|
|
|
@ -491,8 +491,8 @@ int menu_entries_push_list(menu_handle_t *menu,
|
|||
MENU_FILE_SWITCH, 0);
|
||||
file_list_push(list, "Default Filter", "",
|
||||
MENU_SETTINGS_SHADER_FILTER, 0);
|
||||
file_list_push(list, "Load Shader Preset", "",
|
||||
MENU_SETTINGS_SHADER_PRESET, 0);
|
||||
file_list_push(list, "Load Shader Preset", "video_shader_preset",
|
||||
MENU_FILE_SWITCH, 0);
|
||||
file_list_push(list, "Shader Preset Save As",
|
||||
"video_shader_preset_save_as", MENU_FILE_SWITCH, 0);
|
||||
file_list_push(list, "Parameters (Current)", "",
|
||||
|
@ -565,7 +565,7 @@ int menu_entries_push_list(menu_handle_t *menu,
|
|||
|
||||
int menu_parse_check(const char *label, unsigned menu_type)
|
||||
{
|
||||
#if 0
|
||||
#if 1
|
||||
RARCH_LOG("label is menu_parse_check: %s\n", label);
|
||||
#endif
|
||||
if (!((menu_type == MENU_FILE_DIRECTORY ||
|
||||
|
@ -883,6 +883,36 @@ int menu_entries_get_description(const char *label,
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
else if (!strcmp(label, "video_shader_preset"))
|
||||
{
|
||||
snprintf(msg, sizeof_msg,
|
||||
" -- Load Shader Preset. \n"
|
||||
" \n"
|
||||
" Load a "
|
||||
#ifdef HAVE_CG
|
||||
"Cg"
|
||||
#endif
|
||||
#ifdef HAVE_GLSL
|
||||
#ifdef HAVE_CG
|
||||
"/"
|
||||
#endif
|
||||
"GLSL"
|
||||
#endif
|
||||
#ifdef HAVE_HLSL
|
||||
#if defined(HAVE_CG) || defined(HAVE_HLSL)
|
||||
"/"
|
||||
#endif
|
||||
"HLSL"
|
||||
#endif
|
||||
" preset directly. \n"
|
||||
"The menu shader menu is updated accordingly. \n"
|
||||
" \n"
|
||||
"If the CGP uses scaling methods which are not \n"
|
||||
"simple, (i.e. source scaling, same scaling \n"
|
||||
"factor for X/Y), the scaling factor displayed \n"
|
||||
"in the menu might not be correct."
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue