ACMX Vulkan Shader Library
GLSL 4.50 shader effects for ACMX's Vulkan renderer
Loading...
Searching...
No Matches
acidcam_112_purple_rain.comp
Go to the documentation of this file.
1#version 450
2
3/**
4 * @file acidcam_112_purple_rain.comp
5 * @brief Vulkan compute shader: acidcam 112 purple rain.
6 */
7layout(set = 0, binding = 1, std140) uniform SpriteExtended {
8 vec4 mouse;
9 vec4 u0;
10 vec4 u1;
11 vec4 u2;
12 vec4 u3;
13 vec4 custom_uniforms[16];
14 vec4 audio_bands;
15 vec4 audio_history;
17#define alpha ext.u0.x
18#define iFrame int(ext.u2.x)
19
20layout(local_size_x = 16, local_size_y = 16) in;
21layout(set = 0, binding = 5, rgba8) writeonly uniform image2D outputImage;
22layout(set = 0, binding = 0) uniform sampler2D samp;
23
24
25/**
26 * @brief Evaluates source at for this shader effect.
27 * @param p Input value for the calculation.
28 * @param s Input value for the calculation.
29 * @return Computed vec3 value.
30 */
31vec3 source_at(ivec2 p, ivec2 s) { p = clamp(p, ivec2(0), s - 1); return textureLod(samp, (vec2(p) + 0.5) / vec2(s), 0.0).rgb; }
32/**
33 * @brief Evaluates hash for this shader effect.
34 * @param x Input value for the calculation.
35 * @return Computed float value.
36 */
37float hash(float x) { return fract(sin(x * 91.73) * 43758.5453); }
38/**
39 * @brief Executes the compute shader entry point.
40 */
41void main() {
42 ivec2 p = ivec2(gl_GlobalInvocationID.xy), s = imageSize(outputImage); if (any(greaterThanEqual(p, s))) return;
43 int fall = int(mod(float(p.y) + float(iFrame) * (2.0 + hash(p.x) * 8.0), float(s.y))); vec3 src = source_at(p, s), rain = source_at(ivec2(p.x, fall), s).brg;
44 rain *= vec3(0.75, 0.25, 1.35) * (0.45 + 0.55 * step(0.58, hash(float(p.x / 3)))); imageStore(outputImage, p, vec4(mix(src, rain, alpha), 1.0));
45}
layout(set=0, binding=1, std140) uniform SpriteExtended
Definition 3high.frag:7
ext
Definition 3high.frag:16
void main(void)
Executes the fragment shader entry point.
Definition 3high.frag:47
vec3 source_at(vec2 position, ivec2 size)
Evaluates source at for this shader effect.
float hash(vec2 p)
Evaluates hash for this shader effect.
#define iFrame
Definition auraXi1.frag:18
#define alpha
Definition color_g.frag:17