ACMX Vulkan Shader Library
GLSL 4.50 shader effects for ACMX's Vulkan renderer
Loading...
Searching...
No Matches
acidcam_100_channel_sort_descending.comp
Go to the documentation of this file.
1#version 450
2
3/**
4 * @file acidcam_100_channel_sort_descending.comp
5 * @brief Vulkan compute shader: acidcam 100 channel sort descending.
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
19layout(local_size_x = 16, local_size_y = 16) in;
20layout(set = 0, binding = 5, rgba8) writeonly uniform image2D outputImage;
21layout(set = 0, binding = 0) uniform sampler2D samp;
22
23/**
24 * @brief Evaluates source at for this shader effect.
25 * @param p Input value for the calculation.
26 * @param s Input value for the calculation.
27 * @return Computed vec3 value.
28 */
29vec3 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; }
30/**
31 * @brief Evaluates luma for this shader effect.
32 * @param c Input value for the calculation.
33 * @return Computed float value.
34 */
35float luma(vec3 c) { return dot(c, vec3(0.299, 0.587, 0.114)); }
36/**
37 * @brief Executes the compute shader entry point.
38 */
39void main() {
40 ivec2 p = ivec2(gl_GlobalInvocationID.xy), s = imageSize(outputImage); if (any(greaterThanEqual(p, s))) return;
41 ivec2 base = ivec2((p.x / 16) * 16, p.y); vec3 selected = source_at(base, s); float rank = float(p.x % 16) / 15.0;
42 for (int i = 1; i < 16; ++i) { vec3 c = source_at(base + ivec2(i, 0), s); float target = 1.0 - rank; if (abs(luma(c) - target) < abs(luma(selected) - target)) selected = c; }
43 vec3 src = source_at(p, s); imageStore(outputImage, p, vec4(mix(src, selected, alpha), 1.0));
44}
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 luma(vec3 c)
Evaluates luma for this shader effect.
Definition auraXi1.frag:58
#define alpha
Definition color_g.frag:17