From 4f801b764bc8c8eeb96adda4118c2d66a6123bce Mon Sep 17 00:00:00 2001 From: hunterk Date: Thu, 12 Jan 2023 15:26:21 -0600 Subject: [PATCH] Fix GTU-v50 to function like GLSL/Cg versions (#346) * fix gtu-v50 to function like Cg/GLSL versions * fix gtu-v50 to function like Cg/GLSL versions * quick cleanup of dead/commented code --- crt/gtu-v050.slangp | 2 +- crt/shaders/gtu-v050/pass2.slang | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/crt/gtu-v050.slangp b/crt/gtu-v050.slangp index 2ab90e3..d2560c0 100644 --- a/crt/gtu-v050.slangp +++ b/crt/gtu-v050.slangp @@ -10,7 +10,7 @@ scale_type_x1 = viewport scale_x1 = 1.0 scale_type_y1 = source scale_y1 = 1.0 -filter_linear1 = true +filter_linear1 = false float_framebuffer1 = true shader2 = shaders/gtu-v050/pass3.slang diff --git a/crt/shaders/gtu-v050/pass2.slang b/crt/shaders/gtu-v050/pass2.slang index fe1203c..0e4dcb8 100644 --- a/crt/shaders/gtu-v050/pass2.slang +++ b/crt/shaders/gtu-v050/pass2.slang @@ -11,6 +11,7 @@ layout(push_constant) uniform Push float compositeConnection; } params; +#pragma parameter compositeConnection "Composite Connection Enable" 0.0 0.0 1.0 1.0 #pragma parameter signalResolution "Signal Resolution Y" 256.0 16.0 1024.0 16.0 #pragma parameter signalResolutionI "Signal Resolution I" 83.0 1.0 350.0 2.0 #pragma parameter signalResolutionQ "Signal Resolution Q" 25.0 1.0 350.0 2.0 @@ -28,20 +29,19 @@ layout(std140, set = 0, binding = 0) uniform UBO #include "config.h" -#define YIQ_to_RGB mat3x3( 1.0 , 1.0 , 1.0 , 0.9563 , -0.2721 , -1.1070 , 0.6210 , -0.6474 , 1.7046 ) +#define YIQ_to_RGB mat3( 1.0 , 1.0 , 1.0 , 0.9563 , -0.2721 , -1.1070 , 0.6210 , -0.6474 , 1.7046 ) #define pi 3.14159265358 #define a(x) abs(x) #define d(x,b) (pi*b*min(a(x)+0.5,1.0/b)) #define e(x,b) (pi*b*min(max(a(x)-0.5,-1.0/b),1.0/b)) #define STU(x,b) ((d(x,b)+sin(d(x,b))-e(x,b)-sin(e(x,b)))/(2.0*pi)) -//#define X(i) (offset-(i)) #define GETC (texture(Source, vec2(vTexCoord.x - X * params.SourceSize.z, vTexCoord.y)).rgb) -#define VAL_composite vec3((c.x*STU(X,(params.signalResolution * params.SourceSize.z))),(c.y*STU(X,(params.signalResolutionI * params.SourceSize.z))),(c.z*STU(X,(params.signalResolutionQ * params.SourceSize.z)))) -#define VAL (c*STU(X,(params.signalResolution * params.SourceSize.z))) +#define VAL_composite vec3((c.x*STU(X,(params.signalResolution / params.SourceSize.x))),(c.y*STU(X,(params.signalResolutionI / params.SourceSize.x))),(c.z*STU(X,(params.signalResolutionQ / params.SourceSize.x)))) +#define VAL (c*STU(X,(params.signalResolution / params.SourceSize.x))) -#define PROCESS(i) X=(offset-(i));c=GETC;tempColor+=VAL; -#define PROCESS_composite(i) X=(offset-(i));c=GETC;tempColor+=VAL_composite; +#define PROCESS(i) X=(i);c=GETC;tempColor+=VAL; +#define PROCESS_composite(i) X=(i);c=GETC;tempColor+=VAL_composite; #pragma stage vertex layout(location = 0) in vec4 Position; @@ -87,6 +87,5 @@ void main() else tempColor=clamp(tempColor,0.0,1.0); - // tempColor=clamp(tempColor,0.0,1.0); FragColor = vec4(tempColor, 1.0); -} \ No newline at end of file +}