mirror of
https://github.com/libretro/RetroArch
synced 2025-04-18 14:42:30 +00:00
Reimplement shader preset parameter functions
This commit is contained in:
parent
b5cc71720c
commit
18f2b9c63e
@ -370,13 +370,14 @@ static void menu_action_setting_disp_set_label_shader_default_filter(
|
|||||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NEAREST), len);
|
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NEAREST), len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_action_setting_disp_set_label_shader_parameter(
|
static void menu_action_setting_disp_set_label_shader_parameter_internal(
|
||||||
file_list_t* list,
|
file_list_t* list,
|
||||||
unsigned *w, unsigned type, unsigned i,
|
unsigned *w, unsigned type, unsigned i,
|
||||||
const char *label,
|
const char *label,
|
||||||
char *s, size_t len,
|
char *s, size_t len,
|
||||||
const char *path,
|
const char *path,
|
||||||
char *s2, size_t len2)
|
char *s2, size_t len2,
|
||||||
|
unsigned offset)
|
||||||
{
|
{
|
||||||
video_shader_ctx_t shader_info;
|
video_shader_ctx_t shader_info;
|
||||||
const struct video_shader_parameter *param = NULL;
|
const struct video_shader_parameter *param = NULL;
|
||||||
@ -390,8 +391,7 @@ static void menu_action_setting_disp_set_label_shader_parameter(
|
|||||||
if (!shader_info.data)
|
if (!shader_info.data)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
param = &shader_info.data->parameters[type -
|
param = &shader_info.data->parameters[type - offset];
|
||||||
MENU_SETTINGS_SHADER_PARAMETER_0];
|
|
||||||
|
|
||||||
if (!param)
|
if (!param)
|
||||||
return;
|
return;
|
||||||
@ -400,6 +400,18 @@ static void menu_action_setting_disp_set_label_shader_parameter(
|
|||||||
param->current, param->minimum, param->maximum);
|
param->current, param->minimum, param->maximum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void menu_action_setting_disp_set_label_shader_parameter(
|
||||||
|
file_list_t* list,
|
||||||
|
unsigned *w, unsigned type, unsigned i,
|
||||||
|
const char *label,
|
||||||
|
char *s, size_t len,
|
||||||
|
const char *path,
|
||||||
|
char *s2, size_t len2)
|
||||||
|
{
|
||||||
|
menu_action_setting_disp_set_label_shader_parameter_internal(list, w, type, i,
|
||||||
|
label, s, len, path, s2, len2, MENU_SETTINGS_SHADER_PARAMETER_0);
|
||||||
|
}
|
||||||
|
|
||||||
static void menu_action_setting_disp_set_label_shader_preset_parameter(
|
static void menu_action_setting_disp_set_label_shader_preset_parameter(
|
||||||
file_list_t* list,
|
file_list_t* list,
|
||||||
unsigned *w, unsigned type, unsigned i,
|
unsigned *w, unsigned type, unsigned i,
|
||||||
@ -408,18 +420,8 @@ static void menu_action_setting_disp_set_label_shader_preset_parameter(
|
|||||||
const char *path,
|
const char *path,
|
||||||
char *s2, size_t len2)
|
char *s2, size_t len2)
|
||||||
{
|
{
|
||||||
struct video_shader *shader = menu_shader_get();
|
menu_action_setting_disp_set_label_shader_parameter_internal(list, w, type, i,
|
||||||
struct video_shader_parameter *param = shader ?
|
label, s, len, path, s2, len2, MENU_SETTINGS_SHADER_PRESET_PARAMETER_0);
|
||||||
&shader->parameters[type - MENU_SETTINGS_SHADER_PRESET_PARAMETER_0]
|
|
||||||
: NULL;
|
|
||||||
|
|
||||||
*s = '\0';
|
|
||||||
*w = 19;
|
|
||||||
strlcpy(s2, path, len2);
|
|
||||||
|
|
||||||
if (param)
|
|
||||||
snprintf(s, len, "%.2f [%.2f %.2f]",
|
|
||||||
param->current, param->minimum, param->maximum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_action_setting_disp_set_label_shader_scale_pass(
|
static void menu_action_setting_disp_set_label_shader_scale_pass(
|
||||||
|
@ -64,7 +64,8 @@ static int generic_shader_action_parameter_left(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int shader_action_parameter_left(unsigned type, const char *label, bool wraparound)
|
static int shader_action_parameter_left_internal(unsigned type, const char *label, bool wraparound,
|
||||||
|
unsigned offset)
|
||||||
{
|
{
|
||||||
video_shader_ctx_t shader_info;
|
video_shader_ctx_t shader_info;
|
||||||
struct video_shader *shader = menu_shader_get();
|
struct video_shader *shader = menu_shader_get();
|
||||||
@ -75,9 +76,8 @@ static int shader_action_parameter_left(unsigned type, const char *label, bool w
|
|||||||
|
|
||||||
video_shader_driver_get_current_shader(&shader_info);
|
video_shader_driver_get_current_shader(&shader_info);
|
||||||
|
|
||||||
param_prev = &shader_info.data->parameters[type - MENU_SETTINGS_SHADER_PARAMETER_0];
|
param_prev = &shader_info.data->parameters[type - offset];
|
||||||
param_menu = shader ? &shader->parameters[type -
|
param_menu = shader ? &shader->parameters [type - offset] : NULL;
|
||||||
MENU_SETTINGS_SHADER_PARAMETER_0] : NULL;
|
|
||||||
|
|
||||||
if (!param_prev || !param_menu)
|
if (!param_prev || !param_menu)
|
||||||
return menu_cbs_exit();
|
return menu_cbs_exit();
|
||||||
@ -89,6 +89,16 @@ static int shader_action_parameter_left(unsigned type, const char *label, bool w
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int shader_action_parameter_left(unsigned type, const char *label, bool wraparound)
|
||||||
|
{
|
||||||
|
return shader_action_parameter_left_internal(type, label, wraparound, MENU_SETTINGS_SHADER_PARAMETER_0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int shader_action_preset_parameter_left(unsigned type, const char *label, bool wraparound)
|
||||||
|
{
|
||||||
|
return shader_action_parameter_left_internal(type, label, wraparound, MENU_SETTINGS_SHADER_PRESET_PARAMETER_0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_AUDIOMIXER
|
#ifdef HAVE_AUDIOMIXER
|
||||||
@ -920,7 +930,7 @@ static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs,
|
|||||||
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
|
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
|
||||||
&& type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST)
|
&& type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST)
|
||||||
{
|
{
|
||||||
BIND_ACTION_LEFT(cbs, shader_action_parameter_left);
|
BIND_ACTION_LEFT(cbs, shader_action_preset_parameter_left);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN
|
else if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN
|
||||||
|
@ -64,7 +64,8 @@ static int generic_shader_action_parameter_right(struct video_shader_parameter *
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int shader_action_parameter_right(unsigned type, const char *label, bool wraparound)
|
static int generic_shader_action_parameter_right_internal(unsigned type, const char *label,
|
||||||
|
bool wraparound, unsigned offset)
|
||||||
{
|
{
|
||||||
video_shader_ctx_t shader_info;
|
video_shader_ctx_t shader_info;
|
||||||
struct video_shader *shader = menu_shader_get();
|
struct video_shader *shader = menu_shader_get();
|
||||||
@ -75,9 +76,8 @@ int shader_action_parameter_right(unsigned type, const char *label, bool wraparo
|
|||||||
|
|
||||||
video_shader_driver_get_current_shader(&shader_info);
|
video_shader_driver_get_current_shader(&shader_info);
|
||||||
|
|
||||||
param_prev = &shader_info.data->parameters[type - MENU_SETTINGS_SHADER_PARAMETER_0];
|
param_prev = &shader_info.data->parameters[type - offset];
|
||||||
param_menu = shader ? &shader->parameters[type -
|
param_menu = shader ? &shader->parameters [type - offset] : NULL;
|
||||||
MENU_SETTINGS_SHADER_PARAMETER_0] : NULL;
|
|
||||||
|
|
||||||
if (!param_prev || !param_menu)
|
if (!param_prev || !param_menu)
|
||||||
return menu_cbs_exit();
|
return menu_cbs_exit();
|
||||||
@ -89,6 +89,16 @@ int shader_action_parameter_right(unsigned type, const char *label, bool wraparo
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int shader_action_parameter_right(unsigned type, const char *label, bool wraparound)
|
||||||
|
{
|
||||||
|
return generic_shader_action_parameter_right_internal(type, label, wraparound, MENU_SETTINGS_SHADER_PARAMETER_0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int shader_action_preset_parameter_right(unsigned type, const char *label, bool wraparound)
|
||||||
|
{
|
||||||
|
return generic_shader_action_parameter_right_internal(type, label, wraparound, MENU_SETTINGS_SHADER_PRESET_PARAMETER_0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int generic_action_cheat_toggle(size_t idx, unsigned type, const char *label,
|
int generic_action_cheat_toggle(size_t idx, unsigned type, const char *label,
|
||||||
@ -805,7 +815,7 @@ static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs,
|
|||||||
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
|
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
|
||||||
&& type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST)
|
&& type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST)
|
||||||
{
|
{
|
||||||
BIND_ACTION_RIGHT(cbs, shader_action_parameter_right);
|
BIND_ACTION_RIGHT(cbs, shader_action_preset_parameter_right);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN
|
else if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN
|
||||||
|
@ -132,7 +132,7 @@ static int shader_action_parameter_select(const char *path, const char *label, u
|
|||||||
static int shader_action_parameter_preset_select(const char *path, const char *label, unsigned type,
|
static int shader_action_parameter_preset_select(const char *path, const char *label, unsigned type,
|
||||||
size_t idx, size_t entry_idx)
|
size_t idx, size_t entry_idx)
|
||||||
{
|
{
|
||||||
return shader_action_parameter_right(type, label, true);
|
return shader_action_preset_parameter_right(type, label, true);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -166,13 +166,12 @@ static int action_start_input_desc(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
|
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
|
||||||
static int action_start_shader_action_parameter(
|
static int action_start_shader_action_parameter_generic(
|
||||||
const char *path, const char *label,
|
unsigned type, unsigned offset)
|
||||||
unsigned type, size_t idx, size_t entry_idx)
|
|
||||||
{
|
{
|
||||||
video_shader_ctx_t shader_info;
|
video_shader_ctx_t shader_info;
|
||||||
struct video_shader_parameter *param = NULL;
|
struct video_shader_parameter *param = NULL;
|
||||||
unsigned parameter = type - MENU_SETTINGS_SHADER_PARAMETER_0;
|
unsigned parameter = type - offset;
|
||||||
|
|
||||||
video_shader_driver_get_current_shader(&shader_info);
|
video_shader_driver_get_current_shader(&shader_info);
|
||||||
|
|
||||||
@ -187,6 +186,20 @@ static int action_start_shader_action_parameter(
|
|||||||
return menu_shader_manager_clear_parameter(menu_shader_get(), parameter);
|
return menu_shader_manager_clear_parameter(menu_shader_get(), parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int action_start_shader_action_parameter(
|
||||||
|
const char *path, const char *label,
|
||||||
|
unsigned type, size_t idx, size_t entry_idx)
|
||||||
|
{
|
||||||
|
return action_start_shader_action_parameter_generic(type, MENU_SETTINGS_SHADER_PARAMETER_0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int action_start_shader_action_preset_parameter(
|
||||||
|
const char *path, const char *label,
|
||||||
|
unsigned type, size_t idx, size_t entry_idx)
|
||||||
|
{
|
||||||
|
return action_start_shader_action_parameter_generic(type, MENU_SETTINGS_SHADER_PRESET_PARAMETER_0);
|
||||||
|
}
|
||||||
|
|
||||||
static int action_start_shader_pass(
|
static int action_start_shader_pass(
|
||||||
const char *path, const char *label,
|
const char *path, const char *label,
|
||||||
unsigned type, size_t idx, size_t entry_idx)
|
unsigned type, size_t idx, size_t entry_idx)
|
||||||
@ -510,7 +523,7 @@ static int menu_cbs_init_bind_start_compare_type(menu_file_list_cbs_t *cbs,
|
|||||||
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
|
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
|
||||||
&& type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST)
|
&& type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST)
|
||||||
{
|
{
|
||||||
BIND_ACTION_START(cbs, action_start_shader_action_parameter);
|
BIND_ACTION_START(cbs, action_start_shader_action_preset_parameter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -196,6 +196,7 @@ int action_cancel_pop_default(const char *path,
|
|||||||
int action_refresh_default(file_list_t *list, file_list_t *menu_list);
|
int action_refresh_default(file_list_t *list, file_list_t *menu_list);
|
||||||
|
|
||||||
int shader_action_parameter_right(unsigned type, const char *label, bool wraparound);
|
int shader_action_parameter_right(unsigned type, const char *label, bool wraparound);
|
||||||
|
int shader_action_preset_parameter_right(unsigned type, const char *label, bool wraparound);
|
||||||
|
|
||||||
int action_cancel_pop_with_new_pos(const char *path,
|
int action_cancel_pop_with_new_pos(const char *path,
|
||||||
const char *label, unsigned type, size_t idx, size_t new_idx);
|
const char *label, unsigned type, size_t idx, size_t new_idx);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user