From d7b3e9cc8f90a9f4f50cbd03dda765805d9b35d7 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 24 Apr 2016 20:25:56 +0200 Subject: [PATCH] Add old shader versions of XMB ribbon --- ...n.cg.h => pipeline_xmb_ribbon_simple.cg.h} | 2 +- .../pipeline_xmb_ribbon_simple.glsl.frag.h | 9 +++++ .../pipeline_xmb_ribbon_simple.glsl.vert.h | 34 +++++++++++++++++++ gfx/drivers_shader/shader_gl_cg.c | 4 +-- gfx/drivers_shader/shader_glsl.c | 2 ++ 5 files changed, 48 insertions(+), 3 deletions(-) rename gfx/drivers/gl_shaders/{pipeline_xmb_ribbon.cg.h => pipeline_xmb_ribbon_simple.cg.h} (97%) create mode 100644 gfx/drivers/gl_shaders/pipeline_xmb_ribbon_simple.glsl.frag.h create mode 100644 gfx/drivers/gl_shaders/pipeline_xmb_ribbon_simple.glsl.vert.h diff --git a/gfx/drivers/gl_shaders/pipeline_xmb_ribbon.cg.h b/gfx/drivers/gl_shaders/pipeline_xmb_ribbon_simple.cg.h similarity index 97% rename from gfx/drivers/gl_shaders/pipeline_xmb_ribbon.cg.h rename to gfx/drivers/gl_shaders/pipeline_xmb_ribbon_simple.cg.h index de84f75c4b..95c464bc88 100644 --- a/gfx/drivers/gl_shaders/pipeline_xmb_ribbon.cg.h +++ b/gfx/drivers/gl_shaders/pipeline_xmb_ribbon_simple.cg.h @@ -1,4 +1,4 @@ -static const char *stock_xmb = +static const char *stock_xmb_simple = "struct input\n" "{\n" " float time;\n" diff --git a/gfx/drivers/gl_shaders/pipeline_xmb_ribbon_simple.glsl.frag.h b/gfx/drivers/gl_shaders/pipeline_xmb_ribbon_simple.glsl.frag.h new file mode 100644 index 0000000000..4d09824da0 --- /dev/null +++ b/gfx/drivers/gl_shaders/pipeline_xmb_ribbon_simple.glsl.frag.h @@ -0,0 +1,9 @@ +static const char *stock_fragment_xmb_simple = + "#ifdef GL_ES\n" + "precision mediump float;\n" + "#endif\n" + "uniform float time;\n" + "void main()\n" + "{\n" + " gl_FragColor = vec4(1.0, 1.0, 1.0, 0.05);\n" + "}\n"; diff --git a/gfx/drivers/gl_shaders/pipeline_xmb_ribbon_simple.glsl.vert.h b/gfx/drivers/gl_shaders/pipeline_xmb_ribbon_simple.glsl.vert.h new file mode 100644 index 0000000000..d57edd8fac --- /dev/null +++ b/gfx/drivers/gl_shaders/pipeline_xmb_ribbon_simple.glsl.vert.h @@ -0,0 +1,34 @@ +static const char *stock_vertex_xmb_simple = + "#if __VERSION__ >= 130\n" + "#define COMPAT_VARYING out\n" + "#define COMPAT_ATTRIBUTE in\n" + "#else\n" + "#define COMPAT_VARYING varying\n" + "#define COMPAT_ATTRIBUTE attribute\n" + "#endif\n" + "COMPAT_ATTRIBUTE vec3 VertexCoord;\n" + "uniform float time;\n" + "float iqhash( float n )\n" + "{\n" + " return fract(sin(n)*43758.5453);\n" + "}\n" + "float noise( vec3 x )\n" + "{\n" + " vec3 p = floor(x);\n" + " vec3 f = fract(x);\n" + " f = f*f*(3.0-2.0*f);\n" + " float n = p.x + p.y*57.0 + 113.0*p.z;\n" + " return mix(mix(mix( iqhash(n+0.0 ), iqhash(n+1.0 ),f.x),\n" + " mix( iqhash(n+57.0 ), iqhash(n+58.0 ),f.x),f.y),\n" + " mix(mix( iqhash(n+113.0), iqhash(n+114.0),f.x),\n" + " mix( iqhash(n+170.0), iqhash(n+171.0),f.x),f.y),f.z);\n" + "}\n" + "void main()\n" + "{\n" + " vec3 v = vec3(VertexCoord.x, 0.0, VertexCoord.y);\n" + " vec3 v2 = v;\n" + " v2.x = v2.x + time/2.0;\n" + " v2.z = v.z * 3.0;\n" + " v.y = -cos((v.x+v.z/3.0+time)*2.0)/10.0 - noise(v2.xyz)/4.0;\n" + " gl_Position = vec4(v, 1.0);\n" + "}\n"; diff --git a/gfx/drivers_shader/shader_gl_cg.c b/gfx/drivers_shader/shader_gl_cg.c index 69dbec96a1..4ccc1d4752 100644 --- a/gfx/drivers_shader/shader_gl_cg.c +++ b/gfx/drivers_shader/shader_gl_cg.c @@ -43,7 +43,7 @@ #include "../../rewind.h" #include "../video_state_tracker.h" -#include "../drivers/gl_shaders/pipeline_xmb_ribbon.cg.h" +#include "../drivers/gl_shaders/pipeline_xmb_ribbon_simple.cg.h" #define SEMANTIC_TEXCOORD 0x92ee91cdU #define SEMANTIC_TEXCOORD0 0xf0c0cb9dU @@ -1160,7 +1160,7 @@ static void *gl_cg_init(void *data, const char *path) gl_cg_set_shaders(cg_data->prg[1].fprg, cg_data->prg[1].vprg); - shader_prog_info.combined = stock_xmb; + shader_prog_info.combined = stock_xmb_simple; shader_prog_info.is_file = false; gl_cg_compile_program( diff --git a/gfx/drivers_shader/shader_glsl.c b/gfx/drivers_shader/shader_glsl.c index cdbc29c640..f18e56508d 100644 --- a/gfx/drivers_shader/shader_glsl.c +++ b/gfx/drivers_shader/shader_glsl.c @@ -124,6 +124,8 @@ static const char *glsl_prefixes[] = { #include "../drivers/gl_shaders/core_alpha_blend.glsl.vert.h" #include "../drivers/gl_shaders/core_alpha_blend.glsl.frag.h" +#include "../drivers/gl_shaders/pipeline_xmb_ribbon_simple.glsl.vert.h" +#include "../drivers/gl_shaders/pipeline_xmb_ribbon_simple.glsl.frag.h" #include "../drivers/gl_shaders/pipeline_xmb_ribbon.glsl.vert.h" #include "../drivers/gl_shaders/pipeline_xmb_ribbon.glsl.frag.h"