From fbb7dbd36bf4ba5187a34cac8554afb8f653af3e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 9 Jan 2017 17:22:28 +0100 Subject: [PATCH] Add pipeline.active to menu_display_draw_ctx_t --- menu/drivers/materialui.c | 7 ++++--- menu/drivers/nuklear.c | 5 +++-- menu/drivers/xmb.c | 10 ++++++++++ menu/menu_display.c | 15 ++++----------- menu/menu_display.h | 1 + 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 1cdb9756e4..312aad542d 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -844,9 +844,10 @@ static void mui_draw_bg(menu_display_ctx_draw_t *draw) { menu_display_blend_begin(); - draw->x = 0; - draw->y = 0; - draw->pipeline.id = 0; + draw->x = 0; + draw->y = 0; + draw->pipeline.id = 0; + draw->pipeline.active = false; menu_display_draw_bg(draw, false); menu_display_draw(draw); diff --git a/menu/drivers/nuklear.c b/menu/drivers/nuklear.c index 437c273a7c..9d7a94aae9 100644 --- a/menu/drivers/nuklear.c +++ b/menu/drivers/nuklear.c @@ -275,8 +275,9 @@ static void nk_draw_bg( menu_display_blend_begin(); menu_display_set_viewport(); - draw.pipeline.id = VIDEO_SHADER_MENU_5; - draw.pipeline.id = VIDEO_SHADER_MENU_5; + draw.pipeline.id = VIDEO_SHADER_MENU_5; + draw.pipeline.id = VIDEO_SHADER_MENU_5; + draw.pipeline.active = false; menu_display_draw_pipeline(&draw); menu_display_draw(&draw); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 72edc67b00..878ef298b4 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2399,6 +2399,15 @@ static void xmb_render(void *data) menu_animation_ctl(MENU_ANIMATION_CTL_CLEAR_ACTIVE, NULL); } +static bool xmb_shader_pipeline_active(settings_t *settings) +{ + if (!string_is_equal(menu_driver_ident(), "xmb")) + return false; + if (settings->menu.xmb.shader_pipeline == XMB_SHADER_PIPELINE_WALLPAPER) + return false; + return true; +} + static void xmb_draw_bg( xmb_handle_t *xmb, unsigned width, @@ -2428,6 +2437,7 @@ static void xmb_draw_bg( draw.vertex_count = 4; draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP; draw.pipeline.id = 0; + draw.pipeline.active = xmb_shader_pipeline_active(settings); menu_display_blend_begin(); menu_display_set_viewport(); diff --git a/menu/menu_display.c b/menu/menu_display.c index 7dd6405c82..d2eaf151e0 100644 --- a/menu/menu_display.c +++ b/menu/menu_display.c @@ -484,15 +484,6 @@ void menu_display_draw(menu_display_ctx_draw_t *draw) menu_disp->draw(draw); } -static bool menu_display_shader_pipeline_active(settings_t *settings) -{ - if (!string_is_equal(menu_driver_ident(), "xmb")) - return false; - if (settings->menu.xmb.shader_pipeline == XMB_SHADER_PIPELINE_WALLPAPER) - return false; - return true; -} - void menu_display_draw_pipeline(menu_display_ctx_draw_t *draw) { if (!menu_disp || !draw || !menu_disp->draw_pipeline) @@ -505,7 +496,6 @@ void menu_display_draw_bg(menu_display_ctx_draw_t *draw, bool add_opacity_to_wal static struct video_coords coords; const float *new_vertex = NULL; const float *new_tex_coord = NULL; - settings_t *settings = config_get_ptr(); if (!menu_disp || !draw) return; @@ -525,11 +515,14 @@ void menu_display_draw_bg(menu_display_ctx_draw_t *draw, bool add_opacity_to_wal draw->coords = &coords; - if (!menu_display_libretro_running() && !menu_display_shader_pipeline_active(settings)) + if (!menu_display_libretro_running() && !draw->pipeline.active) add_opacity_to_wallpaper = true; if (add_opacity_to_wallpaper) + { + settings_t *settings = config_get_ptr(); menu_display_set_alpha(draw->color, settings->menu.wallpaper.opacity); + } if (!draw->texture) draw->texture = menu_display_white_texture; diff --git a/menu/menu_display.h b/menu/menu_display.h index 258d07ea7e..d58c00df12 100644 --- a/menu/menu_display.h +++ b/menu/menu_display.h @@ -129,6 +129,7 @@ typedef struct menu_display_ctx_draw { unsigned id; const void *backend_data; + bool active; } pipeline; } menu_display_ctx_draw_t;