Skip to content

Commit

Permalink
Changes shaders structure to match the (probably) future retropie ver…
Browse files Browse the repository at this point in the history
…sions
  • Loading branch information
cosmo0 committed Feb 6, 2018
1 parent c590356 commit ce35f91
Show file tree
Hide file tree
Showing 21 changed files with 344 additions and 429 deletions.
2 changes: 1 addition & 1 deletion overlays_shaders/all/retroarch/overlay_cfg/n64.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# N64

# overwrite shader to a non-curved one
video_shader = "/opt/retropie/configs/all/retroarch/shaders/zfast_crt_720p_PI3.glslp"
video_shader = "/opt/retropie/configs/all/retroarch/shaders/zfast_crt_standard.glslp"

#include "/opt/retropie/configs/all/retroarch/overlay_cfg/common_crt.cfg"

Expand Down
2 changes: 1 addition & 1 deletion overlays_shaders/all/retroarch/overlay_cfg/psx.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# PSX

# overwrite shader to non-curved one
video_shader = "/opt/retropie/configs/all/retroarch/shaders/zfast_crt_720p_PI3.glslp"
video_shader = "/opt/retropie/configs/all/retroarch/shaders/zfast_crt_standard.glslp"

#include "/opt/retropie/configs/all/retroarch/overlay_cfg/common_crt.cfg"

Expand Down
3 changes: 3 additions & 0 deletions overlays_shaders/all/retroarch/shaders/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ZFast shaders by G. Hogan

https://retropie.org.uk/forum/topic/13356/
Binary file not shown.
Binary file not shown.
120 changes: 0 additions & 120 deletions overlays_shaders/all/retroarch/shaders/shaders/sharp_quilez_gamma.glsl

This file was deleted.

45 changes: 27 additions & 18 deletions overlays_shaders/all/retroarch/shaders/shaders/zfast_crt_curve.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ Notes: This shader does sharp scaling on the x and y axes based on the
//This can't be an option without slowing the shader down
//Comment this out for a coarser 3 pixel mask...which is currently broken
//on SNES Classic Edition due to Mali 400 gpu precision
#define FINEMASK
//Some drivers don't return black with texture coordinates out of bounds
//SNES Classic is too slow to black these areas out when using fullscreen
//overlays. But you can uncomment the below to black them out if necessary
#define BLACK_OUT_BORDER
//#define FINEMASK
//#define VERTICAL

// Compatibility #ifdefs needed for parameters
#ifdef GL_ES
Expand All @@ -41,11 +38,10 @@ Notes: This shader does sharp scaling on the x and y axes based on the
#endif

// Parameter lines go here:
#pragma parameter CURVE "Curvature" 0.025 0.0 0.05 0.002
#pragma parameter CORNER "Corner" 0.6 0.0 5.0 0.2
#pragma parameter LOWLUMSCAN "Scanline Darkness" 3.0 0.0 10.0 0.5
#pragma parameter BRIGHTBOOST "Brightness Boost" 1.0 0.5 1.5 0.05
#pragma parameter MASK_DARK "Mask Effect Amount" 0.1 0.0 1.0 0.05
#pragma parameter CURVE "Curvature" 0.016 0.0 0.3 0.002
#pragma parameter CORNER "Corner" 0.3 0.0 20.0 0.1
#pragma parameter LOWLUMSCAN "Scanline Darkness" 2.0 0.0 6.0 0.1
#pragma parameter MASK_DARK "Mask Effect Amount" 0.05 0.0 1.0 0.01

#ifdef PARAMETER_UNIFORM
// All parameter floats need to have COMPAT_PRECISION in front of them
Expand Down Expand Up @@ -170,9 +166,12 @@ COMPAT_VARYING vec2 iscreenScale;
vec2 warp(vec2 pos){
pos = -1.0 + 2.0*pos;
vec2 p = pos*pos;
pos*=vec2(1.0+1.33*CURVE*p.y ,1.0+CURVE*p.x);
//return clamp(pos*0.5+0.5 , 0.0 , 1.0);
return clamp(pos*0.5+0.5,0.0,1.0);
#if defined(VERTICAL)
pos*=vec2(1.0 + CURVE*p.y ,1.0 + 1.3333*CURVE*p.x);
#else
pos*=vec2(1.0 + 1.3333*CURVE*p.y ,1.0 + CURVE*p.x);
#endif
return clamp(pos*0.5+0.5, 0.0, 1.0);
}

void main()
Expand All @@ -197,12 +196,21 @@ void main()
colour = texture(Source, p).rgb; //fix tc to p

//compute the aperture mask

#if defined(FINEMASK)
COMPAT_PRECISION float whichmask = fract( gl_FragCoord.x*0.5);
COMPAT_PRECISION float mask = BRIGHTBOOST + float(whichmask < 0.5) * -MASK_DARK;
#if defined(VERTICAL)
COMPAT_PRECISION float whichmask = fract( gl_FragCoord.y*-0.4999);
#else
COMPAT_PRECISION float whichmask = fract( gl_FragCoord.x*-0.4999);
#endif
COMPAT_PRECISION float mask = 1.0 + float(whichmask < 0.5) * -MASK_DARK;
#else
#if defined(VERTICAL)
COMPAT_PRECISION float whichmask = fract(gl_FragCoord.y * -0.3333);
#else
COMPAT_PRECISION float whichmask = fract(gl_FragCoord.x * -0.3333);
COMPAT_PRECISION float mask = BRIGHTBOOST + float(whichmask <= 0.33333) * -MASK_DARK;
#endif
COMPAT_PRECISION float mask = 1.0 + float(whichmask <= 0.33333) * -MASK_DARK;
#endif

//Compute the scanlines. It was actually slower to use a texture LUT for
Expand All @@ -211,7 +219,8 @@ void main()
f -= 0.5;
COMPAT_PRECISION float Y = f.y*f.y;
COMPAT_PRECISION float YY = Y*Y;
FragColor.rgb = colour.rgb*(mask - LOWLUMSCAN*(Y - 2.05*YY));

//FragColor.rgb = colour.rgb*(mask - LOWLUMSCAN*(Y - 2.05*YY)); //Original
FragColor.rgb = colour.rgb*(mask - LOWLUMSCAN*(Y - 5.5*YY*Y));

}
#endif
Loading

0 comments on commit ce35f91

Please sign in to comment.