Put shader code under ifdefs

This commit is contained in:
twinaphex 2015-09-07 22:30:20 +02:00
parent 75d2eb515f
commit c0be42265f
2 changed files with 16 additions and 20 deletions

View File

@ -26,17 +26,16 @@
#include "../../general.h"
#include "../../retroarch.h"
#ifdef HAVE_SHADER_MANAGER
static int generic_shader_action_parameter_left(
struct video_shader *shader, struct video_shader_parameter *param,
unsigned type, const char *label, bool wraparound)
{
#ifdef HAVE_SHADER_MANAGER
if (shader)
{
param->current -= param->step;
param->current = min(max(param->minimum, param->current), param->maximum);
}
#endif
return 0;
}
@ -56,6 +55,7 @@ static int shader_action_parameter_preset_left(unsigned type, const char *label,
struct video_shader_parameter *param = &shader->parameters[type - MENU_SETTINGS_SHADER_PRESET_PARAMETER_0];
return generic_shader_action_parameter_left(shader, param, type, label, wraparound);
}
#endif
static int action_left_cheat(unsigned type, const char *label,
bool wraparound)
@ -390,15 +390,17 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs,
static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs,
unsigned type, uint32_t label_hash, uint32_t menu_label_hash)
{
if (type >= MENU_SETTINGS_SHADER_PARAMETER_0
if (type >= MENU_SETTINGS_CHEAT_BEGIN
&& type <= MENU_SETTINGS_CHEAT_END)
cbs->action_left = action_left_cheat;
#ifdef HAVE_SHADER_MANAGER
else if (type >= MENU_SETTINGS_SHADER_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
cbs->action_left = shader_action_parameter_left;
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST)
cbs->action_left = shader_action_parameter_preset_left;
else if (type >= MENU_SETTINGS_CHEAT_BEGIN
&& type <= MENU_SETTINGS_CHEAT_END)
cbs->action_left = action_left_cheat;
#endif
else if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN
&& type <= MENU_SETTINGS_INPUT_DESC_END)
cbs->action_left = action_left_input_desc;

View File

@ -27,11 +27,11 @@
#include "../../retroarch.h"
#ifdef HAVE_SHADER_MANAGER
static int generic_shader_action_parameter_right(
struct video_shader *shader, struct video_shader_parameter *param,
unsigned type, const char *label, bool wraparound)
{
#ifdef HAVE_SHADER_MANAGER
driver_t *driver = driver_get_ptr();
const ui_companion_driver_t *ui = ui_companion_get_ptr();
@ -43,33 +43,25 @@ static int generic_shader_action_parameter_right(
if (ui->notify_refresh && ui_companion_is_on_foreground())
ui->notify_refresh(driver->ui_companion_data);
#endif
return 0;
}
int shader_action_parameter_right(unsigned type, const char *label, bool wraparound)
{
#ifdef HAVE_SHADER_MANAGER
struct video_shader *shader = video_shader_driver_get_current_shader();
struct video_shader_parameter *param = &shader->parameters[type - MENU_SETTINGS_SHADER_PARAMETER_0];
return generic_shader_action_parameter_right(shader, param, type, label, wraparound);
#else
return 0;
#endif
}
int shader_action_parameter_preset_right(unsigned type, const char *label,
bool wraparound)
{
#ifdef HAVE_SHADER_MANAGER
menu_handle_t *menu = menu_driver_get_ptr();
struct video_shader *shader = menu ? menu->shader : NULL;
struct video_shader_parameter *param = &shader->parameters[type - MENU_SETTINGS_SHADER_PRESET_PARAMETER_0];
return generic_shader_action_parameter_right(shader, param, type, label, wraparound);
#else
return 0;
#endif
}
#endif
int generic_action_cheat_toggle(size_t idx, unsigned type, const char *label,
bool wraparound)
@ -356,15 +348,17 @@ static int bind_right_generic(unsigned type, const char *label,
static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs,
unsigned type, uint32_t label_hash, uint32_t menu_label_hash)
{
if (type >= MENU_SETTINGS_SHADER_PARAMETER_0
if (type >= MENU_SETTINGS_CHEAT_BEGIN
&& type <= MENU_SETTINGS_CHEAT_END)
cbs->action_right = action_right_cheat;
#ifdef HAVE_SHADER_MANAGER
else if (type >= MENU_SETTINGS_SHADER_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
cbs->action_right = shader_action_parameter_right;
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST)
cbs->action_right = shader_action_parameter_preset_right;
else if (type >= MENU_SETTINGS_CHEAT_BEGIN
&& type <= MENU_SETTINGS_CHEAT_END)
cbs->action_right = action_right_cheat;
#endif
else if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN
&& type <= MENU_SETTINGS_INPUT_DESC_END)
cbs->action_right = action_right_input_desc;