RetroArch Pack

This commit is contained in:
Abdessamad DERRAZ
2020-05-08 17:25:48 +02:00
parent 849cc2a33c
commit d9fc3b32f0
3164 changed files with 2458568 additions and 1 deletions

View File

@@ -0,0 +1,77 @@
// 4xGLSL HqFilter shader, Modified to use in PPSSPP. Grabbed from:
// http://forums.ngemu.com/showthread.php?t=76098
// by guest(r) (guest.r@gmail.com)
// License: GNU-GPL
// Shader notes: looks better with sprite games
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D sampler0;
varying vec4 v_texcoord0;
varying vec4 v_texcoord1;
varying vec4 v_texcoord2;
varying vec4 v_texcoord3;
varying vec4 v_texcoord4;
varying vec4 v_texcoord5;
varying vec4 v_texcoord6;
const float mx = 0.325; // start smoothing factor
const float k = -0.250; // smoothing decrease factor
const float max_w = 0.25; // max. smoothing weigth
const float min_w =-0.05; // min smoothing/sharpening weigth
void main()
{
vec3 c = texture2D(sampler0, v_texcoord0.xy).xyz;
vec3 i1 = texture2D(sampler0, v_texcoord1.xy).xyz;
vec3 i2 = texture2D(sampler0, v_texcoord2.xy).xyz;
vec3 i3 = texture2D(sampler0, v_texcoord3.xy).xyz;
vec3 i4 = texture2D(sampler0, v_texcoord4.xy).xyz;
vec3 o1 = texture2D(sampler0, v_texcoord5.xy).xyz;
vec3 o3 = texture2D(sampler0, v_texcoord6.xy).xyz;
vec3 o2 = texture2D(sampler0, v_texcoord5.zw).xyz;
vec3 o4 = texture2D(sampler0, v_texcoord6.zw).xyz;
vec3 dt = vec3(1.0,1.0,1.0);
float ko1=dot(abs(o1-c),dt);
float ko2=dot(abs(o2-c),dt);
float ko3=dot(abs(o3-c),dt);
float ko4=dot(abs(o4-c),dt);
float sd1 = dot(abs(i1-i3),dt);
float sd2 = dot(abs(i2-i4),dt);
float w1 = step(ko1,ko3)*sd2;
float w2 = step(ko2,ko4)*sd1;
float w3 = step(ko3,ko1)*sd2;
float w4 = step(ko4,ko2)*sd1;
c = (w1*o1+w2*o2+w3*o3+w4*o4+0.1*c)/(w1+w2+w3+w4+0.1);
float lc = c.r+c.g+c.b+0.2;
w1 = (i1.r+i1.g+i1.b+lc)*0.2;
w1 = clamp(k*dot(abs(c-i1),dt)/w1+mx,min_w,max_w);
w2 = (i2.r+i2.g+i2.b+lc)*0.2;
w2 = clamp(k*dot(abs(c-i2),dt)/w2+mx,min_w,max_w);
w3 = (i3.r+i3.g+i3.b+lc)*0.2;
w3 = clamp(k*dot(abs(c-i3),dt)/w3+mx,min_w,max_w);
w4 = (i4.r+i4.g+i4.b+lc)*0.2;
w4 = clamp(k*dot(abs(c-i4),dt)/w4+mx,min_w,max_w);
gl_FragColor.rgb = w1*i1 + w2*i2 + w3*i3 + w4*i4 + (1.0-w1-w2-w3-w4)*c;
gl_FragColor.a = 1.0;
}

View File

@@ -0,0 +1,32 @@
attribute vec4 a_position;
attribute vec2 a_texcoord0;
uniform vec2 u_texelDelta;
uniform vec2 u_pixelDelta;
varying vec4 v_texcoord0;
varying vec4 v_texcoord1;
varying vec4 v_texcoord2;
varying vec4 v_texcoord3;
varying vec4 v_texcoord4;
varying vec4 v_texcoord5;
varying vec4 v_texcoord6;
void main()
{
float x = u_pixelDelta.x*((u_texelDelta.x/u_pixelDelta.x)/2.0);
float y = u_pixelDelta.y*((u_texelDelta.y/u_pixelDelta.y)/2.0);
vec2 dg1 = vec2( x,y);
vec2 dg2 = vec2(-x,y);
vec2 sd1 = dg1*0.5;
vec2 sd2 = dg2*0.5;
gl_Position = a_position;
v_texcoord0=a_texcoord0.xyxy;
v_texcoord1.xy = v_texcoord0.xy - sd1;
v_texcoord2.xy = v_texcoord0.xy - sd2;
v_texcoord3.xy = v_texcoord0.xy + sd1;
v_texcoord4.xy = v_texcoord0.xy + sd2;
v_texcoord5.xy = v_texcoord0.xy - dg1;
v_texcoord6.xy = v_texcoord0.xy + dg1;
v_texcoord5.zw = v_texcoord0.xy - dg2;
v_texcoord6.zw = v_texcoord0.xy + dg2;
}

View File

@@ -0,0 +1,218 @@
/*
Hyllian's xBR-lv2 Shader Accuracy (tweak by guest.r)
Copyright (C) 2011-2015 Hyllian - sergiogdb@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Incorporates some of the ideas from SABR shader. Thanks to Joshua Street.
*/
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
#define CornerA 0 //ON:1/OFF:0 / A, B, C, D are just different variants of corner rounding
#define CornerB 0 //ON:1/OFF:0 / activate only one
#define CornerD 0 //ON:1/OFF:0
// CornerC //used as default if none of the above is defined
const float XBR_SCALE = 3.0;
const float lv2_cf = 2.0;
const float coef = 2.0;
const vec3 rgbw = vec3(14.352, 28.176, 5.472);
const vec4 eq_threshold = vec4(15.0, 15.0, 15.0, 15.0);
const vec4 Ao = vec4( 1.0, -1.0, -1.0, 1.0 );
const vec4 Bo = vec4( 1.0, 1.0, -1.0,-1.0 );
const vec4 Co = vec4( 1.5, 0.5, -0.5, 0.5 );
const vec4 Ax = vec4( 1.0, -1.0, -1.0, 1.0 );
const vec4 Bx = vec4( 0.5, 2.0, -0.5,-2.0 );
const vec4 Cx = vec4( 1.0, 1.0, -0.5, 0.0 );
const vec4 Ay = vec4( 1.0, -1.0, -1.0, 1.0 );
const vec4 By = vec4( 2.0, 0.5, -2.0,-0.5 );
const vec4 Cy = vec4( 2.0, 0.0, -1.0, 0.5 );
const vec4 Ci = vec4(0.25, 0.25, 0.25, 0.25);
uniform sampler2D sampler0;
uniform vec2 u_texelDelta;
uniform vec2 u_pixelDelta;
varying vec2 v_texcoord0;
// Difference between vector components.
vec4 df(vec4 A, vec4 B) {
return vec4(abs(A-B));
}
// Compare two vectors and return their components are different.
vec4 diff(vec4 A, vec4 B) {
return vec4(notEqual(A, B));
}
// Determine if two vector components are equal based on a threshold.
vec4 eq(vec4 A, vec4 B) {
return (step(df(A, B), eq_threshold));
}
// Determine if two vector components are NOT equal based on a threshold.
vec4 neq(vec4 A, vec4 B) {
return (vec4(1.0, 1.0, 1.0, 1.0) - eq(A, B));
}
float c_df(vec3 c1, vec3 c2) {
vec3 df = abs(c1 - c2);
return df.r + df.g + df.b;
}
void main() {
bool upscale = u_texelDelta.x > (1.6 * u_pixelDelta.x);
vec3 res = texture2D(sampler0, v_texcoord0.xy).xyz;
// Let's skip the whole scaling if output size smaller than 1.6x of input size
if (upscale) {
vec4 edri, edr, edr_l, edr_u, px; // px = pixel, edr = edge detection rule
vec4 irlv0, irlv1, irlv2l, irlv2u;
vec4 fx, fx_l, fx_u; // inequations of straight lines.
vec2 pS = 1.0 / u_texelDelta.xy;
vec2 fp = fract(v_texcoord0.xy*pS.xy);
vec2 TexCoord_0 = v_texcoord0.xy-fp*u_pixelDelta.xy;
vec2 dx = vec2(u_texelDelta.x,0.0);
vec2 dy = vec2(0.0,u_texelDelta.y);
vec2 y2 = dy + dy; vec2 x2 = dx + dx;
vec4 delta = vec4(1.0/XBR_SCALE, 1.0/XBR_SCALE, 1.0/XBR_SCALE, 1.0/XBR_SCALE);
vec4 delta_l = vec4(0.5/XBR_SCALE, 1.0/XBR_SCALE, 0.5/XBR_SCALE, 1.0/XBR_SCALE);
vec4 delta_u = delta_l.yxwz;
vec3 A = texture2D(sampler0, TexCoord_0 -dx -dy ).xyz;
vec3 B = texture2D(sampler0, TexCoord_0 -dy ).xyz;
vec3 C = texture2D(sampler0, TexCoord_0 +dx -dy ).xyz;
vec3 D = texture2D(sampler0, TexCoord_0 -dx ).xyz;
vec3 E = texture2D(sampler0, TexCoord_0 ).xyz;
vec3 F = texture2D(sampler0, TexCoord_0 +dx ).xyz;
vec3 G = texture2D(sampler0, TexCoord_0 -dx +dy ).xyz;
vec3 H = texture2D(sampler0, TexCoord_0 +dy ).xyz;
vec3 I = texture2D(sampler0, TexCoord_0 +dx +dy ).xyz;
vec3 A1 = texture2D(sampler0, TexCoord_0 -dx -y2).xyz;
vec3 C1 = texture2D(sampler0, TexCoord_0 +dx -y2).xyz;
vec3 A0 = texture2D(sampler0, TexCoord_0 -x2 -dy).xyz;
vec3 G0 = texture2D(sampler0, TexCoord_0 -x2 +dy).xyz;
vec3 C4 = texture2D(sampler0, TexCoord_0 +x2 -dy).xyz;
vec3 I4 = texture2D(sampler0, TexCoord_0 +x2 +dy).xyz;
vec3 G5 = texture2D(sampler0, TexCoord_0 -dx +y2).xyz;
vec3 I5 = texture2D(sampler0, TexCoord_0 +dx +y2).xyz;
vec3 B1 = texture2D(sampler0, TexCoord_0 -y2).xyz;
vec3 D0 = texture2D(sampler0, TexCoord_0 -x2 ).xyz;
vec3 H5 = texture2D(sampler0, TexCoord_0 +y2).xyz;
vec3 F4 = texture2D(sampler0, TexCoord_0 +x2 ).xyz;
vec4 b = vec4(dot(B ,rgbw), dot(D ,rgbw), dot(H ,rgbw), dot(F ,rgbw));
vec4 c = vec4(dot(C ,rgbw), dot(A ,rgbw), dot(G ,rgbw), dot(I ,rgbw));
vec4 d = b.yzwx;
vec4 e = vec4(dot(E,rgbw));
vec4 f = b.wxyz;
vec4 g = c.zwxy;
vec4 h = b.zwxy;
vec4 i = c.wxyz;
vec4 i4 = vec4(dot(I4,rgbw), dot(C1,rgbw), dot(A0,rgbw), dot(G5,rgbw));
vec4 i5 = vec4(dot(I5,rgbw), dot(C4,rgbw), dot(A1,rgbw), dot(G0,rgbw));
vec4 h5 = vec4(dot(H5,rgbw), dot(F4,rgbw), dot(B1,rgbw), dot(D0,rgbw));
vec4 f4 = h5.yzwx;
// These inequations define the line below which interpolation occurs.
fx = (Ao*fp.y+Bo*fp.x);
fx_l = (Ax*fp.y+Bx*fp.x);
fx_u = (Ay*fp.y+By*fp.x);
irlv1 = irlv0 = diff(e,f) * diff(e,h);
#if(CornerA==0) // A takes priority skipping other corners
#define SMOOTH_TIPS
// Corner C also default if no other ones used
irlv1 = (irlv0 * ( neq(f,b) * neq(f,c) + neq(h,d) * neq(h,g) + eq(e,i) * (neq(f,f4) * neq(f,i4) + neq(h,h5) * neq(h,i5)) + eq(e,g) + eq(e,c)) );
int select1 = 0;
#if(CornerB==1) // Corner B
irlv1 = (irlv0 * ( neq(f,b) * neq(h,d) + eq(e,i) * neq(f,i4) * neq(h,i5) + eq(e,g) + eq(e,c) ) );
select1 = 1;
#endif
#if(CornerD==1) // Corner D
if (select1==0) {
vec4 c1 = i4.yzwx;
vec4 g0 = i5.wxyz;
irlv1 = (irlv0 * ( neq(f,b) * neq(h,d) + eq(e,i) * neq(f,i4) * neq(h,i5) + eq(e,g) + eq(e,c) ) * (diff(f,f4) * diff(f,i) + diff(h,h5) * diff(h,i) + diff(h,g) + diff(f,c) + eq(b,c1) * eq(d,g0)));
}
#endif
#endif
irlv2l = diff(e,g) * diff(d,g);
irlv2u = diff(e,c) * diff(b,c);
vec4 fx45i = clamp((fx + delta -Co - Ci) / (2.0*delta ), 0.0, 1.0);
vec4 fx45 = clamp((fx + delta -Co ) / (2.0*delta ), 0.0, 1.0);
vec4 fx30 = clamp((fx_l + delta_l -Cx ) / (2.0*delta_l), 0.0, 1.0);
vec4 fx60 = clamp((fx_u + delta_u -Cy ) / (2.0*delta_u), 0.0, 1.0);
vec4 w1, w2;
w1.x = dot(abs(E-C),rgbw) + dot(abs(E-G),rgbw) + dot(abs(I-H5),rgbw) + dot(abs(I-F4),rgbw) + 4.0*dot(abs(H-F),rgbw);
w1.y = dot(abs(E-A),rgbw) + dot(abs(E-I),rgbw) + dot(abs(C-F4),rgbw) + dot(abs(C-B1),rgbw) + 4.0*dot(abs(F-B),rgbw);
w1.z = dot(abs(E-G),rgbw) + dot(abs(E-C),rgbw) + dot(abs(A-B1),rgbw) + dot(abs(A-D0),rgbw) + 4.0*dot(abs(B-D),rgbw);
w1.w = dot(abs(E-I),rgbw) + dot(abs(E-A),rgbw) + dot(abs(G-D0),rgbw) + dot(abs(G-H5),rgbw) + 4.0*dot(abs(D-H),rgbw);
w2.x = dot(abs(H-D),rgbw) + dot(abs(H-I5),rgbw) + dot(abs(F-I4),rgbw) + dot(abs(F-B),rgbw) + 4.0*dot(abs(E-I),rgbw);
w2.y = dot(abs(F-H),rgbw) + dot(abs(F-C4),rgbw) + dot(abs(B-C1),rgbw) + dot(abs(B-D),rgbw) + 4.0*dot(abs(E-C),rgbw);
w2.z = dot(abs(B-F),rgbw) + dot(abs(B-A1),rgbw) + dot(abs(D-A0),rgbw) + dot(abs(D-H),rgbw) + 4.0*dot(abs(E-A),rgbw);
w2.w = dot(abs(D-B),rgbw) + dot(abs(D-G0),rgbw) + dot(abs(H-G5),rgbw) + dot(abs(H-F),rgbw) + 4.0*dot(abs(E-G),rgbw);
edri = step(w1, w2) * irlv0;
edr = step(w1 + vec4(0.1, 0.1, 0.1, 0.1), w2) * step(vec4(0.5, 0.5, 0.5, 0.5), irlv1);
w1.x = dot(abs(F-G),rgbw); w1.y = dot(abs(B-I),rgbw); w1.z = dot(abs(D-C),rgbw); w1.w = dot(abs(H-A),rgbw);
w2.x = dot(abs(H-C),rgbw); w2.y = dot(abs(F-A),rgbw); w2.z = dot(abs(B-G),rgbw); w2.w = dot(abs(D-I),rgbw);
edr_l = step( lv2_cf*w1, w2 ) * irlv2l * edr;
edr_u = step( lv2_cf*w2, w1 ) * irlv2u * edr;
fx45 = edr * fx45;
fx30 = edr_l * fx30;
fx60 = edr_u * fx60;
fx45i = edri * fx45i;
w1.x = dot(abs(E-F),rgbw); w1.y = dot(abs(E-B),rgbw); w1.z = dot(abs(E-D),rgbw); w1.w = dot(abs(E-H),rgbw);
w2.x = dot(abs(E-H),rgbw); w2.y = dot(abs(E-F),rgbw); w2.z = dot(abs(E-B),rgbw); w2.w = dot(abs(E-D),rgbw);
px = step(w1, w2);
#ifdef SMOOTH_TIPS
vec4 maximos = max(max(fx30, fx60), max(fx45, fx45i));
#else
vec4 maximos = max(max(fx30, fx60), fx45);
#endif
vec3 res1 = E;
res1 = mix(res1, mix(H, F, px.x), maximos.x);
res1 = mix(res1, mix(B, D, px.z), maximos.z);
vec3 res2 = E;
res2 = mix(res2, mix(F, B, px.y), maximos.y);
res2 = mix(res2, mix(D, H, px.w), maximos.w);
res = mix(res1, res2, step(c_df(E, res1), c_df(E, res2)));
}
gl_FragColor.xyz = res;
gl_FragColor.a = 1.0;
}

View File

@@ -0,0 +1,133 @@
/*
Hyllian's 5xBR v3.5a Shader
Copyright (C) 2011 Hyllian/Jararaca - sergiogdb@gmail.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D sampler0;
uniform vec2 u_texelDelta;
uniform vec2 u_pixelDelta;
varying vec2 v_texcoord0;
const float coef = 2.0;
const vec3 rgbw = vec3(16.163, 23.351, 8.4772);
const vec4 Ao = vec4( 1.0, -1.0, -1.0, 1.0 );
const vec4 Bo = vec4( 1.0, 1.0, -1.0,-1.0 );
const vec4 Co = vec4( 1.5, 0.5, -0.5, 0.5 );
const vec4 Ax = vec4( 1.0, -1.0, -1.0, 1.0 );
const vec4 Bx = vec4( 0.5, 2.0, -0.5,-2.0 );
const vec4 Cx = vec4( 1.0, 1.0, -0.5, 0.0 );
const vec4 Ay = vec4( 1.0, -1.0, -1.0, 1.0 );
const vec4 By = vec4( 2.0, 0.5, -2.0,-0.5 );
const vec4 Cy = vec4( 2.0, 0.0, -1.0, 0.5 );
vec4 df(vec4 A, vec4 B) {
return abs(A-B);
}
vec4 weighted_distance(vec4 a, vec4 b, vec4 c, vec4 d, vec4 e, vec4 f, vec4 g, vec4 h) {
return (df(a,b) + df(a,c) + df(d,e) + df(d,f) + 4.0*df(g,h));
}
void main(){
bool upscale = u_texelDelta.x > (1.6 * u_pixelDelta.x);
vec3 res = texture2D(sampler0, v_texcoord0.xy).xyz;
// Let's skip the whole scaling if output size smaller than 1.6x of input size
if (upscale) {
bvec4 edr, edr_left, edr_up, px; // px = pixel, edr = edge detection rule
bvec4 interp_restriction_lv1, interp_restriction_lv2_left, interp_restriction_lv2_up;
bvec4 nc; // new_color
bvec4 fx, fx_left, fx_up; // inequations of straight lines.
vec2 pS = 1.0 / u_texelDelta.xy;
vec2 fp = fract(v_texcoord0.xy*pS.xy);
vec2 TexCoord_0 = v_texcoord0.xy-fp*u_pixelDelta.xy;
vec2 dx = vec2(u_texelDelta.x,0.0);
vec2 dy = vec2(0.0,u_texelDelta.y);
vec2 y2 = dy + dy; vec2 x2 = dx + dx;
vec3 A = texture2D(sampler0, TexCoord_0 -dx -dy ).xyz;
vec3 B = texture2D(sampler0, TexCoord_0 -dy ).xyz;
vec3 C = texture2D(sampler0, TexCoord_0 +dx -dy ).xyz;
vec3 D = texture2D(sampler0, TexCoord_0 -dx ).xyz;
vec3 E = texture2D(sampler0, TexCoord_0 ).xyz;
vec3 F = texture2D(sampler0, TexCoord_0 +dx ).xyz;
vec3 G = texture2D(sampler0, TexCoord_0 -dx +dy ).xyz;
vec3 H = texture2D(sampler0, TexCoord_0 +dy ).xyz;
vec3 I = texture2D(sampler0, TexCoord_0 +dx +dy ).xyz;
vec3 A1 = texture2D(sampler0, TexCoord_0 -dx -y2).xyz;
vec3 C1 = texture2D(sampler0, TexCoord_0 +dx -y2).xyz;
vec3 A0 = texture2D(sampler0, TexCoord_0 -x2 -dy).xyz;
vec3 G0 = texture2D(sampler0, TexCoord_0 -x2 +dy).xyz;
vec3 C4 = texture2D(sampler0, TexCoord_0 +x2 -dy).xyz;
vec3 I4 = texture2D(sampler0, TexCoord_0 +x2 +dy).xyz;
vec3 G5 = texture2D(sampler0, TexCoord_0 -dx +y2).xyz;
vec3 I5 = texture2D(sampler0, TexCoord_0 +dx +y2).xyz;
vec3 B1 = texture2D(sampler0, TexCoord_0 -y2).xyz;
vec3 D0 = texture2D(sampler0, TexCoord_0 -x2 ).xyz;
vec3 H5 = texture2D(sampler0, TexCoord_0 +y2).xyz;
vec3 F4 = texture2D(sampler0, TexCoord_0 +x2 ).xyz;
vec4 b = vec4(dot(B ,rgbw), dot(D ,rgbw), dot(H ,rgbw), dot(F ,rgbw));
vec4 c = vec4(dot(C ,rgbw), dot(A ,rgbw), dot(G ,rgbw), dot(I ,rgbw));
vec4 d = vec4(b.y, b.z, b.w, b.x);
vec4 e = vec4(dot(E,rgbw));
vec4 f = vec4(b.w, b.x, b.y, b.z);
vec4 g = vec4(c.z, c.w, c.x, c.y);
vec4 h = vec4(b.z, b.w, b.x, b.y);
vec4 i = vec4(c.w, c.x, c.y, c.z);
vec4 i4 = vec4(dot(I4,rgbw), dot(C1,rgbw), dot(A0,rgbw), dot(G5,rgbw));
vec4 i5 = vec4(dot(I5,rgbw), dot(C4,rgbw), dot(A1,rgbw), dot(G0,rgbw));
vec4 h5 = vec4(dot(H5,rgbw), dot(F4,rgbw), dot(B1,rgbw), dot(D0,rgbw));
vec4 f4 = vec4(h5.y, h5.z, h5.w, h5.x);
// These inequations define the line below which interpolation occurs.
fx = greaterThan(Ao*fp.y+Bo*fp.x,Co);
fx_left = greaterThan(Ax*fp.y+Bx*fp.x,Cx);
fx_up = greaterThan(Ay*fp.y+By*fp.x,Cy);
interp_restriction_lv1 = bvec4(vec4(notEqual(e,f))*vec4(notEqual(e,h)));
interp_restriction_lv2_left = bvec4(vec4(notEqual(e,g))*vec4(notEqual(d,g)));
interp_restriction_lv2_up = bvec4(vec4(notEqual(e,c))*vec4(notEqual(b,c)));
edr = bvec4(vec4(lessThan(weighted_distance( e, c, g, i, h5, f4, h, f), weighted_distance( h, d, i5, f, i4, b, e, i)))*vec4(interp_restriction_lv1));
edr_left = bvec4(vec4(lessThanEqual(coef*df(f,g),df(h,c)))*vec4(interp_restriction_lv2_left));
edr_up = bvec4(vec4(greaterThanEqual(df(f,g),coef*df(h,c)))*vec4(interp_restriction_lv2_up));
nc.x = ( edr.x && (fx.x || edr_left.x && fx_left.x || edr_up.x && fx_up.x) );
nc.y = ( edr.y && (fx.y || edr_left.y && fx_left.y || edr_up.y && fx_up.y) );
nc.z = ( edr.z && (fx.z || edr_left.z && fx_left.z || edr_up.z && fx_up.z) );
nc.w = ( edr.w && (fx.w || edr_left.w && fx_left.w || edr_up.w && fx_up.w) );
px = lessThanEqual(df(e,f),df(e,h));
res = nc.x ? px.x ? F : H : nc.y ? px.y ? B : F : nc.z ? px.z ? D : B : nc.w ? px.w ? H : D : E;
}
gl_FragColor.rgb = res;
gl_FragColor.a = 1.0;
}

View File

@@ -0,0 +1,28 @@
/*
Hyllian's 5xBR v3.5a Shader
Copyright (C) 2011 Hyllian/Jararaca - sergiogdb@gmail.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
attribute vec4 a_position;
attribute vec2 a_texcoord0;
varying vec2 v_texcoord0;
void main() {
v_texcoord0 = a_texcoord0;
gl_Position = a_position;
}

View File

@@ -0,0 +1,73 @@
// PPSSPP: Simple Gauss filter
// Made by Bigpet
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D sampler0;
// The inverse of the texture dimensions along X and Y
uniform vec2 u_texelDelta;
uniform vec2 u_pixelDelta;
varying vec2 v_texcoord0;
void main() {
// The parameters are hardcoded for now, but could be
// made into uniforms to control fromt he program.
float GAUSS_SPAN_MAX = 1.5;
//just a variable to describe the maximu
float GAUSS_KERNEL_SIZE = 5.0;
//indices
// XX XX 00 XX XX
// XX 01 02 03 XX
// 04 05 06 07 08
// XX 09 10 11 XX
// XX XX 12 XX XX
//filter strength, rather smooth
// XX XX 01 XX XX
// XX 03 08 03 XX
// 01 08 10 08 01
// XX 03 08 03 XX
// XX XX 01 XX XX
vec2 offset = u_pixelDelta*GAUSS_SPAN_MAX/GAUSS_KERNEL_SIZE;
vec3 rgbSimple0 = 1.0 * texture2D(sampler0, v_texcoord0.xy + offset * vec2( 0.0,-2.0)).xyz;
vec3 rgbSimple1 = 3.0 * texture2D(sampler0, v_texcoord0.xy + offset * vec2(-1.0,-1.0)).xyz;
vec3 rgbSimple2 = 8.0 * texture2D(sampler0, v_texcoord0.xy + offset * vec2( 0.0,-1.0)).xyz;
vec3 rgbSimple3 = 3.0 * texture2D(sampler0, v_texcoord0.xy + offset * vec2( 1.0,-1.0)).xyz;
vec3 rgbSimple4 = 1.0 * texture2D(sampler0, v_texcoord0.xy + offset * vec2(-2.0, 0.0)).xyz;
vec3 rgbSimple5 = 8.0 * texture2D(sampler0, v_texcoord0.xy + offset * vec2(-1.0, 0.0)).xyz;
vec3 rgbSimple6 = 10.0 * texture2D(sampler0, v_texcoord0.xy + offset * vec2( 0.0, 0.0)).xyz;
vec3 rgbSimple7 = 8.0 * texture2D(sampler0, v_texcoord0.xy + offset * vec2( 1.0, 0.0)).xyz;
vec3 rgbSimple8 = 1.0 * texture2D(sampler0, v_texcoord0.xy + offset * vec2( 2.0, 0.0)).xyz;
vec3 rgbSimple9 = 3.0 * texture2D(sampler0, v_texcoord0.xy + offset * vec2(-1.0, 1.0)).xyz;
vec3 rgbSimple10= 8.0 * texture2D(sampler0, v_texcoord0.xy + offset * vec2( 0.0, 1.0)).xyz;
vec3 rgbSimple11= 3.0 * texture2D(sampler0, v_texcoord0.xy + offset * vec2( 1.0, 1.0)).xyz;
vec3 rgbSimple12= 1.0 * texture2D(sampler0, v_texcoord0.xy + offset * vec2( 0.0, 2.0)).xyz;
//vec3 rgbSimple10= vec3(1.0,0.0,0.0);
//vec3 rgbSimple11= vec3(1.0,0.0,0.0);
//vec3 rgbSimple12= vec3(1.0,0.0,0.0);
vec3 rgb = rgbSimple0 +
rgbSimple1 +
rgbSimple2 +
rgbSimple3 +
rgbSimple4 +
rgbSimple5 +
rgbSimple6 +
rgbSimple7 +
rgbSimple8 +
rgbSimple9 +
rgbSimple10 +
rgbSimple11 +
rgbSimple12;
rgb = rgb / 58.0;
gl_FragColor.xyz=rgb;
gl_FragColor.a = 1.0;
}

View File

@@ -0,0 +1,69 @@
// AA-Color shader, Modified to use in PPSSPP. Grabbed from:
// http://forums.ngemu.com/showthread.php?t=76098
// by guest(r) (guest.r@gmail.com)
// license: GNU-GPL
// Color variables
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
const vec3 c_ch = vec3(1.0,1.0,1.0); // rgb color channel intensity
const float a = 1.20 ; // saturation
const float b = 1.00 ; // brightness
const float c = 1.25 ; // contrast
// you can use contrast1,contrast2...contrast4 (or contrast0 for speedup)
float contrast0(float x)
{ return x; }
float contrast1(float x)
{ x = x*1.1547-1.0;
return sign(x)*pow(abs(x),1.0/c)*0.86 + 0.86;}
float contrast2(float x)
{ return normalize(vec2(pow(x,c),pow(0.86,c))).x*1.72;}
float contrast3(float x)
{ return 1.73*pow(0.57735*x,c); }
float contrast4(float x)
{ return clamp(0.866 + c*(x-0.866),0.05, 1.73); }
uniform sampler2D sampler0;
varying vec4 v_texcoord0;
varying vec4 v_texcoord1;
varying vec4 v_texcoord2;
varying vec4 v_texcoord3;
varying vec4 v_texcoord4;
varying vec4 v_texcoord5;
varying vec4 v_texcoord6;
void main()
{
vec3 c10 = texture2D(sampler0, v_texcoord1.xy).xyz;
vec3 c01 = texture2D(sampler0, v_texcoord4.xy).xyz;
vec3 c11 = texture2D(sampler0, v_texcoord0.xy).xyz;
vec3 c21 = texture2D(sampler0, v_texcoord5.xy).xyz;
vec3 c12 = texture2D(sampler0, v_texcoord2.xy).xyz;
vec3 dt = vec3(1.0,1.0,1.0);
float k1=dot(abs(c01-c21),dt);
float k2=dot(abs(c10-c12),dt);
vec3 color = (k1*(c10+c12)+k2*(c01+c21)+0.001*c11)/(2.0*(k1+k2)+0.001);
float x = sqrt(dot(color,color));
color.r = pow(color.r+0.001,a);
color.g = pow(color.g+0.001,a);
color.b = pow(color.b+0.001,a);
gl_FragColor.rgb = contrast4(x)*normalize(color*c_ch)*b;
gl_FragColor.a = 1.0;
}

View File

@@ -0,0 +1,33 @@
// by guest(r) - guest.r@gmail.com
// license: GNU-GPL
attribute vec4 a_position;
attribute vec2 a_texcoord0;
uniform vec2 u_texelDelta;
varying vec4 v_texcoord0;
varying vec4 v_texcoord1;
varying vec4 v_texcoord2;
varying vec4 v_texcoord3;
varying vec4 v_texcoord4;
varying vec4 v_texcoord5;
varying vec4 v_texcoord6;
float scaleoffset = 0.8;
void main()
{
float x = u_texelDelta.x*scaleoffset;
float y = u_texelDelta.y*scaleoffset;
gl_Position = a_position;
v_texcoord0 = a_texcoord0.xyxy;
v_texcoord1 = v_texcoord0;
v_texcoord2 = v_texcoord0;
v_texcoord4 = v_texcoord0;
v_texcoord5 = v_texcoord0;
v_texcoord1.y-=y;
v_texcoord2.y+=y;
v_texcoord4.x-=x;
v_texcoord5.x+=x;
}

View File

@@ -0,0 +1,48 @@
// Simple Bloom shader; created to use in PPSSPP.
// Without excessive samples and complex nested loops
// (to make it compatible with low-end GPUs and to ensure ps_2_0 compatibility).
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D sampler0;
varying vec2 v_texcoord0;
float amount = 0.60; // suitable range = 0.00 - 1.00
float power = 0.5; // suitable range = 0.0 - 1.0
void main()
{
vec3 color = texture2D(sampler0, v_texcoord0.xy).xyz;
vec4 sum = vec4(0);
vec3 bloom;
for(int i= -3 ;i < 3; i++)
{
sum += texture2D(sampler0, v_texcoord0 + vec2(-1, i)*0.004) * amount;
sum += texture2D(sampler0, v_texcoord0 + vec2(0, i)*0.004) * amount;
sum += texture2D(sampler0, v_texcoord0 + vec2(1, i)*0.004) * amount;
}
if (color.r < 0.3 && color.g < 0.3 && color.b < 0.3)
{
bloom = sum.xyz*sum.xyz*0.012 + color;
}
else
{
if (color.r < 0.5 && color.g < 0.5 && color.b < 0.5)
{
bloom = sum.xyz*sum.xyz*0.009 + color;
}
else
{
bloom = sum.xyz*sum.xyz*0.0075 + color;
}
}
bloom = mix(color, bloom, power);
gl_FragColor.rgb = bloom;
gl_FragColor.a = 1.0;
}

View File

@@ -0,0 +1,52 @@
// Modified to use in PPSSPP. Grabbed from:
// http://forums.ngemu.com/showthread.php?t=76098
// Advanced Cartoon shader I
// by guest(r) (guest.r@gmail.com)
// license: GNU-GPL
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
const float bb = 0.5; // effects black border sensitivity; from 0.0 to 1.0
uniform sampler2D sampler0;
varying vec4 v_texcoord0;
varying vec4 v_texcoord1;
varying vec4 v_texcoord2;
varying vec4 v_texcoord3;
varying vec4 v_texcoord4;
varying vec4 v_texcoord5;
varying vec4 v_texcoord6;
void main()
{
vec3 c00 = texture2D(sampler0, v_texcoord5.xy).xyz;
vec3 c10 = texture2D(sampler0, v_texcoord1.xy).xyz;
vec3 c20 = texture2D(sampler0, v_texcoord2.zw).xyz;
vec3 c01 = texture2D(sampler0, v_texcoord3.xy).xyz;
vec3 c11 = texture2D(sampler0, v_texcoord0.xy).xyz;
vec3 c21 = texture2D(sampler0, v_texcoord4.xy).xyz;
vec3 c02 = texture2D(sampler0, v_texcoord1.zw).xyz;
vec3 c12 = texture2D(sampler0, v_texcoord2.xy).xyz;
vec3 c22 = texture2D(sampler0, v_texcoord6.xy).xyz;
vec3 dt = vec3(1.0,1.0,1.0);
float d1=dot(abs(c00-c22),dt);
float d2=dot(abs(c20-c02),dt);
float hl=dot(abs(c01-c21),dt);
float vl=dot(abs(c10-c12),dt);
float d = bb*(d1+d2+hl+vl)/(dot(c11,dt)+0.15);
float lc = 4.0*length(c11);
float f = fract(lc); f*=f;
lc = 0.25*(floor(lc) + f*f)+0.05;
c11 = 4.0*normalize(c11);
vec3 frct = fract(c11); frct*=frct;
c11 = floor(c11)+ 0.05*dt + frct*frct;
gl_FragColor.rgb = 0.25*lc*(1.1-d*sqrt(d))*c11;
gl_FragColor.a = 1.0;
}

View File

@@ -0,0 +1,34 @@
attribute vec4 a_position;
attribute vec2 a_texcoord0;
uniform vec2 u_texelDelta;
varying vec4 v_texcoord0;
varying vec4 v_texcoord1;
varying vec4 v_texcoord2;
varying vec4 v_texcoord3;
varying vec4 v_texcoord4;
varying vec4 v_texcoord5;
varying vec4 v_texcoord6;
float scaleoffset = 0.8; //edge detection offset
void main()
{
float x = u_texelDelta.x*scaleoffset;
float y = u_texelDelta.y*scaleoffset;
vec2 dg1 = vec2( x,y);
vec2 dg2 = vec2(-x,y);
vec2 dx = vec2(x,0.0);
vec2 dy = vec2(0.0,y);
gl_Position = a_position;
v_texcoord0=a_texcoord0.xyxy;
v_texcoord1.xy = v_texcoord0.xy - dy;
v_texcoord2.xy = v_texcoord0.xy + dy;
v_texcoord3.xy = v_texcoord0.xy - dx;
v_texcoord4.xy = v_texcoord0.xy + dx;
v_texcoord5.xy = v_texcoord0.xy - dg1;
v_texcoord6.xy = v_texcoord0.xy + dg1;
v_texcoord1.zw = v_texcoord0.xy - dg2;
v_texcoord2.zw = v_texcoord0.xy + dg2;
}

View File

@@ -0,0 +1,33 @@
// Retro (CRT) shader, created to use in PPSSPP.
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D sampler0;
varying vec2 v_texcoord0;
uniform vec4 u_time;
void main()
{
// scanlines
int vPos = int( ( v_texcoord0.y + u_time.x * 0.5 ) * 272.0 );
float line_intensity = mod( float(vPos), 2.0 );
// color shift
float off = line_intensity * 0.0005;
vec2 shift = vec2( off, 0 );
// shift R and G channels to simulate NTSC color bleed
vec2 colorShift = vec2( 0.001, 0 );
float r = texture2D( sampler0, v_texcoord0 + colorShift + shift ).x;
float g = texture2D( sampler0, v_texcoord0 - colorShift + shift ).y;
float b = texture2D( sampler0, v_texcoord0 ).z;
vec4 c = vec4( r, g * 0.99, b, 1.0 ) * clamp( line_intensity, 0.85, 1.0 );
float rollbar = sin( ( v_texcoord0.y + u_time.x ) * 4.0 );
gl_FragColor.rgba = c + (rollbar * 0.02);
}

View File

@@ -0,0 +1,95 @@
# You can have multiple ini files if you want, it doesn't matter.
[FXAA]
Name=FXAA Antialiasing
Author=nVidia
Fragment=fxaa.fsh
Vertex=fxaa.vsh
[CRT]
Name=CRT Scanlines
Author=KillaMaaki
Fragment=crt.fsh
Vertex=fxaa.vsh
60fps=True
[Natural]
Name=Natural Colors
Fragment=natural.fsh
Vertex=natural.vsh
[NaturalA]
Name=Natural Colors (No Blur)
Fragment=naturalA.fsh
Vertex=natural.vsh
[Vignette]
Name=Vignette
Author=Henrik
Fragment=vignette.fsh
Vertex=fxaa.vsh
[Grayscale]
Name=Grayscale
Author=Henrik
Fragment=grayscale.fsh
Vertex=fxaa.vsh
[Bloom]
Name=Bloom
Fragment=bloom.fsh
Vertex=fxaa.vsh
[Sharpen]
Name=Sharpen
Fragment=sharpen.fsh
Vertex=fxaa.vsh
[InverseColors]
Name=Inverse Colors
Author=Henrik
Fragment=inversecolors.fsh
Vertex=fxaa.vsh
[Scanlines]
Name=Scanlines (CRT)
Fragment=scanlines.fsh
Vertex=fxaa.vsh
OutputResolution=True
[Cartoon]
Name=Cartoon
Fragment=cartoon.fsh
Vertex=cartoon.vsh
[4xHqGLSL]
Name=4xHqGLSL Upscaler
Fragment=4xhqglsl.fsh
Vertex=4xhqglsl.vsh
OutputResolution=True
Upscaling=True
[AAColor]
Name=AA-Color
Fragment=aacolor.fsh
Vertex=aacolor.vsh
[UpscaleSpline36]
Name=Spline36 Upscaler
Fragment=upscale_spline36.fsh
Vertex=upscale_spline36.vsh
OutputResolution=True
RequiresIntSupport=True
Upscaling=True
[5xBR]
Name=5xBR Upscaler
Author=Hyllian
Fragment=5xBR.fsh
Vertex=5xBR.vsh
OutputResolution=True
Upscaling=True
[5xBR-lv2]
Name=5xBR lv2 Upscaler
Author=Hyllian (tweak by guest.r)
Fragment=5xBR-lv2.fsh
Vertex=5xBR.vsh
OutputResolution=True
Upscaling=True
[VideoSmoothingAA]
Name=Video aware guest.r AA 4.o
Author=guest.r(tweak by LunaMoo)
Fragment=videoAA.fsh
Vertex=fxaa.vsh
OutputResolution=True
[SSAA(Gauss)]
Name=Super Sampling AA(Gauss)
Fragment=GaussianDownscale.fsh
Vertex=fxaa.vsh
OutputResolution=True
SSAA=2

View File

@@ -0,0 +1,68 @@
// PPSSPP: Grabbed from Processing and slightly modified.
// FXAA shader, GLSL code adapted from:
// http://horde3d.org/wiki/index.php5?title=Shading_Technique_-_FXAA
// Whitepaper describing the technique:
// http://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D sampler0;
// The inverse of the texture dimensions along X and Y
uniform vec2 u_texelDelta;
varying vec2 v_texcoord0;
void main() {
// The parameters are hardcoded for now, but could be
// made into uniforms to control fromt he program.
float FXAA_SPAN_MAX = 8.0;
float FXAA_REDUCE_MUL = 1.0/8.0;
float FXAA_REDUCE_MIN = (1.0/128.0);
vec3 rgbNW = texture2D(sampler0, v_texcoord0.xy + (vec2(-1.0, -1.0) * u_texelDelta)).xyz;
vec3 rgbNE = texture2D(sampler0, v_texcoord0.xy + (vec2(+1.0, -1.0) * u_texelDelta)).xyz;
vec3 rgbSW = texture2D(sampler0, v_texcoord0.xy + (vec2(-1.0, +1.0) * u_texelDelta)).xyz;
vec3 rgbSE = texture2D(sampler0, v_texcoord0.xy + (vec2(+1.0, +1.0) * u_texelDelta)).xyz;
vec3 rgbM = texture2D(sampler0, v_texcoord0.xy).xyz;
vec3 luma = vec3(0.299, 0.587, 0.114);
float lumaNW = dot(rgbNW, luma);
float lumaNE = dot(rgbNE, luma);
float lumaSW = dot(rgbSW, luma);
float lumaSE = dot(rgbSE, luma);
float lumaM = dot( rgbM, luma);
float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
vec2 dir;
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);
float rcpDirMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce);
dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),
max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * u_texelDelta;
vec3 rgbA = (1.0/2.0) * (
texture2D(sampler0, v_texcoord0.xy + dir * (1.0/3.0 - 0.5)).xyz +
texture2D(sampler0, v_texcoord0.xy + dir * (2.0/3.0 - 0.5)).xyz);
vec3 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (
texture2D(sampler0, v_texcoord0.xy + dir * (0.0/3.0 - 0.5)).xyz +
texture2D(sampler0, v_texcoord0.xy + dir * (3.0/3.0 - 0.5)).xyz);
float lumaB = dot(rgbB, luma);
if((lumaB < lumaMin) || (lumaB > lumaMax)){
gl_FragColor.xyz=rgbA;
} else {
gl_FragColor.xyz=rgbB;
}
gl_FragColor.a = 1.0;
}

View File

@@ -0,0 +1,7 @@
attribute vec4 a_position;
attribute vec2 a_texcoord0;
varying vec2 v_texcoord0;
void main() {
v_texcoord0 = a_texcoord0;
gl_Position = a_position;
}

View File

@@ -0,0 +1,16 @@
// Simple grayscale shader
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D sampler0;
varying vec2 v_texcoord0;
void main() {
vec3 rgb = texture2D(sampler0, v_texcoord0.xy).xyz;
float luma = dot(rgb, vec3(0.299, 0.587, 0.114));
gl_FragColor.rgb = vec3(luma, luma, luma);
gl_FragColor.a = 1.0;
}

View File

@@ -0,0 +1,19 @@
// Simple false color shader
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D sampler0;
varying vec2 v_texcoord0;
void main() {
vec3 rgb = texture2D(sampler0, v_texcoord0.xy).xyz;
float luma = dot(rgb, vec3(0.299, 0.587, 0.114));
vec3 gray = vec3(luma, luma, luma) - 0.5;
rgb -= vec3(0.5, 0.5, 0.5);
gl_FragColor.rgb = mix(rgb, gray, 2.0) + 0.5;
gl_FragColor.a = 1.0;
}

View File

@@ -0,0 +1,58 @@
// Natural Vision Shader, modified to use in PPSSPP.
// by ShadX (Modded by SimoneT)
// http://forums.ngemu.com/showthread.php?t=76098
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D sampler0;
varying vec4 v_texcoord0;
varying vec4 v_texcoord1;
varying vec4 v_texcoord2;
varying vec4 v_texcoord3;
const mat3 RGBtoYIQ = mat3(0.299, 0.596, 0.212,
0.587,-0.275,-0.523,
0.114,-0.321, 0.311);
const mat3 YIQtoRGB = mat3(1.0, 1.0, 1.0,
0.95568806036115671171,-0.27158179694405859326,-1.1081773266826619523,
0.61985809445637075388,-0.64687381613840131330, 1.7050645599191817149);
const vec3 val00 = vec3( 1.2, 1.2, 1.2);
void main()
{
vec3 c0,c1;
c0 = texture2D(sampler0,v_texcoord0.xy).xyz;
c0+=(texture2D(sampler0,v_texcoord0.zy).xyz)*0.25;
c0+=(texture2D(sampler0,v_texcoord0.xw).xyz)*0.25;
c0+=(texture2D(sampler0,v_texcoord0.zw).xyz)*0.125;
c0+= texture2D(sampler0,v_texcoord1.xy).xyz;
c0+=(texture2D(sampler0,v_texcoord1.zy).xyz)*0.25;
c0+=(texture2D(sampler0,v_texcoord1.xw).xyz)*0.25;
c0+=(texture2D(sampler0,v_texcoord1.zw).xyz)*0.125;
c0+= texture2D(sampler0,v_texcoord2.xy).xyz;
c0+=(texture2D(sampler0,v_texcoord2.zy).xyz)*0.25;
c0+=(texture2D(sampler0,v_texcoord2.xw).xyz)*0.25;
c0+=(texture2D(sampler0,v_texcoord2.zw).xyz)*0.125;
c0+= texture2D(sampler0,v_texcoord3.xy).xyz;
c0+=(texture2D(sampler0,v_texcoord3.zy).xyz)*0.25;
c0+=(texture2D(sampler0,v_texcoord3.xw).xyz)*0.25;
c0+=(texture2D(sampler0,v_texcoord3.zw).xyz)*0.125;
c0*=0.153846153846;
c1=RGBtoYIQ*c0;
c1=vec3(pow(c1.x,val00.x),c1.yz*val00.yz);
gl_FragColor.rgb=YIQtoRGB*c1;
gl_FragColor.a = 1.0;
}

View File

@@ -0,0 +1,19 @@
uniform vec2 u_texelDelta;
attribute vec4 a_position;
attribute vec2 a_texcoord0;
varying vec4 v_texcoord0;
varying vec4 v_texcoord1;
varying vec4 v_texcoord2;
varying vec4 v_texcoord3;
void main()
{
gl_Position=a_position;
v_texcoord0=a_texcoord0.xyxy+vec4(-0.5,-0.5,-1.5,-1.5)*u_texelDelta.xyxy;
v_texcoord1=a_texcoord0.xyxy+vec4( 0.5,-0.5, 1.5,-1.5)*u_texelDelta.xyxy;
v_texcoord2=a_texcoord0.xyxy+vec4(-0.5, 0.5,-1.5, 1.5)*u_texelDelta.xyxy;
v_texcoord3=a_texcoord0.xyxy+vec4( 0.5, 0.5, 1.5, 1.5)*u_texelDelta.xyxy;
}

View File

@@ -0,0 +1,39 @@
// Natural Vision Shader with removed blur.
// by ShadX (Modded by SimoneT and Leopard20)
// http://forums.ngemu.com/showthread.php?t=76098
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D sampler0;
varying vec4 v_texcoord0;
varying vec4 v_texcoord1;
varying vec4 v_texcoord2;
varying vec4 v_texcoord3;
const mat3 RGBtoYIQ = mat3(0.299, 0.596, 0.212,
0.587,-0.275,-0.523,
0.114,-0.321, 0.311);
const mat3 YIQtoRGB = mat3(1.0, 1.0, 1.0,
0.95568806036115671171,-0.27158179694405859326,-1.1081773266826619523,
0.61985809445637075388,-0.64687381613840131330, 1.7050645599191817149);
const vec3 val00 = vec3( 1.2, 1.2, 1.2);
void main()
{
vec3 c0,c1;
c0 = texture2D(sampler0,v_texcoord0.xy).xyz;
c1=RGBtoYIQ*c0;
c1=vec3(pow(c1.x,val00.x),c1.yz*val00.yz);
gl_FragColor.rgb=YIQtoRGB*c1;
gl_FragColor.a = 1.0;
}

View File

@@ -0,0 +1,30 @@
// Advanced Scanlines (CRT) shader, created to use in PPSSPP.
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D sampler0;
varying vec2 v_texcoord0;
float amount = 1.0; // suitable range = 0.0 - 1.0
float intensity = 0.5; // suitable range = 0.0 - 1.0
void main()
{
float pos0 = ((v_texcoord0.y + 1.0) * 170.0*amount);
float pos1 = cos((fract( pos0 ) - 0.5)*3.1415926*intensity)*1.5;
vec4 rgb = texture2D( sampler0, v_texcoord0 );
// slight contrast curve
vec4 color = rgb*0.5+0.5*rgb*rgb*1.2;
// color tint
color *= vec4(0.9,1.0,0.7, 0.0);
// vignette
color *= 1.1 - 0.6 * (dot(v_texcoord0 - 0.5, v_texcoord0 - 0.5) * 2.0);
gl_FragColor.rgba = mix(vec4(0,0,0,0), color, pos1);
}

View File

@@ -0,0 +1,19 @@
// Simple sharpen shader; created to use in PPSSPP
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D sampler0;
varying vec2 v_texcoord0;
float amount = 1.5;
void main()
{
vec3 color = texture2D(sampler0, v_texcoord0.xy).xyz;
color -= texture2D(sampler0, v_texcoord0.xy+0.0001).xyz*7.0*amount;
color += texture2D(sampler0, v_texcoord0.xy-0.0001).xyz*7.0*amount;
gl_FragColor.rgb = color;
}

View File

@@ -0,0 +1,120 @@
// Spline36 upscaling shader.
// See issue #3921
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D sampler0;
varying vec2 v_position;
uniform vec2 u_texelDelta;
uniform vec2 u_pixelDelta;
const vec2 HALF_PIXEL = vec2(0.5, 0.5);
float spline36_0_1(float x) {
return ((13.0 / 11.0 * x - 453.0 / 209.0) * x - 3.0 / 209.0) * x + 1.0;
}
float spline36_1_2(float x) {
return ((-6.0 / 11.0 * x + 612.0 / 209.0) * x - 1038.0 / 209.0) * x + 540.0 / 209.0;
}
float spline36_2_3(float x) {
return ((1.0 / 11.0 * x - 159.0 / 209.0) * x + 434.0 / 209.0) * x - 384.0 / 209.0;
}
vec4 rgb(int inputX, int inputY) {
return texture2D(sampler0, (vec2(inputX, inputY) + HALF_PIXEL) * u_texelDelta);
}
vec4 interpolateHorizontally(vec2 inputPos, ivec2 inputPosFloor, int dy) {
float sumOfWeights = 0.0;
vec4 sumOfWeightedPixel = vec4(0.0);
float x;
float weight;
x = inputPos.x - float(inputPosFloor.x - 2);
weight = spline36_2_3(x);
sumOfWeights += weight;
sumOfWeightedPixel += weight * rgb(inputPosFloor.x - 2, inputPosFloor.y + dy);
--x;
weight = spline36_1_2(x);
sumOfWeights += weight;
sumOfWeightedPixel += weight * rgb(inputPosFloor.x - 1, inputPosFloor.y + dy);
--x;
weight = spline36_0_1(x);
sumOfWeights += weight;
sumOfWeightedPixel += weight * rgb(inputPosFloor.x + 0, inputPosFloor.y + dy);
x = 1.0 - x;
weight = spline36_0_1(x);
sumOfWeights += weight;
sumOfWeightedPixel += weight * rgb(inputPosFloor.x + 1, inputPosFloor.y + dy);
++x;
weight = spline36_1_2(x);
sumOfWeights += weight;
sumOfWeightedPixel += weight * rgb(inputPosFloor.x + 2, inputPosFloor.y + dy);
++x;
weight = spline36_2_3(x);
sumOfWeights += weight;
sumOfWeightedPixel += weight * rgb(inputPosFloor.x + 3, inputPosFloor.y + dy);
return sumOfWeightedPixel / sumOfWeights;
}
vec4 process(vec2 outputPos) {
vec2 inputPos = outputPos / u_texelDelta;
ivec2 inputPosFloor = ivec2(inputPos);
// Vertical interporation
float sumOfWeights = 0.0;
vec4 sumOfWeightedPixel = vec4(0.0);
float weight;
float y;
y = inputPos.y - float(inputPosFloor.y - 2);
weight = spline36_2_3(y);
sumOfWeights += weight;
sumOfWeightedPixel += weight * interpolateHorizontally(inputPos, inputPosFloor, -2);
--y;
weight = spline36_1_2(y);
sumOfWeights += weight;
sumOfWeightedPixel += weight * interpolateHorizontally(inputPos, inputPosFloor, -1);
--y;
weight = spline36_0_1(y);
sumOfWeights += weight;
sumOfWeightedPixel += weight * interpolateHorizontally(inputPos, inputPosFloor, +0);
y = 1.0 - y;
weight = spline36_0_1(y);
sumOfWeights += weight;
sumOfWeightedPixel += weight * interpolateHorizontally(inputPos, inputPosFloor, +1);
++y;
weight = spline36_1_2(y);
sumOfWeights += weight;
sumOfWeightedPixel += weight * interpolateHorizontally(inputPos, inputPosFloor, +2);
++y;
weight = spline36_2_3(y);
sumOfWeights += weight;
sumOfWeightedPixel += weight * interpolateHorizontally(inputPos, inputPosFloor, +3);
return vec4((sumOfWeightedPixel / sumOfWeights).xyz, 1.0);
}
void main()
{
gl_FragColor.rgba = process(v_position);
}

View File

@@ -0,0 +1,11 @@
attribute vec4 a_position;
attribute vec2 a_texcoord0;
varying vec2 v_position;
void main()
{
gl_Position = a_position;
v_position = a_texcoord0;
}

View File

@@ -0,0 +1,201 @@
/*
AA shader 4.o / AA shader 4.o - filtro
Copyright (C) 2014 guest(r) - guest.r@gmail.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Modified as video aware smoothing effect for PPSSPP.
// Some variable definitions had to be moved inside functions(and so repeated) due to glsl->hlsl auto translation failing.
// Also auto translation fails with bool uniform, which is why u_video is defined as float.
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D sampler0;
uniform float u_video;
//===========
varying vec2 v_texcoord0;
const vec3 dt = vec3(1.0,1.0,1.0);
vec3 texture2d (vec2 texcoord) {
float scale = 1.0;
if (u_video==1.0){
scale = 2.0;
} else {
scale = 7.0;
}
vec4 yx = vec4(1.0/480.0,1.0/272.0,-1.0/480.0,-1.0/272.0)/scale;
vec4 xy = vec4(2.0/480.0,2.0/272.0,-2.0/480.0,-2.0/272.0)/scale;
vec3 s00 = texture2D(sampler0, texcoord + yx.zw).xyz;
vec3 s20 = texture2D(sampler0, texcoord + yx.xw).xyz;
vec3 s22 = texture2D(sampler0, texcoord + yx.xy).xyz;
vec3 s02 = texture2D(sampler0, texcoord + yx.zy).xyz;
float m1=dot(abs(s00-s22),dt)+0.001;
float m2=dot(abs(s02-s20),dt)+0.001;
return 0.5*(m2*(s00+s22)+m1*(s02+s20))/(m1+m2);
}
vec3 texture2dd (vec2 texcoord) {
float scale = 1.0;
if (u_video==1.0){
scale = 2.0;
} else {
scale = 7.0;
}
vec4 yx = vec4(1.0/480.0,1.0/272.0,-1.0/480.0,-1.0/272.0)/scale;
vec4 xy = vec4(2.0/480.0,2.0/272.0,-2.0/480.0,-2.0/272.0)/scale;
vec3 c11 = texture2D(sampler0, texcoord ).xyz;
vec3 c00 = texture2D(sampler0, texcoord + xy.zw).xyz;
vec3 c20 = texture2D(sampler0, texcoord + xy.xw).xyz;
vec3 c22 = texture2D(sampler0, texcoord + xy.xy).xyz;
vec3 c02 = texture2D(sampler0, texcoord + xy.zy).xyz;
vec3 s00 = texture2D(sampler0, texcoord + yx.zw).xyz;
vec3 s20 = texture2D(sampler0, texcoord + yx.xw).xyz;
vec3 s22 = texture2D(sampler0, texcoord + yx.xy).xyz;
vec3 s02 = texture2D(sampler0, texcoord + yx.zy).xyz;
float d1=dot(abs(c00-c22),dt)+0.001;
float d2=dot(abs(c20-c02),dt)+0.001;
float m1=dot(abs(s00-s22),dt)+0.001;
float m2=dot(abs(s02-s20),dt)+0.001;
vec3 t2=(d1*(c20+c02)+d2*(c00+c22))/(2.0*(d1+d2));
return 0.25*(c11+t2+(m2*(s00+s22)+m1*(s02+s20))/(m1+m2));
}
void main() {
float scale = 7.0;
bool filtro = false;
if (u_video==1.0){
scale = 2.0;
filtro = true;
} else {
scale = 7.0;
filtro = false;
}
// Calculating texel coordinates
vec2 size = vec2(480.0,272.0)*scale;
vec2 inv_size = vec2(1.0/480.0,1.0/272.0)/scale;
vec2 OGL2Pos = v_texcoord0 * size;
vec2 fp = fract(OGL2Pos);
vec2 dx = vec2(inv_size.x,0.0);
vec2 dy = vec2(0.0, inv_size.y);
vec2 g1 = vec2(inv_size.x,inv_size.y);
vec2 g2 = vec2(-inv_size.x,inv_size.y);
vec2 pC4 = floor(OGL2Pos) * inv_size + 0.5*inv_size;
// Reading the texels
vec3 C0 = texture2d(pC4 - g1);
vec3 C1 = texture2d(pC4 - dy);
vec3 C2 = texture2d(pC4 - g2);
vec3 C3 = texture2d(pC4 - dx);
vec3 C4 = texture2d(pC4 );
vec3 C5 = texture2d(pC4 + dx);
vec3 C6 = texture2d(pC4 + g2);
vec3 C7 = texture2d(pC4 + dy);
vec3 C8 = texture2d(pC4 + g1);
vec3 ul, ur, dl, dr;
float m1, m2;
m1 = dot(abs(C0-C4),dt)+0.001;
m2 = dot(abs(C1-C3),dt)+0.001;
ul = (m2*(C0+C4)+m1*(C1+C3))/(m1+m2);
m1 = dot(abs(C1-C5),dt)+0.001;
m2 = dot(abs(C2-C4),dt)+0.001;
ur = (m2*(C1+C5)+m1*(C2+C4))/(m1+m2);
m1 = dot(abs(C3-C7),dt)+0.001;
m2 = dot(abs(C6-C4),dt)+0.001;
dl = (m2*(C3+C7)+m1*(C6+C4))/(m1+m2);
m1 = dot(abs(C4-C8),dt)+0.001;
m2 = dot(abs(C5-C7),dt)+0.001;
dr = (m2*(C4+C8)+m1*(C5+C7))/(m1+m2);
vec3 result = vec3(0.5*((dr*fp.x+dl*(1.0-fp.x))*fp.y+(ur*fp.x+ul*(1.0-fp.x))*(1.0-fp.y)));
if(filtro){
vec3 c11 = 0.5*((dr*fp.x+dl*(1.0-fp.x))*fp.y+(ur*fp.x+ul*(1.0-fp.x))*(1.0-fp.y));
inv_size = vec2(2.0/480.0,2.0/272.0)/scale;;
dx = vec2(inv_size.x,0.0);
dy = vec2(0.0,inv_size.y);
g1 = vec2( inv_size.x,inv_size.y);
g2 = vec2(-inv_size.x,inv_size.y);
pC4 = v_texcoord0;
C0 = texture2dd(pC4-g1);
C1 = texture2dd(pC4-dy);
C2 = texture2dd(pC4-g2);
C3 = texture2dd(pC4-dx);
C4 = texture2dd(pC4 );
C5 = texture2dd(pC4+dx);
C6 = texture2dd(pC4+g2);
C7 = texture2dd(pC4+dy);
C8 = texture2dd(pC4+g1);
vec3 mn1 = min(min(C0,C1),C2);
vec3 mn2 = min(min(C3,C4),C5);
vec3 mn3 = min(min(C6,C7),C8);
vec3 mx1 = max(max(C0,C1),C2);
vec3 mx2 = max(max(C3,C4),C5);
vec3 mx3 = max(max(C6,C7),C8);
mn1 = min(min(mn1,mn2),mn3);
mx1 = max(max(mx1,mx2),mx3);
vec3 dif1 = abs(c11-mn1) + 0.0001*dt;
vec3 dif2 = abs(c11-mx1) + 0.0001*dt;
float filterparam = 2.0;
dif1=vec3(pow(dif1.x,filterparam),pow(dif1.y,filterparam),pow(dif1.z,filterparam));
dif2=vec3(pow(dif2.x,filterparam),pow(dif2.y,filterparam),pow(dif2.z,filterparam));
c11.r = (dif1.x*mx1.x + dif2.x*mn1.x)/(dif1.x + dif2.x);
c11.g = (dif1.y*mx1.y + dif2.y*mn1.y)/(dif1.y + dif2.y);
c11.b = (dif1.z*mx1.z + dif2.z*mn1.z)/(dif1.z + dif2.z);
result = c11;
}
gl_FragColor.xyz=result.xyz;
gl_FragColor.a = 1.0;
}

View File

@@ -0,0 +1,16 @@
// Simple vignette shader - darker towards the corners like in the unprocessed output of a real camera.
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D sampler0;
varying vec2 v_texcoord0;
void main() {
float vignette = 1.1 - 0.6 * (dot(v_texcoord0 - 0.5, v_texcoord0 - 0.5) * 2.0);
vec3 rgb = texture2D(sampler0, v_texcoord0.xy).xyz;
gl_FragColor.rgb = vignette * rgb;
gl_FragColor.a = 1.0;
}