mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
(Menu) Refactor shader pass string representation
This commit is contained in:
parent
082b22e670
commit
9913edc365
@ -280,90 +280,6 @@ static int menu_info_screen_iterate(unsigned action)
|
|||||||
snprintf(msg, sizeof(msg),
|
snprintf(msg, sizeof(msg),
|
||||||
" -- Toggles menu.");
|
" -- Toggles menu.");
|
||||||
break;
|
break;
|
||||||
case MENU_SETTINGS_SHADER_0_FILTER + (0 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_FILTER + (1 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_FILTER + (2 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_FILTER + (3 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_FILTER + (4 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_FILTER + (5 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_FILTER + (6 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_FILTER + (7 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_FILTER + (8 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_FILTER + (9 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_FILTER + (10 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_FILTER + (11 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_FILTER + (12 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_FILTER + (13 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_FILTER + (14 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_FILTER + (15 * 3):
|
|
||||||
snprintf(msg, sizeof(msg),
|
|
||||||
" -- Hardware filter for this pass. \n"
|
|
||||||
" \n"
|
|
||||||
"If 'Don't Care' is set, 'Default \n"
|
|
||||||
"Filter' will be used."
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case MENU_SETTINGS_SHADER_0 + (0 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0 + (1 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0 + (2 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0 + (3 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0 + (4 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0 + (5 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0 + (6 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0 + (7 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0 + (8 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0 + (9 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0 + (10 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0 + (11 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0 + (12 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0 + (13 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0 + (14 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0 + (15 * 3):
|
|
||||||
snprintf(msg, sizeof(msg),
|
|
||||||
" -- Path to shader. \n"
|
|
||||||
" \n"
|
|
||||||
"All shaders must be of the same \n"
|
|
||||||
"type (i.e. CG, GLSL or HLSL). \n"
|
|
||||||
" \n"
|
|
||||||
"Set Shader Directory to set where \n"
|
|
||||||
"the browser starts to look for \n"
|
|
||||||
"shaders."
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case MENU_SETTINGS_SHADER_0_SCALE + (0 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_SCALE + (1 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_SCALE + (2 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_SCALE + (3 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_SCALE + (4 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_SCALE + (5 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_SCALE + (6 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_SCALE + (7 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_SCALE + (8 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_SCALE + (9 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_SCALE + (10 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_SCALE + (11 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_SCALE + (12 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_SCALE + (13 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_SCALE + (14 * 3):
|
|
||||||
case MENU_SETTINGS_SHADER_0_SCALE + (15 * 3):
|
|
||||||
snprintf(msg, sizeof(msg),
|
|
||||||
" -- Scale for this pass. \n"
|
|
||||||
" \n"
|
|
||||||
"The scale factor accumulates, i.e. 2x \n"
|
|
||||||
"for first pass and 2x for second pass \n"
|
|
||||||
"will give you a 4x total scale. \n"
|
|
||||||
" \n"
|
|
||||||
"If there is a scale factor for last \n"
|
|
||||||
"pass, the result is stretched to \n"
|
|
||||||
"screen with the filter specified in \n"
|
|
||||||
"'Default Filter'. \n"
|
|
||||||
" \n"
|
|
||||||
"If 'Don't Care' is set, either 1x \n"
|
|
||||||
"scale or stretch to fullscreen will \n"
|
|
||||||
"be used depending if it's not the last \n"
|
|
||||||
"pass or not."
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
snprintf(msg, sizeof(msg),
|
snprintf(msg, sizeof(msg),
|
||||||
"-- No info on this item available. --\n");
|
"-- No info on this item available. --\n");
|
||||||
|
@ -321,6 +321,10 @@ static int menu_common_shader_manager_setting_toggle(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
RARCH_LOG("shader label: %s\n", label);
|
||||||
|
#endif
|
||||||
|
|
||||||
rarch_setting_t *current_setting = NULL;
|
rarch_setting_t *current_setting = NULL;
|
||||||
rarch_setting_t *setting_data = (rarch_setting_t *)setting_data_get_list();
|
rarch_setting_t *setting_data = (rarch_setting_t *)setting_data_get_list();
|
||||||
|
|
||||||
@ -376,13 +380,6 @@ static int menu_common_shader_manager_setting_toggle(
|
|||||||
menu_setting_set(id, label, action);
|
menu_setting_set(id, label, action);
|
||||||
else if (!strcmp(label, "video_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)
|
|
||||||
pass = &shader->pass[dist_shader];
|
|
||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
case MENU_ACTION_OK:
|
case MENU_ACTION_OK:
|
||||||
@ -393,15 +390,13 @@ static int menu_common_shader_manager_setting_toggle(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_ACTION_START:
|
case MENU_ACTION_START:
|
||||||
if (pass)
|
|
||||||
*pass->source.path = '\0';
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((dist_shader % 3) == 0)
|
else if (!strcmp(label, "video_shader_pass"))
|
||||||
{
|
{
|
||||||
struct gfx_shader *shader = (struct gfx_shader*)driver.menu->shader;
|
struct gfx_shader *shader = (struct gfx_shader*)driver.menu->shader;
|
||||||
|
|
||||||
@ -423,7 +418,7 @@ static int menu_common_shader_manager_setting_toggle(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((dist_filter % 3) == 0)
|
else if (!strcmp(label, "video_shader_filter_pass"))
|
||||||
{
|
{
|
||||||
dist_filter /= 3;
|
dist_filter /= 3;
|
||||||
struct gfx_shader *shader = (struct gfx_shader*)driver.menu->shader;
|
struct gfx_shader *shader = (struct gfx_shader*)driver.menu->shader;
|
||||||
@ -451,7 +446,7 @@ static int menu_common_shader_manager_setting_toggle(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((dist_scale % 3) == 0)
|
else if (!strcmp(label, "video_shader_scale_pass"))
|
||||||
{
|
{
|
||||||
dist_scale /= 3;
|
dist_scale /= 3;
|
||||||
struct gfx_shader *shader = (struct gfx_shader*)driver.menu->shader;
|
struct gfx_shader *shader = (struct gfx_shader*)driver.menu->shader;
|
||||||
|
@ -634,12 +634,9 @@ void menu_build_scroll_indices(file_list_t *buf)
|
|||||||
unsigned menu_common_type_is(const char *label, unsigned type)
|
unsigned menu_common_type_is(const char *label, unsigned type)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
(
|
!strcmp(label, "video_shader_pass") ||
|
||||||
type >= MENU_SETTINGS_SHADER_0 &&
|
!strcmp(label, "video_shader_filter_pass") ||
|
||||||
type <= MENU_SETTINGS_SHADER_LAST &&
|
!strcmp(label, "video_shader_scale_pass") ||
|
||||||
(((type - MENU_SETTINGS_SHADER_0) % 3) == 0)
|
|
||||||
)
|
|
||||||
||
|
|
||||||
!strcmp(label, "video_shader_default_filter") ||
|
!strcmp(label, "video_shader_default_filter") ||
|
||||||
!strcmp(label, "video_shader_num_passes") ||
|
!strcmp(label, "video_shader_num_passes") ||
|
||||||
!strcmp(label, "video_shader_preset")
|
!strcmp(label, "video_shader_preset")
|
||||||
|
@ -508,15 +508,15 @@ int menu_entries_push_list(menu_handle_t *menu,
|
|||||||
char buf[64];
|
char buf[64];
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "Shader #%u", i);
|
snprintf(buf, sizeof(buf), "Shader #%u", i);
|
||||||
file_list_push(list, buf, "",
|
file_list_push(list, buf, "video_shader_pass",
|
||||||
MENU_SETTINGS_SHADER_0 + 3 * i, 0);
|
MENU_SETTINGS_SHADER_0 + 3 * i, 0);
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "Shader #%u Filter", i);
|
snprintf(buf, sizeof(buf), "Shader #%u Filter", i);
|
||||||
file_list_push(list, buf, "",
|
file_list_push(list, buf, "video_shader_filter_pass",
|
||||||
MENU_SETTINGS_SHADER_0_FILTER + 3 * i, 0);
|
MENU_SETTINGS_SHADER_0_FILTER + 3 * i, 0);
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "Shader #%u Scale", i);
|
snprintf(buf, sizeof(buf), "Shader #%u Scale", i);
|
||||||
file_list_push(list, buf, "",
|
file_list_push(list, buf, "video_shader_scale_pass",
|
||||||
MENU_SETTINGS_SHADER_0_SCALE + 3 * i, 0);
|
MENU_SETTINGS_SHADER_0_SCALE + 3 * i, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -945,5 +945,50 @@ int menu_entries_get_description(const char *label,
|
|||||||
);
|
);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
else if (!strcmp(label, "video_shader_pass"))
|
||||||
|
{
|
||||||
|
snprintf(msg, sizeof_msg,
|
||||||
|
" -- Path to shader. \n"
|
||||||
|
" \n"
|
||||||
|
"All shaders must be of the same \n"
|
||||||
|
"type (i.e. CG, GLSL or HLSL). \n"
|
||||||
|
" \n"
|
||||||
|
"Set Shader Directory to set where \n"
|
||||||
|
"the browser starts to look for \n"
|
||||||
|
"shaders."
|
||||||
|
);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if (!strcmp(label, "video_shader_filter_pass"))
|
||||||
|
{
|
||||||
|
snprintf(msg, sizeof_msg,
|
||||||
|
" -- Hardware filter for this pass. \n"
|
||||||
|
" \n"
|
||||||
|
"If 'Don't Care' is set, 'Default \n"
|
||||||
|
"Filter' will be used."
|
||||||
|
);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if (!strcmp(label, "video_shader_scale_pass"))
|
||||||
|
{
|
||||||
|
snprintf(msg, sizeof_msg,
|
||||||
|
" -- Scale for this pass. \n"
|
||||||
|
" \n"
|
||||||
|
"The scale factor accumulates, i.e. 2x \n"
|
||||||
|
"for first pass and 2x for second pass \n"
|
||||||
|
"will give you a 4x total scale. \n"
|
||||||
|
" \n"
|
||||||
|
"If there is a scale factor for last \n"
|
||||||
|
"pass, the result is stretched to \n"
|
||||||
|
"screen with the filter specified in \n"
|
||||||
|
"'Default Filter'. \n"
|
||||||
|
" \n"
|
||||||
|
"If 'Don't Care' is set, either 1x \n"
|
||||||
|
"scale or stretch to fullscreen will \n"
|
||||||
|
"be used depending if it's not the last \n"
|
||||||
|
"pass or not."
|
||||||
|
);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user