diff --git a/gfx/drivers/gl_shaders/legacy_pipeline_snow.glsl.vert.h b/gfx/drivers/gl_shaders/legacy_pipeline_snow.glsl.vert.h index e08190d5bc..15cbbd1c16 100644 --- a/gfx/drivers/gl_shaders/legacy_pipeline_snow.glsl.vert.h +++ b/gfx/drivers/gl_shaders/legacy_pipeline_snow.glsl.vert.h @@ -1,6 +1,6 @@ #include "shaders_common.h" -static const char *stock_vertex_xmb_simple_legacy = GLSL( +static const char *stock_vertex_xmb_snow_legacy = GLSL( attribute vec3 VertexCoord; uniform float time; float iqhash( float n ) diff --git a/gfx/drivers/gl_shaders/modern_pipeline_snow.glsl.vert.h b/gfx/drivers/gl_shaders/modern_pipeline_snow.glsl.vert.h index a3f5fd0bcc..4d65301e58 100644 --- a/gfx/drivers/gl_shaders/modern_pipeline_snow.glsl.vert.h +++ b/gfx/drivers/gl_shaders/modern_pipeline_snow.glsl.vert.h @@ -1,6 +1,6 @@ #include "shaders_common.h" -static const char *stock_vertex_xmb_simple_modern = GLSL( +static const char *stock_vertex_xmb_snow = GLSL( in vec3 VertexCoord; uniform float time; @@ -24,10 +24,6 @@ static const char *stock_vertex_xmb_simple_modern = GLSL( void main() { vec3 v = vec3(VertexCoord.x, 0.0, VertexCoord.y); - //vec3 v2 = v; - //v2.x = v2.x + time/2.0; - //v2.z = v.z * 3.0; - //v.y = -cos((v.x+v.z/3.0+time)*2.0)/10.0 - noise(v2.xyz)/4.0; gl_Position = vec4(v, 1.0); } ); diff --git a/gfx/drivers/gl_shaders/pipeline_snow.cg.h b/gfx/drivers/gl_shaders/pipeline_snow.cg.h index eff14891e6..1d9ee06969 100644 --- a/gfx/drivers/gl_shaders/pipeline_snow.cg.h +++ b/gfx/drivers/gl_shaders/pipeline_snow.cg.h @@ -1,6 +1,6 @@ #include "shaders_common.h" -static const char *stock_xmb_simple = CG( +static const char *stock_xmb_snow = CG( struct input { float time; diff --git a/gfx/drivers/gl_shaders/pipeline_snow.glsl.frag.h b/gfx/drivers/gl_shaders/pipeline_snow.glsl.frag.h index 10b8971ccc..e9f47c4554 100644 --- a/gfx/drivers/gl_shaders/pipeline_snow.glsl.frag.h +++ b/gfx/drivers/gl_shaders/pipeline_snow.glsl.frag.h @@ -1,6 +1,6 @@ #include "shaders_common.h" -static const char *stock_fragment_xmb_simple = GLSL( +static const char *stock_fragment_xmb_snow = GLSL( uniform float time; vec2 res = vec2(1920*3, 1080*3); diff --git a/gfx/drivers_shader/shader_gl_cg.c b/gfx/drivers_shader/shader_gl_cg.c index 0ee2b55438..df63653d17 100644 --- a/gfx/drivers_shader/shader_gl_cg.c +++ b/gfx/drivers_shader/shader_gl_cg.c @@ -41,6 +41,7 @@ #ifdef HAVE_SHADERPIPELINE #include "../drivers/gl_shaders/pipeline_xmb_ribbon_simple.cg.h" +#include "../drivers/gl_shaders/pipeline_snow.cg.h" #endif #include "../include/Cg/cg.h" diff --git a/gfx/drivers_shader/shader_glsl.c b/gfx/drivers_shader/shader_glsl.c index 5e3be0c109..8c9121a89f 100644 --- a/gfx/drivers_shader/shader_glsl.c +++ b/gfx/drivers_shader/shader_glsl.c @@ -121,8 +121,11 @@ static const char *glsl_prefixes[] = { #ifdef HAVE_SHADERPIPELINE #include "../drivers/gl_shaders/legacy_pipeline_xmb_ribbon_simple.glsl.vert.h" #include "../drivers/gl_shaders/modern_pipeline_xmb_ribbon_simple.glsl.vert.h" +#include "../drivers/gl_shaders/modern_pipeline_snow.glsl.vert.h" #include "../drivers/gl_shaders/pipeline_xmb_ribbon_simple.glsl.frag.h" +#include "../drivers/gl_shaders/pipeline_snow.glsl.frag.h" #if !defined(HAVE_OPENGLES) +#include "../drivers/gl_shaders/legacy_pipeline_snow.glsl.vert.h" #include "../drivers/gl_shaders/legacy_pipeline_xmb_ribbon.glsl.vert.h" #include "../drivers/gl_shaders/modern_pipeline_xmb_ribbon.glsl.vert.h" #include "../drivers/gl_shaders/pipeline_xmb_ribbon.glsl.frag.h" diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 0370a27c0d..e665735e36 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -1190,6 +1190,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON, "Ribbon") MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON_SIMPLIFIED, "Ribbon (simplified)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SNOW, + "Snow") MSG_HASH(MENU_ENUM_LABEL_VALUE_SHOW_ADVANCED_SETTINGS, "Show Advanced Settings") MSG_HASH(MENU_ENUM_LABEL_VALUE_SHOW_HIDDEN_FILES, diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index 4905bfd256..c1a11ce419 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -225,6 +225,11 @@ static void menu_action_setting_disp_set_label_pipeline( msg_hash_to_str( MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON), len); break; + case XMB_SHADER_PIPELINE_SNOW: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SNOW), len); + break; } strlcpy(s2, path, len2); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 728e9d34fe..38ad551c5e 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2278,7 +2278,8 @@ static void xmb_draw_bg( menu_display_draw_gradient(&draw); draw.pipeline.id = VIDEO_SHADER_MENU_SEC; - if (settings->menu.xmb.shader_pipeline == XMB_SHADER_PIPELINE_RIBBON) + if (settings->menu.xmb.shader_pipeline == XMB_SHADER_PIPELINE_RIBBON || + settings->menu.xmb.shader_pipeline == XMB_SHADER_PIPELINE_SNOW) draw.pipeline.id = VIDEO_SHADER_MENU; menu_display_draw_pipeline(&draw); @@ -2798,36 +2799,63 @@ static void xmb_ribbon_set_vertex(float *ribbon_verts, unsigned idx, unsigned ro static void xmb_init_ribbon(xmb_handle_t * xmb) { video_coords_t coords; - float ribbon_verts[2 * XMB_RIBBON_VERTICES]; - float dummy[4 * XMB_RIBBON_VERTICES]; - unsigned i, r, c, col; - video_coord_array_t *ca = NULL; + unsigned vertices_total; + unsigned r, c, col; + unsigned i = 0; + float *ribbon_verts = NULL; + float *dummy = NULL; + settings_t *settings = config_get_ptr(); + video_coord_array_t *ca = menu_display_get_coords_array(); - memset(&dummy[0], 0, 4 * XMB_RIBBON_VERTICES * sizeof(float)); - ca = menu_display_get_coords_array(); - - /* Set up vertices */ - i = 0; - for (r = 0; r < XMB_RIBBON_ROWS - 1; r++) + if (settings->menu.xmb.shader_pipeline == XMB_SHADER_PIPELINE_SNOW) { - for (c = 0; c < XMB_RIBBON_COLS; c++) + vertices_total = 4; + ribbon_verts = (float*)calloc(2 * vertices_total, sizeof(float)); + + ribbon_verts[0] = -1.0f; + ribbon_verts[1] = -1.0f; + ribbon_verts[2] = 1.0f; + ribbon_verts[3] = -1.0f; + ribbon_verts[4] = -1.0f; + ribbon_verts[5] = 1.0f; + ribbon_verts[6] = 1.0f; + ribbon_verts[7] = 1.0f; + + } + else + { + vertices_total = XMB_RIBBON_VERTICES; + ribbon_verts = (float*)calloc(2 * vertices_total, sizeof(float)); + + /* Set up vertices */ + for (r = 0; r < XMB_RIBBON_ROWS - 1; r++) { - col = r % 2 ? XMB_RIBBON_COLS - c - 1 : c; - xmb_ribbon_set_vertex(ribbon_verts, i, r, col); - xmb_ribbon_set_vertex(ribbon_verts, i + 2, r + 1, col); - i += 4; + for (c = 0; c < XMB_RIBBON_COLS; c++) + { + col = r % 2 ? XMB_RIBBON_COLS - c - 1 : c; + xmb_ribbon_set_vertex(ribbon_verts, i, r, col); + xmb_ribbon_set_vertex(ribbon_verts, i + 2, r + 1, col); + i += 4; + } } } + dummy = (float*)calloc(4 * vertices_total, sizeof(float)); + coords.color = dummy; coords.vertex = ribbon_verts; coords.tex_coord = dummy; coords.lut_tex_coord = dummy; - coords.vertices = XMB_RIBBON_VERTICES; + coords.vertices = vertices_total; - video_coord_array_append(ca, &coords, XMB_RIBBON_VERTICES); + free(dummy); + free(ribbon_verts); + + video_coord_array_append(ca, &coords, coords.vertices); } + + static void *xmb_init(void **userdata) { unsigned width, height; @@ -2901,6 +2929,7 @@ static void *xmb_init(void **userdata) menu_display_allocate_white_texture(); xmb_init_horizontal_list(xmb); + xmb_init_ribbon(xmb); return menu; diff --git a/menu/menu_display.h b/menu/menu_display.h index 33a1bcc18d..c49d4f723a 100644 --- a/menu/menu_display.h +++ b/menu/menu_display.h @@ -74,6 +74,7 @@ enum xmb_shader_pipeline XMB_SHADER_PIPELINE_WALLPAPER = 0, XMB_SHADER_PIPELINE_SIMPLE_RIBBON, XMB_SHADER_PIPELINE_RIBBON, + XMB_SHADER_PIPELINE_SNOW, XMB_SHADER_PIPELINE_LAST }; diff --git a/msg_hash.h b/msg_hash.h index c831603e12..8b81689d9c 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -376,6 +376,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON_SIMPLIFIED, MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON, + MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SNOW, MENU_ENUM_LABEL_MATERIALUI_MENU_HEADER_OPACITY, MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_HEADER_OPACITY,