-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Reflections code rewriten; - New params;
- Loading branch information
Showing
11 changed files
with
497 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
box_scale = "2.980000" | ||
in_res_x = "326.000000" | ||
geom_center_y = "-0.002000" | ||
geom_curvature = "1.000000" | ||
geom_R = "2.000000" | ||
geom_cornersize = "0.011000" | ||
geom_cornersmooth = "280.000000" | ||
CN_VIG_TOGGLE = "1.000000" | ||
CN_VIG_EXP = "0.080000" | ||
reflection_strength = "0.250000" | ||
frame_w = "0.495000" | ||
frame_h = "0.651000" | ||
bezel_w = "0.036000" | ||
bezel_h = "0.032000" | ||
bezel_center_y = "0.004000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Yeah, it's redundant, but I won't create inner 'includes' over and over, because Retroarch | ||
// crawls to unroll these f***rs. | ||
|
||
#pragma parameter frame_nonono "FRAME:" 0.0 0.0 1.0 1.0 | ||
#pragma parameter box_scale " Image Scale" 4.0 1.0 10.0 0.02 | ||
#pragma parameter in_res_x " Viewport Size X" 320.0 100.0 600.0 1.0 | ||
#pragma parameter in_res_y " Viewport Size Y" 240.0 64.0 512.0 1.0 | ||
#pragma parameter geom_center_x " Center X" 0.0 -1.0 1.0 0.001 | ||
#pragma parameter geom_center_y " Center Y" 0.0 -1.0 1.0 0.002 | ||
#pragma parameter ub_rotate " Rotate (TATE)" 0.0 0.0 1.0 1.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#pragma parameter frame_nonono "FRAME:" 0.0 0.0 1.0 1.0 | ||
#pragma parameter box_scale " Image Scale" 4.0 1.0 10.0 0.02 | ||
#pragma parameter in_res_x " Viewport Size X" 320.0 100.0 600.0 1.0 | ||
#pragma parameter in_res_y " Viewport Size Y" 240.0 64.0 512.0 1.0 | ||
#pragma parameter geom_center_x " Center X" 0.0 -1.0 1.0 0.001 | ||
#pragma parameter geom_center_y " Center Y" 0.0 -1.0 1.0 0.002 | ||
#pragma parameter ub_rotate " Rotate (TATE)" 0.0 0.0 1.0 1.0 | ||
|
||
#pragma parameter geom_nonono "GEOM'S CURVATURE:" 0.0 0.0 1.0 1.0 | ||
#pragma parameter geom_curvature " Curvature Toggle" 0.0 0.0 1.0 1.0 | ||
#pragma parameter geom_R " Curvature Radius" 2.0 0.3 10.0 0.1 | ||
#pragma parameter geom_d " Distance" 1.5 0.1 3.0 0.1 | ||
#pragma parameter geom_invert_aspect " Curvature Aspect Inversion" 0.0 0.0 1.0 1.0 | ||
#pragma parameter geom_cornersize " Corner Size" 0.006 0.006 1.0 0.005 | ||
#pragma parameter geom_cornersmooth " Corner Smoothness" 400.0 80.0 2000.0 100.0 | ||
#pragma parameter geom_x_tilt " Horizontal Tilt" 0.0 -0.5 0.5 0.01 | ||
#pragma parameter geom_y_tilt " Vertical Tilt" 0.0 -0.5 0.5 0.01 | ||
#pragma parameter geom_inner_center_x " Inner Center X" 0.0 -1.0 1.0 0.001 | ||
#pragma parameter geom_inner_center_y " Inner Center Y" 0.0 -1.0 1.0 0.001 | ||
#pragma parameter geom_overscan_x " Horiz. Overscan %" 100.0 -125.0 125.0 0.5 | ||
#pragma parameter geom_overscan_y " Vert. Overscan %" 100.0 -125.0 125.0 0.5 |
125 changes: 125 additions & 0 deletions
125
shaders/support_shaders/g-sharp2_resampler/g-sharp2_resampler-horizontal.slang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
#version 450 | ||
|
||
/* | ||
G-sharp resampler 2.0 horizontal - dynamic range (upscaler, downsampler) | ||
|
||
Copyright (C) 2024 guest(r) | ||
|
||
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. | ||
|
||
*/ | ||
|
||
layout(push_constant) uniform Push | ||
{ | ||
vec4 SourceSize; | ||
vec4 OriginalSize; | ||
vec4 OutputSize; | ||
uint FrameCount; | ||
float GSHARP0; | ||
float GMAXSHARP; | ||
float GPAR; | ||
float GBOOST; | ||
} params; | ||
|
||
#pragma parameter gsharp_nonono "G-SHARP2 DOWNSAMPLE:" 0.0 0.0 1.0 1.0 | ||
|
||
#pragma parameter GSHARP0 " Filter Range" 1.0 0.75 8.0 0.05 | ||
#define GSHARP0 params.GSHARP0 | ||
|
||
#pragma parameter GBOOST " Filter Boost (same range, speedup)" 1.70 1.0 2.5 0.05 | ||
#define GBOOST params.GBOOST | ||
float GBOOST1 = 1.0/GBOOST; | ||
|
||
#pragma parameter GMAXSHARP " Filter Sharpness" 0.10 0.0 0.25 0.01 | ||
float GMAXSHARP = 0.5*GBOOST*GBOOST*params.GMAXSHARP; | ||
|
||
#pragma parameter GPAR " Anti-Ringing" 0.50 0.0 1.0 0.10 | ||
#define GPAR params.GPAR | ||
|
||
layout(std140, set = 0, binding = 0) uniform UBO | ||
{ | ||
mat4 MVP; | ||
} global; | ||
|
||
#pragma stage vertex | ||
layout(location = 0) in vec4 Position; | ||
layout(location = 1) in vec2 TexCoord; | ||
layout(location = 0) out vec2 vTexCoord; | ||
|
||
void main() | ||
{ | ||
gl_Position = global.MVP * Position; | ||
vTexCoord = TexCoord * 1.00001; | ||
} | ||
|
||
#pragma stage fragment | ||
layout(location = 0) in vec2 vTexCoord; | ||
layout(location = 0) out vec4 FragColor; | ||
layout(set = 0, binding = 2) uniform sampler2D Source; | ||
|
||
#define COMPAT_TEXTURE(c,d) texture(c,d) | ||
#define SourceSize params.SourceSize | ||
|
||
float smothstep(float x) | ||
{ | ||
return exp(-1.75*x*x); | ||
} | ||
|
||
float getw(float x) | ||
{ | ||
float z = x*GBOOST1; | ||
float y = smothstep(z); | ||
return max(y*y*y - GMAXSHARP, mix(-GMAXSHARP, 0.0, x-1.0)); | ||
} | ||
|
||
void main() | ||
{ | ||
vec2 pos = vTexCoord * SourceSize.xy-0.5; | ||
float f = -fract(pos.x); | ||
vec2 tex = floor(pos)*SourceSize.zw + 0.5*SourceSize.zw; | ||
vec3 color = 0.0.xxx; | ||
vec2 dx = vec2(SourceSize.z, 0.0); | ||
|
||
float w, fp; | ||
float wsum = 0.0; | ||
vec3 pixel; | ||
vec3 cmax = 0.0.xxx; | ||
vec3 cmin = 1.0.xxx; | ||
float FPRi = 1.0/GSHARP0; | ||
float FPR2 = 2.0*GSHARP0; | ||
float FPR3 = FPR2*FPR2; | ||
float LOOPSIZE = ceil(FPR2); | ||
float x = -LOOPSIZE+1.0; | ||
|
||
do | ||
{ | ||
fp = min(abs(x+f),FPR2); | ||
pixel = COMPAT_TEXTURE(Source, tex + x*dx).rgb; | ||
fp = fp*FPRi; | ||
w = getw(fp); | ||
if (w > 0.0) { cmin = min(cmin, pixel); cmax = max(cmax, pixel); } | ||
color = color + w * pixel; | ||
wsum = wsum + w; | ||
|
||
x = x + 1.0; | ||
|
||
} while (x <= LOOPSIZE); | ||
|
||
color = color / wsum; | ||
|
||
color = mix(clamp(color, 0.0, 1.0), clamp(color, cmin, cmax), GPAR); | ||
|
||
FragColor = vec4(color, 1.0); | ||
} |
124 changes: 124 additions & 0 deletions
124
shaders/support_shaders/g-sharp2_resampler/g-sharp2_resampler-vertical.slang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
#version 450 | ||
|
||
/* | ||
G-sharp resampler 2.0 vertical - dynamic range (upscaler, downsampler) | ||
|
||
Copyright (C) 2024 guest(r) | ||
|
||
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. | ||
|
||
*/ | ||
|
||
layout(push_constant) uniform Push | ||
{ | ||
vec4 SourceSize; | ||
vec4 OriginalSize; | ||
vec4 OutputSize; | ||
uint FrameCount; | ||
float GSHARP0; | ||
float GMAXSHARP; | ||
float GPAR; | ||
float GBOOST; | ||
} params; | ||
|
||
|
||
#pragma parameter GSHARP0 " Filter Range" 1.0 0.75 8.0 0.05 | ||
#define GSHARP0 params.GSHARP0 | ||
|
||
#pragma parameter GBOOST " Filter Boost (same range, speedup)" 1.70 1.0 2.5 0.05 | ||
#define GBOOST params.GBOOST | ||
float GBOOST1 = 1.0/GBOOST; | ||
|
||
#pragma parameter GMAXSHARP " Filter Sharpness" 0.10 0.0 0.25 0.01 | ||
float GMAXSHARP = 0.5*GBOOST*GBOOST*params.GMAXSHARP; | ||
|
||
#pragma parameter GPAR " Anti-Ringing" 0.50 0.0 1.0 0.10 | ||
#define GPAR params.GPAR | ||
|
||
layout(std140, set = 0, binding = 0) uniform UBO | ||
{ | ||
mat4 MVP; | ||
} global; | ||
|
||
#pragma stage vertex | ||
layout(location = 0) in vec4 Position; | ||
layout(location = 1) in vec2 TexCoord; | ||
layout(location = 0) out vec2 vTexCoord; | ||
|
||
void main() | ||
{ | ||
gl_Position = global.MVP * Position; | ||
vTexCoord = TexCoord * 1.00001; | ||
} | ||
|
||
#pragma stage fragment | ||
layout(location = 0) in vec2 vTexCoord; | ||
layout(location = 0) out vec4 FragColor; | ||
layout(set = 0, binding = 2) uniform sampler2D Source; | ||
|
||
#define COMPAT_TEXTURE(c,d) texture(c,d) | ||
#define SourceSize params.SourceSize | ||
|
||
float smothstep(float x) | ||
{ | ||
return exp(-1.75*x*x); | ||
} | ||
|
||
float getw(float x) | ||
{ | ||
float z = x*GBOOST1; | ||
float y = smothstep(z); | ||
return max(y*y*y - GMAXSHARP, mix(-GMAXSHARP, 0.0, x-1.0)); | ||
} | ||
|
||
void main() | ||
{ | ||
vec2 pos = vTexCoord * SourceSize.xy-0.5; | ||
float f = -fract(pos.y); | ||
vec2 tex = floor(pos)*SourceSize.zw + 0.5*SourceSize.zw; | ||
vec3 color = 0.0.xxx; | ||
vec2 dy = vec2(0.0, SourceSize.w); | ||
|
||
float w, fp; | ||
float wsum = 0.0; | ||
vec3 pixel; | ||
vec3 cmax = 0.0.xxx; | ||
vec3 cmin = 1.0.xxx; | ||
float FPRi = 1.0/GSHARP0; | ||
float FPR2 = 2.0*GSHARP0; | ||
float FPR3 = FPR2*FPR2; | ||
float LOOPSIZE = ceil(FPR2); | ||
float y = -LOOPSIZE+1.0; | ||
|
||
do | ||
{ | ||
fp = min(abs(y+f),FPR2); | ||
pixel = COMPAT_TEXTURE(Source, tex + y*dy).rgb; | ||
fp = fp*FPRi; | ||
w = getw(fp); | ||
if (w > 0.0) { cmin = min(cmin, pixel); cmax = max(cmax, pixel); } | ||
color = color + w * pixel; | ||
wsum = wsum + w; | ||
|
||
y = y + 1.0; | ||
|
||
} while (y <= LOOPSIZE); | ||
|
||
color = color / wsum; | ||
|
||
color = mix(clamp(color, 0.0, 1.0), clamp(color, cmin, cmax), GPAR); | ||
|
||
FragColor = vec4(color, 1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.