fix interlacing shader; i think framecount might be b0rk3n

This commit is contained in:
hunterk 2016-07-19 16:18:36 -05:00
parent e060625eef
commit c1de320e4e
2 changed files with 14 additions and 6 deletions

View file

@ -11,7 +11,7 @@ layout(std140, set = 0, binding = 0) uniform UBO
#define percent 0.0 #define percent 0.0
#define enable_480i 1.0 #define enable_480i 1.0
#define top_field_first 0.0 #define top_field_first 1.0
/* /*
Interlacing Interlacing
@ -42,15 +42,17 @@ void main()
{ {
vec4 res = texture(Source, vTexCoord).rgba; vec4 res = texture(Source, vTexCoord).rgba;
float y = 0.0; float y = 0.0;
float tick = global.FrameCount;
// assume anything with a vertical resolution greater than 400 lines is interlaced // assume anything with a vertical resolution greater than 400 lines is interlaced
if (global.SourceSize.w > 400.0) if (global.SourceSize.y > 400.0)
{y = global.SourceSize.y * vTexCoord.y + (global.FrameCount * enable_480i) + top_field_first;} {y = global.SourceSize.y * (vTexCoord.y + 0.5 / global.SourceSize.y) + ((tick * 1.00) * enable_480i) + top_field_first;}
else else
{y = 2.0 * global.SourceSize.y * vTexCoord.y + top_field_first;} {y = 2.0 * global.SourceSize.y * vTexCoord.y + top_field_first;}
if (mod(y, 2.0) > 0.99999) if (mod(y, 1.99999) > 0.99999)
{FragColor = res;} {res = res;}
else else
{FragColor = vec4(percent) * res;} {res = vec4(percent) * res;}
FragColor = res;
} }

6
misc/interlacing.slangp Normal file
View file

@ -0,0 +1,6 @@
shaders = 1
shader0 = interlacing.slang
filter_linear0 = false
scale_type_0 = source
frame_count_mod0 = 4