From a7f96ace8ee37e735b3c112e675fd3b979bb7375 Mon Sep 17 00:00:00 2001 From: hunterk Date: Tue, 26 Jul 2016 12:00:03 -0500 Subject: [PATCH] add alias to crtglow - needs to be done for other glow presets --- crt/crtglow_gauss_ntsc_3phase.slangp | 1 + crt/shaders/glow/resolve.slang | 16 ++++++---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/crt/crtglow_gauss_ntsc_3phase.slangp b/crt/crtglow_gauss_ntsc_3phase.slangp index f6bd78b..2078223 100644 --- a/crt/crtglow_gauss_ntsc_3phase.slangp +++ b/crt/crtglow_gauss_ntsc_3phase.slangp @@ -28,6 +28,7 @@ filter_linear3 = false scale_type3 = viewport scale3 = 1.0 srgb_framebuffer3 = true +alias3 = "CRTPass" shader4 = shaders/glow/threshold.slang filter_linear4 = false diff --git a/crt/shaders/glow/resolve.slang b/crt/shaders/glow/resolve.slang index 3ea74a9..6791dcd 100644 --- a/crt/shaders/glow/resolve.slang +++ b/crt/shaders/glow/resolve.slang @@ -6,8 +6,7 @@ layout(std140, set = 0, binding = 0) uniform UBO vec4 OutputSize; vec4 OriginalSize; vec4 SourceSize; - vec4 PassOutputSize4; - + vec4 CRTPassSize; } global; #pragma stage vertex @@ -25,7 +24,7 @@ void main() layout(location = 0) in vec2 vTexCoord; layout(location = 0) out vec4 FragColor; layout(set = 0, binding = 1) uniform sampler2D Source; -layout(set = 0, binding = 2) uniform sampler2D PassOutput4; +layout(set = 0, binding = 2) uniform sampler2D CRTPass; // For debugging #define BLOOM_ONLY 0 @@ -33,20 +32,17 @@ layout(set = 0, binding = 2) uniform sampler2D PassOutput4; #define BLOOM_STRENGTH 0.45 #define OUTPUT_GAMMA 2.2 -#define CRT_PASS PassOutput4 +#define CRT_PASS CRTPass void main() { - vec2 tex = floor(global.PassOutputSize4.xy * vTexCoord); - tex = (tex + 0.5) * global.PassOutputSize4.zw; - #if BLOOM_ONLY - vec3 source = BLOOM_STRENGTH * texture(Source, tex).rgb; + vec3 source = BLOOM_STRENGTH * texture(Source, vTexCoord).rgb; #else /* TODO/FIXME - In slang, how do I get the equivalent of PASSPREV4.tex_coord? */ - vec3 source = 1.15 * texture(CRT_PASS, tex).rgb; - vec3 bloom = texture(Source, tex).rgb; + vec3 source = 1.15 * texture(CRT_PASS, vTexCoord).rgb; + vec3 bloom = texture(Source, vTexCoord).rgb; source += BLOOM_STRENGTH * bloom; #endif FragColor = vec4(pow(clamp(source, 0.0, 1.0), vec3(1.0 / OUTPUT_GAMMA)), 1.0);