Divorce menu->shader from menu_handle_t

This commit is contained in:
twinaphex 2015-12-10 20:12:08 +01:00
parent aaf6d64432
commit 5fbfabab5b
2 changed files with 9 additions and 8 deletions

View File

@ -56,6 +56,7 @@ static const menu_ctx_driver_t *menu_ctx_drivers[] = {
static menu_handle_t *menu_driver_data;
static const menu_ctx_driver_t *menu_driver_ctx;
static struct video_shader *menu_driver_shader;
/**
* menu_driver_find_handle:
@ -612,8 +613,8 @@ void *menu_init(const void *data)
goto error;
#ifdef HAVE_SHADER_MANAGER
menu->shader = (struct video_shader*)calloc(1, sizeof(struct video_shader));
if (!menu->shader)
menu_driver_shader = (struct video_shader*)calloc(1, sizeof(struct video_shader));
if (!menu_driver_shader)
goto error;
#endif
@ -666,9 +667,9 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
break;
case RARCH_MENU_CTL_SHADER_DEINIT:
#ifdef HAVE_SHADER_MANAGER
if (menu_driver_data->shader)
free(menu_driver_data->shader);
menu_driver_data->shader = NULL;
if (menu_driver_shader)
free(menu_driver_shader);
menu_driver_shader = NULL;
#endif
return true;
case RARCH_MENU_CTL_SHADER_GET:
@ -676,7 +677,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
struct video_shader **shader = (struct video_shader**)data;
if (!shader)
return false;
*shader = menu_driver_data ? menu_driver_data->shader : NULL;
*shader = menu_driver_shader;
}
return true;
case RARCH_MENU_CTL_FRAME:

View File

@ -30,12 +30,13 @@
#include "menu_entries.h"
#include "menu_setting.h"
#include "../gfx/video_shader_driver.h"
#include "../driver.h"
#include "../libretro.h"
#include "../playlist.h"
#include "../input/input_driver.h"
#include "../dynamic.h"
#include "../gfx/video_shader_driver.h"
#ifdef __cplusplus
extern "C" {
@ -243,7 +244,6 @@ typedef struct
/* Menu shader */
char default_glslp[PATH_MAX_LENGTH];
char default_cgp[PATH_MAX_LENGTH];
struct video_shader *shader;
content_playlist_t *playlist;
char db_playlist_file[PATH_MAX_LENGTH];