diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index baa11a4070..7ad2b88478 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -215,27 +215,21 @@ static int action_left_shader_scale_pass(unsigned type, const char *label, bool wraparound) { #ifdef HAVE_SHADER_MANAGER - unsigned pass = type - MENU_SETTINGS_SHADER_PASS_SCALE_0; - struct video_shader *shader = NULL; - struct video_shader_pass *shader_pass = NULL; + unsigned current_scale, delta; + unsigned pass = type - + MENU_SETTINGS_SHADER_PASS_SCALE_0; + struct video_shader_pass *shader_pass = menu_shader_manager_get_pass(pass); - menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET, - &shader); - if (!shader) - return menu_cbs_exit(); - shader_pass = &shader->pass[pass]; if (!shader_pass) return menu_cbs_exit(); - { - unsigned current_scale = shader_pass->fbo.scale_x; - unsigned delta = 5; - current_scale = (current_scale + delta) % 6; + current_scale = shader_pass->fbo.scale_x; + delta = 5; + current_scale = (current_scale + delta) % 6; - shader_pass->fbo.valid = current_scale; - shader_pass->fbo.scale_x = shader_pass->fbo.scale_y = current_scale; - - } + shader_pass->fbo.valid = current_scale; + shader_pass->fbo.scale_x = current_scale; + shader_pass->fbo.scale_y = current_scale; #endif return 0; } diff --git a/menu/menu_shader.c b/menu/menu_shader.c index c146222226..65566a7461 100644 --- a/menu/menu_shader.c +++ b/menu/menu_shader.c @@ -32,8 +32,6 @@ #include "../paths.h" #include "../verbosity.h" -#include "../gfx/video_shader_driver.h" - #ifdef HAVE_SHADER_MANAGER /* Menu shader */ static char default_glslp[PATH_MAX_LENGTH]; @@ -41,6 +39,19 @@ static char default_cgp[PATH_MAX_LENGTH]; static char default_slangp[PATH_MAX_LENGTH]; #endif +struct video_shader_pass *menu_shader_manager_get_pass(unsigned i) +{ + struct video_shader *shader = NULL; + + menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET, + &shader); + + if (!shader) + return NULL; + + return &shader->pass[i]; +} + unsigned menu_shader_manager_get_amount_passes(void) { struct video_shader *shader = NULL; diff --git a/menu/menu_shader.h b/menu/menu_shader.h index 1e5fac18ab..3e28b902a1 100644 --- a/menu/menu_shader.h +++ b/menu/menu_shader.h @@ -19,8 +19,12 @@ #include +#include "../gfx/video_shader_driver.h" + RETRO_BEGIN_DECLS +struct video_shader_pass *menu_shader_manager_get_pass(unsigned i); + unsigned menu_shader_manager_get_amount_passes(void); /**