mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-23 00:01:31 +11:00
prevent rounding errors with deinterlacing shaders
This commit is contained in:
parent
e4f6e62bf1
commit
994fc49f12
|
@ -53,11 +53,11 @@ void main()
|
|||
}
|
||||
else
|
||||
{
|
||||
y = 2.0 * params.SourceSize.y * vTexCoord.y;
|
||||
y = 2.000001 * params.SourceSize.y * vTexCoord.y;
|
||||
prev = current;
|
||||
}
|
||||
|
||||
if (mod(y, 2.0) > 0.99999) current = current;
|
||||
else current = vec4(pow(texture(Source, vTexCoord), vec4(2.2)));
|
||||
FragColor = vec4(pow((current + prev) / vec4(2.0), vec4(1.0 / 2.2)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,9 +43,9 @@ void main()
|
|||
float y = 0.0;
|
||||
// assume anything with a vertical resolution greater than 400 lines is interlaced
|
||||
if (params.SourceSize.y > 400.0) y = params.SourceSize.y * vTexCoord.y + float(params.FrameCount);
|
||||
else y = 2.0 * params.SourceSize.y * vTexCoord.y;
|
||||
else y = 2.000001 * params.SourceSize.y * vTexCoord.y;
|
||||
|
||||
if (mod(y, 2.0) > 0.99999) FragColor = vec4(texture(Source, vTexCoord + vec2(0.0, params.SourceSize.w)));
|
||||
else
|
||||
FragColor = vec4(texture(Source, vTexCoord).rgb, 1.0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,11 +55,11 @@ void main()
|
|||
if (registers.SourceSize.y > 400.0)
|
||||
{y = registers.SourceSize.y * vTexCoord.y + (tick * registers.enable_480i) + registers.top_field_first;}
|
||||
else
|
||||
{y = 2.0 * registers.SourceSize.y * vTexCoord.y + registers.top_field_first;}
|
||||
{y = 2.000001 * registers.SourceSize.y * vTexCoord.y + registers.top_field_first;}
|
||||
|
||||
if (mod(y, 1.99999) > 0.99999)
|
||||
{res = res;}
|
||||
else
|
||||
{res = vec4(registers.percent) * res;}
|
||||
FragColor = res;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue