mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-30 11:21:32 +11:00
43 lines
2.7 KiB
Plaintext
43 lines
2.7 KiB
Plaintext
#version 450
|
|
|
|
layout(push_constant) uniform Push
|
|
{
|
|
vec4 SourceSize;
|
|
vec4 OriginalSize;
|
|
vec4 OutputSize;
|
|
uint FrameCount;
|
|
} params;
|
|
|
|
layout(std140, set = 0, binding = 0) uniform UBO
|
|
{
|
|
mat4 MVP;
|
|
} global;
|
|
|
|
#pragma stage vertex
|
|
layout(location = 0) in vec4 Position;
|
|
layout(location = 1) in vec2 TexCoord;
|
|
layout(location = 0) out vec2 vTexCoord;
|
|
|
|
void main()
|
|
{
|
|
gl_Position = global.MVP * Position;
|
|
vTexCoord = TexCoord;
|
|
}
|
|
|
|
#pragma stage fragment
|
|
layout(location = 0) in vec2 vTexCoord;
|
|
layout(location = 0) out vec4 FragColor;
|
|
layout(set = 0, binding = 2) uniform sampler2D Source;
|
|
|
|
const float rndtable[256] = float[](
|
|
0.000, 0.031, 0.427, 0.863, 0.871, 0.945, 0.584, 0.420, 0.294, 0.973, 0.996, 0.549, 0.063, 0.259, 0.290, 0.082, 0.827, 0.184, 0.314, 0.949, 0.604, 0.106, 0.804, 0.502, 0.631, 0.349, 0.302, 0.141, 0.373, 0.431, 0.333, 0.188, 0.831, 0.549, 0.827, 0.976, 0.086, 0.310, 0.784, 0.196, 0.110, 0.737, 0.204, 0.549, 0.792, 0.471, 0.267, 0.569, 0.243, 0.275, 0.722, 0.745, 0.357, 0.773, 0.596, 0.878, 0.584, 0.408, 0.098, 0.698, 0.988, 0.714, 0.792, 0.714, 0.553, 0.773, 0.016, 0.318, 0.710, 0.949, 0.569, 0.165, 0.153, 0.890, 0.612, 0.776, 0.882, 0.757, 0.859, 0.365, 0.478, 0.686, 0.976, 0.000, 0.686, 0.561, 0.275, 0.937, 0.180, 0.965, 0.639, 0.208, 0.639, 0.427, 0.659, 0.529, 0.008, 0.922, 0.098, 0.361, 0.078, 0.569, 0.541, 0.302, 0.271, 0.651, 0.306, 0.690, 0.678, 0.831, 0.651, 0.443, 0.369, 0.631, 0.161, 0.196, 0.937, 0.192, 0.435, 0.643, 0.275, 0.235, 0.008, 0.145, 0.671, 0.294, 0.533, 0.612, 0.043, 0.220, 0.165, 0.573, 0.541, 0.898, 0.286, 0.573, 0.302, 0.239, 0.384, 0.769, 0.529, 0.416, 0.247, 0.773, 0.765, 0.337, 0.376, 0.796, 0.443, 0.396, 0.667, 0.969, 0.710, 0.443, 0.314, 0.980, 0.424, 0.027, 1.000, 0.929, 0.506, 0.886, 0.310, 0.420, 0.439, 0.651, 0.404, 0.945, 0.094, 0.875, 0.937, 0.471, 0.776, 0.227, 0.235, 0.322, 0.502, 0.012, 0.722, 0.259, 0.561, 0.878, 0.569, 0.878, 0.318, 0.808, 0.639, 0.176, 0.247, 0.353, 0.659, 0.447, 0.231, 0.129, 0.624, 0.373, 0.110, 0.545, 0.482, 0.384, 0.490, 0.769, 0.059, 0.275, 0.761, 0.992, 0.212, 0.055, 0.427, 0.886, 0.278, 0.067, 0.631, 0.365, 0.729, 0.341, 0.957, 0.541, 0.078, 0.204, 0.482, 0.984, 0.102, 0.141, 0.067, 0.180, 0.204, 0.906, 0.910, 0.298, 0.122, 0.867, 0.329, 0.145, 0.847, 0.647, 0.831, 0.416, 0.773, 0.949, 0.384, 0.169, 0.153, 0.686, 0.996, 0.569, 0.745, 0.329, 0.463, 0.871, 0.733, 0.533, 0.471, 0.639, 0.925, 0.976
|
|
);
|
|
|
|
void main()
|
|
{
|
|
vec3 Image = texture(Source, vTexCoord + vec2(params.SourceSize.z * rndtable[params.FrameCount] * 0.4, 0.0)).xyz
|
|
+ texture(Source, vTexCoord - vec2(params.SourceSize.z * rndtable[params.FrameCount] * 0.4, 0.0)).xyz;
|
|
|
|
FragColor = vec4(Image * 0.5, 1.0);
|
|
}
|