Create DISPLAYLIST_SHADER_PARAMETERS and DISPLAYLIST_SHADER_PARAMETERS_PRESET
This commit is contained in:
parent
467bcb10a1
commit
654f1e0868
|
@ -25,6 +25,8 @@
|
|||
#include "menu_displaylist.h"
|
||||
#include "menu_navigation.h"
|
||||
|
||||
#include "../gfx/video_shader_driver.h"
|
||||
|
||||
#include "../performance.h"
|
||||
#include "../settings.h"
|
||||
|
||||
|
@ -598,6 +600,24 @@ static int menu_displaylist_parse_core_options(menu_displaylist_info_t *info)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
static int deferred_push_video_shader_parameters_common(
|
||||
file_list_t *list, file_list_t *menu_list,
|
||||
const char *path, const char *label, unsigned type,
|
||||
struct video_shader *shader, unsigned base_parameter)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < shader->num_parameters; i++)
|
||||
{
|
||||
menu_list_push(list, shader->parameters[i].desc, label,
|
||||
base_parameter + i, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||
{
|
||||
int ret = 0;
|
||||
|
@ -721,6 +741,26 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
|||
need_push = true;
|
||||
need_refresh = true;
|
||||
break;
|
||||
case DISPLAYLIST_SHADER_PARAMETERS:
|
||||
case DISPLAYLIST_SHADER_PARAMETERS_PRESET:
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
menu_list_clear(info->list);
|
||||
{
|
||||
struct video_shader *shader = video_shader_driver_get_current_shader();
|
||||
if (!shader)
|
||||
return 0;
|
||||
|
||||
ret = deferred_push_video_shader_parameters_common(info->list,
|
||||
info->menu_list,
|
||||
info->path, info->label, info->type, shader,
|
||||
(type == DISPLAYLIST_SHADER_PARAMETERS)
|
||||
? MENU_SETTINGS_SHADER_PARAMETER_0 : MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
|
||||
);
|
||||
|
||||
need_push = true;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
if (need_sort)
|
||||
|
|
|
@ -58,6 +58,8 @@ enum
|
|||
DISPLAYLIST_IMAGES,
|
||||
DISPLAYLIST_FONTS,
|
||||
DISPLAYLIST_OVERLAYS,
|
||||
DISPLAYLIST_SHADER_PARAMETERS,
|
||||
DISPLAYLIST_SHADER_PARAMETERS_PRESET,
|
||||
};
|
||||
|
||||
typedef struct menu_displaylist_info
|
||||
|
|
|
@ -1169,59 +1169,32 @@ static int deferred_push_performance_counters(void *data, void *userdata,
|
|||
return menu_displaylist_push_list(&info, DISPLAYLIST_PERFCOUNTER_SELECTION);
|
||||
}
|
||||
|
||||
static int deferred_push_video_shader_parameters_common(void *data, void *userdata,
|
||||
const char *path, const char *label, unsigned type,
|
||||
struct video_shader *shader, unsigned base_parameter)
|
||||
{
|
||||
unsigned i;
|
||||
file_list_t *list = (file_list_t*)data;
|
||||
file_list_t *menu_list = (file_list_t*)userdata;
|
||||
|
||||
if (!list || !menu_list)
|
||||
return -1;
|
||||
|
||||
menu_list_clear(list);
|
||||
|
||||
for (i = 0; i < shader->num_parameters; i++)
|
||||
{
|
||||
menu_list_push(list,
|
||||
shader->parameters[i].desc, label,
|
||||
base_parameter + i, 0);
|
||||
}
|
||||
|
||||
menu_driver_populate_entries(path, label, type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int deferred_push_video_shader_preset_parameters(void *data, void *userdata,
|
||||
const char *path, const char *label, unsigned type)
|
||||
{
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
if (!menu)
|
||||
return -1;
|
||||
if (!menu->shader)
|
||||
return 0;
|
||||
menu_displaylist_info_t info = {0};
|
||||
|
||||
return deferred_push_video_shader_parameters_common(data, userdata,
|
||||
path, label, type,
|
||||
menu->shader, MENU_SETTINGS_SHADER_PRESET_PARAMETER_0);
|
||||
info.list = (file_list_t*)data;
|
||||
info.menu_list = (file_list_t*)userdata;
|
||||
info.type = type;
|
||||
strlcpy(info.path, path, sizeof(info.path));
|
||||
strlcpy(info.label, label, sizeof(info.label));
|
||||
|
||||
return menu_displaylist_push_list(&info, DISPLAYLIST_SHADER_PARAMETERS_PRESET);
|
||||
}
|
||||
|
||||
static int deferred_push_video_shader_parameters(void *data, void *userdata,
|
||||
const char *path, const char *label, unsigned type)
|
||||
{
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
struct video_shader *shader = video_shader_driver_get_current_shader();
|
||||
if (!shader)
|
||||
return 0;
|
||||
menu_displaylist_info_t info = {0};
|
||||
|
||||
return deferred_push_video_shader_parameters_common(data, userdata,
|
||||
path, label, type,
|
||||
shader, MENU_SETTINGS_SHADER_PARAMETER_0);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
info.list = (file_list_t*)data;
|
||||
info.menu_list = (file_list_t*)userdata;
|
||||
info.type = type;
|
||||
strlcpy(info.path, path, sizeof(info.path));
|
||||
strlcpy(info.label, label, sizeof(info.label));
|
||||
|
||||
return menu_displaylist_push_list(&info, DISPLAYLIST_SHADER_PARAMETERS);
|
||||
}
|
||||
|
||||
static int deferred_push_settings(void *data, void *userdata,
|
||||
|
|
Loading…
Reference in New Issue