summaryrefslogtreecommitdiff
path: root/shaders
diff options
context:
space:
mode:
authorMarkus Wick <markus@selfnet.de>2014-02-12 03:59:31 +0100
committerEric Anholt <eric@anholt.net>2014-02-14 15:12:18 -0800
commitab970c1daee4cfa61ebd6a96259129dbcd5bc106 (patch)
tree447849053c0c41b88e3aded1e33c1edcced5fd64 /shaders
parentbbd7319f40dcb98f4e918b329d772c8dbfc678a0 (diff)
Add dolphin-emu shaders.
Diffstat (limited to 'shaders')
-rw-r--r--shaders/dolphin/efb2ram.shader_test100
-rw-r--r--shaders/dolphin/efb2tex.shader_test64
-rw-r--r--shaders/dolphin/format_changes.1.shader_test60
-rw-r--r--shaders/dolphin/format_changes.2.shader_test60
-rw-r--r--shaders/dolphin/mkwii.1.shader_test218
-rw-r--r--shaders/dolphin/mkwii.2.shader_test168
-rw-r--r--shaders/dolphin/nsmbw.1.shader_test229
-rw-r--r--shaders/dolphin/nsmbw.2.shader_test180
-rw-r--r--shaders/dolphin/realxfb.shader_test67
-rw-r--r--shaders/dolphin/smg.1.shader_test173
-rw-r--r--shaders/dolphin/smg.2.shader_test167
11 files changed, 1486 insertions, 0 deletions
diff --git a/shaders/dolphin/efb2ram.shader_test b/shaders/dolphin/efb2ram.shader_test
new file mode 100644
index 0000000..d1e72a8
--- /dev/null
+++ b/shaders/dolphin/efb2ram.shader_test
@@ -0,0 +1,100 @@
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+void main()
+{
+ vec2 rawpos = vec2(gl_VertexID&1, gl_VertexID&2);
+ gl_Position = vec4(rawpos*2.0-1.0, 0.0, 1.0);
+}
+
+[fragment shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+uniform int4 position;
+#define samp0 samp9
+uniform sampler2D samp0;
+ out vec4 ocol0;
+void main()
+{
+ int2 sampleUv;
+ int2 uv1 = int2(gl_FragCoord.xy);
+ float2 uv0 = float2(0.0, 0.0);
+ uv1.x = uv1.x * 1;
+ int yl = uv1.y / 4;
+ int yb = yl * 4;
+ int yoff = uv1.y - yb;
+ int xp = uv1.x + yoff * position.z;
+ int xel = xp / 2;
+ int xb = xel / 4;
+ int xoff = xel - xb * 4;
+ int xl = uv1.x * 2 / 4;
+ int xib = uv1.x * 2 - xl * 4;
+ int halfxb = xb / 2;
+ sampleUv.x = xib + halfxb * 4;
+ sampleUv.y = yb + xoff;
+ bool first = xb == (halfxb * 2);
+ float4 texSample;
+ float4 color0;
+ float4 color1;
+uv0 = float2(sampleUv + int2(0, 0));
+uv0 += float2(0.5, 0.5);
+uv0 *= float(position.w);
+uv0 += float2(position.xy);
+uv0 /= float2(640, 528);
+uv0.y = 1.0-uv0.y;
+texSample = texture(samp0, uv0).rgba;
+ color0.b = texSample.a;
+ color0.g = texSample.r;
+ color1.b = texSample.g;
+ color1.g = texSample.b;
+uv0 = float2(sampleUv + int2(1, 0));
+uv0 += float2(0.5, 0.5);
+uv0 *= float(position.w);
+uv0 += float2(position.xy);
+uv0 /= float2(640, 528);
+uv0.y = 1.0-uv0.y;
+texSample = texture(samp0, uv0).rgba;
+ color0.r = texSample.a;
+ color0.a = texSample.r;
+ color1.r = texSample.g;
+ color1.a = texSample.b;
+ ocol0 = first ? color0 : color1;
+}
+
diff --git a/shaders/dolphin/efb2tex.shader_test b/shaders/dolphin/efb2tex.shader_test
new file mode 100644
index 0000000..1a457aa
--- /dev/null
+++ b/shaders/dolphin/efb2tex.shader_test
@@ -0,0 +1,64 @@
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+VARYOUT vec2 uv0;
+uniform sampler2D samp9;
+uniform vec4 copy_position;
+void main()
+{
+ vec2 rawpos = vec2(gl_VertexID&1, gl_VertexID&2);
+ uv0 = mix(copy_position.xy, copy_position.zw, rawpos) / vec2(textureSize(samp9, 0));
+ gl_Position = vec4(rawpos*2.0-1.0, 0.0, 1.0);
+}
+
+[fragment shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+uniform sampler2D samp9;
+uniform vec4 colmat[7];
+VARYIN vec2 uv0;
+out vec4 ocol0;
+
+void main(){
+ vec4 texcol = texture(samp9, uv0);
+ texcol = round(texcol * colmat[5]) * colmat[6];
+ ocol0 = texcol * mat4(colmat[0], colmat[1], colmat[2], colmat[3]) + colmat[4];
+}
+
diff --git a/shaders/dolphin/format_changes.1.shader_test b/shaders/dolphin/format_changes.1.shader_test
new file mode 100644
index 0000000..2b09fd9
--- /dev/null
+++ b/shaders/dolphin/format_changes.1.shader_test
@@ -0,0 +1,60 @@
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+void main(void) {
+ vec2 rawpos = vec2(gl_VertexID&1, gl_VertexID&2);
+ gl_Position = vec4(rawpos*2.0-1.0, 0.0, 1.0);
+}
+
+[fragment shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+uniform sampler2D samp9;
+out vec4 ocol0;
+void main()
+{
+ ivec4 src6 = ivec4(round(texelFetch(samp9, ivec2(gl_FragCoord.xy), 0) * 63.f));
+ ivec4 dst8;
+ dst8.r = (src6.r << 2) | (src6.g >> 4);
+ dst8.g = ((src6.g & 0xF) << 4) | (src6.b >> 2);
+ dst8.b = ((src6.b & 0x3) << 6) | src6.a;
+ dst8.a = 255;
+ ocol0 = float4(dst8) / 255.f;
+}
diff --git a/shaders/dolphin/format_changes.2.shader_test b/shaders/dolphin/format_changes.2.shader_test
new file mode 100644
index 0000000..86b5c5f
--- /dev/null
+++ b/shaders/dolphin/format_changes.2.shader_test
@@ -0,0 +1,60 @@
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+void main(void) {
+ vec2 rawpos = vec2(gl_VertexID&1, gl_VertexID&2);
+ gl_Position = vec4(rawpos*2.0-1.0, 0.0, 1.0);
+}
+
+[fragment shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+uniform sampler2D samp9;
+out vec4 ocol0;
+void main()
+{
+ ivec4 src8 = ivec4(round(texelFetch(samp9, ivec2(gl_FragCoord.xy), 0) * 255.f));
+ ivec4 dst6;
+ dst6.r = src8.r >> 2;
+ dst6.g = ((src8.r & 0x3) << 4) | (src8.g >> 4);
+ dst6.b = ((src8.g & 0xF) << 2) | (src8.b >> 6);
+ dst6.a = src8.b & 0x3F;
+ ocol0 = float4(dst6) / 63.f;
+}
diff --git a/shaders/dolphin/mkwii.1.shader_test b/shaders/dolphin/mkwii.1.shader_test
new file mode 100644
index 0000000..e933133
--- /dev/null
+++ b/shaders/dolphin/mkwii.1.shader_test
@@ -0,0 +1,218 @@
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+layout(std140, binding = 2) uniform VSBlock {
+float4 cpnmtx[6] ;
+float4 cproj[4] ;
+float4 cmtrl[4] ;
+float4 clights[40] ;
+float4 ctexmtx[24] ;
+float4 ctrmtx[64] ;
+float4 cnmtx[32] ;
+float4 cpostmtx[64] ;
+float4 cDepth ;
+};
+struct VS_OUTPUT {
+ float4 pos;
+ float4 colors_0;
+ float4 colors_1;
+ float3 tex0;
+ float3 tex1;
+ float4 clipPos;
+};
+ATTRIN float4 rawpos; // ATTR0,
+ATTRIN float3 rawnorm0; // ATTR2,
+ATTRIN float4 color0; // ATTR5,
+ATTRIN float2 tex0; // ATTR8,
+VARYOUT float3 uv0_2;
+VARYOUT float3 uv1_2;
+VARYOUT float4 clipPos_2;
+VARYOUT float4 colors_02;
+VARYOUT float4 colors_12;
+void main()
+{
+VS_OUTPUT o;
+float4 pos = float4(dot(cpnmtx[0], rawpos), dot(cpnmtx[1], rawpos), dot(cpnmtx[2], rawpos), 1.0);
+float3 _norm0 = normalize(float3(dot(cpnmtx[3].xyz, rawnorm0), dot(cpnmtx[4].xyz, rawnorm0), dot(cpnmtx[5].xyz, rawnorm0)));
+o.pos = float4(dot(cproj[0], pos), dot(cproj[1], pos), dot(cproj[2], pos), dot(cproj[3], pos));
+float4 mat, lacc;
+float3 ldir, h;
+float dist, dist2, attn;
+{
+mat = color0;
+lacc = cmtrl[0];
+lacc.w = 1.0;
+ldir = clights[5*0+3].xyz - pos.xyz;
+dist2 = dot(ldir, ldir);
+dist = sqrt(dist2);
+ldir = ldir / dist;
+attn = max(0.0, dot(ldir, clights[5*0+4].xyz));
+attn = max(0.0, clights[5*0+1].x + clights[5*0+1].y*attn + clights[5*0+1].z*attn*attn) / dot(clights[5*0+2].xyz, float3(1.0,dist,dist2));
+lacc.xyz += attn * max(0.0,dot(ldir, _norm0)) * clights[5*0].xyz;
+
+o.colors_0 = mat * clamp(lacc, 0.0, 1.0);
+}
+o.colors_1 = o.colors_0;
+float4 coord = float4(0.0, 0.0, 1.0, 1.0);
+{
+coord = float4(0.0, 0.0, 1.0, 1.0);
+coord = float4(tex0.x, tex0.y, 1.0, 1.0);
+o.tex0.xyz = float3(dot(coord, ctexmtx[0]), dot(coord, ctexmtx[1]), 1);
+float4 P0 = cpostmtx[0];
+float4 P1 = cpostmtx[1];
+float4 P2 = cpostmtx[2];
+o.tex0.xyz = float3(dot(P0.xyz, o.tex0.xyz) + P0.w, dot(P1.xyz, o.tex0.xyz) + P1.w, dot(P2.xyz, o.tex0.xyz) + P2.w);
+}
+{
+coord = float4(0.0, 0.0, 1.0, 1.0);
+coord = float4(rawnorm0.xyz, 1.0);
+o.tex1.xyz = float3(dot(coord, ctexmtx[3]), dot(coord, ctexmtx[4]), dot(coord, ctexmtx[5]));
+float4 P0 = cpostmtx[3];
+float4 P1 = cpostmtx[4];
+float4 P2 = cpostmtx[5];
+o.tex1.xyz = normalize(o.tex1.xyz);
+o.tex1.xyz = float3(dot(P0.xyz, o.tex1.xyz) + P0.w, dot(P1.xyz, o.tex1.xyz) + P1.w, dot(P2.xyz, o.tex1.xyz) + P2.w);
+}
+o.clipPos = float4(pos.x,pos.y,o.pos.z,o.pos.w);
+o.pos.z = o.pos.w + o.pos.z * 2.0;
+ uv0_2.xyz = o.tex0;
+ uv1_2.xyz = o.tex1;
+ clipPos_2 = o.clipPos;
+colors_02 = o.colors_0;
+colors_12 = o.colors_1;
+gl_Position = o.pos;
+}
+
+[fragment shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+//Pixel Shader for TEV stages
+//3 TEV stages, 2 texgens, 0 IND stages
+float fmod( float x, float y )
+{
+ float z = fract( abs( x / y) ) * abs( y );
+ return (x < 0.0) ? -z : z;
+}
+uniform sampler2D samp0;
+uniform sampler2D samp1;
+uniform sampler2D samp2;
+uniform sampler2D samp3;
+uniform sampler2D samp4;
+uniform sampler2D samp5;
+uniform sampler2D samp6;
+uniform sampler2D samp7;
+
+layout(std140, binding = 1) uniform PSBlock {
+float4 color[4] ;
+float4 k[4] ;
+float4 alphaRef[1] ;
+float4 texdim[8] ;
+float4 czbias[2] ;
+float4 cindscale[2] ;
+float4 cindmtx[6] ;
+float4 cfog[3] ;
+float4 cPLights[40] ;
+float4 cPmtrl[4] ;
+};
+out vec4 ocol0;
+VARYIN float4 colors_02;
+VARYIN float4 colors_12;
+VARYIN float3 uv0_2;
+VARYIN float3 uv1_2;
+VARYIN float4 clipPos_2;
+void main()
+{
+ float4 c0 = color[1], c1 = color[2], c2 = color[3], prev = float4(0.0, 0.0, 0.0, 0.0), textemp = float4(0.0, 0.0, 0.0, 0.0), rastemp = float4(0.0, 0.0, 0.0, 0.0), konsttemp = float4(0.0, 0.0, 0.0, 0.0);
+ float3 comp16 = float3(1.0, 255.0, 0.0), comp24 = float3(1.0, 255.0, 255.0*255.0);
+ float alphabump=0.0;
+ float3 tevcoord=float3(0.0, 0.0, 0.0);
+ float2 wrappedcoord=float2(0.0,0.0), tempcoord=float2(0.0,0.0);
+ float4 cc0=float4(0.0,0.0,0.0,0.0), cc1=float4(0.0,0.0,0.0,0.0);
+ float4 cc2=float4(0.0,0.0,0.0,0.0), cprev=float4(0.0,0.0,0.0,0.0);
+ float4 crastemp=float4(0.0,0.0,0.0,0.0),ckonsttemp=float4(0.0,0.0,0.0,0.0);
+
+float4 rawpos = gl_FragCoord;
+float4 colors_0 = colors_02;
+float4 colors_1 = colors_12;
+float3 uv0 = uv0_2;
+float3 uv1 = uv1_2;
+float4 clipPos = clipPos_2;
+ clipPos = float4(rawpos.x, rawpos.y, clipPos.z, clipPos.w);
+uv0.xy = uv0.xy * texdim[0].zw;
+ if (uv1.z != 0.0) uv1.xy = uv1.xy / uv1.z;
+uv1.xy = uv1.xy * texdim[1].zw;
+// TEV stage 0
+tevcoord.xy = uv0.xy;
+textemp = texture(samp0,tevcoord.xy * texdim[0].xy).rgba;
+konsttemp = float4(k[2].rgb, k[3].a);
+ckonsttemp = frac(konsttemp * (255.0/256.0)) * (256.0/255.0);
+cc0 = frac(c0 * (255.0/256.0)) * (256.0/255.0);
+// color combine
+prev.rgb = clamp((textemp.rgb)*(cc0.rgb), 0.0, 1.0);
+// alpha combine
+prev.a = clamp(textemp.a*ckonsttemp.a, 0.0, 1.0);
+
+// TEV done
+// TEV stage 1
+tevcoord.xy = uv1.xy;
+textemp = texture(samp1,tevcoord.xy * texdim[1].xy).rgba;
+konsttemp = float4(k[3].aaa, k[3].a);
+ckonsttemp = frac(konsttemp * (255.0/256.0)) * (256.0/255.0);
+// color combine
+prev.rgb = clamp((prev.rgb)+(textemp.rgb)*(float3(1.0, 1.0, 1.0)-(ckonsttemp.rgb))-0.5, 0.0, 1.0);
+// alpha combine
+prev.a = clamp(prev.a+textemp.a*(1.0-ckonsttemp.a), 0.0, 1.0);
+
+// TEV done
+// TEV stage 2
+rastemp = colors_0.rgba;
+crastemp = frac(rastemp * (255.0/256.0)) * (256.0/255.0);
+textemp = float4(1.0, 1.0, 1.0, 1.0);
+cprev = prev;
+// color combine
+prev.rgb = clamp((cprev.rgb)*(crastemp.rgb), 0.0, 1.0);
+// alpha combine
+prev.a = clamp(cprev.a*crastemp.a, 0.0, 1.0);
+
+// TEV done
+float zCoord = rawpos.z;
+ ocol0 = prev;
+}
+
diff --git a/shaders/dolphin/mkwii.2.shader_test b/shaders/dolphin/mkwii.2.shader_test
new file mode 100644
index 0000000..881c5bb
--- /dev/null
+++ b/shaders/dolphin/mkwii.2.shader_test
@@ -0,0 +1,168 @@
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+layout(std140, binding = 2) uniform VSBlock {
+float4 cpnmtx[6] ;
+float4 cproj[4] ;
+float4 cmtrl[4] ;
+float4 clights[40] ;
+float4 ctexmtx[24] ;
+float4 ctrmtx[64] ;
+float4 cnmtx[32] ;
+float4 cpostmtx[64] ;
+float4 cDepth ;
+};
+struct VS_OUTPUT {
+ float4 pos;
+ float4 colors_0;
+ float4 colors_1;
+ float3 tex0;
+ float4 clipPos;
+};
+ATTRIN float4 rawpos; // ATTR0,
+ATTRIN float2 tex0; // ATTR8,
+VARYOUT float3 uv0_2;
+VARYOUT float4 clipPos_2;
+VARYOUT float4 colors_02;
+VARYOUT float4 colors_12;
+void main()
+{
+VS_OUTPUT o;
+float4 pos = float4(dot(cpnmtx[0], rawpos), dot(cpnmtx[1], rawpos), dot(cpnmtx[2], rawpos), 1.0);
+float3 _norm0 = float3(0.0, 0.0, 0.0);
+o.pos = float4(dot(cproj[0], pos), dot(cproj[1], pos), dot(cproj[2], pos), dot(cproj[3], pos));
+float4 mat, lacc;
+float3 ldir, h;
+float dist, dist2, attn;
+{
+mat = float4(1.0, 1.0, 1.0, 1.0);
+lacc = float4(1.0, 1.0, 1.0, 1.0);
+lacc.w = 1.0;
+o.colors_0 = mat * clamp(lacc, 0.0, 1.0);
+}
+o.colors_1 = o.colors_0;
+float4 coord = float4(0.0, 0.0, 1.0, 1.0);
+{
+coord = float4(0.0, 0.0, 1.0, 1.0);
+coord = float4(tex0.x, tex0.y, 1.0, 1.0);
+o.tex0.xyz = float3(dot(coord, ctexmtx[0]), dot(coord, ctexmtx[1]), 1);
+float4 P0 = cpostmtx[61];
+float4 P1 = cpostmtx[62];
+float4 P2 = cpostmtx[63];
+o.tex0.xyz = float3(dot(P0.xyz, o.tex0.xyz) + P0.w, dot(P1.xyz, o.tex0.xyz) + P1.w, dot(P2.xyz, o.tex0.xyz) + P2.w);
+}
+o.clipPos = float4(pos.x,pos.y,o.pos.z,o.pos.w);
+o.pos.z = o.pos.w + o.pos.z * 2.0;
+ uv0_2.xyz = o.tex0;
+ clipPos_2 = o.clipPos;
+colors_02 = o.colors_0;
+colors_12 = o.colors_1;
+gl_Position = o.pos;
+}
+
+[fragment shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+//Pixel Shader for TEV stages
+//1 TEV stages, 1 texgens, 0 IND stages
+float fmod( float x, float y )
+{
+ float z = fract( abs( x / y) ) * abs( y );
+ return (x < 0.0) ? -z : z;
+}
+uniform sampler2D samp0;
+uniform sampler2D samp1;
+uniform sampler2D samp2;
+uniform sampler2D samp3;
+uniform sampler2D samp4;
+uniform sampler2D samp5;
+uniform sampler2D samp6;
+uniform sampler2D samp7;
+
+layout(std140, binding = 1) uniform PSBlock {
+float4 color[4] ;
+float4 k[4] ;
+float4 alphaRef[1] ;
+float4 texdim[8] ;
+float4 czbias[2] ;
+float4 cindscale[2] ;
+float4 cindmtx[6] ;
+float4 cfog[3] ;
+float4 cPLights[40] ;
+float4 cPmtrl[4] ;
+};
+out vec4 ocol0;
+VARYIN float4 colors_02;
+VARYIN float4 colors_12;
+VARYIN float3 uv0_2;
+VARYIN float4 clipPos_2;
+void main()
+{
+ float4 c0 = color[1], c1 = color[2], c2 = color[3], prev = float4(0.0, 0.0, 0.0, 0.0), textemp = float4(0.0, 0.0, 0.0, 0.0), rastemp = float4(0.0, 0.0, 0.0, 0.0), konsttemp = float4(0.0, 0.0, 0.0, 0.0);
+ float3 comp16 = float3(1.0, 255.0, 0.0), comp24 = float3(1.0, 255.0, 255.0*255.0);
+ float alphabump=0.0;
+ float3 tevcoord=float3(0.0, 0.0, 0.0);
+ float2 wrappedcoord=float2(0.0,0.0), tempcoord=float2(0.0,0.0);
+ float4 cc0=float4(0.0,0.0,0.0,0.0), cc1=float4(0.0,0.0,0.0,0.0);
+ float4 cc2=float4(0.0,0.0,0.0,0.0), cprev=float4(0.0,0.0,0.0,0.0);
+ float4 crastemp=float4(0.0,0.0,0.0,0.0),ckonsttemp=float4(0.0,0.0,0.0,0.0);
+
+float4 rawpos = gl_FragCoord;
+float4 colors_0 = colors_02;
+float4 colors_1 = colors_12;
+float3 uv0 = uv0_2;
+float4 clipPos = clipPos_2;
+ clipPos = float4(rawpos.x, rawpos.y, clipPos.z, clipPos.w);
+uv0.xy = uv0.xy * texdim[0].zw;
+// TEV stage 0
+tevcoord.xy = uv0.xy;
+textemp = texture(samp0,tevcoord.xy * texdim[0].xy).rgba;
+cc0 = frac(c0 * (255.0/256.0)) * (256.0/255.0);
+cc1 = frac(c1 * (255.0/256.0)) * (256.0/255.0);
+// color combine
+prev.rgb = clamp(lerp((cc0.rgb), (cc1.rgb), (textemp.rgb)), 0.0, 1.0);
+// alpha combine
+prev.a = clamp(lerp(cc0.a, cc1.a, textemp.a), 0.0, 1.0);
+
+// TEV done
+float zCoord = rawpos.z;
+ ocol0 = prev;
+}
+
diff --git a/shaders/dolphin/nsmbw.1.shader_test b/shaders/dolphin/nsmbw.1.shader_test
new file mode 100644
index 0000000..b9bbdc1
--- /dev/null
+++ b/shaders/dolphin/nsmbw.1.shader_test
@@ -0,0 +1,229 @@
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+layout(std140, binding = 2) uniform VSBlock {
+float4 cpnmtx[6] ;
+float4 cproj[4] ;
+float4 cmtrl[4] ;
+float4 clights[40] ;
+float4 ctexmtx[24] ;
+float4 ctrmtx[64] ;
+float4 cnmtx[32] ;
+float4 cpostmtx[64] ;
+float4 cDepth ;
+};
+struct VS_OUTPUT {
+ float4 pos;
+ float4 colors_0;
+ float4 colors_1;
+ float3 tex0;
+ float3 tex1;
+ float3 tex2;
+ float4 clipPos;
+};
+ATTRIN float4 rawpos; // ATTR0,
+ATTRIN float3 rawnorm0; // ATTR2,
+ATTRIN float4 color0; // ATTR5,
+ATTRIN float2 tex0; // ATTR8,
+VARYOUT float3 uv0_2;
+VARYOUT float3 uv1_2;
+VARYOUT float3 uv2_2;
+VARYOUT float4 clipPos_2;
+VARYOUT float4 colors_02;
+VARYOUT float4 colors_12;
+void main()
+{
+VS_OUTPUT o;
+float4 pos = float4(dot(cpnmtx[0], rawpos), dot(cpnmtx[1], rawpos), dot(cpnmtx[2], rawpos), 1.0);
+float3 _norm0 = normalize(float3(dot(cpnmtx[3].xyz, rawnorm0), dot(cpnmtx[4].xyz, rawnorm0), dot(cpnmtx[5].xyz, rawnorm0)));
+o.pos = float4(dot(cproj[0], pos), dot(cproj[1], pos), dot(cproj[2], pos), dot(cproj[3], pos));
+float4 mat, lacc;
+float3 ldir, h;
+float dist, dist2, attn;
+{
+mat = color0;
+lacc = float4(1.0, 1.0, 1.0, 1.0);
+mat.w = cmtrl[2].w;
+lacc.w = 1.0;
+o.colors_0 = mat * clamp(lacc, 0.0, 1.0);
+}
+o.colors_1 = o.colors_0;
+float4 coord = float4(0.0, 0.0, 1.0, 1.0);
+{
+coord = float4(0.0, 0.0, 1.0, 1.0);
+coord = float4(tex0.x, tex0.y, 1.0, 1.0);
+o.tex0.xyz = float3(dot(coord, ctexmtx[0]), dot(coord, ctexmtx[1]), 1);
+float4 P0 = cpostmtx[0];
+float4 P1 = cpostmtx[1];
+float4 P2 = cpostmtx[2];
+o.tex0.xyz = float3(dot(P0.xyz, o.tex0.xyz) + P0.w, dot(P1.xyz, o.tex0.xyz) + P1.w, dot(P2.xyz, o.tex0.xyz) + P2.w);
+}
+{
+coord = float4(0.0, 0.0, 1.0, 1.0);
+coord = float4(rawnorm0.xyz, 1.0);
+o.tex1.xyz = float3(dot(coord, ctexmtx[3]), dot(coord, ctexmtx[4]), dot(coord, ctexmtx[5]));
+float4 P0 = cpostmtx[3];
+float4 P1 = cpostmtx[4];
+float4 P2 = cpostmtx[5];
+o.tex1.xyz = normalize(o.tex1.xyz);
+o.tex1.xyz = float3(dot(P0.xyz, o.tex1.xyz) + P0.w, dot(P1.xyz, o.tex1.xyz) + P1.w, dot(P2.xyz, o.tex1.xyz) + P2.w);
+}
+{
+coord = float4(0.0, 0.0, 1.0, 1.0);
+coord = float4(rawnorm0.xyz, 1.0);
+o.tex2.xyz = float3(dot(coord, ctexmtx[6]), dot(coord, ctexmtx[7]), dot(coord, ctexmtx[8]));
+float4 P0 = cpostmtx[6];
+float4 P1 = cpostmtx[7];
+float4 P2 = cpostmtx[8];
+o.tex2.xyz = normalize(o.tex2.xyz);
+o.tex2.xyz = float3(dot(P0.xyz, o.tex2.xyz) + P0.w, dot(P1.xyz, o.tex2.xyz) + P1.w, dot(P2.xyz, o.tex2.xyz) + P2.w);
+}
+o.clipPos = float4(pos.x,pos.y,o.pos.z,o.pos.w);
+o.pos.z = o.pos.w + o.pos.z * 2.0;
+ uv0_2.xyz = o.tex0;
+ uv1_2.xyz = o.tex1;
+ uv2_2.xyz = o.tex2;
+ clipPos_2 = o.clipPos;
+colors_02 = o.colors_0;
+colors_12 = o.colors_1;
+gl_Position = o.pos;
+}
+
+[fragment shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+//Pixel Shader for TEV stages
+//3 TEV stages, 3 texgens, 0 IND stages
+float fmod( float x, float y )
+{
+ float z = fract( abs( x / y) ) * abs( y );
+ return (x < 0.0) ? -z : z;
+}
+uniform sampler2D samp0;
+uniform sampler2D samp1;
+uniform sampler2D samp2;
+uniform sampler2D samp3;
+uniform sampler2D samp4;
+uniform sampler2D samp5;
+uniform sampler2D samp6;
+uniform sampler2D samp7;
+
+layout(std140, binding = 1) uniform PSBlock {
+float4 color[4] ;
+float4 k[4] ;
+float4 alphaRef[1] ;
+float4 texdim[8] ;
+float4 czbias[2] ;
+float4 cindscale[2] ;
+float4 cindmtx[6] ;
+float4 cfog[3] ;
+float4 cPLights[40] ;
+float4 cPmtrl[4] ;
+};
+out vec4 ocol0;
+VARYIN float4 colors_02;
+VARYIN float4 colors_12;
+VARYIN float3 uv0_2;
+VARYIN float3 uv1_2;
+VARYIN float3 uv2_2;
+VARYIN float4 clipPos_2;
+void main()
+{
+ float4 c0 = color[1], c1 = color[2], c2 = color[3], prev = float4(0.0, 0.0, 0.0, 0.0), textemp = float4(0.0, 0.0, 0.0, 0.0), rastemp = float4(0.0, 0.0, 0.0, 0.0), konsttemp = float4(0.0, 0.0, 0.0, 0.0);
+ float3 comp16 = float3(1.0, 255.0, 0.0), comp24 = float3(1.0, 255.0, 255.0*255.0);
+ float alphabump=0.0;
+ float3 tevcoord=float3(0.0, 0.0, 0.0);
+ float2 wrappedcoord=float2(0.0,0.0), tempcoord=float2(0.0,0.0);
+ float4 cc0=float4(0.0,0.0,0.0,0.0), cc1=float4(0.0,0.0,0.0,0.0);
+ float4 cc2=float4(0.0,0.0,0.0,0.0), cprev=float4(0.0,0.0,0.0,0.0);
+ float4 crastemp=float4(0.0,0.0,0.0,0.0),ckonsttemp=float4(0.0,0.0,0.0,0.0);
+
+float4 rawpos = gl_FragCoord;
+float4 colors_0 = colors_02;
+float4 colors_1 = colors_12;
+float3 uv0 = uv0_2;
+float3 uv1 = uv1_2;
+float3 uv2 = uv2_2;
+float4 clipPos = clipPos_2;
+ clipPos = float4(rawpos.x, rawpos.y, clipPos.z, clipPos.w);
+uv0.xy = uv0.xy * texdim[0].zw;
+ if (uv1.z != 0.0) uv1.xy = uv1.xy / uv1.z;
+uv1.xy = uv1.xy * texdim[1].zw;
+ if (uv2.z != 0.0) uv2.xy = uv2.xy / uv2.z;
+uv2.xy = uv2.xy * texdim[2].zw;
+// TEV stage 0
+rastemp = colors_0.rgba;
+crastemp = frac(rastemp * (255.0/256.0)) * (256.0/255.0);
+tevcoord.xy = uv1.xy;
+textemp = texture(samp1,tevcoord.xy * texdim[1].xy).rgba;
+// color combine
+prev.rgb = clamp((textemp.rgb)*(crastemp.rgb), 0.0, 1.0);
+// alpha combine
+prev.a = clamp(rastemp.a+float4(0.0, 0.0, 0.0, 0.0).a, 0.0, 1.0);
+
+// TEV done
+// TEV stage 1
+tevcoord.xy = uv0.xy;
+textemp = texture(samp0,tevcoord.xy * texdim[0].xy).rgba;
+cprev = prev;
+// color combine
+prev.rgb = clamp((textemp.rgb)*(cprev.rgb), 0.0, 1.0);
+// alpha combine
+prev.a = clamp(cprev.a*textemp.a, 0.0, 1.0);
+
+// TEV done
+// TEV stage 2
+rastemp = colors_0.rgba;
+crastemp = frac(rastemp * (255.0/256.0)) * (256.0/255.0);
+tevcoord.xy = uv2.xy;
+textemp = texture(samp2,tevcoord.xy * texdim[2].xy).rgba;
+konsttemp = float4(k[3].rgb, k[3].a);
+ckonsttemp = frac(konsttemp * (255.0/256.0)) * (256.0/255.0);
+cprev = prev;
+// color combine
+prev.rgb = clamp((konsttemp.rgb)+lerp((cprev.rgb), (crastemp.rgb), (textemp.rgb)), 0.0, 1.0);
+// alpha combine
+prev.a = clamp(cprev.a*ckonsttemp.a, 0.0, 1.0);
+
+// TEV done
+float zCoord = rawpos.z;
+ ocol0 = prev;
+}
+
diff --git a/shaders/dolphin/nsmbw.2.shader_test b/shaders/dolphin/nsmbw.2.shader_test
new file mode 100644
index 0000000..ccb1c97
--- /dev/null
+++ b/shaders/dolphin/nsmbw.2.shader_test
@@ -0,0 +1,180 @@
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+layout(std140, binding = 2) uniform VSBlock {
+float4 cpnmtx[6] ;
+float4 cproj[4] ;
+float4 cmtrl[4] ;
+float4 clights[40] ;
+float4 ctexmtx[24] ;
+float4 ctrmtx[64] ;
+float4 cnmtx[32] ;
+float4 cpostmtx[64] ;
+float4 cDepth ;
+};
+struct VS_OUTPUT {
+ float4 pos;
+ float4 colors_0;
+ float4 colors_1;
+ float3 tex0;
+ float4 clipPos;
+};
+ATTRIN float4 rawpos; // ATTR0,
+ATTRIN float4 color0; // ATTR5,
+ATTRIN float2 tex0; // ATTR8,
+VARYOUT float3 uv0_2;
+VARYOUT float4 clipPos_2;
+VARYOUT float4 colors_02;
+VARYOUT float4 colors_12;
+void main()
+{
+VS_OUTPUT o;
+float4 pos = float4(dot(cpnmtx[0], rawpos), dot(cpnmtx[1], rawpos), dot(cpnmtx[2], rawpos), 1.0);
+float3 _norm0 = float3(0.0, 0.0, 0.0);
+o.pos = float4(dot(cproj[0], pos), dot(cproj[1], pos), dot(cproj[2], pos), dot(cproj[3], pos));
+float4 mat, lacc;
+float3 ldir, h;
+float dist, dist2, attn;
+{
+mat = color0;
+lacc = float4(1.0, 1.0, 1.0, 1.0);
+lacc.w = 1.0;
+o.colors_0 = mat * clamp(lacc, 0.0, 1.0);
+}
+o.colors_1 = o.colors_0;
+float4 coord = float4(0.0, 0.0, 1.0, 1.0);
+{
+coord = float4(0.0, 0.0, 1.0, 1.0);
+coord = float4(tex0.x, tex0.y, 1.0, 1.0);
+o.tex0.xyz = float3(dot(coord, ctexmtx[0]), dot(coord, ctexmtx[1]), 1);
+float4 P0 = cpostmtx[61];
+float4 P1 = cpostmtx[62];
+float4 P2 = cpostmtx[63];
+o.tex0.xyz = float3(dot(P0.xyz, o.tex0.xyz) + P0.w, dot(P1.xyz, o.tex0.xyz) + P1.w, dot(P2.xyz, o.tex0.xyz) + P2.w);
+}
+o.clipPos = float4(pos.x,pos.y,o.pos.z,o.pos.w);
+o.pos.z = o.pos.w + o.pos.z * 2.0;
+ uv0_2.xyz = o.tex0;
+ clipPos_2 = o.clipPos;
+colors_02 = o.colors_0;
+colors_12 = o.colors_1;
+gl_Position = o.pos;
+}
+
+[fragment shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+//Pixel Shader for TEV stages
+//2 TEV stages, 1 texgens, 0 IND stages
+float fmod( float x, float y )
+{
+ float z = fract( abs( x / y) ) * abs( y );
+ return (x < 0.0) ? -z : z;
+}
+uniform sampler2D samp0;
+uniform sampler2D samp1;
+uniform sampler2D samp2;
+uniform sampler2D samp3;
+uniform sampler2D samp4;
+uniform sampler2D samp5;
+uniform sampler2D samp6;
+uniform sampler2D samp7;
+
+layout(std140, binding = 1) uniform PSBlock {
+float4 color[4] ;
+float4 k[4] ;
+float4 alphaRef[1] ;
+float4 texdim[8] ;
+float4 czbias[2] ;
+float4 cindscale[2] ;
+float4 cindmtx[6] ;
+float4 cfog[3] ;
+float4 cPLights[40] ;
+float4 cPmtrl[4] ;
+};
+out vec4 ocol0;
+VARYIN float4 colors_02;
+VARYIN float4 colors_12;
+VARYIN float3 uv0_2;
+VARYIN float4 clipPos_2;
+void main()
+{
+ float4 c0 = color[1], c1 = color[2], c2 = color[3], prev = float4(0.0, 0.0, 0.0, 0.0), textemp = float4(0.0, 0.0, 0.0, 0.0), rastemp = float4(0.0, 0.0, 0.0, 0.0), konsttemp = float4(0.0, 0.0, 0.0, 0.0);
+ float3 comp16 = float3(1.0, 255.0, 0.0), comp24 = float3(1.0, 255.0, 255.0*255.0);
+ float alphabump=0.0;
+ float3 tevcoord=float3(0.0, 0.0, 0.0);
+ float2 wrappedcoord=float2(0.0,0.0), tempcoord=float2(0.0,0.0);
+ float4 cc0=float4(0.0,0.0,0.0,0.0), cc1=float4(0.0,0.0,0.0,0.0);
+ float4 cc2=float4(0.0,0.0,0.0,0.0), cprev=float4(0.0,0.0,0.0,0.0);
+ float4 crastemp=float4(0.0,0.0,0.0,0.0),ckonsttemp=float4(0.0,0.0,0.0,0.0);
+
+float4 rawpos = gl_FragCoord;
+float4 colors_0 = colors_02;
+float4 colors_1 = colors_12;
+float3 uv0 = uv0_2;
+float4 clipPos = clipPos_2;
+ clipPos = float4(rawpos.x, rawpos.y, clipPos.z, clipPos.w);
+uv0.xy = uv0.xy * texdim[0].zw;
+// TEV stage 0
+tevcoord.xy = uv0.xy;
+textemp = texture(samp0,tevcoord.xy * texdim[0].xy).rgba;
+cc0 = frac(c0 * (255.0/256.0)) * (256.0/255.0);
+cc1 = frac(c1 * (255.0/256.0)) * (256.0/255.0);
+// color combine
+prev.rgb = clamp(lerp((cc0.rgb), (cc1.rgb), (textemp.rgb)), 0.0, 1.0);
+// alpha combine
+prev.a = clamp(lerp(cc0.a, cc1.a, textemp.a), 0.0, 1.0);
+
+// TEV done
+// TEV stage 1
+rastemp = colors_0.rgba;
+crastemp = frac(rastemp * (255.0/256.0)) * (256.0/255.0);
+textemp = float4(1.0, 1.0, 1.0, 1.0);
+cprev = prev;
+// color combine
+prev.rgb = clamp((cprev.rgb)*(crastemp.rgb), 0.0, 1.0);
+// alpha combine
+prev.a = clamp(cprev.a*crastemp.a, 0.0, 1.0);
+
+// TEV done
+float zCoord = rawpos.z;
+ ocol0 = prev;
+}
+
diff --git a/shaders/dolphin/realxfb.shader_test b/shaders/dolphin/realxfb.shader_test
new file mode 100644
index 0000000..eb243fe
--- /dev/null
+++ b/shaders/dolphin/realxfb.shader_test
@@ -0,0 +1,67 @@
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+void main()
+{
+ vec2 rawpos = vec2(gl_VertexID&1, gl_VertexID&2);
+ gl_Position = vec4(rawpos*2.0-1.0, 0.0, 1.0);
+}
+
+[fragment shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+uniform sampler2D samp9;
+VARYIN vec2 uv0;
+out vec4 ocol0;
+void main()
+{
+ ivec2 uv = ivec2(gl_FragCoord.xy);
+ ivec2 ts = textureSize(samp9, 0);
+ vec4 c0 = texelFetch(samp9, ivec2(uv.x/2, ts.y-uv.y-1), 0);
+ float y = mix(c0.b, c0.r, (uv.x & 1) == 1);
+ float yComp = 1.164 * (y - 0.0625);
+ float uComp = c0.g - 0.5;
+ float vComp = c0.a - 0.5;
+ ocol0 = vec4(yComp + (1.596 * vComp),
+ yComp - (0.813 * vComp) - (0.391 * uComp),
+ yComp + (2.018 * uComp),
+ 1.0);
+}
+
diff --git a/shaders/dolphin/smg.1.shader_test b/shaders/dolphin/smg.1.shader_test
new file mode 100644
index 0000000..16004bc
--- /dev/null
+++ b/shaders/dolphin/smg.1.shader_test
@@ -0,0 +1,173 @@
+[require]
+GLSL >= 1.30
+
+[fragment shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+//Pixel Shader for TEV stages
+//1 TEV stages, 1 texgens, 0 IND stages
+float fmod( float x, float y )
+{
+ float z = fract( abs( x / y) ) * abs( y );
+ return (x < 0.0) ? -z : z;
+}
+uniform sampler2D samp0;
+uniform sampler2D samp1;
+uniform sampler2D samp2;
+uniform sampler2D samp3;
+uniform sampler2D samp4;
+uniform sampler2D samp5;
+uniform sampler2D samp6;
+uniform sampler2D samp7;
+
+layout(std140, binding = 1) uniform PSBlock {
+float4 color[4] ;
+float4 k[4] ;
+float4 alphaRef[1] ;
+float4 texdim[8] ;
+float4 czbias[2] ;
+float4 cindscale[2] ;
+float4 cindmtx[6] ;
+float4 cfog[3] ;
+float4 cPLights[40] ;
+float4 cPmtrl[4] ;
+};
+out vec4 ocol0;
+out vec4 ocol1;
+VARYIN float4 colors_02;
+VARYIN float4 colors_12;
+VARYIN float3 uv0_2;
+VARYIN float4 clipPos_2;
+void main()
+{
+ float4 c0 = color[1], c1 = color[2], c2 = color[3], prev = float4(0.0, 0.0, 0.0, 0.0), textemp = float4(0.0, 0.0, 0.0, 0.0), rastemp = float4(0.0, 0.0, 0.0, 0.0), konsttemp = float4(0.0, 0.0, 0.0, 0.0);
+ float3 comp16 = float3(1.0, 255.0, 0.0), comp24 = float3(1.0, 255.0, 255.0*255.0);
+ float alphabump=0.0;
+ float3 tevcoord=float3(0.0, 0.0, 0.0);
+ float2 wrappedcoord=float2(0.0,0.0), tempcoord=float2(0.0,0.0);
+ float4 cc0=float4(0.0,0.0,0.0,0.0), cc1=float4(0.0,0.0,0.0,0.0);
+ float4 cc2=float4(0.0,0.0,0.0,0.0), cprev=float4(0.0,0.0,0.0,0.0);
+ float4 crastemp=float4(0.0,0.0,0.0,0.0),ckonsttemp=float4(0.0,0.0,0.0,0.0);
+
+float4 rawpos = gl_FragCoord;
+float4 colors_0 = colors_02;
+float4 colors_1 = colors_12;
+float3 uv0 = uv0_2;
+float4 clipPos = clipPos_2;
+ clipPos = float4(rawpos.x, rawpos.y, clipPos.z, clipPos.w);
+uv0.xy = uv0.xy * texdim[0].zw;
+// TEV stage 0
+rastemp = colors_0.rgba;
+crastemp = frac(rastemp * (255.0/256.0)) * (256.0/255.0);
+tevcoord.xy = uv0.xy;
+textemp = texture(samp0,tevcoord.xy * texdim[0].xy).rgba;
+// color combine
+prev.rgb = clamp((c0.rgb)+(textemp.rgb)*(crastemp.rgb)-0.5, 0.0, 1.0);
+// alpha combine
+prev.a = clamp(textemp.a*crastemp.a, 0.0, 1.0);
+
+// TEV done
+float zCoord = rawpos.z;
+ ocol0 = prev;
+ ocol1 = prev;
+ ocol0.a = alphaRef[0].a;
+}
+
+[vertex shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+layout(std140, binding = 2) uniform VSBlock {
+float4 cpnmtx[6] ;
+float4 cproj[4] ;
+float4 cmtrl[4] ;
+float4 clights[40] ;
+float4 ctexmtx[24] ;
+float4 ctrmtx[64] ;
+float4 cnmtx[32] ;
+float4 cpostmtx[64] ;
+float4 cDepth ;
+};
+struct VS_OUTPUT {
+ float4 pos;
+ float4 colors_0;
+ float4 colors_1;
+ float3 tex0;
+ float4 clipPos;
+};
+ATTRIN float4 rawpos; // ATTR0,
+ATTRIN float3 rawnorm0; // ATTR2,
+ATTRIN float4 color0; // ATTR5,
+ATTRIN float2 tex0; // ATTR8,
+VARYOUT float3 uv0_2;
+VARYOUT float4 clipPos_2;
+VARYOUT float4 colors_02;
+VARYOUT float4 colors_12;
+void main()
+{
+VS_OUTPUT o;
+float4 pos = float4(dot(cpnmtx[0], rawpos), dot(cpnmtx[1], rawpos), dot(cpnmtx[2], rawpos), 1.0);
+float3 _norm0 = normalize(float3(dot(cpnmtx[3].xyz, rawnorm0), dot(cpnmtx[4].xyz, rawnorm0), dot(cpnmtx[5].xyz, rawnorm0)));
+o.pos = float4(dot(cproj[0], pos), dot(cproj[1], pos), dot(cproj[2], pos), dot(cproj[3], pos));
+float4 mat, lacc;
+float3 ldir, h;
+float dist, dist2, attn;
+{
+mat = color0;
+lacc = float4(1.0, 1.0, 1.0, 1.0);
+lacc.w = 1.0;
+o.colors_0 = mat * clamp(lacc, 0.0, 1.0);
+}
+o.colors_1 = o.colors_0;
+float4 coord = float4(0.0, 0.0, 1.0, 1.0);
+{
+coord = float4(0.0, 0.0, 1.0, 1.0);
+coord = float4(tex0.x, tex0.y, 1.0, 1.0);
+o.tex0.xyz = float3(dot(coord, ctexmtx[0]), dot(coord, ctexmtx[1]), 1);
+float4 P0 = cpostmtx[61];
+float4 P1 = cpostmtx[62];
+float4 P2 = cpostmtx[63];
+o.tex0.xyz = float3(dot(P0.xyz, o.tex0.xyz) + P0.w, dot(P1.xyz, o.tex0.xyz) + P1.w, dot(P2.xyz, o.tex0.xyz) + P2.w);
+}
+o.clipPos = float4(pos.x,pos.y,o.pos.z,o.pos.w);
+o.pos.z = o.pos.w + o.pos.z * 2.0;
+ uv0_2.xyz = o.tex0;
+ clipPos_2 = o.clipPos;
+colors_02 = o.colors_0;
+colors_12 = o.colors_1;
+gl_Position = o.pos;
+}
+
diff --git a/shaders/dolphin/smg.2.shader_test b/shaders/dolphin/smg.2.shader_test
new file mode 100644
index 0000000..8b8a1f9
--- /dev/null
+++ b/shaders/dolphin/smg.2.shader_test
@@ -0,0 +1,167 @@
+[require]
+GLSL >= 1.30
+
+[fragment shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+//Pixel Shader for TEV stages
+//1 TEV stages, 1 texgens, 0 IND stages
+float fmod( float x, float y )
+{
+ float z = fract( abs( x / y) ) * abs( y );
+ return (x < 0.0) ? -z : z;
+}
+uniform sampler2D samp0;
+uniform sampler2D samp1;
+uniform sampler2D samp2;
+uniform sampler2D samp3;
+uniform sampler2D samp4;
+uniform sampler2D samp5;
+uniform sampler2D samp6;
+uniform sampler2D samp7;
+
+layout(std140, binding = 1) uniform PSBlock {
+float4 color[4] ;
+float4 k[4] ;
+float4 alphaRef[1] ;
+float4 texdim[8] ;
+float4 czbias[2] ;
+float4 cindscale[2] ;
+float4 cindmtx[6] ;
+float4 cfog[3] ;
+float4 cPLights[40] ;
+float4 cPmtrl[4] ;
+};
+out vec4 ocol0;
+#define depth gl_FragDepth
+VARYIN float4 colors_02;
+VARYIN float4 colors_12;
+VARYIN float3 uv0_2;
+VARYIN float4 clipPos_2;
+void main()
+{
+ float4 c0 = color[1], c1 = color[2], c2 = color[3], prev = float4(0.0, 0.0, 0.0, 0.0), textemp = float4(0.0, 0.0, 0.0, 0.0), rastemp = float4(0.0, 0.0, 0.0, 0.0), konsttemp = float4(0.0, 0.0, 0.0, 0.0);
+ float3 comp16 = float3(1.0, 255.0, 0.0), comp24 = float3(1.0, 255.0, 255.0*255.0);
+ float alphabump=0.0;
+ float3 tevcoord=float3(0.0, 0.0, 0.0);
+ float2 wrappedcoord=float2(0.0,0.0), tempcoord=float2(0.0,0.0);
+ float4 cc0=float4(0.0,0.0,0.0,0.0), cc1=float4(0.0,0.0,0.0,0.0);
+ float4 cc2=float4(0.0,0.0,0.0,0.0), cprev=float4(0.0,0.0,0.0,0.0);
+ float4 crastemp=float4(0.0,0.0,0.0,0.0),ckonsttemp=float4(0.0,0.0,0.0,0.0);
+
+float4 rawpos = gl_FragCoord;
+float4 colors_0 = colors_02;
+float4 colors_1 = colors_12;
+float3 uv0 = uv0_2;
+float4 clipPos = clipPos_2;
+ clipPos = float4(rawpos.x, rawpos.y, clipPos.z, clipPos.w);
+uv0.xy = uv0.xy * texdim[0].zw;
+// TEV stage 0
+tevcoord.xy = uv0.xy;
+textemp = texture(samp0,tevcoord.xy * texdim[0].xy).rgba;
+// color combine
+prev.rgb = clamp((c0.rgb)+float3(0.0, 0.0, 0.0), 0.0, 1.0);
+// alpha combine
+prev.a = clamp(c0.a+float4(0.0, 0.0, 0.0, 0.0).a, 0.0, 1.0);
+
+// TEV done
+float zCoord = rawpos.z;
+zCoord = dot(czbias[0].xyzw, textemp.xyzw) + czbias[1].w ;
+zCoord = zCoord * (16777215.0/16777216.0);
+zCoord = frac(zCoord);
+zCoord = zCoord * (16777216.0/16777215.0);
+depth = zCoord;
+ ocol0 = prev;
+}
+
+[vertex shader]
+#version 130
+#extension GL_ARB_uniform_buffer_object : enable
+
+#extension GL_ARB_shading_language_420pack : enable
+
+
+#define ATTRIN in
+#define ATTROUT out
+#define VARYIN centroid in
+#define VARYOUT centroid out
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#define frac fract
+#define lerp mix
+
+layout(std140, binding = 2) uniform VSBlock {
+float4 cpnmtx[6] ;
+float4 cproj[4] ;
+float4 cmtrl[4] ;
+float4 clights[40] ;
+float4 ctexmtx[24] ;
+float4 ctrmtx[64] ;
+float4 cnmtx[32] ;
+float4 cpostmtx[64] ;
+float4 cDepth ;
+};
+struct VS_OUTPUT {
+ float4 pos;
+ float4 colors_0;
+ float4 colors_1;
+ float3 tex0;
+ float4 clipPos;
+};
+ATTRIN float4 rawpos; // ATTR0,
+ATTRIN float2 tex0; // ATTR8,
+VARYOUT float3 uv0_2;
+VARYOUT float4 clipPos_2;
+VARYOUT float4 colors_02;
+VARYOUT float4 colors_12;
+void main()
+{
+VS_OUTPUT o;
+float4 pos = float4(dot(cpnmtx[0], rawpos), dot(cpnmtx[1], rawpos), dot(cpnmtx[2], rawpos), 1.0);
+float3 _norm0 = float3(0.0, 0.0, 0.0);
+o.pos = float4(dot(cproj[0], pos), dot(cproj[1], pos), dot(cproj[2], pos), dot(cproj[3], pos));
+float4 mat, lacc;
+float3 ldir, h;
+float dist, dist2, attn;
+o.colors_0 = float4(1.0, 1.0, 1.0, 1.0);
+o.colors_1 = o.colors_0;
+float4 coord = float4(0.0, 0.0, 1.0, 1.0);
+{
+coord = float4(0.0, 0.0, 1.0, 1.0);
+coord = float4(tex0.x, tex0.y, 1.0, 1.0);
+o.tex0.xyz = float3(dot(coord, ctexmtx[0]), dot(coord, ctexmtx[1]), 1);
+float4 P0 = cpostmtx[61];
+float4 P1 = cpostmtx[62];
+float4 P2 = cpostmtx[63];
+o.tex0.xyz = float3(dot(P0.xyz, o.tex0.xyz) + P0.w, dot(P1.xyz, o.tex0.xyz) + P1.w, dot(P2.xyz, o.tex0.xyz) + P2.w);
+}
+o.clipPos = float4(pos.x,pos.y,o.pos.z,o.pos.w);
+o.pos.z = o.pos.w + o.pos.z * 2.0;
+ uv0_2.xyz = o.tex0;
+ clipPos_2 = o.clipPos;
+colors_02 = o.colors_0;
+colors_12 = o.colors_1;
+gl_Position = o.pos;
+}
+