mirror of
https://github.com/libretro/slang-shaders.git
synced 2024-11-27 10:30:24 +00:00
Pick some hotfixes till 4717d92
This commit is contained in:
parent
7db474790c
commit
e0fb63dd6e
@ -202,7 +202,7 @@ IN_GLOW_SPREAD = "1.500000"
|
||||
IN_GLOW_W = "2.000000"
|
||||
IN_GLOW_H = "7.000000"
|
||||
DO_PIXELGRID = "1.000000"
|
||||
PIXELGRID_MIN_W = "0.300000"
|
||||
PIXELGRID_MIN_W = "0.400000"
|
||||
PIXELGRID_MAX_W = "1.000000"
|
||||
PIXELGRID_GAMMA_W = "5.200000"
|
||||
PIXELGRID_MUL_X = "1.375000"
|
||||
|
@ -201,7 +201,7 @@ PIXELGRID_H_COUNT = "4.000000"
|
||||
PIXELGRID_R_SHIFT = "1.000000"
|
||||
PIXELGRID_G_SHIFT = "2.000000"
|
||||
PIXELGRID_B_SHIFT = "3.000000"
|
||||
PIXELGRID_MIN_W = "0.150000"
|
||||
PIXELGRID_MIN_W = "0.250000"
|
||||
PIXELGRID_MAX_W = "0.800000"
|
||||
DO_PIXELGRID_H = "0.000000"
|
||||
PIXELGRID_Y_MASK = "1.000000"
|
||||
|
@ -21,7 +21,7 @@ layout(location = 3) out float vLed_step;
|
||||
layout(location = 4) out float lod;
|
||||
layout(location = 5) out vec2 pre_pass_coords;
|
||||
layout(location = 6) out float vIs_rotated;
|
||||
|
||||
layout(location = 7) out float vAMBI_STRETCH;
|
||||
layout(location = 8) out float vAMBI_POWER;
|
||||
layout(location = 9) out float vSmpBorder_min;
|
||||
layout(location = 10) out float vSmpBorder_max;
|
||||
@ -36,10 +36,16 @@ void main() {
|
||||
vSmpBorder_max = 1.0-smp_internalness;
|
||||
|
||||
|
||||
bool isrotated = is_rotated();
|
||||
vIs_rotated = float(isrotated);
|
||||
|
||||
if (isrotated)
|
||||
vAMBI_STRETCH = AMBI_STRETCH_VERTICAL;
|
||||
else
|
||||
vAMBI_STRETCH = AMBI_STRETCH;
|
||||
|
||||
//Move virtual leds position inside to compensate for widen effect
|
||||
float led_internalness = AMBI_INT_OFFSET + (AMBI_STRETCH *0.025);
|
||||
float led_internalness = AMBI_INT_OFFSET + (vAMBI_STRETCH *0.025);
|
||||
|
||||
|
||||
//less internalness when using bezel:
|
||||
@ -61,9 +67,7 @@ void main() {
|
||||
//Scale to the original aspect
|
||||
float in_aspect = get_in_aspect();
|
||||
|
||||
bool isrotated = is_rotated();
|
||||
vIs_rotated = float(isrotated);
|
||||
|
||||
|
||||
if ( need_NO_integer_scale() )
|
||||
pre_pass_coords = get_scaled_coords_aspect(TexCoord,global.FinalViewportSize, in_aspect, isrotated) + vec2(0.00001);
|
||||
else
|
||||
@ -94,7 +98,7 @@ layout(location = 3) in float vLed_step;
|
||||
layout(location = 4) in float lod;
|
||||
layout(location = 5) in vec2 pre_pass_coords;
|
||||
layout(location = 6) in float vIs_rotated;
|
||||
|
||||
layout(location = 7) in float vAMBI_STRETCH;
|
||||
layout(location = 8) in float vAMBI_POWER;
|
||||
layout(location = 9) in float vSmpBorder_min;
|
||||
layout(location = 10) in float vSmpBorder_max;
|
||||
@ -141,8 +145,8 @@ vec3 ambi_pre_pass(vec2 coords) {
|
||||
//Stretch the lights?
|
||||
float z1=distance(vec2(0.5,0.5), coords);
|
||||
vec2 zoomed_coords = zoomxy(coords, vec2(1+z1));
|
||||
coords = mix(coords, zoomed_coords, AMBI_STRETCH*0.5);
|
||||
float lAMBI_FALLOFF = AMBI_FALLOFF + (z1 * AMBI_STRETCH*0.5);
|
||||
coords = mix(coords, zoomed_coords, vAMBI_STRETCH*0.5);
|
||||
float lAMBI_FALLOFF = AMBI_FALLOFF + (z1 * vAMBI_STRETCH*0.5);
|
||||
|
||||
//Finally, emulate leds.
|
||||
vec3 pixel_out = vec3(0.0);
|
||||
@ -196,7 +200,7 @@ vec3 ambi_pre_pass(vec2 coords) {
|
||||
smp_point.x += vSmp_step;
|
||||
}
|
||||
//pixel_out = pow(pixel_out, 1/vec3(AMBI_GAMMA));
|
||||
return pow(pixel_out, 1/vec3(1+AMBI_STRETCH));
|
||||
return pow(pixel_out, 1/vec3(1+vAMBI_STRETCH));
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,11 +13,23 @@ layout(location = 0) out vec2 vTexCoord;
|
||||
layout(location = 1) out vec2 vFuzzy_main_pass_stage_1;
|
||||
layout(location = 2) out vec3 vTemperature_rgb;
|
||||
layout(location = 3) out vec3 vTemperature_rgb_gamma_in;
|
||||
layout(location = 4) out float vIn_aspect;
|
||||
layout(location = 5) out vec2 vCo_avglum;
|
||||
|
||||
void main() {
|
||||
gl_Position = global.MVP * Position;
|
||||
vTexCoord = TexCoord;
|
||||
|
||||
vIn_aspect = get_in_aspect();
|
||||
|
||||
//Since avglum pass moves itself to follow content_geom_override() because it is needed by
|
||||
//specularity code in final pass, we have to revert that here, or strength on white zones
|
||||
//will break when using content geometry override.
|
||||
vCo_avglum = vTexCoord;
|
||||
if (DO_GAME_GEOM_OVERRIDE == 1.0)
|
||||
vCo_avglum = content_geom_override(vTexCoord, 1/GAME_GEOM_ASPECT, vIn_aspect, -GAME_GEOM_VSHIFT, -GAME_GEOM_HSHIFT, 1/GAME_GEOM_ZOOM);
|
||||
|
||||
|
||||
//Get fuzzy mul and pow factor
|
||||
vFuzzy_main_pass_stage_1 = apply_fuzzy_main_pass_stage_1();
|
||||
|
||||
@ -50,6 +62,8 @@ layout(location = 0) in vec2 vTexCoord;
|
||||
layout(location = 1) in vec2 vFuzzy_main_pass_stage_1;
|
||||
layout(location = 2) in vec3 vTemperature_rgb;
|
||||
layout(location = 3) in vec3 vTemperature_rgb_gamma_in;
|
||||
layout(location = 4) in float vIn_aspect;
|
||||
layout(location = 5) in vec2 vCo_avglum;
|
||||
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
|
||||
@ -131,8 +145,11 @@ void main() {
|
||||
|
||||
|
||||
if (BLOOM_OVER_WHITE < 1.0) {
|
||||
|
||||
|
||||
//Apply other content coords modifiers
|
||||
//Use mipmap available in avglum_pass to identify bright areas.
|
||||
vec3 avglum = texture(avglum_pass,vTexCoord).rgb;
|
||||
vec3 avglum = texture(avglum_pass,vCo_avglum).rgb;
|
||||
float b_brightness = max(avglum.b,max(avglum.r,avglum.g));
|
||||
b_brightness *= 1-BLOOM_OVER_WHITE;
|
||||
over_white_correction =1- b_brightness;
|
||||
|
@ -19,8 +19,8 @@
|
||||
|
||||
//#define DEBUG
|
||||
//#define DEBUG_COLOR_CALIB
|
||||
#define DEBUG_TIME_FADE
|
||||
//#define DEBUG_SOLID_COLOR
|
||||
//#define DEBUG_TIME_FADE
|
||||
#define DEBUG_SOLID_COLOR
|
||||
//#define DEBUG_STEP_GRADIENT
|
||||
//#define DEBUG_STEP_GRADIENT_V
|
||||
//#define DEBUG_BLINK
|
||||
|
@ -138,7 +138,6 @@
|
||||
#define DO_CURVATURE global.DO_CURVATURE
|
||||
#define GEOM_WARP_X global.GEOM_WARP_X
|
||||
#define GEOM_WARP_Y global.GEOM_WARP_Y
|
||||
#define GEOM_CUT_EARS global.GEOM_CUT_EARS
|
||||
#define GEOM_CORNER_SIZE global.GEOM_CORNER_SIZE
|
||||
#define GEOM_CORNER_SMOOTH global.GEOM_CORNER_SMOOTH
|
||||
|
||||
@ -190,10 +189,11 @@
|
||||
|
||||
#define DO_AMBILIGHT global.DO_AMBILIGHT
|
||||
#define AMBI_STEPS global.AMBI_STEPS
|
||||
#define AMBI_FALLOFF global.AMBI_FALLOFF
|
||||
#define AMBI_FALLOFF global.AMBI_FALLOFF
|
||||
#define AMBI_POWER global.AMBI_POWER
|
||||
#define AMBI_GAMMA global.AMBI_GAMMA
|
||||
#define AMBI_STRETCH params.AMBI_STRETCH
|
||||
#define AMBI_STRETCH_VERTICAL params.AMBI_STRETCH_VERTICAL
|
||||
#define AMBI_OVER_BEZEL global.AMBI_OVER_BEZEL
|
||||
#define AMBI_OVER_BEZEL_SIZE global.AMBI_OVER_BEZEL_SIZE
|
||||
#define AMBI_BG_IMAGE_BLEND_MODE global.AMBI_BG_IMAGE_BLEND_MODE
|
||||
@ -298,8 +298,9 @@
|
||||
#define PIXELGRID_INTR_FLICK_POWR global.PIXELGRID_INTR_FLICK_POWR
|
||||
#define PIXELGRID_INTR_DISABLE_Y global.PIXELGRID_INTR_DISABLE_Y
|
||||
|
||||
|
||||
#define PIXELGRID_GAMMA_W global.PIXELGRID_GAMMA_W
|
||||
#define PIXELGRID_GAMMA_W global.PIXELGRID_GAMMA_W
|
||||
|
||||
//#define MOIRE_SWEET_SPOT global.MOIRE_SWEET_SPOT
|
||||
|
||||
#define DELTA_RENDER_FORCE_REFRESH global.DELTA_RENDER_FORCE_REFRESH
|
||||
#define DELTA_RENDER_CHECK_AREA global.DELTA_RENDER_CHECK_AREA
|
||||
|
@ -163,6 +163,7 @@ layout(push_constant) uniform Push {
|
||||
float BLOOM_QUALITY ; //1
|
||||
float AMBI_ADD_ON_BLACK;
|
||||
float AMBI_STRETCH;
|
||||
float AMBI_STRETCH_VERTICAL;
|
||||
float AMBI_INT_OFFSET ;
|
||||
|
||||
} params;
|
||||
@ -230,7 +231,6 @@ layout(std140, set = 0, binding = 0) uniform UBO {
|
||||
float DO_CURVATURE;
|
||||
float GEOM_WARP_X;
|
||||
float GEOM_WARP_Y;
|
||||
float GEOM_CUT_EARS;
|
||||
float GEOM_CORNER_SIZE;
|
||||
float GEOM_CORNER_SMOOTH;
|
||||
|
||||
@ -382,6 +382,8 @@ layout(std140, set = 0, binding = 0) uniform UBO {
|
||||
float PIXELGRID_GAMMA_H;
|
||||
float PIXELGRID_GAMMA_W;
|
||||
//float PIXELGRID_HMASK_NO_BRIGHT;
|
||||
//float MOIRE_SWEET_SPOT;
|
||||
|
||||
float PIXELGRID_BASAL_GRID;
|
||||
float DELTA_RENDER_FORCE_REFRESH;
|
||||
float DELTA_RENDER_CHECK_AREA;
|
||||
@ -484,7 +486,7 @@ layout(std140, set = 0, binding = 0) uniform UBO {
|
||||
#pragma parameter BLANK7 " " 0.0 0.0 1.0 1.0
|
||||
|
||||
|
||||
#pragma parameter TATE "★ Tate mode (0:disabled 1:auto 2:forced)" 0.0 0.0 2.0 1.0
|
||||
#pragma parameter TATE "★ Tate mode (0:disabled 1:auto 2:forced)" 1.0 0.0 2.0 1.0
|
||||
#pragma parameter BLANK7a " " 0.0 0.0 1.0 1.0
|
||||
|
||||
|
||||
@ -515,12 +517,13 @@ layout(std140, set = 0, binding = 0) uniform UBO {
|
||||
#pragma parameter PIXELGRID_MIN_H " . Phosphors height Min" 0.2 0.00 1.0 0.05
|
||||
#pragma parameter PIXELGRID_MAX_H " . Phosphors height Max" 0.6 0.0 1.5 0.05
|
||||
#pragma parameter PIXELGRID_GAMMA_H " . Phosphors height min->max gamma:" 4.2 1.0 8.00 0.1
|
||||
#pragma parameter PIXELGRID_OFFSET_CORE " . Slotmask(-fake) offset (low => anti-moiree)" 0.0 0.0 1.0 0.01
|
||||
#pragma parameter PIXELGRID_NO_INTERBLEED_H " . Inter line extra steepness" 0.0 0.0 10.0 0.1
|
||||
#pragma parameter PIXELGRID_H_DEDOT " . Dedot mask between scanlines (use only if needed!)" 0.0 0.0 1.0 0.1
|
||||
//#pragma parameter MOIRE_SWEET_SPOT " . Moire mitigation sweet spot" 0.0 0.0 1.0 0.01
|
||||
#pragma parameter PIXELGRID_OFFSET_CORE " . Slotmask(-fake) offset" 0.0 0.0 1.0 0.01
|
||||
#pragma parameter PIXELGRID_DECON_R_H " . Deconvergence Y: R phosphor" 0.0 -1.6 1.6 0.1
|
||||
#pragma parameter PIXELGRID_DECON_G_H " . Deconvergence Y: G phosphor" 0.0 -1.6 1.6 0.1
|
||||
#pragma parameter PIXELGRID_DECON_B_H " . Deconvergence Y: B phosphor" 0.0 -1.6 1.6 0.1
|
||||
#pragma parameter PIXELGRID_DECON_B_H " . Deconvergence Y: B phosphor" 0.0 -1.6 1.6 0.1
|
||||
#pragma parameter PIXELGRID_H_DEDOT " . Dedot mask between scanlines (use only if needed!)" 0.0 0.0 1.0 0.1
|
||||
|
||||
|
||||
#pragma parameter BLANK12f " " 0.0 0.0 1.0 1.0
|
||||
@ -595,7 +598,6 @@ layout(std140, set = 0, binding = 0) uniform UBO {
|
||||
#pragma parameter DO_CURVATURE "★ Curvature/Border enable? (cu) ==>" 0.0 0.0 1.0 1.0
|
||||
#pragma parameter GEOM_WARP_X " Warp X" 0.28 0.0 6.0 0.01
|
||||
#pragma parameter GEOM_WARP_Y " Warp Y" 0.32 0.0 6.0 0.01
|
||||
#pragma parameter GEOM_CUT_EARS " Cut curvature ears" 1.4 1.0 10.0 0.01
|
||||
#pragma parameter GEOM_CORNER_SIZE " Corner radius" 0.005 0.005 0.1 0.001
|
||||
#pragma parameter GEOM_CORNER_SMOOTH " Corner sharpness" 350.0 15.0 1000.0 1.0
|
||||
#pragma parameter BLANK14 " " 0.0 0.0 1.0 1.0
|
||||
@ -652,7 +654,8 @@ layout(std140, set = 0, binding = 0) uniform UBO {
|
||||
#pragma parameter AMBI_FALLOFF " Led power/falloff" 0.4 0.1 3.0 0.01
|
||||
#pragma parameter AMBI_POWER " Led Saturation" 1.8 0.0 100.0 0.05
|
||||
#pragma parameter AMBI_INT_OFFSET " Led internalness" 0.07 -1.0 1.0 0.01
|
||||
#pragma parameter AMBI_STRETCH " Widen lights" 0.0 0.0 1.0 0.01
|
||||
#pragma parameter AMBI_STRETCH " Widen lights (horizontal games)" 0.0 0.0 1.0 0.01
|
||||
#pragma parameter AMBI_STRETCH_VERTICAL " Widen lights (vertical games)" 0.5 0.0 1.0 0.01
|
||||
#pragma parameter AMBI_GAMMA " Output Gamma" 1.3 0.1 8.0 0.1
|
||||
#pragma parameter AMBI_OVER_BEZEL " Colorize Bezel" 0.2 0.0 5.0 0.05
|
||||
#pragma parameter AMBI_OVER_BEZEL_SIZE " . Colorization size" 0.15 0.0 0.5 0.001
|
||||
|
@ -561,7 +561,15 @@ vec4 fn_pixel_grid(vec2 in_coords, vec3 pixel_in, float min_inLum, float max_inL
|
||||
float triad_stagger_offset = is_even * pi * (PIXELGRID_OFFSET_CORE);
|
||||
//get 3 sines with applied the optional staggered offset for slotmask, and single phosphors staggering for y deconvergence.
|
||||
vec3 decon_stagger = vec3( PIXELGRID_DECON_R_H, PIXELGRID_DECON_G_H, PIXELGRID_DECON_B_H) ; //* (pixel_in/max_inLum) ;
|
||||
vec3 rgb_h_sin = sin( (freq_base_core.y * interlacing_adapt_period) + triad_stagger_offset - decon_stagger + vScanlineAlternateOffset );
|
||||
|
||||
#ifdef MOIRE_MITIGATION
|
||||
#define IS_EVEN float(sin(vPG_freq_base_screen_unfloored.x * vPG_offsets_and_size.a) > 0.5)
|
||||
float moire_mitigation_sweet_spot = IS_EVEN * MOIRE_SWEET_SPOT;
|
||||
vec3 rgb_h_sin = sin( (freq_base_core.y * interlacing_adapt_period) + triad_stagger_offset - decon_stagger + vScanlineAlternateOffset + moire_mitigation_sweet_spot );
|
||||
#else
|
||||
vec3 rgb_h_sin = sin( (freq_base_core.y * interlacing_adapt_period) + triad_stagger_offset - decon_stagger + vScanlineAlternateOffset);
|
||||
#endif
|
||||
|
||||
//make it positve with doubled frequency:
|
||||
rgb_h_sin = (rgb_h_sin * rgb_h_sin);
|
||||
|
||||
@ -707,20 +715,16 @@ vec4 fn_pixel_grid(vec2 in_coords, vec3 pixel_in, float min_inLum, float max_inL
|
||||
//mask posterization experiment:
|
||||
//mask = floor(mask*16.0)/16.0;
|
||||
//mask = pow(mask, vec3(0.5));
|
||||
|
||||
|
||||
|
||||
//Apply Overmask:
|
||||
mask = PIXELGRID_OVERMASK * (mask - 0.5) + 0.5;
|
||||
pixel_in = mix(pixel_in, pixel_in * PIXELGRID_OVERMASK, PIXELGRID_OVERMASK);
|
||||
|
||||
|
||||
//Apply the mask to pixel_in and clamp the minimum to the unexcited grille.
|
||||
vec3 mask_and_grille = max(mask * pixel_in, rgb_grille * PIXELGRID_BASAL_GRID*0.0025);
|
||||
|
||||
vec3 mask_and_grille = max(mask * pixel_in, rgb_grille * PIXELGRID_BASAL_GRID*0.0025);
|
||||
|
||||
//return it with alpha channel containing the mask itself, so that halo can selectively light it.
|
||||
return vec4( mask_and_grille , dot(rgb_h, vec3(0.3333)));
|
||||
return vec4( mask_and_grille , dot(rgb_h, vec3(0.3333)));
|
||||
}
|
||||
|
||||
|
||||
@ -943,9 +947,15 @@ vec3 light_over_image(vec3 light, vec3 image, float black_illumination) {
|
||||
//Simulates illumination.
|
||||
//It works by adding the light on the image.
|
||||
//It will add less light on dark colors (
|
||||
vec3 light_on_black = black_illumination * light;
|
||||
return image.rgb + ( (light - light_on_black ) * image.rgb ) + light_on_black;
|
||||
|
||||
//mitigate clipping by lowering light on bright images:
|
||||
light = light * (1- (max(image.r,image.g),image.b) ) ;
|
||||
|
||||
|
||||
vec3 light_on_black = black_illumination * light;
|
||||
vec3 modulated_on_black = image.rgb + ( (light - 0.0 ) * image.rgb ) + light_on_black;
|
||||
|
||||
return modulated_on_black;
|
||||
}
|
||||
|
||||
vec3 ambi_blend_image(vec4 image, vec3 ambi, float blend_mode) {
|
||||
@ -1207,7 +1217,6 @@ void main() {
|
||||
//Dynamic lum dependant full screen zoom?
|
||||
if (DO_DYNZOOM == 1.0)
|
||||
co_content = zoom(co_content, get_dyn_zoom(avglum_pass) );
|
||||
|
||||
|
||||
//Create an alpha mask to write content into, it holds opacity info that will be used to compose:
|
||||
if (DO_CURVATURE == 1.0) {
|
||||
@ -1243,7 +1252,8 @@ void main() {
|
||||
//Ambient light
|
||||
if (DO_AMBILIGHT == 1.0) {
|
||||
pixel_ambi = texture(ambi_temporal_pass, vOutputCoord).rgb;
|
||||
pixel_ambi += random_fast( (NOISEPOWER * NOISEPOWER_AMBI_MUL) * ((1-pixel_ambi.g) * (pixel_ambi.g*1 - pixel_ambi.r*0.125 -pixel_ambi.b*0.125 ) ) ,
|
||||
if (DO_BG_IMAGE != 1.0)
|
||||
pixel_ambi += random_fast( (NOISEPOWER * NOISEPOWER_AMBI_MUL) * ((1-pixel_ambi.g) * (pixel_ambi.g*1 - pixel_ambi.r*0.125 -pixel_ambi.b*0.125 ) ) ,
|
||||
vTexCoord * vDynamicSeed ) ;
|
||||
|
||||
float ambi_noise_power = (NOISEPOWER * NOISEPOWER_AMBI_MUL * (1-pixel_ambi.g) ) * //only middle green channel
|
||||
|
@ -1,3 +1,3 @@
|
||||
I'm using jpg as a bg image to keep size low.
|
||||
RA on android has an issue with jpg loading, but fortunately i found a workaround:
|
||||
RA on android has an issue with jpg loading, but fortunately i found a workaround (pushing black levels):
|
||||
https://github.com/libretro/RetroArch/issues/15337
|
||||
|
Loading…
Reference in New Issue
Block a user