Create menu_shader_manager_get_pass

This commit is contained in:
twinaphex 2017-01-09 03:06:24 +01:00
parent 9b0950440a
commit 5e3c2f3f63
3 changed files with 27 additions and 18 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -19,8 +19,12 @@
#include <retro_common_api.h>
#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);
/**