mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-23 00:01:31 +11:00
update interlacing with parameters and fixed framecounter
This commit is contained in:
parent
ae4d9317c9
commit
b8ca696948
|
@ -1,17 +1,24 @@
|
||||||
#version 450
|
#version 450
|
||||||
|
|
||||||
layout(std140, set = 0, binding = 0) uniform UBO
|
layout(push_constant) uniform Push
|
||||||
{
|
{
|
||||||
mat4 MVP;
|
|
||||||
vec4 OutputSize;
|
vec4 OutputSize;
|
||||||
vec4 OriginalSize;
|
vec4 OriginalSize;
|
||||||
vec4 SourceSize;
|
vec4 SourceSize;
|
||||||
uint FrameCount;
|
uint FrameCount;
|
||||||
|
float percent;
|
||||||
|
float enable_480i;
|
||||||
|
float top_field_first;
|
||||||
|
} registers;
|
||||||
|
|
||||||
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
|
{
|
||||||
|
mat4 MVP;
|
||||||
} global;
|
} global;
|
||||||
|
|
||||||
#define percent 0.0
|
#pragma parameter percent "Interlacing Scanline Bright %" 0.0 0.0 1.0 0.05
|
||||||
#define enable_480i 1.0
|
#pragma parameter enable_480i "Enable 480i Mode" 1.0 0.0 1.0 1.0
|
||||||
#define top_field_first 1.0
|
#pragma parameter top_field_first "Top Field First Enable" 0.0 0.0 1.0 1.0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Interlacing
|
Interlacing
|
||||||
|
@ -42,17 +49,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;
|
float tick = registers.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.y > 400.0)
|
if (registers.SourceSize.y > 400.0)
|
||||||
{y = global.SourceSize.y * (vTexCoord.y + 0.5 / global.SourceSize.y) + ((tick * 1.00) * enable_480i) + top_field_first;}
|
{y = registers.SourceSize.y * vTexCoord.y + (tick * registers.enable_480i) + registers.top_field_first;}
|
||||||
else
|
else
|
||||||
{y = 2.0 * global.SourceSize.y * vTexCoord.y + top_field_first;}
|
{y = 2.0 * registers.SourceSize.y * vTexCoord.y + registers.top_field_first;}
|
||||||
|
|
||||||
if (mod(y, 1.99999) > 0.99999)
|
if (mod(y, 1.99999) > 0.99999)
|
||||||
{res = res;}
|
{res = res;}
|
||||||
else
|
else
|
||||||
{res = vec4(percent) * res;}
|
{res = vec4(registers.percent) * res;}
|
||||||
FragColor = res;
|
FragColor = res;
|
||||||
}
|
}
|
|
@ -1,6 +0,0 @@
|
||||||
shaders = 1
|
|
||||||
|
|
||||||
shader0 = interlacing.slang
|
|
||||||
filter_linear0 = false
|
|
||||||
scale_type_0 = source
|
|
||||||
frame_count_mod0 = 4
|
|
Loading…
Reference in a new issue