mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-22 15:51:30 +11:00
add parameters and push constants to ntsc-gauss-pass
This commit is contained in:
parent
18bcb94089
commit
806e5fe46c
|
@ -1,16 +1,22 @@
|
||||||
#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 NTSC_CRT_GAMMA;
|
||||||
|
float NTSC_DISPLAY_GAMMA;
|
||||||
|
} registers;
|
||||||
|
|
||||||
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
|
{
|
||||||
|
mat4 MVP;
|
||||||
} global;
|
} global;
|
||||||
|
|
||||||
#define NTSC_CRT_GAMMA 2.5
|
#pragma parameter NTSC_CRT_GAMMA "NTSC CRT Gamma" 2.5 0.0 10.0 0.1
|
||||||
#define NTSC_DISPLAY_GAMMA 2.1
|
#pragma parameter NTSC_DISPLAY_GAMMA "NTSC Display Gamma" 2.1 0.0 10.0 0.1
|
||||||
|
|
||||||
#pragma stage vertex
|
#pragma stage vertex
|
||||||
layout(location = 0) in vec4 Position;
|
layout(location = 0) in vec4 Position;
|
||||||
|
@ -23,8 +29,8 @@ void main()
|
||||||
{
|
{
|
||||||
gl_Position = global.MVP * Position;
|
gl_Position = global.MVP * Position;
|
||||||
vTexCoord = TexCoord;
|
vTexCoord = TexCoord;
|
||||||
pix_no = TexCoord * global.SourceSize.xy;
|
pix_no = TexCoord * registers.SourceSize.xy;
|
||||||
one = 1.0 / global.SourceSize.xy;
|
one = 1.0 / registers.SourceSize.xy;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma stage fragment
|
#pragma stage fragment
|
||||||
|
@ -34,7 +40,7 @@ layout(location = 2) in vec2 pix_no;
|
||||||
layout(location = 0) out vec4 FragColor;
|
layout(location = 0) out vec4 FragColor;
|
||||||
layout(set = 0, binding = 2) uniform sampler2D Source;
|
layout(set = 0, binding = 2) uniform sampler2D Source;
|
||||||
|
|
||||||
#define TEX(off) pow(texture(Source, vTexCoord + vec2(0.0, (off) * one.y)).rgb, vec3(NTSC_CRT_GAMMA))
|
#define TEX(off) pow(texture(Source, vTexCoord + vec2(0.0, (off) * one.y)).rgb, vec3(registers.NTSC_CRT_GAMMA))
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
|
@ -58,5 +64,5 @@ void main()
|
||||||
scanline += frame3 * exp(-5.0 * dist3 * dist3);
|
scanline += frame3 * exp(-5.0 * dist3 * dist3);
|
||||||
scanline += frame4 * exp(-5.0 * dist4 * dist4);
|
scanline += frame4 * exp(-5.0 * dist4 * dist4);
|
||||||
|
|
||||||
FragColor = vec4(pow(1.15 * scanline, vec3(1.0 / NTSC_DISPLAY_GAMMA)), 1.0);
|
FragColor = vec4(pow(1.15 * scanline, vec3(1.0 / registers.NTSC_DISPLAY_GAMMA)), 1.0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue